code
stringlengths 2.5k
150k
| kind
stringclasses 1
value |
---|---|
wordpress wp_convert_bytes_to_hr( int $bytes ): string wp\_convert\_bytes\_to\_hr( int $bytes ): string
================================================
This function has been deprecated. Use [size\_format()](size_format) instead.
Converts an integer byte value to a shorthand byte value.
* [size\_format()](size_format)
`$bytes` int Required An integer byte value. string A shorthand byte value.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_convert_bytes_to_hr( $bytes ) {
_deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' );
$units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' );
$log = log( $bytes, KB_IN_BYTES );
$power = (int) $log;
$size = KB_IN_BYTES ** ( $log - $power );
if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) {
$unit = $units[ $power ];
} else {
$size = $bytes;
$unit = $units[0];
}
return $size . $unit;
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Use [size\_format()](size_format) |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_allow_comment( array $commentdata, bool $wp_error = false ): int|string|WP_Error wp\_allow\_comment( array $commentdata, bool $wp\_error = false ): int|string|WP\_Error
=======================================================================================
Validates whether this comment is allowed to be made.
`$commentdata` array Required Contains information on the comment. `$wp_error` bool Optional When true, a disallowed comment will result in the function returning a [WP\_Error](../classes/wp_error) object, rather than executing [wp\_die()](wp_die) .
More Arguments from wp\_die( ... $args ) Arguments to control behavior. If `$args` is an integer, then it is treated as the response code.
* `response`intThe HTTP response code. Default 200 for Ajax requests, 500 otherwise.
* `link_url`stringA URL to include a link to. Only works in combination with $link\_text.
Default empty string.
* `link_text`stringA label for the link to include. Only works in combination with $link\_url.
Default empty string.
* `back_link`boolWhether to include a link to go back. Default false.
* `text_direction`stringThe text direction. This is only useful internally, when WordPress is still loading and the site's locale is not set up yet. Accepts `'rtl'` and `'ltr'`.
Default is the value of [is\_rtl()](is_rtl) .
* `charset`stringCharacter set of the HTML output. Default `'utf-8'`.
* `code`stringError code to use. Default is `'wp_die'`, or the main error code if $message is a [WP\_Error](../classes/wp_error).
* `exit`boolWhether to exit the process after completion. Default true.
Default: `false`
int|string|[WP\_Error](../classes/wp_error) Allowed comments return the approval status (`0|1|`'spam'`|`'trash'``).
If `$wp_error` is true, disallowed comments return a [WP\_Error](../classes/wp_error).
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_allow_comment( $commentdata, $wp_error = false ) {
global $wpdb;
// Simple duplicate check.
// expected_slashed ($comment_post_ID, $comment_author, $comment_author_email, $comment_content)
$dupe = $wpdb->prepare(
"SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = %s AND comment_approved != 'trash' AND ( comment_author = %s ",
wp_unslash( $commentdata['comment_post_ID'] ),
wp_unslash( $commentdata['comment_parent'] ),
wp_unslash( $commentdata['comment_author'] )
);
if ( $commentdata['comment_author_email'] ) {
$dupe .= $wpdb->prepare(
'AND comment_author_email = %s ',
wp_unslash( $commentdata['comment_author_email'] )
);
}
$dupe .= $wpdb->prepare(
') AND comment_content = %s LIMIT 1',
wp_unslash( $commentdata['comment_content'] )
);
$dupe_id = $wpdb->get_var( $dupe );
/**
* Filters the ID, if any, of the duplicate comment found when creating a new comment.
*
* Return an empty value from this filter to allow what WP considers a duplicate comment.
*
* @since 4.4.0
*
* @param int $dupe_id ID of the comment identified as a duplicate.
* @param array $commentdata Data for the comment being created.
*/
$dupe_id = apply_filters( 'duplicate_comment_id', $dupe_id, $commentdata );
if ( $dupe_id ) {
/**
* Fires immediately after a duplicate comment is detected.
*
* @since 3.0.0
*
* @param array $commentdata Comment data.
*/
do_action( 'comment_duplicate_trigger', $commentdata );
/**
* Filters duplicate comment error message.
*
* @since 5.2.0
*
* @param string $comment_duplicate_message Duplicate comment error message.
*/
$comment_duplicate_message = apply_filters( 'comment_duplicate_message', __( 'Duplicate comment detected; it looks as though you’ve already said that!' ) );
if ( $wp_error ) {
return new WP_Error( 'comment_duplicate', $comment_duplicate_message, 409 );
} else {
if ( wp_doing_ajax() ) {
die( $comment_duplicate_message );
}
wp_die( $comment_duplicate_message, 409 );
}
}
/**
* Fires immediately before a comment is marked approved.
*
* Allows checking for comment flooding.
*
* @since 2.3.0
* @since 4.7.0 The `$avoid_die` parameter was added.
* @since 5.5.0 The `$avoid_die` parameter was renamed to `$wp_error`.
*
* @param string $comment_author_ip Comment author's IP address.
* @param string $comment_author_email Comment author's email.
* @param string $comment_date_gmt GMT date the comment was posted.
* @param bool $wp_error Whether to return a WP_Error object instead of executing
* wp_die() or die() if a comment flood is occurring.
*/
do_action(
'check_comment_flood',
$commentdata['comment_author_IP'],
$commentdata['comment_author_email'],
$commentdata['comment_date_gmt'],
$wp_error
);
/**
* Filters whether a comment is part of a comment flood.
*
* The default check is wp_check_comment_flood(). See check_comment_flood_db().
*
* @since 4.7.0
* @since 5.5.0 The `$avoid_die` parameter was renamed to `$wp_error`.
*
* @param bool $is_flood Is a comment flooding occurring? Default false.
* @param string $comment_author_ip Comment author's IP address.
* @param string $comment_author_email Comment author's email.
* @param string $comment_date_gmt GMT date the comment was posted.
* @param bool $wp_error Whether to return a WP_Error object instead of executing
* wp_die() or die() if a comment flood is occurring.
*/
$is_flood = apply_filters(
'wp_is_comment_flood',
false,
$commentdata['comment_author_IP'],
$commentdata['comment_author_email'],
$commentdata['comment_date_gmt'],
$wp_error
);
if ( $is_flood ) {
/** This filter is documented in wp-includes/comment-template.php */
$comment_flood_message = apply_filters( 'comment_flood_message', __( 'You are posting comments too quickly. Slow down.' ) );
return new WP_Error( 'comment_flood', $comment_flood_message, 429 );
}
if ( ! empty( $commentdata['user_id'] ) ) {
$user = get_userdata( $commentdata['user_id'] );
$post_author = $wpdb->get_var(
$wpdb->prepare(
"SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1",
$commentdata['comment_post_ID']
)
);
}
if ( isset( $user ) && ( $commentdata['user_id'] == $post_author || $user->has_cap( 'moderate_comments' ) ) ) {
// The author and the admins get respect.
$approved = 1;
} else {
// Everyone else's comments will be checked.
if ( check_comment(
$commentdata['comment_author'],
$commentdata['comment_author_email'],
$commentdata['comment_author_url'],
$commentdata['comment_content'],
$commentdata['comment_author_IP'],
$commentdata['comment_agent'],
$commentdata['comment_type']
) ) {
$approved = 1;
} else {
$approved = 0;
}
if ( wp_check_comment_disallowed_list(
$commentdata['comment_author'],
$commentdata['comment_author_email'],
$commentdata['comment_author_url'],
$commentdata['comment_content'],
$commentdata['comment_author_IP'],
$commentdata['comment_agent']
) ) {
$approved = EMPTY_TRASH_DAYS ? 'trash' : 'spam';
}
}
/**
* Filters a comment's approval status before it is set.
*
* @since 2.1.0
* @since 4.9.0 Returning a WP_Error value from the filter will short-circuit comment insertion
* and allow skipping further processing.
*
* @param int|string|WP_Error $approved The approval status. Accepts 1, 0, 'spam', 'trash',
* or WP_Error.
* @param array $commentdata Comment data.
*/
return apply_filters( 'pre_comment_approved', $approved, $commentdata );
}
```
[do\_action( 'check\_comment\_flood', string $comment\_author\_ip, string $comment\_author\_email, string $comment\_date\_gmt, bool $wp\_error )](../hooks/check_comment_flood)
Fires immediately before a comment is marked approved.
[apply\_filters( 'comment\_duplicate\_message', string $comment\_duplicate\_message )](../hooks/comment_duplicate_message)
Filters duplicate comment error message.
[do\_action( 'comment\_duplicate\_trigger', array $commentdata )](../hooks/comment_duplicate_trigger)
Fires immediately after a duplicate comment is detected.
[apply\_filters( 'comment\_flood\_message', string $comment\_flood\_message )](../hooks/comment_flood_message)
Filters the comment flood error message.
[apply\_filters( 'duplicate\_comment\_id', int $dupe\_id, array $commentdata )](../hooks/duplicate_comment_id)
Filters the ID, if any, of the duplicate comment found when creating a new comment.
[apply\_filters( 'pre\_comment\_approved', int|string|WP\_Error $approved, array $commentdata )](../hooks/pre_comment_approved)
Filters a comment’s approval status before it is set.
[apply\_filters( 'wp\_is\_comment\_flood', bool $is\_flood, string $comment\_author\_ip, string $comment\_author\_email, string $comment\_date\_gmt, bool $wp\_error )](../hooks/wp_is_comment_flood)
Filters whether a comment is part of a comment flood.
| Uses | Description |
| --- | --- |
| [wp\_check\_comment\_disallowed\_list()](wp_check_comment_disallowed_list) wp-includes/comment.php | Checks if a comment contains disallowed characters or words. |
| [wp\_doing\_ajax()](wp_doing_ajax) wp-includes/load.php | Determines whether the current request is a WordPress Ajax request. |
| [check\_comment()](check_comment) wp-includes/comment.php | Checks whether a comment passes internal checks to be allowed to add. |
| [\_\_()](__) 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. |
| [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. |
| [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. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Comments\_Controller::create\_item()](../classes/wp_rest_comments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Creates a comment. |
| [wp\_new\_comment()](wp_new_comment) wp-includes/comment.php | Adds a new comment to the database. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | The `$avoid_die` parameter was renamed to `$wp_error`. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | The `$avoid_die` parameter was added, allowing the function to return a [WP\_Error](../classes/wp_error) object instead of dying. |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress is_super_admin( int|false $user_id = false ): bool is\_super\_admin( int|false $user\_id = false ): bool
=====================================================
Determines whether user is a site admin.
`$user_id` int|false Optional The ID of a user. Defaults to false, to check the current user. Default: `false`
bool Whether the user is a site admin.
File: `wp-includes/capabilities.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/capabilities.php/)
```
function is_super_admin( $user_id = false ) {
if ( ! $user_id ) {
$user = wp_get_current_user();
} else {
$user = get_userdata( $user_id );
}
if ( ! $user || ! $user->exists() ) {
return false;
}
if ( is_multisite() ) {
$super_admins = get_super_admins();
if ( is_array( $super_admins ) && in_array( $user->user_login, $super_admins, true ) ) {
return true;
}
} else {
if ( $user->has_cap( 'delete_users' ) ) {
return true;
}
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [get\_super\_admins()](get_super_admins) wp-includes/capabilities.php | Retrieves a list of super admins. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [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. |
| Used By | Description |
| --- | --- |
| [wp\_maybe\_grant\_site\_health\_caps()](wp_maybe_grant_site_health_caps) wp-includes/capabilities.php | Filters the user capabilities to grant the ‘view\_site\_health\_checks’ capabilities as necessary. |
| [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\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. |
| [WP\_User::has\_cap()](../classes/wp_user/has_cap) wp-includes/class-wp-user.php | Returns whether the user has the specified capability. |
| [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. |
| [is\_site\_admin()](is_site_admin) wp-includes/ms-deprecated.php | Determine if user is a site admin. |
| [ms\_site\_check()](ms_site_check) wp-includes/ms-load.php | Checks status of current blog. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_check_mysql_version() wp\_check\_mysql\_version()
===========================
Checks the version of the installed MySQL binary.
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function wp_check_mysql_version() {
global $wpdb;
$result = $wpdb->check_database_version();
if ( is_wp_error( $result ) ) {
wp_die( $result );
}
}
```
| Uses | Description |
| --- | --- |
| [wpdb::check\_database\_version()](../classes/wpdb/check_database_version) wp-includes/class-wpdb.php | Determines whether MySQL database is at least the required minimum version. |
| [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. |
| Used By | Description |
| --- | --- |
| [wp\_upgrade()](wp_upgrade) wp-admin/includes/upgrade.php | Runs WordPress Upgrade functions. |
| [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress write_post(): int|void write\_post(): int|void
=======================
Calls [wp\_write\_post()](wp_write_post) and handles the errors.
int|void Post ID on success, void on failure.
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function write_post() {
$result = wp_write_post();
if ( is_wp_error( $result ) ) {
wp_die( $result->get_error_message() );
} else {
return $result;
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_write\_post()](wp_write_post) wp-admin/includes/post.php | Creates a new post from the “Write Post” form using `$_POST` information. |
| [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 |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_get_missing_image_subsizes( int $attachment_id ): array[] wp\_get\_missing\_image\_subsizes( int $attachment\_id ): array[]
=================================================================
Compare the existing image sub-sizes (as saved in the attachment meta) to the currently registered image sub-sizes, and return the difference.
Registered sub-sizes that are larger than the image are skipped.
`$attachment_id` int Required The image attachment post ID. array[] Associative array of arrays of image sub-size information for missing image sizes, keyed by image size name.
File: `wp-admin/includes/image.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image.php/)
```
function wp_get_missing_image_subsizes( $attachment_id ) {
if ( ! wp_attachment_is_image( $attachment_id ) ) {
return array();
}
$registered_sizes = wp_get_registered_image_subsizes();
$image_meta = wp_get_attachment_metadata( $attachment_id );
// Meta error?
if ( empty( $image_meta ) ) {
return $registered_sizes;
}
// Use the originally uploaded image dimensions as full_width and full_height.
if ( ! empty( $image_meta['original_image'] ) ) {
$image_file = wp_get_original_image_path( $attachment_id );
$imagesize = wp_getimagesize( $image_file );
}
if ( ! empty( $imagesize ) ) {
$full_width = $imagesize[0];
$full_height = $imagesize[1];
} else {
$full_width = (int) $image_meta['width'];
$full_height = (int) $image_meta['height'];
}
$possible_sizes = array();
// Skip registered sizes that are too large for the uploaded image.
foreach ( $registered_sizes as $size_name => $size_data ) {
if ( image_resize_dimensions( $full_width, $full_height, $size_data['width'], $size_data['height'], $size_data['crop'] ) ) {
$possible_sizes[ $size_name ] = $size_data;
}
}
if ( empty( $image_meta['sizes'] ) ) {
$image_meta['sizes'] = array();
}
/*
* Remove sizes that already exist. Only checks for matching "size names".
* It is possible that the dimensions for a particular size name have changed.
* For example the user has changed the values on the Settings -> Media screen.
* However we keep the old sub-sizes with the previous dimensions
* as the image may have been used in an older post.
*/
$missing_sizes = array_diff_key( $possible_sizes, $image_meta['sizes'] );
/**
* Filters the array of missing image sub-sizes for an uploaded image.
*
* @since 5.3.0
*
* @param array[] $missing_sizes Associative array of arrays of image sub-size information for
* missing image sizes, keyed by image size name.
* @param array $image_meta The image meta data.
* @param int $attachment_id The image attachment post ID.
*/
return apply_filters( 'wp_get_missing_image_subsizes', $missing_sizes, $image_meta, $attachment_id );
}
```
[apply\_filters( 'wp\_get\_missing\_image\_subsizes', array[] $missing\_sizes, array $image\_meta, int $attachment\_id )](../hooks/wp_get_missing_image_subsizes)
Filters the array of missing image sub-sizes for an uploaded image.
| Uses | Description |
| --- | --- |
| [wp\_getimagesize()](wp_getimagesize) wp-includes/media.php | Allows PHP’s getimagesize() to be debuggable when necessary. |
| [wp\_get\_original\_image\_path()](wp_get_original_image_path) wp-includes/post.php | Retrieves the path to an uploaded image file. |
| [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. |
| [image\_resize\_dimensions()](image_resize_dimensions) wp-includes/media.php | Retrieves calculated resize dimensions for use in [WP\_Image\_Editor](../classes/wp_image_editor). |
| [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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [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\_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. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
| programming_docs |
wordpress use_ssl_preference( WP_User $user ) use\_ssl\_preference( WP\_User $user )
======================================
Optional SSL preference that can be turned on by hooking to the ‘personal\_options’ action.
See the [‘personal\_options’](../hooks/personal_options) action.
`$user` [WP\_User](../classes/wp_user) Required User data object. File: `wp-admin/includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/user.php/)
```
function use_ssl_preference( $user ) {
?>
<tr class="user-use-ssl-wrap">
<th scope="row"><?php _e( 'Use https' ); ?></th>
<td><label for="use_ssl"><input name="use_ssl" type="checkbox" id="use_ssl" value="1" <?php checked( '1', $user->use_ssl ); ?> /> <?php _e( 'Always use https when visiting the admin' ); ?></label></td>
</tr>
<?php
}
```
| Uses | Description |
| --- | --- |
| [checked()](checked) wp-includes/general-template.php | Outputs the HTML checked attribute. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress header_textcolor() header\_textcolor()
===================
Displays the custom header text color in 3- or 6-digit hexadecimal form (minus the hash symbol).
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function header_textcolor() {
echo get_header_textcolor();
}
```
| Uses | Description |
| --- | --- |
| [get\_header\_textcolor()](get_header_textcolor) wp-includes/theme.php | Retrieves the custom header text color in 3- or 6-digit hexadecimal form. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress get_site( WP_Site|int|null $site = null ): WP_Site|null get\_site( WP\_Site|int|null $site = null ): WP\_Site|null
==========================================================
Retrieves site data given a site ID or site object.
Site data will be cached and returned after being passed through a filter.
If the provided site is empty, the current site global will be used.
`$site` [WP\_Site](../classes/wp_site)|int|null Optional Site to retrieve. Default is the current site. Default: `null`
[WP\_Site](../classes/wp_site)|null The site object or null if not found.
File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function get_site( $site = null ) {
if ( empty( $site ) ) {
$site = get_current_blog_id();
}
if ( $site instanceof WP_Site ) {
$_site = $site;
} elseif ( is_object( $site ) ) {
$_site = new WP_Site( $site );
} else {
$_site = WP_Site::get_instance( $site );
}
if ( ! $_site ) {
return null;
}
/**
* Fires after a site is retrieved.
*
* @since 4.6.0
*
* @param WP_Site $_site Site data.
*/
$_site = apply_filters( 'get_site', $_site );
return $_site;
}
```
[apply\_filters( 'get\_site', WP\_Site $\_site )](../hooks/get_site)
Fires after a site is retrieved.
| Uses | Description |
| --- | --- |
| [WP\_Site::\_\_construct()](../classes/wp_site/__construct) wp-includes/class-wp-site.php | Creates a new [WP\_Site](../classes/wp_site) object. |
| [WP\_Site::get\_instance()](../classes/wp_site/get_instance) wp-includes/class-wp-site.php | Retrieves a site from the database by its ID. |
| [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 |
| --- | --- |
| [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\_uninitialize\_site()](wp_uninitialize_site) wp-includes/ms-site.php | Runs the uninitialization routine for a given site. |
| [wp\_insert\_site()](wp_insert_site) wp-includes/ms-site.php | Inserts a new site into the database. |
| [wp\_update\_site()](wp_update_site) wp-includes/ms-site.php | Updates a site in the database. |
| [wp\_delete\_site()](wp_delete_site) wp-includes/ms-site.php | Deletes a site from the database. |
| [WP\_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\_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\_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. |
| [wpmu\_delete\_blog()](wpmu_delete_blog) wp-admin/includes/ms.php | Delete a site. |
| [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. |
| [wp\_get\_sites()](wp_get_sites) wp-includes/ms-deprecated.php | Return an array of sites for a network or networks. |
| [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. |
| [ms\_site\_check()](ms_site_check) wp-includes/ms-load.php | Checks status of current blog. |
| [get\_dashboard\_blog()](get_dashboard_blog) wp-includes/ms-deprecated.php | Get the “dashboard blog”, the blog where users without a blog edit their profile data. |
| [get\_blog\_status()](get_blog_status) wp-includes/ms-blogs.php | Get a blog details field. |
| [clean\_blog\_cache()](clean_blog_cache) wp-includes/ms-site.php | Clean the blog cache |
| [get\_blogaddress\_by\_id()](get_blogaddress_by_id) wp-includes/ms-blogs.php | Get a full blog URL, given a blog ID. |
| [wp\_xmlrpc\_server::\_multisite\_getUsersBlogs()](../classes/wp_xmlrpc_server/_multisite_getusersblogs) wp-includes/class-wp-xmlrpc-server.php | Private function for retrieving a users blogs for multisite setups |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress get_previous_post( bool $in_same_term = false, int[]|string $excluded_terms = '', string $taxonomy = 'category' ): WP_Post|null|string get\_previous\_post( bool $in\_same\_term = false, int[]|string $excluded\_terms = '', string $taxonomy = 'category' ): WP\_Post|null|string
============================================================================================================================================
Retrieves the previous post that is adjacent to the current post.
`$in_same_term` bool Optional Whether post should be in a same taxonomy term. Default: `false`
`$excluded_terms` int[]|string Optional Array or comma-separated list of excluded term IDs. Default: `''`
`$taxonomy` string Optional Taxonomy, if $in\_same\_term is true. Default `'category'`. Default: `'category'`
[WP\_Post](../classes/wp_post)|null|string Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_previous_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
return get_adjacent_post( $in_same_term, $excluded_terms, true, $taxonomy );
}
```
| Uses | Description |
| --- | --- |
| [get\_adjacent\_post()](get_adjacent_post) wp-includes/link-template.php | Retrieves the adjacent post. |
| Used By | Description |
| --- | --- |
| [previous\_post()](previous_post) wp-includes/deprecated.php | Prints a link to the previous post. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress populate_roles_300() populate\_roles\_300()
======================
Create and modify WordPress roles for WordPress 3.0.
File: `wp-admin/includes/schema.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/schema.php/)
```
function populate_roles_300() {
$role = get_role( 'administrator' );
if ( ! empty( $role ) ) {
$role->add_cap( 'update_core' );
$role->add_cap( 'list_users' );
$role->add_cap( 'remove_users' );
$role->add_cap( 'promote_users' );
$role->add_cap( 'edit_theme_options' );
$role->add_cap( 'delete_themes' );
$role->add_cap( 'export' );
}
}
```
| 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 |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress search_theme_directories( bool $force = false ): array|false search\_theme\_directories( bool $force = false ): array|false
==============================================================
Searches all registered theme directories for complete and valid themes.
`$force` bool Optional Whether to force a new directory scan. Default: `false`
array|false Valid themes found on success, false on failure.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function search_theme_directories( $force = false ) {
global $wp_theme_directories;
static $found_themes = null;
if ( empty( $wp_theme_directories ) ) {
return false;
}
if ( ! $force && isset( $found_themes ) ) {
return $found_themes;
}
$found_themes = array();
$wp_theme_directories = (array) $wp_theme_directories;
$relative_theme_roots = array();
/*
* Set up maybe-relative, maybe-absolute array of theme directories.
* We always want to return absolute, but we need to cache relative
* to use in get_theme_root().
*/
foreach ( $wp_theme_directories as $theme_root ) {
if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) ) {
$relative_theme_roots[ str_replace( WP_CONTENT_DIR, '', $theme_root ) ] = $theme_root;
} else {
$relative_theme_roots[ $theme_root ] = $theme_root;
}
}
/**
* Filters whether to get the cache of the registered theme directories.
*
* @since 3.4.0
*
* @param bool $cache_expiration Whether to get the cache of the theme directories. Default false.
* @param string $context The class or function name calling the filter.
*/
$cache_expiration = apply_filters( 'wp_cache_themes_persistently', false, 'search_theme_directories' );
if ( $cache_expiration ) {
$cached_roots = get_site_transient( 'theme_roots' );
if ( is_array( $cached_roots ) ) {
foreach ( $cached_roots as $theme_dir => $theme_root ) {
// A cached theme root is no longer around, so skip it.
if ( ! isset( $relative_theme_roots[ $theme_root ] ) ) {
continue;
}
$found_themes[ $theme_dir ] = array(
'theme_file' => $theme_dir . '/style.css',
'theme_root' => $relative_theme_roots[ $theme_root ], // Convert relative to absolute.
);
}
return $found_themes;
}
if ( ! is_int( $cache_expiration ) ) {
$cache_expiration = 30 * MINUTE_IN_SECONDS;
}
} else {
$cache_expiration = 30 * MINUTE_IN_SECONDS;
}
/* Loop the registered theme directories and extract all themes */
foreach ( $wp_theme_directories as $theme_root ) {
// Start with directories in the root of the active theme directory.
$dirs = @ scandir( $theme_root );
if ( ! $dirs ) {
trigger_error( "$theme_root is not readable", E_USER_NOTICE );
continue;
}
foreach ( $dirs as $dir ) {
if ( ! is_dir( $theme_root . '/' . $dir ) || '.' === $dir[0] || 'CVS' === $dir ) {
continue;
}
if ( file_exists( $theme_root . '/' . $dir . '/style.css' ) ) {
// wp-content/themes/a-single-theme
// wp-content/themes is $theme_root, a-single-theme is $dir.
$found_themes[ $dir ] = array(
'theme_file' => $dir . '/style.css',
'theme_root' => $theme_root,
);
} else {
$found_theme = false;
// wp-content/themes/a-folder-of-themes/*
// wp-content/themes is $theme_root, a-folder-of-themes is $dir, then themes are $sub_dirs.
$sub_dirs = @ scandir( $theme_root . '/' . $dir );
if ( ! $sub_dirs ) {
trigger_error( "$theme_root/$dir is not readable", E_USER_NOTICE );
continue;
}
foreach ( $sub_dirs as $sub_dir ) {
if ( ! is_dir( $theme_root . '/' . $dir . '/' . $sub_dir ) || '.' === $dir[0] || 'CVS' === $dir ) {
continue;
}
if ( ! file_exists( $theme_root . '/' . $dir . '/' . $sub_dir . '/style.css' ) ) {
continue;
}
$found_themes[ $dir . '/' . $sub_dir ] = array(
'theme_file' => $dir . '/' . $sub_dir . '/style.css',
'theme_root' => $theme_root,
);
$found_theme = true;
}
// Never mind the above, it's just a theme missing a style.css.
// Return it; WP_Theme will catch the error.
if ( ! $found_theme ) {
$found_themes[ $dir ] = array(
'theme_file' => $dir . '/style.css',
'theme_root' => $theme_root,
);
}
}
}
}
asort( $found_themes );
$theme_roots = array();
$relative_theme_roots = array_flip( $relative_theme_roots );
foreach ( $found_themes as $theme_dir => $theme_data ) {
$theme_roots[ $theme_dir ] = $relative_theme_roots[ $theme_data['theme_root'] ]; // Convert absolute to relative.
}
if ( get_site_transient( 'theme_roots' ) != $theme_roots ) {
set_site_transient( 'theme_roots', $theme_roots, $cache_expiration );
}
return $found_themes;
}
```
[apply\_filters( 'wp\_cache\_themes\_persistently', bool $cache\_expiration, string $context )](../hooks/wp_cache_themes_persistently)
Filters whether to get the cache of the registered theme directories.
| Uses | Description |
| --- | --- |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_query\_themes()](wp_ajax_query_themes) wp-admin/includes/ajax-actions.php | Ajax handler for getting themes from [themes\_api()](themes_api) . |
| [get\_theme\_roots()](get_theme_roots) wp-includes/theme.php | Retrieves theme roots. |
| [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\_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). |
| [WP\_Theme::\_\_construct()](../classes/wp_theme/__construct) wp-includes/class-wp-theme.php | Constructor for [WP\_Theme](../classes/wp_theme). |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress delete_site_meta_by_key( string $meta_key ): bool delete\_site\_meta\_by\_key( string $meta\_key ): bool
======================================================
Deletes everything from site meta matching meta key.
`$meta_key` string Required Metadata key to search for when deleting. bool Whether the site meta key was deleted from the database.
File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function delete_site_meta_by_key( $meta_key ) {
return delete_metadata( 'blog', null, $meta_key, '', true );
}
```
| Uses | Description |
| --- | --- |
| [delete\_metadata()](delete_metadata) wp-includes/meta.php | Deletes metadata for the specified object. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress wp_ajax_get_post_thumbnail_html() wp\_ajax\_get\_post\_thumbnail\_html()
======================================
Ajax handler for retrieving HTML for 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_get_post_thumbnail_html() {
$post_ID = (int) $_POST['post_id'];
check_ajax_referer( "update-post_$post_ID" );
if ( ! current_user_can( 'edit_post', $post_ID ) ) {
wp_die( -1 );
}
$thumbnail_id = (int) $_POST['thumbnail_id'];
// For backward compatibility, -1 refers to no featured image.
if ( -1 === $thumbnail_id ) {
$thumbnail_id = null;
}
$return = _wp_post_thumbnail_html( $thumbnail_id, $post_ID );
wp_send_json_success( $return );
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_post\_thumbnail\_html()](_wp_post_thumbnail_html) wp-admin/includes/post.php | Returns HTML for the post thumbnail meta box. |
| [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 |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress wp_filter_post_kses( string $data ): string wp\_filter\_post\_kses( string $data ): string
==============================================
Sanitizes content for allowed HTML tags for post content.
Post content refers to the page contents of the ‘post’ type and not `$_POST` data from forms.
This function expects slashed data.
`$data` string Required Post content to filter, expected to be escaped with slashes. string Filtered post content with allowed HTML tags and attributes intact.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_filter_post_kses( $data ) {
return addslashes( wp_kses( stripslashes( $data ), 'post' ) );
}
```
| Uses | Description |
| --- | --- |
| [wp\_kses()](wp_kses) wp-includes/kses.php | Filters text content and strips out disallowed HTML. |
| Used By | Description |
| --- | --- |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_default_packages_scripts( WP_Scripts $scripts ) wp\_default\_packages\_scripts( WP\_Scripts $scripts )
======================================================
Registers all the WordPress packages scripts that are in the standardized `js/dist/` location.
For the order of `$scripts->add` see `wp_default_scripts`.
`$scripts` [WP\_Scripts](../classes/wp_scripts) Required [WP\_Scripts](../classes/wp_scripts) object. File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_default_packages_scripts( $scripts ) {
$suffix = defined( 'WP_RUN_CORE_TESTS' ) ? '.min' : wp_scripts_get_suffix();
/*
* Expects multidimensional array like:
*
* 'a11y.js' => array('dependencies' => array(...), 'version' => '...'),
* 'annotations.js' => array('dependencies' => array(...), 'version' => '...'),
* 'api-fetch.js' => array(...
*/
$assets = include ABSPATH . WPINC . "/assets/script-loader-packages{$suffix}.php";
foreach ( $assets as $file_name => $package_data ) {
$basename = str_replace( $suffix . '.js', '', basename( $file_name ) );
$handle = 'wp-' . $basename;
$path = "/wp-includes/js/dist/{$basename}{$suffix}.js";
if ( ! empty( $package_data['dependencies'] ) ) {
$dependencies = $package_data['dependencies'];
} else {
$dependencies = array();
}
// Add dependencies that cannot be detected and generated by build tools.
switch ( $handle ) {
case 'wp-block-library':
array_push( $dependencies, 'editor' );
break;
case 'wp-edit-post':
array_push( $dependencies, 'media-models', 'media-views', 'postbox', 'wp-dom-ready' );
break;
case 'wp-preferences':
array_push( $dependencies, 'wp-preferences-persistence' );
break;
}
$scripts->add( $handle, $path, $dependencies, $package_data['version'], 1 );
if ( in_array( 'wp-i18n', $dependencies, true ) ) {
$scripts->set_translations( $handle );
}
/*
* Manually set the text direction localization after wp-i18n is printed.
* This ensures that wp.i18n.isRTL() returns true in RTL languages.
* We cannot use $scripts->set_translations( 'wp-i18n' ) to do this
* because WordPress prints a script's translations *before* the script,
* which means, in the case of wp-i18n, that wp.i18n.setLocaleData()
* is called before wp.i18n is defined.
*/
if ( 'wp-i18n' === $handle ) {
$ltr = _x( 'ltr', 'text direction' );
$script = sprintf( "wp.i18n.setLocaleData( { 'text direction\u0004ltr': [ '%s' ] } );", $ltr );
$scripts->add_inline_script( $handle, $script, 'after' );
}
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_scripts\_get\_suffix()](wp_scripts_get_suffix) wp-includes/script-loader.php | Returns the suffix that can be used for the scripts. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| Used By | Description |
| --- | --- |
| [wp\_default\_packages()](wp_default_packages) wp-includes/script-loader.php | Registers all the WordPress packages scripts. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
| programming_docs |
wordpress cancel_comment_reply_link( string $text = '' ) cancel\_comment\_reply\_link( string $text = '' )
=================================================
Displays HTML content for cancel comment reply link.
`$text` string Optional Text to display for cancel reply link. If empty, defaults to 'Click here to cancel reply'. Default: `''`
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function cancel_comment_reply_link( $text = '' ) {
echo get_cancel_comment_reply_link( $text );
}
```
| Uses | Description |
| --- | --- |
| [get\_cancel\_comment\_reply\_link()](get_cancel_comment_reply_link) wp-includes/comment-template.php | Retrieves HTML content for cancel comment reply link. |
| Used By | Description |
| --- | --- |
| [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress confirm_another_blog_signup( string $domain, string $path, string $blog_title, string $user_name, string $user_email = '', array $meta = array(), int $blog_id ) confirm\_another\_blog\_signup( string $domain, string $path, string $blog\_title, string $user\_name, string $user\_email = '', array $meta = array(), int $blog\_id )
=======================================================================================================================================================================
Shows a message confirming that the new site has been created.
`$domain` string Required The domain URL. `$path` string Required The site root path. `$blog_title` string Required The site title. `$user_name` string Required The username. `$user_email` string Optional The user's email address. Default: `''`
`$meta` array Optional Any additional meta from the ['add\_signup\_meta'](../hooks/add_signup_meta) filter in [validate\_blog\_signup()](validate_blog_signup) . Default: `array()`
`$blog_id` int Required The site ID. File: `wp-signup.php`. [View all references](https://developer.wordpress.org/reference/files/wp-signup.php/)
```
function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array(), $blog_id = 0 ) {
if ( $blog_id ) {
switch_to_blog( $blog_id );
$home_url = home_url( '/' );
$login_url = wp_login_url();
restore_current_blog();
} else {
$home_url = 'http://' . $domain . $path;
$login_url = 'http://' . $domain . $path . 'wp-login.php';
}
$site = sprintf(
'<a href="%1$s">%2$s</a>',
esc_url( $home_url ),
$blog_title
);
?>
<h2>
<?php
/* translators: %s: Site title. */
printf( __( 'The site %s is yours.' ), $site );
?>
</h2>
<p>
<?php
printf(
/* translators: 1: Link to new site, 2: Login URL, 3: Username. */
__( '%1$s is your new site. <a href="%2$s">Log in</a> as “%3$s” using your existing password.' ),
sprintf(
'<a href="%s">%s</a>',
esc_url( $home_url ),
untrailingslashit( $domain . $path )
),
esc_url( $login_url ),
$user_name
);
?>
</p>
<?php
/**
* Fires when the site or user sign-up process is complete.
*
* @since 3.0.0
*/
do_action( 'signup_finished' );
}
```
[do\_action( 'signup\_finished' )](../hooks/signup_finished)
Fires when the site or user sign-up process is complete.
| Uses | Description |
| --- | --- |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. |
| [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) . |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| 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/) | MU (3.0.0) |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress has_header_video(): bool has\_header\_video(): bool
==========================
Checks whether a header video is set or not.
* [get\_header\_video\_url()](get_header_video_url)
bool Whether a header video is set or not.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function has_header_video() {
return (bool) get_header_video_url();
}
```
| Uses | Description |
| --- | --- |
| [get\_header\_video\_url()](get_header_video_url) wp-includes/theme.php | Retrieves header video URL for custom header. |
| Used By | Description |
| --- | --- |
| [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| [the\_custom\_header\_markup()](the_custom_header_markup) wp-includes/theme.php | Prints the markup for a custom header. |
| [has\_custom\_header()](has_custom_header) wp-includes/theme.php | Checks whether a custom header is set or not. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress post_excerpt_meta_box( WP_Post $post ) post\_excerpt\_meta\_box( WP\_Post $post )
==========================================
Displays post excerpt 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_excerpt_meta_box( $post ) {
?>
<label class="screen-reader-text" for="excerpt"><?php _e( 'Excerpt' ); ?></label><textarea rows="1" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea>
<p>
<?php
printf(
/* translators: %s: Documentation URL. */
__( 'Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="%s">Learn more about manual excerpts</a>.' ),
__( 'https://wordpress.org/support/article/excerpt/' )
);
?>
</p>
<?php
}
```
| Uses | Description |
| --- | --- |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [\_\_()](__) 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 type_url_form_image(): string type\_url\_form\_image(): string
================================
This function has been deprecated. Use [wp\_media\_insert\_url\_form()](wp_media_insert_url_form) instead.
Handles retrieving the insert-from-URL form for an image.
* [wp\_media\_insert\_url\_form()](wp_media_insert_url_form)
string
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function type_url_form_image() {
_deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('image')" );
return wp_media_insert_url_form( 'image' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_media\_insert\_url\_form()](wp_media_insert_url_form) wp-admin/includes/media.php | Creates the form for external url. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress comment_id_fields( int $post_id ) comment\_id\_fields( int $post\_id )
====================================
Outputs hidden input HTML for replying to comments.
Adds two hidden inputs to the comment form to identify the `comment_post_ID` and `comment_parent` values for threaded comments.
This tag must be within the `<form>` section of the `comments.php` template.
* [get\_comment\_id\_fields()](get_comment_id_fields)
`$post_id` int Optional Post ID. Defaults to the current post ID. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function comment_id_fields( $post_id = 0 ) {
echo get_comment_id_fields( $post_id );
}
```
| Uses | Description |
| --- | --- |
| [get\_comment\_id\_fields()](get_comment_id_fields) wp-includes/comment-template.php | Retrieves hidden input HTML for replying to comments. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress get_the_term_list( int $post_id, string $taxonomy, string $before = '', string $sep = '', string $after = '' ): string|false|WP_Error get\_the\_term\_list( int $post\_id, string $taxonomy, string $before = '', string $sep = '', string $after = '' ): string|false|WP\_Error
==========================================================================================================================================
Retrieves a post’s terms as a list with specified format.
Terms are linked to their respective term listing pages.
`$post_id` int Required Post ID. `$taxonomy` string Required Taxonomy name. `$before` string Optional String to use before the terms. Default: `''`
`$sep` string Optional String to use between the terms. Default: `''`
`$after` string Optional String to use after the terms. Default: `''`
string|false|[WP\_Error](../classes/wp_error) A list of terms on success, false if there are no terms, [WP\_Error](../classes/wp_error) on failure.
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function get_the_term_list( $post_id, $taxonomy, $before = '', $sep = '', $after = '' ) {
$terms = get_the_terms( $post_id, $taxonomy );
if ( is_wp_error( $terms ) ) {
return $terms;
}
if ( empty( $terms ) ) {
return false;
}
$links = array();
foreach ( $terms as $term ) {
$link = get_term_link( $term, $taxonomy );
if ( is_wp_error( $link ) ) {
return $link;
}
$links[] = '<a href="' . esc_url( $link ) . '" rel="tag">' . $term->name . '</a>';
}
/**
* Filters the term links for a given taxonomy.
*
* The dynamic portion of the hook name, `$taxonomy`, refers
* to the taxonomy slug.
*
* Possible hook names include:
*
* - `term_links-category`
* - `term_links-post_tag`
* - `term_links-post_format`
*
* @since 2.5.0
*
* @param string[] $links An array of term links.
*/
$term_links = apply_filters( "term_links-{$taxonomy}", $links ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
return $before . implode( $sep, $term_links ) . $after;
}
```
[apply\_filters( "term\_links-{$taxonomy}", string[] $links )](../hooks/term_links-taxonomy)
Filters the term links for a given taxonomy.
| 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. |
| [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. |
| [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 |
| --- | --- |
| [the\_terms()](the_terms) wp-includes/category-template.php | Displays the terms for a post in a list. |
| [get\_the\_tag\_list()](get_the_tag_list) wp-includes/category-template.php | Retrieves the tags for a post formatted as a string. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress the_author_nickname() the\_author\_nickname()
=======================
This function has been deprecated. Use [the\_author\_meta()](the_author_meta) instead.
Display the nickname 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_nickname() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'nickname\')' );
the_author_meta('nickname');
}
```
| 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_get_attachment_thumb_url( int $post_id ): string|false wp\_get\_attachment\_thumb\_url( int $post\_id ): string|false
==============================================================
Retrieves URL for an attachment thumbnail.
`$post_id` int Optional Attachment ID. Default is the ID of the global `$post`. string|false Thumbnail URL on success, false on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_get_attachment_thumb_url( $post_id = 0 ) {
$post_id = (int) $post_id;
// This uses image_downsize() which also looks for the (very) old format $image_meta['thumb']
// when the newer format $image_meta['sizes']['thumbnail'] doesn't exist.
$thumbnail_url = wp_get_attachment_image_url( $post_id, 'thumbnail' );
if ( empty( $thumbnail_url ) ) {
return false;
}
/**
* Filters the attachment thumbnail URL.
*
* @since 2.1.0
*
* @param string $thumbnail_url URL for the attachment thumbnail.
* @param int $post_id Attachment ID.
*/
return apply_filters( 'wp_get_attachment_thumb_url', $thumbnail_url, $post_id );
}
```
[apply\_filters( 'wp\_get\_attachment\_thumb\_url', string $thumbnail\_url, int $post\_id )](../hooks/wp_get_attachment_thumb_url)
Filters the attachment thumbnail URL.
| Uses | Description |
| --- | --- |
| [wp\_get\_attachment\_image\_url()](wp_get_attachment_image_url) wp-includes/media.php | Gets the URL of an image attachment. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [get\_attachment\_icon\_src()](get_attachment_icon_src) wp-includes/deprecated.php | Retrieve icon URL and Path. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Changed to use [wp\_get\_attachment\_image\_url()](wp_get_attachment_image_url) . |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress get_author_user_ids(): array get\_author\_user\_ids(): array
===============================
This function has been deprecated. Use [get\_users()](get_users) instead.
Get all user IDs.
array List of user IDs.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function get_author_user_ids() {
_deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
global $wpdb;
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.
return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
}
```
| Uses | Description |
| --- | --- |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [wpdb::get\_blog\_prefix()](../classes/wpdb/get_blog_prefix) wp-includes/class-wpdb.php | Gets blog prefix. |
| [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. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_dequeue_style( string $handle ) wp\_dequeue\_style( string $handle )
====================================
Remove a previously enqueued CSS stylesheet.
* [WP\_Dependencies::dequeue()](../classes/wp_dependencies/dequeue)
`$handle` string Required Name of the stylesheet to be removed. File: `wp-includes/functions.wp-styles.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-styles.php/)
```
function wp_dequeue_style( $handle ) {
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
wp_styles()->dequeue( $handle );
}
```
| Uses | Description |
| --- | --- |
| [wp\_styles()](wp_styles) wp-includes/functions.wp-styles.php | Initialize $wp\_styles if it has not been set. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_dashboard_quick_press_output() wp\_dashboard\_quick\_press\_output()
=====================================
This function has been deprecated. Use [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press) instead.
Output the QuickPress dashboard widget.
* [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press)
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function wp_dashboard_quick_press_output() {
_deprecated_function( __FUNCTION__, '3.2.0', 'wp_dashboard_quick_press()' );
wp_dashboard_quick_press();
}
```
| Uses | Description |
| --- | --- |
| [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press) wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. |
| [\_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/) | Use [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press) |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress count_user_posts( int $userid, array|string $post_type = 'post', bool $public_only = false ): string count\_user\_posts( int $userid, array|string $post\_type = 'post', bool $public\_only = false ): string
========================================================================================================
Gets the number of posts a user has written.
`$userid` int Required User ID. `$post_type` array|string Optional Single post type or array of post types to count the number of posts for. Default `'post'`. Default: `'post'`
`$public_only` bool Optional Whether to only return counts for public posts. Default: `false`
string Number of posts the user has written in this post type.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function count_user_posts( $userid, $post_type = 'post', $public_only = false ) {
global $wpdb;
$where = get_posts_by_author_sql( $post_type, true, $userid, $public_only );
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
/**
* Filters the number of posts a user has written.
*
* @since 2.7.0
* @since 4.1.0 Added `$post_type` argument.
* @since 4.3.1 Added `$public_only` argument.
*
* @param int $count The user's post count.
* @param int $userid User ID.
* @param string|array $post_type Single post type or array of post types to count the number of posts for.
* @param bool $public_only Whether to limit counted posts to public posts.
*/
return apply_filters( 'get_usernumposts', $count, $userid, $post_type, $public_only );
}
```
[apply\_filters( 'get\_usernumposts', int $count, int $userid, string|array $post\_type, bool $public\_only )](../hooks/get_usernumposts)
Filters the number of posts a user has written.
| Uses | Description |
| --- | --- |
| [get\_posts\_by\_author\_sql()](get_posts_by_author_sql) wp-includes/post.php | Retrieves the post SQL based on capability, author, and type. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| Used By | Description |
| --- | --- |
| [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. |
| [get\_usernumposts()](get_usernumposts) wp-includes/deprecated.php | Retrieves the number of posts a user has written. |
| [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 |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Added `$public_only` argument. Added the ability to pass an array of post types to `$post_type`. |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Added `$post_type` argument. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress save_mod_rewrite_rules(): bool|null save\_mod\_rewrite\_rules(): bool|null
======================================
Updates the htaccess file with the current rules if it is writable.
Always writes to the file if it exists and is writable to ensure that we blank out old rules.
bool|null True on write success, false on failure. Null in multisite.
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function save_mod_rewrite_rules() {
global $wp_rewrite;
if ( is_multisite() ) {
return;
}
// Ensure get_home_path() is declared.
require_once ABSPATH . 'wp-admin/includes/file.php';
$home_path = get_home_path();
$htaccess_file = $home_path . '.htaccess';
/*
* If the file doesn't already exist check for write access to the directory
* and whether we have some rules. Else check for write access to the file.
*/
if ( ! file_exists( $htaccess_file ) && is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks()
|| is_writable( $htaccess_file )
) {
if ( got_mod_rewrite() ) {
$rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );
return insert_with_markers( $htaccess_file, 'WordPress', $rules );
}
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [insert\_with\_markers()](insert_with_markers) wp-admin/includes/misc.php | Inserts an array of strings into a file (.htaccess), placing it between BEGIN and END markers. |
| [got\_mod\_rewrite()](got_mod_rewrite) wp-admin/includes/misc.php | Returns whether the server is running Apache with the mod\_rewrite module loaded. |
| [get\_home\_path()](get_home_path) wp-admin/includes/file.php | Gets the absolute filesystem path to the root of the WordPress installation. |
| [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::using\_mod\_rewrite\_permalinks()](../classes/wp_rewrite/using_mod_rewrite_permalinks) wp-includes/class-wp-rewrite.php | Determines whether permalinks are being used and rewrite module is enabled. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| Used By | Description |
| --- | --- |
| [WP\_Rewrite::flush\_rules()](../classes/wp_rewrite/flush_rules) wp-includes/class-wp-rewrite.php | Removes rewrite rules and then recreate rewrite rules. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_author_posts_url( int $author_id, string $author_nicename = '' ): string get\_author\_posts\_url( int $author\_id, string $author\_nicename = '' ): string
=================================================================================
Retrieves the URL to the author page for the user with the ID provided.
`$author_id` int Required Author ID. `$author_nicename` string Optional The author's nicename (slug). Default: `''`
string The URL to the author's page.
File: `wp-includes/author-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/author-template.php/)
```
function get_author_posts_url( $author_id, $author_nicename = '' ) {
global $wp_rewrite;
$author_id = (int) $author_id;
$link = $wp_rewrite->get_author_permastruct();
if ( empty( $link ) ) {
$file = home_url( '/' );
$link = $file . '?author=' . $author_id;
} else {
if ( '' === $author_nicename ) {
$user = get_userdata( $author_id );
if ( ! empty( $user->user_nicename ) ) {
$author_nicename = $user->user_nicename;
}
}
$link = str_replace( '%author%', $author_nicename, $link );
$link = home_url( user_trailingslashit( $link ) );
}
/**
* Filters the URL to the author's page.
*
* @since 2.1.0
*
* @param string $link The URL to the author's page.
* @param int $author_id The author's ID.
* @param string $author_nicename The author's nice name.
*/
$link = apply_filters( 'author_link', $link, $author_id, $author_nicename );
return $link;
}
```
[apply\_filters( 'author\_link', string $link, int $author\_id, string $author\_nicename )](../hooks/author_link)
Filters the URL to the author’s page.
| Uses | Description |
| --- | --- |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [WP\_Rewrite::get\_author\_permastruct()](../classes/wp_rewrite/get_author_permastruct) wp-includes/class-wp-rewrite.php | Retrieves the author permalink structure. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user 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. |
| Used By | Description |
| --- | --- |
| [WP\_Sitemaps\_Users::get\_url\_list()](../classes/wp_sitemaps_users/get_url_list) wp-includes/sitemaps/providers/class-wp-sitemaps-users.php | Gets a URL list for a user sitemap. |
| [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. |
| [get\_oembed\_response\_data()](get_oembed_response_data) wp-includes/embed.php | Retrieves the oEmbed response data for a given 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\_Users\_List\_Table::single\_row()](../classes/wp_users_list_table/single_row) wp-admin/includes/class-wp-users-list-table.php | Generate HTML for a single row on the users.php admin panel. |
| [get\_author\_link()](get_author_link) wp-includes/deprecated.php | Returns or Prints link to the author’s posts. |
| [get\_author\_feed\_link()](get_author_feed_link) wp-includes/link-template.php | Retrieves the feed link for a given author. |
| [wp\_admin\_bar\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| [wp\_list\_authors()](wp_list_authors) wp-includes/author-template.php | Lists all the authors of the site, with several options available. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_resolve_post_date( string $post_date = '', string $post_date_gmt = '' ): string|false wp\_resolve\_post\_date( string $post\_date = '', string $post\_date\_gmt = '' ): string|false
==============================================================================================
Uses wp\_checkdate to return a valid Gregorian-calendar value for post\_date.
If post\_date is not provided, this first checks post\_date\_gmt if provided, then falls back to use the current time.
For back-compat purposes in wp\_insert\_post, an empty post\_date and an invalid post\_date\_gmt will continue to return ‘1970-01-01 00:00:00’ rather than false.
`$post_date` string Optional The date in mysql format. Default: `''`
`$post_date_gmt` string Optional The GMT date in mysql format. Default: `''`
string|false A valid Gregorian-calendar date string, or false on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_resolve_post_date( $post_date = '', $post_date_gmt = '' ) {
// If the date is empty, set the date to now.
if ( empty( $post_date ) || '0000-00-00 00:00:00' === $post_date ) {
if ( empty( $post_date_gmt ) || '0000-00-00 00:00:00' === $post_date_gmt ) {
$post_date = current_time( 'mysql' );
} else {
$post_date = get_date_from_gmt( $post_date_gmt );
}
}
// Validate the date.
$month = (int) substr( $post_date, 5, 2 );
$day = (int) substr( $post_date, 8, 2 );
$year = (int) substr( $post_date, 0, 4 );
$valid_date = wp_checkdate( $month, $day, $year, $post_date );
if ( ! $valid_date ) {
return false;
}
return $post_date;
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [wp\_checkdate()](wp_checkdate) wp-includes/functions.php | Tests if the supplied date is valid for the Gregorian calendar. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| Used By | Description |
| --- | --- |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress get_plugin_files( string $plugin ): string[] get\_plugin\_files( string $plugin ): string[]
==============================================
Gets a list of a plugin’s files.
`$plugin` string Required Path to the plugin file relative to the plugins directory. string[] Array of file names relative to the plugin root.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function get_plugin_files( $plugin ) {
$plugin_file = WP_PLUGIN_DIR . '/' . $plugin;
$dir = dirname( $plugin_file );
$plugin_files = array( plugin_basename( $plugin_file ) );
if ( is_dir( $dir ) && WP_PLUGIN_DIR !== $dir ) {
/**
* Filters the array of excluded directories and files while scanning the folder.
*
* @since 4.9.0
*
* @param string[] $exclusions Array of excluded directories and files.
*/
$exclusions = (array) apply_filters( 'plugin_files_exclusions', array( 'CVS', 'node_modules', 'vendor', 'bower_components' ) );
$list_files = list_files( $dir, 100, $exclusions );
$list_files = array_map( 'plugin_basename', $list_files );
$plugin_files = array_merge( $plugin_files, $list_files );
$plugin_files = array_values( array_unique( $plugin_files ) );
}
return $plugin_files;
}
```
[apply\_filters( 'plugin\_files\_exclusions', string[] $exclusions )](../hooks/plugin_files_exclusions)
Filters the array of excluded directories and files while scanning the folder.
| Uses | Description |
| --- | --- |
| [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. |
| [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress is_email( string $email, bool $deprecated = false ): string|false is\_email( string $email, bool $deprecated = false ): string|false
==================================================================
Verifies that an email is valid.
Does not grok i18n domains. Not RFC compliant.
`$email` string Required Email address to verify. `$deprecated` bool Optional Deprecated. Default: `false`
string|false Valid email address on success, false on failure.
Does not grok i18n domains. Not RFC compliant.
It does not correctly test for invalid characters. This code does not distinguish email such as [email protected]:
```
if ( ! preg_match('/^[a-z0-9-]+$/i', $sub ) ) {
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' );
}
```
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function is_email( $email, $deprecated = false ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '3.0.0' );
}
// Test for the minimum length the email can be.
if ( strlen( $email ) < 6 ) {
/**
* Filters whether an email address is valid.
*
* This filter is evaluated under several different contexts, such as 'email_too_short',
* 'email_no_at', 'local_invalid_chars', 'domain_period_sequence', 'domain_period_limits',
* 'domain_no_periods', 'sub_hyphen_limits', 'sub_invalid_chars', or no specific context.
*
* @since 2.8.0
*
* @param string|false $is_email The email address if successfully passed the is_email() checks, false otherwise.
* @param string $email The email address being checked.
* @param string $context Context under which the email was tested.
*/
return apply_filters( 'is_email', false, $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( 'is_email', false, $email, 'email_no_at' );
}
// Split out the local and domain parts.
list( $local, $domain ) = explode( '@', $email, 2 );
// LOCAL PART
// Test for invalid characters.
if ( ! preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) {
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'is_email', false, $email, 'local_invalid_chars' );
}
// DOMAIN PART
// Test for sequences of periods.
if ( preg_match( '/\.{2,}/', $domain ) ) {
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'is_email', false, $email, 'domain_period_sequence' );
}
// Test for leading and trailing periods and whitespace.
if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) {
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'is_email', false, $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( 'is_email', false, $email, 'domain_no_periods' );
}
// Loop through each sub.
foreach ( $subs as $sub ) {
// Test for leading and trailing hyphens and whitespace.
if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) {
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' );
}
// Test for invalid characters.
if ( ! preg_match( '/^[a-z0-9-]+$/i', $sub ) ) {
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' );
}
}
// Congratulations, your email made it!
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'is_email', $email, $email, null );
}
```
[apply\_filters( 'is\_email', string|false $is\_email, string $email, string $context )](../hooks/is_email)
Filters whether an email address is valid.
| Uses | Description |
| --- | --- |
| [\_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\_authenticate\_application\_password()](wp_authenticate_application_password) wp-includes/user.php | Authenticates the user using an application password. |
| [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\_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\_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. |
| [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. |
| [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. |
| [wp\_authenticate\_email\_password()](wp_authenticate_email_password) wp-includes/user.php | Authenticates a user using the email and password. |
| [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. |
| [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. |
| [populate\_network()](populate_network) wp-admin/includes/schema.php | Populate network settings. |
| [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| [register\_new\_user()](register_new_user) wp-includes/user.php | Handles registering a new user. |
| [newblog\_notify\_siteadmin()](newblog_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new site has been activated. |
| [newuser\_notify\_siteadmin()](newuser_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new user has been activated. |
| [wpmu\_validate\_user\_signup()](wpmu_validate_user_signup) wp-includes/ms-functions.php | Sanitizes and validates data required for a user sign-up. |
| [validate\_email()](validate_email) wp-includes/ms-deprecated.php | Deprecated functionality to validate an email address. |
| [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. |
| [wp\_xmlrpc\_server::wp\_newComment()](../classes/wp_xmlrpc_server/wp_newcomment) wp-includes/class-wp-xmlrpc-server.php | Create new comment. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
| programming_docs |
wordpress wp_make_link_relative( string $link ): string wp\_make\_link\_relative( string $link ): string
================================================
Converts full URL paths to absolute paths.
Removes the http or https protocols and the domain. Keeps the path ‘/’ at the beginning, so it isn’t a true relative link, but from the web root base.
`$link` string Required Full URL path. string Absolute path.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_make_link_relative( $link ) {
return preg_replace( '|^(https?:)?//[^/]+(/?.*)|i', '$2', $link );
}
```
| 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\_normalize\_relative\_css\_links()](_wp_normalize_relative_css_links) wp-includes/script-loader.php | Makes URLs relative to the WordPress installation. |
| Version | Description |
| --- | --- |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Support was added for relative URLs. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress _get_admin_bar_pref( string $context = 'front', int $user ): bool \_get\_admin\_bar\_pref( string $context = 'front', int $user ): 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.
Retrieves the admin bar display preference of a user.
`$context` string Optional Context of this preference check. Defaults to `'front'`. The `'admin'` preference is no longer used. Default: `'front'`
`$user` int Optional ID of the user to check, defaults to 0 for current user. bool Whether the admin bar should be showing for this user.
File: `wp-includes/admin-bar.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/admin-bar.php/)
```
function _get_admin_bar_pref( $context = 'front', $user = 0 ) {
$pref = get_user_option( "show_admin_bar_{$context}", $user );
if ( false === $pref ) {
return true;
}
return 'true' === $pref;
}
```
| Uses | Description |
| --- | --- |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| Used By | Description |
| --- | --- |
| [is\_admin\_bar\_showing()](is_admin_bar_showing) wp-includes/admin-bar.php | Determines whether the admin bar should be showing. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_enqueue_global_styles() wp\_enqueue\_global\_styles()
=============================
Enqueues the global styles defined via theme.json.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_enqueue_global_styles() {
$separate_assets = wp_should_load_separate_core_block_assets();
$is_block_theme = wp_is_block_theme();
$is_classic_theme = ! $is_block_theme;
/*
* Global styles should be printed in the head when loading all styles combined.
* The footer should only be used to print global styles for classic themes with separate core assets enabled.
*
* See https://core.trac.wordpress.org/ticket/53494.
*/
if (
( $is_block_theme && doing_action( 'wp_footer' ) ) ||
( $is_classic_theme && doing_action( 'wp_footer' ) && ! $separate_assets ) ||
( $is_classic_theme && doing_action( 'wp_enqueue_scripts' ) && $separate_assets )
) {
return;
}
/*
* If loading the CSS for each block separately, then load the theme.json CSS conditionally.
* This removes the CSS from the global-styles stylesheet and adds it to the inline CSS for each block.
* This filter must be registered before calling wp_get_global_stylesheet();
*/
add_filter( 'wp_theme_json_get_style_nodes', 'wp_filter_out_block_nodes' );
$stylesheet = wp_get_global_stylesheet();
if ( empty( $stylesheet ) ) {
return;
}
wp_register_style( 'global-styles', false, array(), true, true );
wp_add_inline_style( 'global-styles', $stylesheet );
wp_enqueue_style( 'global-styles' );
// Add each block as an inline css.
wp_add_global_styles_for_blocks();
}
```
| Uses | Description |
| --- | --- |
| [wp\_add\_global\_styles\_for\_blocks()](wp_add_global_styles_for_blocks) wp-includes/global-styles-and-settings.php | Adds global style rules to the inline style for each block. |
| [wp\_get\_global\_stylesheet()](wp_get_global_stylesheet) wp-includes/global-styles-and-settings.php | Returns the stylesheet resulting of merging core, theme, and user data. |
| [wp\_is\_block\_theme()](wp_is_block_theme) wp-includes/theme.php | Returns whether the active theme is a block-based theme or not. |
| [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\_register\_style()](wp_register_style) wp-includes/functions.wp-styles.php | Register a CSS stylesheet. |
| [wp\_add\_inline\_style()](wp_add_inline_style) wp-includes/functions.wp-styles.php | Add extra CSS styles to a registered stylesheet. |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| [doing\_action()](doing_action) wp-includes/plugin.php | Returns whether or not an action hook is currently being processed. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress create_initial_theme_features() create\_initial\_theme\_features()
==================================
Creates the initial theme features when the ‘setup\_theme’ action is fired.
See [‘setup\_theme’](../hooks/setup_theme).
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function create_initial_theme_features() {
register_theme_feature(
'align-wide',
array(
'description' => __( 'Whether theme opts in to wide alignment CSS class.' ),
'show_in_rest' => true,
)
);
register_theme_feature(
'automatic-feed-links',
array(
'description' => __( 'Whether posts and comments RSS feed links are added to head.' ),
'show_in_rest' => true,
)
);
register_theme_feature(
'block-templates',
array(
'description' => __( 'Whether a theme uses block-based templates.' ),
'show_in_rest' => true,
)
);
register_theme_feature(
'block-template-parts',
array(
'description' => __( 'Whether a theme uses block-based template parts.' ),
'show_in_rest' => true,
)
);
register_theme_feature(
'custom-background',
array(
'description' => __( 'Custom background if defined by the theme.' ),
'type' => 'object',
'show_in_rest' => array(
'schema' => array(
'properties' => array(
'default-image' => array(
'type' => 'string',
'format' => 'uri',
),
'default-preset' => array(
'type' => 'string',
'enum' => array(
'default',
'fill',
'fit',
'repeat',
'custom',
),
),
'default-position-x' => array(
'type' => 'string',
'enum' => array(
'left',
'center',
'right',
),
),
'default-position-y' => array(
'type' => 'string',
'enum' => array(
'left',
'center',
'right',
),
),
'default-size' => array(
'type' => 'string',
'enum' => array(
'auto',
'contain',
'cover',
),
),
'default-repeat' => array(
'type' => 'string',
'enum' => array(
'repeat-x',
'repeat-y',
'repeat',
'no-repeat',
),
),
'default-attachment' => array(
'type' => 'string',
'enum' => array(
'scroll',
'fixed',
),
),
'default-color' => array(
'type' => 'string',
),
),
),
),
)
);
register_theme_feature(
'custom-header',
array(
'description' => __( 'Custom header if defined by the theme.' ),
'type' => 'object',
'show_in_rest' => array(
'schema' => array(
'properties' => array(
'default-image' => array(
'type' => 'string',
'format' => 'uri',
),
'random-default' => array(
'type' => 'boolean',
),
'width' => array(
'type' => 'integer',
),
'height' => array(
'type' => 'integer',
),
'flex-height' => array(
'type' => 'boolean',
),
'flex-width' => array(
'type' => 'boolean',
),
'default-text-color' => array(
'type' => 'string',
),
'header-text' => array(
'type' => 'boolean',
),
'uploads' => array(
'type' => 'boolean',
),
'video' => array(
'type' => 'boolean',
),
),
),
),
)
);
register_theme_feature(
'custom-logo',
array(
'type' => 'object',
'description' => __( 'Custom logo if defined by the theme.' ),
'show_in_rest' => array(
'schema' => array(
'properties' => array(
'width' => array(
'type' => 'integer',
),
'height' => array(
'type' => 'integer',
),
'flex-width' => array(
'type' => 'boolean',
),
'flex-height' => array(
'type' => 'boolean',
),
'header-text' => array(
'type' => 'array',
'items' => array(
'type' => 'string',
),
),
'unlink-homepage-logo' => array(
'type' => 'boolean',
),
),
),
),
)
);
register_theme_feature(
'customize-selective-refresh-widgets',
array(
'description' => __( 'Whether the theme enables Selective Refresh for Widgets being managed with the Customizer.' ),
'show_in_rest' => true,
)
);
register_theme_feature(
'dark-editor-style',
array(
'description' => __( 'Whether theme opts in to the dark editor style UI.' ),
'show_in_rest' => true,
)
);
register_theme_feature(
'disable-custom-colors',
array(
'description' => __( 'Whether the theme disables custom colors.' ),
'show_in_rest' => true,
)
);
register_theme_feature(
'disable-custom-font-sizes',
array(
'description' => __( 'Whether the theme disables custom font sizes.' ),
'show_in_rest' => true,
)
);
register_theme_feature(
'disable-custom-gradients',
array(
'description' => __( 'Whether the theme disables custom gradients.' ),
'show_in_rest' => true,
)
);
register_theme_feature(
'disable-layout-styles',
array(
'description' => __( 'Whether the theme disables generated layout styles.' ),
'show_in_rest' => true,
)
);
register_theme_feature(
'editor-color-palette',
array(
'type' => 'array',
'description' => __( 'Custom color palette if defined by the theme.' ),
'show_in_rest' => array(
'schema' => array(
'items' => array(
'type' => 'object',
'properties' => array(
'name' => array(
'type' => 'string',
),
'slug' => array(
'type' => 'string',
),
'color' => array(
'type' => 'string',
),
),
),
),
),
)
);
register_theme_feature(
'editor-font-sizes',
array(
'type' => 'array',
'description' => __( 'Custom font sizes if defined by the theme.' ),
'show_in_rest' => array(
'schema' => array(
'items' => array(
'type' => 'object',
'properties' => array(
'name' => array(
'type' => 'string',
),
'size' => array(
'type' => 'number',
),
'slug' => array(
'type' => 'string',
),
),
),
),
),
)
);
register_theme_feature(
'editor-gradient-presets',
array(
'type' => 'array',
'description' => __( 'Custom gradient presets if defined by the theme.' ),
'show_in_rest' => array(
'schema' => array(
'items' => array(
'type' => 'object',
'properties' => array(
'name' => array(
'type' => 'string',
),
'gradient' => array(
'type' => 'string',
),
'slug' => array(
'type' => 'string',
),
),
),
),
),
)
);
register_theme_feature(
'editor-styles',
array(
'description' => __( 'Whether theme opts in to the editor styles CSS wrapper.' ),
'show_in_rest' => true,
)
);
register_theme_feature(
'html5',
array(
'type' => 'array',
'description' => __( 'Allows use of HTML5 markup for search forms, comment forms, comment lists, gallery, and caption.' ),
'show_in_rest' => array(
'schema' => array(
'items' => array(
'type' => 'string',
'enum' => array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'script',
'style',
),
),
),
),
)
);
register_theme_feature(
'post-formats',
array(
'type' => 'array',
'description' => __( 'Post formats supported.' ),
'show_in_rest' => array(
'name' => 'formats',
'schema' => array(
'items' => array(
'type' => 'string',
'enum' => get_post_format_slugs(),
),
'default' => array( 'standard' ),
),
'prepare_callback' => static function ( $formats ) {
$formats = is_array( $formats ) ? array_values( $formats[0] ) : array();
$formats = array_merge( array( 'standard' ), $formats );
return $formats;
},
),
)
);
register_theme_feature(
'post-thumbnails',
array(
'type' => 'array',
'description' => __( 'The post types that support thumbnails or true if all post types are supported.' ),
'show_in_rest' => array(
'type' => array( 'boolean', 'array' ),
'schema' => array(
'items' => array(
'type' => 'string',
),
),
),
)
);
register_theme_feature(
'responsive-embeds',
array(
'description' => __( 'Whether the theme supports responsive embedded content.' ),
'show_in_rest' => true,
)
);
register_theme_feature(
'title-tag',
array(
'description' => __( 'Whether the theme can manage the document title tag.' ),
'show_in_rest' => true,
)
);
register_theme_feature(
'wp-block-styles',
array(
'description' => __( 'Whether theme opts in to default WordPress block styles for viewing.' ),
'show_in_rest' => true,
)
);
}
```
| Uses | Description |
| --- | --- |
| [register\_theme\_feature()](register_theme_feature) wp-includes/theme.php | Registers a theme feature for use in [add\_theme\_support()](add_theme_support) . |
| [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. |
| Version | Description |
| --- | --- |
| [6.0.1](https://developer.wordpress.org/reference/since/6.0.1/) | The `block-templates` feature was added. |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress wp_http_supports( array $capabilities = array(), string $url = null ): bool wp\_http\_supports( array $capabilities = array(), string $url = null ): bool
=============================================================================
Determines if there is an HTTP Transport that can process this request.
`$capabilities` array Optional Array of capabilities to test or a [wp\_remote\_request()](wp_remote_request) $args array. More Arguments from wp\_remote\_request( ... $args ) Request arguments. Default: `array()`
`$url` string Optional If given, will check if the URL requires SSL and adds that requirement to the capabilities array. Default: `null`
bool
File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/)
```
function wp_http_supports( $capabilities = array(), $url = null ) {
$http = _wp_http_get_object();
$capabilities = wp_parse_args( $capabilities );
$count = count( $capabilities );
// If we have a numeric $capabilities array, spoof a wp_remote_request() associative $args array.
if ( $count && count( array_filter( array_keys( $capabilities ), 'is_numeric' ) ) == $count ) {
$capabilities = array_combine( array_values( $capabilities ), array_fill( 0, $count, true ) );
}
if ( $url && ! isset( $capabilities['ssl'] ) ) {
$scheme = parse_url( $url, PHP_URL_SCHEME );
if ( 'https' === $scheme || 'ssl' === $scheme ) {
$capabilities['ssl'] = true;
}
}
return (bool) $http->_get_first_available_transport( $capabilities );
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_http\_get\_object()](_wp_http_get_object) wp-includes/http.php | Returns the initialized [WP\_Http](../classes/wp_http) Object |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| 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 |
| [WP\_Site\_Health::get\_test\_ssl\_support()](../classes/wp_site_health/get_test_ssl_support) wp-admin/includes/class-wp-site-health.php | Checks if the HTTP API can handle SSL/TLS requests. |
| [wp\_check\_php\_version()](wp_check_php_version) wp-admin/includes/misc.php | Checks if the user needs to update PHP. |
| [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. |
| [translations\_api()](translations_api) wp-admin/includes/translation-install.php | Retrieve translations from WordPress Translation API. |
| [themes\_api()](themes_api) wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. |
| [get\_core\_checksums()](get_core_checksums) wp-admin/includes/update.php | Gets and caches the checksums for the given version of WordPress. |
| [wp\_check\_browser\_version()](wp_check_browser_version) wp-admin/includes/dashboard.php | Checks if the user needs a browser update. |
| [plugins\_api()](plugins_api) wp-admin/includes/plugin-install.php | Retrieves plugin installer pages from the WordPress.org Plugins API. |
| [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\_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 |
| --- | --- |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
| programming_docs |
wordpress get_date_template(): string get\_date\_template(): string
=============================
Retrieves path of date 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 ‘date’.
* [get\_query\_template()](get_query_template)
string Full path to date template file.
File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
```
function get_date_template() {
return get_query_template( 'date' );
}
```
| Uses | Description |
| --- | --- |
| [get\_query\_template()](get_query_template) wp-includes/template.php | Retrieves path to a template. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_loginout( string $redirect = '', bool $echo = true ): void|string wp\_loginout( string $redirect = '', bool $echo = true ): void|string
=====================================================================
Displays the Log In/Out link.
Displays a link, which allows users to navigate to the Log In page to log in or log out depending on whether they are currently logged in.
`$redirect` string Optional path to redirect to on login/logout. Default: `''`
`$echo` bool Optional Default to echo and not return the link. Default: `true`
void|string Void if `$echo` argument is true, log in/out link 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_loginout( $redirect = '', $echo = true ) {
if ( ! is_user_logged_in() ) {
$link = '<a href="' . esc_url( wp_login_url( $redirect ) ) . '">' . __( 'Log in' ) . '</a>';
} else {
$link = '<a href="' . esc_url( wp_logout_url( $redirect ) ) . '">' . __( 'Log out' ) . '</a>';
}
if ( $echo ) {
/**
* Filters the HTML output for the Log In/Log Out link.
*
* @since 1.5.0
*
* @param string $link The HTML link content.
*/
echo apply_filters( 'loginout', $link );
} else {
/** This filter is documented in wp-includes/general-template.php */
return apply_filters( 'loginout', $link );
}
}
```
[apply\_filters( 'loginout', string $link )](../hooks/loginout)
Filters the HTML output for the Log In/Log Out link.
| Uses | Description |
| --- | --- |
| [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. |
| [wp\_logout\_url()](wp_logout_url) wp-includes/general-template.php | Retrieves the logout URL. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Widget\_Meta::widget()](../classes/wp_widget_meta/widget) wp-includes/widgets/class-wp-widget-meta.php | Outputs the content for the current Meta widget instance. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress _maybe_update_themes() \_maybe\_update\_themes()
=========================
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 themes versions only after a duration of time.
This is for performance reasons to make sure that on the theme version checker is not run on every page load.
File: `wp-includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/update.php/)
```
function _maybe_update_themes() {
$current = get_site_transient( 'update_themes' );
if ( isset( $current->last_checked )
&& 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked )
) {
return;
}
wp_update_themes();
}
```
| Uses | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_ajax_replyto_comment( string $action ) wp\_ajax\_replyto\_comment( string $action )
============================================
Ajax handler for replying to a comment.
`$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_replyto_comment( $action ) {
if ( empty( $action ) ) {
$action = 'replyto-comment';
}
check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
$comment_post_id = (int) $_POST['comment_post_ID'];
$post = get_post( $comment_post_id );
if ( ! $post ) {
wp_die( -1 );
}
if ( ! current_user_can( 'edit_post', $comment_post_id ) ) {
wp_die( -1 );
}
if ( empty( $post->post_status ) ) {
wp_die( 1 );
} elseif ( in_array( $post->post_status, array( 'draft', 'pending', 'trash' ), true ) ) {
wp_die( __( 'You cannot reply to a comment on a draft post.' ) );
}
$user = wp_get_current_user();
if ( $user->exists() ) {
$comment_author = wp_slash( $user->display_name );
$comment_author_email = wp_slash( $user->user_email );
$comment_author_url = wp_slash( $user->user_url );
$user_id = $user->ID;
if ( current_user_can( 'unfiltered_html' ) ) {
if ( ! isset( $_POST['_wp_unfiltered_html_comment'] ) ) {
$_POST['_wp_unfiltered_html_comment'] = '';
}
if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) {
kses_remove_filters(); // Start with a clean slate.
kses_init_filters(); // Set up the filters.
remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
add_filter( 'pre_comment_content', 'wp_filter_kses' );
}
}
} else {
wp_die( __( 'Sorry, you must be logged in to reply to a comment.' ) );
}
$comment_content = trim( $_POST['content'] );
if ( '' === $comment_content ) {
wp_die( __( 'Please type your comment text.' ) );
}
$comment_type = isset( $_POST['comment_type'] ) ? trim( $_POST['comment_type'] ) : 'comment';
$comment_parent = 0;
if ( isset( $_POST['comment_ID'] ) ) {
$comment_parent = absint( $_POST['comment_ID'] );
}
$comment_auto_approved = false;
$commentdata = array(
'comment_post_ID' => $comment_post_id,
);
$commentdata += compact(
'comment_author',
'comment_author_email',
'comment_author_url',
'comment_content',
'comment_type',
'comment_parent',
'user_id'
);
// Automatically approve parent comment.
if ( ! empty( $_POST['approve_parent'] ) ) {
$parent = get_comment( $comment_parent );
if ( $parent && '0' === $parent->comment_approved && $parent->comment_post_ID == $comment_post_id ) {
if ( ! current_user_can( 'edit_comment', $parent->comment_ID ) ) {
wp_die( -1 );
}
if ( wp_set_comment_status( $parent, 'approve' ) ) {
$comment_auto_approved = true;
}
}
}
$comment_id = wp_new_comment( $commentdata );
if ( is_wp_error( $comment_id ) ) {
wp_die( $comment_id->get_error_message() );
}
$comment = get_comment( $comment_id );
if ( ! $comment ) {
wp_die( 1 );
}
$position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
ob_start();
if ( isset( $_REQUEST['mode'] ) && 'dashboard' === $_REQUEST['mode'] ) {
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
_wp_dashboard_recent_comments_row( $comment );
} else {
if ( isset( $_REQUEST['mode'] ) && 'single' === $_REQUEST['mode'] ) {
$wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
} else {
$wp_list_table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
}
$wp_list_table->single_row( $comment );
}
$comment_list_item = ob_get_clean();
$response = array(
'what' => 'comment',
'id' => $comment->comment_ID,
'data' => $comment_list_item,
'position' => $position,
);
$counts = wp_count_comments();
$response['supplemental'] = array(
'in_moderation' => $counts->moderated,
'i18n_comments_text' => sprintf(
/* translators: %s: Number of comments. */
_n( '%s Comment', '%s Comments', $counts->approved ),
number_format_i18n( $counts->approved )
),
'i18n_moderation_text' => sprintf(
/* translators: %s: Number of comments. */
_n( '%s Comment in moderation', '%s Comments in moderation', $counts->moderated ),
number_format_i18n( $counts->moderated )
),
);
if ( $comment_auto_approved ) {
$response['supplemental']['parent_approved'] = $parent->comment_ID;
$response['supplemental']['parent_post_id'] = $parent->comment_post_ID;
}
$x = new WP_Ajax_Response();
$x->add( $response );
$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. |
| [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. |
| [\_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\_count\_comments()](wp_count_comments) wp-includes/comment.php | Retrieves the total comment counts for the whole site or a single post. |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [wp\_new\_comment()](wp_new_comment) wp-includes/comment.php | Adds a new comment to the database. |
| [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\_set\_comment\_status()](wp_set_comment_status) wp-includes/comment.php | Sets the status of a comment. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [kses\_remove\_filters()](kses_remove_filters) wp-includes/kses.php | Removes all KSES input form content filters. |
| [kses\_init\_filters()](kses_init_filters) wp-includes/kses.php | Adds all KSES input form content filters. |
| [\_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\_Response::\_\_construct()](../classes/wp_ajax_response/__construct) wp-includes/class-wp-ajax-response.php | Constructor – Passes args to [WP\_Ajax\_Response::add()](../classes/wp_ajax_response/add). |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress _add_template_loader_filters() \_add\_template\_loader\_filters()
==================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Adds necessary filters to use ‘wp\_template’ posts instead of theme template files.
File: `wp-includes/block-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template.php/)
```
function _add_template_loader_filters() {
if ( ! current_theme_supports( 'block-templates' ) ) {
return;
}
$template_types = array_keys( get_default_block_template_types() );
foreach ( $template_types as $template_type ) {
// Skip 'embed' for now because it is not a regular template type.
if ( 'embed' === $template_type ) {
continue;
}
add_filter( str_replace( '-', '', $template_type ) . '_template', 'locate_block_template', 20, 3 );
}
// Request to resolve a template.
if ( isset( $_GET['_wp-find-template'] ) ) {
add_filter( 'pre_get_posts', '_resolve_template_for_new_post' );
}
}
```
| Uses | Description |
| --- | --- |
| [get\_default\_block\_template\_types()](get_default_block_template_types) wp-includes/block-template-utils.php | Returns a filtered list of default template types, containing their localized titles and descriptions. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress wp_is_writable( string $path ): bool wp\_is\_writable( string $path ): bool
======================================
Determines if a directory is writable.
This function is used to work around certain ACL issues in PHP primarily affecting Windows Servers.
* [win\_is\_writable()](win_is_writable)
`$path` string Required 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 wp_is_writable( $path ) {
if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) {
return win_is_writable( $path );
} else {
return @is_writable( $path );
}
}
```
| Uses | Description |
| --- | --- |
| [win\_is\_writable()](win_is_writable) wp-includes/functions.php | Workaround for Windows bug in is\_writable() function |
| Used By | Description |
| --- | --- |
| [WP\_Debug\_Data::debug\_data()](../classes/wp_debug_data/debug_data) wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| [WP\_Http::request()](../classes/wp_http/request) wp-includes/class-wp-http.php | Send an HTTP request to a URI. |
| [get\_temp\_dir()](get_temp_dir) wp-includes/functions.php | Determines a writable directory for temporary files. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress image_align_input_fields( WP_Post $post, string $checked = '' ): string image\_align\_input\_fields( WP\_Post $post, string $checked = '' ): string
===========================================================================
Retrieves HTML for the image alignment radio buttons with the specified one checked.
`$post` [WP\_Post](../classes/wp_post) Required `$checked` 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_align_input_fields( $post, $checked = '' ) {
if ( empty( $checked ) ) {
$checked = get_user_setting( 'align', 'none' );
}
$alignments = array(
'none' => __( 'None' ),
'left' => __( 'Left' ),
'center' => __( 'Center' ),
'right' => __( 'Right' ),
);
if ( ! array_key_exists( (string) $checked, $alignments ) ) {
$checked = 'none';
}
$output = array();
foreach ( $alignments as $name => $label ) {
$name = esc_attr( $name );
$output[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='$name'" .
( $checked == $name ? " checked='checked'" : '' ) .
" /><label for='image-align-{$name}-{$post->ID}' class='align image-align-{$name}-label'>$label</label>";
}
return implode( "\n", $output );
}
```
| Uses | Description |
| --- | --- |
| [get\_user\_setting()](get_user_setting) wp-includes/option.php | Retrieves user interface setting value based on setting name. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| 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 update_post_parent_caches( WP_Post[] $posts ) update\_post\_parent\_caches( WP\_Post[] $posts )
=================================================
Updates parent post caches for a list of post objects.
`$posts` [WP\_Post](../classes/wp_post)[] Required Array of post objects. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function update_post_parent_caches( $posts ) {
$parent_ids = wp_list_pluck( $posts, 'post_parent' );
$parent_ids = array_map( 'absint', $parent_ids );
$parent_ids = array_unique( array_filter( $parent_ids ) );
if ( ! empty( $parent_ids ) ) {
_prime_post_caches( $parent_ids, false );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_list\_pluck()](wp_list_pluck) wp-includes/functions.php | Plucks a certain field out of each object or array in an array. |
| [\_prime\_post\_caches()](_prime_post_caches) wp-includes/post.php | Adds any posts from the given IDs to the cache that do not already exist in cache. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Posts\_Controller::get\_items()](../classes/wp_rest_posts_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves a collection of posts. |
| [wp\_ajax\_query\_attachments()](wp_ajax_query_attachments) wp-admin/includes/ajax-actions.php | Ajax handler for querying attachments. |
| [WP\_Media\_List\_Table::prepare\_items()](../classes/wp_media_list_table/prepare_items) wp-admin/includes/class-wp-media-list-table.php | |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress media_upload_html_bypass() media\_upload\_html\_bypass()
=============================
Displays the browser’s built-in uploader message.
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function media_upload_html_bypass() {
?>
<p class="upload-html-bypass hide-if-no-js">
<?php _e( 'You are using the browser’s built-in file uploader. The WordPress uploader includes multiple file selection and drag and drop capability. <a href="#">Switch to the multi-file uploader</a>.' ); ?>
</p>
<?php
}
```
| Uses | Description |
| --- | --- |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
| programming_docs |
wordpress wp_ajax_dismiss_wp_pointer() wp\_ajax\_dismiss\_wp\_pointer()
================================
Ajax handler for dismissing a WordPress pointer.
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_dismiss_wp_pointer() {
$pointer = $_POST['pointer'];
if ( sanitize_key( $pointer ) != $pointer ) {
wp_die( 0 );
}
// check_ajax_referer( 'dismiss-pointer_' . $pointer );
$dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) );
if ( in_array( $pointer, $dismissed, true ) ) {
wp_die( 0 );
}
$dismissed[] = $pointer;
$dismissed = implode( ',', $dismissed );
update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $dismissed );
wp_die( 1 );
}
```
| 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. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [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. |
wordpress iis7_supports_permalinks(): bool iis7\_supports\_permalinks(): bool
==================================
Checks if IIS 7+ supports pretty permalinks.
bool Whether IIS7 supports permalinks.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function iis7_supports_permalinks() {
global $is_iis7;
$supports_permalinks = false;
if ( $is_iis7 ) {
/* First we check if the DOMDocument class exists. If it does not exist, then we cannot
* easily update the xml configuration file, hence we just bail out and tell user that
* pretty permalinks cannot be used.
*
* Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When
* URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'.
* Lastly we make sure that PHP is running via FastCGI. This is important because if it runs
* via ISAPI then pretty permalinks will not work.
*/
$supports_permalinks = class_exists( 'DOMDocument', false ) && isset( $_SERVER['IIS_UrlRewriteModule'] ) && ( 'cgi-fcgi' === PHP_SAPI );
}
/**
* Filters whether IIS 7+ supports pretty permalinks.
*
* @since 2.8.0
*
* @param bool $supports_permalinks Whether IIS7 supports permalinks. Default false.
*/
return apply_filters( 'iis7_supports_permalinks', $supports_permalinks );
}
```
[apply\_filters( 'iis7\_supports\_permalinks', bool $supports\_permalinks )](../hooks/iis7_supports_permalinks)
Filters whether IIS 7+ supports pretty permalinks.
| 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 |
| --- | --- |
| [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. |
| [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. |
| [got\_url\_rewrite()](got_url_rewrite) wp-admin/includes/misc.php | Returns whether the server supports URL rewriting. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress is_email_address_unsafe( string $user_email ): bool is\_email\_address\_unsafe( string $user\_email ): bool
=======================================================
Checks an email address against a list of banned domains.
This function checks against the Banned Email Domains list at wp-admin/network/settings.php. The check is only run on self-registrations; user creation at wp-admin/network/users.php bypasses this check.
`$user_email` string Required The email provided by the user at registration. bool True when the email address is banned, false otherwise.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function is_email_address_unsafe( $user_email ) {
$banned_names = get_site_option( 'banned_email_domains' );
if ( $banned_names && ! is_array( $banned_names ) ) {
$banned_names = explode( "\n", $banned_names );
}
$is_email_address_unsafe = false;
if ( $banned_names && is_array( $banned_names ) && false !== strpos( $user_email, '@', 1 ) ) {
$banned_names = array_map( 'strtolower', $banned_names );
$normalized_email = strtolower( $user_email );
list( $email_local_part, $email_domain ) = explode( '@', $normalized_email );
foreach ( $banned_names as $banned_domain ) {
if ( ! $banned_domain ) {
continue;
}
if ( $email_domain == $banned_domain ) {
$is_email_address_unsafe = true;
break;
}
$dotted_domain = ".$banned_domain";
if ( substr( $normalized_email, -strlen( $dotted_domain ) ) === $dotted_domain ) {
$is_email_address_unsafe = true;
break;
}
}
}
/**
* Filters whether an email address is unsafe.
*
* @since 3.5.0
*
* @param bool $is_email_address_unsafe Whether the email address is "unsafe". Default false.
* @param string $user_email User email address.
*/
return apply_filters( 'is_email_address_unsafe', $is_email_address_unsafe, $user_email );
}
```
[apply\_filters( 'is\_email\_address\_unsafe', bool $is\_email\_address\_unsafe, string $user\_email )](../hooks/is_email_address_unsafe)
Filters whether an email address is unsafe.
| 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. |
| Used By | Description |
| --- | --- |
| [wpmu\_validate\_user\_signup()](wpmu_validate_user_signup) wp-includes/ms-functions.php | Sanitizes and validates data required for a user sign-up. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress get_post_format_strings(): string[] get\_post\_format\_strings(): string[]
======================================
Returns an array of post format slugs to their translated and pretty display versions
string[] Array of post format labels keyed by format slug.
File: `wp-includes/post-formats.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-formats.php/)
```
function get_post_format_strings() {
$strings = array(
'standard' => _x( 'Standard', 'Post format' ), // Special case. Any value that evals to false will be considered standard.
'aside' => _x( 'Aside', 'Post format' ),
'chat' => _x( 'Chat', 'Post format' ),
'gallery' => _x( 'Gallery', 'Post format' ),
'link' => _x( 'Link', 'Post format' ),
'image' => _x( 'Image', 'Post format' ),
'quote' => _x( 'Quote', 'Post format' ),
'status' => _x( 'Status', 'Post format' ),
'video' => _x( 'Video', 'Post format' ),
'audio' => _x( 'Audio', 'Post format' ),
);
return $strings;
}
```
| Uses | Description |
| --- | --- |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| Used By | Description |
| --- | --- |
| [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. |
| [get\_post\_format\_slugs()](get_post_format_slugs) wp-includes/post-formats.php | Retrieves the array of post format slugs. |
| [get\_post\_format\_string()](get_post_format_string) wp-includes/post-formats.php | Returns a pretty, translated version of a post format slug |
| [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::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. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress do_favicon() do\_favicon()
=============
Displays the favicon.ico file content.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function do_favicon() {
/**
* Fires when serving the favicon.ico file.
*
* @since 5.4.0
*/
do_action( 'do_faviconico' );
wp_redirect( get_site_icon_url( 32, includes_url( 'images/w-logo-blue-white-bg.png' ) ) );
exit;
}
```
[do\_action( 'do\_faviconico' )](../hooks/do_faviconico)
Fires when serving the favicon.ico file.
| Uses | Description |
| --- | --- |
| [get\_site\_icon\_url()](get_site_icon_url) wp-includes/general-template.php | Returns the Site Icon URL. |
| [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. |
| [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Introduced. |
wordpress _admin_notice_post_locked() \_admin\_notice\_post\_locked()
===============================
Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post.
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function _admin_notice_post_locked() {
$post = get_post();
if ( ! $post ) {
return;
}
$user = null;
$user_id = wp_check_post_lock( $post->ID );
if ( $user_id ) {
$user = get_userdata( $user_id );
}
if ( $user ) {
/**
* Filters whether to show the post locked dialog.
*
* Returning false from the filter will prevent the dialog from being displayed.
*
* @since 3.6.0
*
* @param bool $display Whether to display the dialog. Default true.
* @param WP_Post $post Post object.
* @param WP_User $user The user with the lock for the post.
*/
if ( ! apply_filters( 'show_post_locked_dialog', true, $post, $user ) ) {
return;
}
$locked = true;
} else {
$locked = false;
}
$sendback = wp_get_referer();
if ( $locked && $sendback && false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) {
$sendback_text = __( 'Go back' );
} else {
$sendback = admin_url( 'edit.php' );
if ( 'post' !== $post->post_type ) {
$sendback = add_query_arg( 'post_type', $post->post_type, $sendback );
}
$sendback_text = get_post_type_object( $post->post_type )->labels->all_items;
}
$hidden = $locked ? '' : ' hidden';
?>
<div id="post-lock-dialog" class="notification-dialog-wrap<?php echo $hidden; ?>">
<div class="notification-dialog-background"></div>
<div class="notification-dialog">
<?php
if ( $locked ) {
$query_args = array();
if ( get_post_type_object( $post->post_type )->public ) {
if ( 'publish' === $post->post_status || $user->ID != $post->post_author ) {
// Latest content is in autosave.
$nonce = wp_create_nonce( 'post_preview_' . $post->ID );
$query_args['preview_id'] = $post->ID;
$query_args['preview_nonce'] = $nonce;
}
}
$preview_link = get_preview_post_link( $post->ID, $query_args );
/**
* Filters whether to allow the post lock to be overridden.
*
* Returning false from the filter will disable the ability
* to override the post lock.
*
* @since 3.6.0
*
* @param bool $override Whether to allow the post lock to be overridden. Default true.
* @param WP_Post $post Post object.
* @param WP_User $user The user with the lock for the post.
*/
$override = apply_filters( 'override_post_lock', true, $post, $user );
$tab_last = $override ? '' : ' wp-tab-last';
?>
<div class="post-locked-message">
<div class="post-locked-avatar"><?php echo get_avatar( $user->ID, 64 ); ?></div>
<p class="currently-editing wp-tab-first" tabindex="0">
<?php
if ( $override ) {
/* translators: %s: User's display name. */
printf( __( '%s is currently editing this post. Do you want to take over?' ), esc_html( $user->display_name ) );
} else {
/* translators: %s: User's display name. */
printf( __( '%s is currently editing this post.' ), esc_html( $user->display_name ) );
}
?>
</p>
<?php
/**
* Fires inside the post locked dialog before the buttons are displayed.
*
* @since 3.6.0
* @since 5.4.0 The $user parameter was added.
*
* @param WP_Post $post Post object.
* @param WP_User $user The user with the lock for the post.
*/
do_action( 'post_locked_dialog', $post, $user );
?>
<p>
<a class="button" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a>
<?php if ( $preview_link ) { ?>
<a class="button<?php echo $tab_last; ?>" href="<?php echo esc_url( $preview_link ); ?>"><?php _e( 'Preview' ); ?></a>
<?php
}
// Allow plugins to prevent some users overriding the post lock.
if ( $override ) {
?>
<a class="button button-primary wp-tab-last" href="<?php echo esc_url( add_query_arg( 'get-post-lock', '1', wp_nonce_url( get_edit_post_link( $post->ID, 'url' ), 'lock-post_' . $post->ID ) ) ); ?>"><?php _e( 'Take over' ); ?></a>
<?php
}
?>
</p>
</div>
<?php
} else {
?>
<div class="post-taken-over">
<div class="post-locked-avatar"></div>
<p class="wp-tab-first" tabindex="0">
<span class="currently-editing"></span><br />
<span class="locked-saving hidden"><img src="<?php echo esc_url( admin_url( 'images/spinner-2x.gif' ) ); ?>" width="16" height="16" alt="" /> <?php _e( 'Saving revision…' ); ?></span>
<span class="locked-saved hidden"><?php _e( 'Your latest changes were saved as a revision.' ); ?></span>
</p>
<?php
/**
* Fires inside the dialog displayed when a user has lost the post lock.
*
* @since 3.6.0
*
* @param WP_Post $post Post object.
*/
do_action( 'post_lock_lost_dialog', $post );
?>
<p><a class="button button-primary wp-tab-last" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a></p>
</div>
<?php
}
?>
</div>
</div>
<?php
}
```
[apply\_filters( 'override\_post\_lock', bool $override, WP\_Post $post, WP\_User $user )](../hooks/override_post_lock)
Filters whether to allow the post lock to be overridden.
[do\_action( 'post\_locked\_dialog', WP\_Post $post, WP\_User $user )](../hooks/post_locked_dialog)
Fires inside the post locked dialog before the buttons are displayed.
[do\_action( 'post\_lock\_lost\_dialog', WP\_Post $post )](../hooks/post_lock_lost_dialog)
Fires inside the dialog displayed when a user has lost the post lock.
[apply\_filters( 'show\_post\_locked\_dialog', bool $display, WP\_Post $post, WP\_User $user )](../hooks/show_post_locked_dialog)
Filters whether to show the post locked dialog.
| Uses | Description |
| --- | --- |
| [get\_preview\_post\_link()](get_preview_post_link) wp-includes/link-template.php | Retrieves the URL used for the post preview. |
| [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. |
| [get\_edit\_post\_link()](get_edit_post_link) wp-includes/link-template.php | Retrieves the edit post link for post. |
| [wp\_check\_post\_lock()](wp_check_post_lock) wp-admin/includes/post.php | Determines whether the post is currently being edited by another user. |
| [wp\_create\_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\_get\_referer()](wp_get_referer) wp-includes/functions.php | Retrieves referer from ‘\_wp\_http\_referer’ or HTTP referer. |
| [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. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [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. |
| [\_\_()](__) 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. |
| [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. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Version | Description |
| --- | --- |
| [2.8.5](https://developer.wordpress.org/reference/since/2.8.5/) | Introduced. |
wordpress html_type_rss() html\_type\_rss()
=================
Displays the HTML type based on the blog setting.
The two possible values are either ‘xhtml’ or ‘html’.
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function html_type_rss() {
$type = get_bloginfo( 'html_type' );
if ( strpos( $type, 'xhtml' ) !== false ) {
$type = 'xhtml';
} else {
$type = 'html';
}
echo $type;
}
```
| Uses | Description |
| --- | --- |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress _custom_header_background_just_in_time() \_custom\_header\_background\_just\_in\_time()
==============================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Registers the internal custom header and background routines.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function _custom_header_background_just_in_time() {
global $custom_image_header, $custom_background;
if ( current_theme_supports( 'custom-header' ) ) {
// In case any constants were defined after an add_custom_image_header() call, re-run.
add_theme_support( 'custom-header', array( '__jit' => true ) );
$args = get_theme_support( 'custom-header' );
if ( $args[0]['wp-head-callback'] ) {
add_action( 'wp_head', $args[0]['wp-head-callback'] );
}
if ( is_admin() ) {
require_once ABSPATH . 'wp-admin/includes/class-custom-image-header.php';
$custom_image_header = new Custom_Image_Header( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] );
}
}
if ( current_theme_supports( 'custom-background' ) ) {
// In case any constants were defined after an add_custom_background() call, re-run.
add_theme_support( 'custom-background', array( '__jit' => true ) );
$args = get_theme_support( 'custom-background' );
add_action( 'wp_head', $args[0]['wp-head-callback'] );
if ( is_admin() ) {
require_once ABSPATH . 'wp-admin/includes/class-custom-background.php';
$custom_background = new Custom_Background( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] );
}
}
}
```
| Uses | Description |
| --- | --- |
| [Custom\_Image\_Header::\_\_construct()](../classes/custom_image_header/__construct) wp-admin/includes/class-custom-image-header.php | Constructor – Register administration header callback. |
| [Custom\_Background::\_\_construct()](../classes/custom_background/__construct) wp-admin/includes/class-custom-background.php | Constructor – Registers administration header callback. |
| [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. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
| programming_docs |
wordpress _xml_wp_die_handler( string $message, string $title = '', string|array $args = array() ) \_xml\_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 XML 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 _xml_wp_die_handler( $message, $title = '', $args = array() ) {
list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args );
$message = htmlspecialchars( $message );
$title = htmlspecialchars( $title );
$xml = <<<EOD
<error>
<code>{$parsed_args['code']}</code>
<title><![CDATA[{$title}]]></title>
<message><![CDATA[{$message}]]></message>
<data>
<status>{$parsed_args['response']}</status>
</data>
</error>
EOD;
if ( ! headers_sent() ) {
header( "Content-Type: text/xml; charset={$parsed_args['charset']}" );
if ( null !== $parsed_args['response'] ) {
status_header( $parsed_args['response'] );
}
nocache_headers();
}
echo $xml;
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. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress add_existing_user_to_blog( array|false $details = false ): true|WP_Error|void add\_existing\_user\_to\_blog( array|false $details = false ): true|WP\_Error|void
==================================================================================
Adds a user to a blog based on details from [maybe\_add\_existing\_user\_to\_blog()](maybe_add_existing_user_to_blog) .
`$details` array|false Optional User details. Must at least contain values for the keys listed below.
* `user_id`intThe ID of the user being added to the current blog.
* `role`stringThe role to be assigned to the user.
Default: `false`
true|[WP\_Error](../classes/wp_error)|void True on success or a [WP\_Error](../classes/wp_error) object if the user doesn't exist or could not be added. Void if $details array was not provided.
This function is called by `maybe_add_existing_user_to_blog()` and should not be called directly. This page is for informational purposes only. Use `add_user_to_blog()`.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function add_existing_user_to_blog( $details = false ) {
if ( is_array( $details ) ) {
$blog_id = get_current_blog_id();
$result = add_user_to_blog( $blog_id, $details['user_id'], $details['role'] );
/**
* Fires immediately after an existing user is added to a site.
*
* @since MU (3.0.0)
*
* @param int $user_id User ID.
* @param true|WP_Error $result True on success or a WP_Error object if the user doesn't exist
* or could not be added.
*/
do_action( 'added_existing_user', $details['user_id'], $result );
return $result;
}
}
```
[do\_action( 'added\_existing\_user', int $user\_id, true|WP\_Error $result )](../hooks/added_existing_user)
Fires immediately after an existing user is added to a site.
| Uses | Description |
| --- | --- |
| [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. |
| [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. |
| Used By | Description |
| --- | --- |
| [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}/. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress _admin_bar_bump_cb() \_admin\_bar\_bump\_cb()
========================
Prints default admin bar callback.
File: `wp-includes/admin-bar.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/admin-bar.php/)
```
function _admin_bar_bump_cb() {
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
?>
<style<?php echo $type_attr; ?> media="screen">
html { margin-top: 32px !important; }
@media screen and ( max-width: 782px ) {
html { margin-top: 46px !important; }
}
</style>
<?php
}
```
| Uses | Description |
| --- | --- |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress fetch_rss( string $url ): MagpieRSS|false fetch\_rss( string $url ): MagpieRSS|false
==========================================
Build Magpie object based on RSS from URL.
`$url` string Required URL to retrieve feed. [MagpieRSS](../classes/magpierss)|false [MagpieRSS](../classes/magpierss) object on success, false on failure.
File: `wp-includes/rss.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rss.php/)
```
function fetch_rss ($url) {
// initialize constants
init();
if ( !isset($url) ) {
// error("fetch_rss called without a url");
return false;
}
// if cache is disabled
if ( !MAGPIE_CACHE_ON ) {
// fetch file, and parse it
$resp = _fetch_remote_file( $url );
if ( is_success( $resp->status ) ) {
return _response_to_rss( $resp );
}
else {
// error("Failed to fetch $url and cache is off");
return false;
}
}
// else cache is ON
else {
// Flow
// 1. check cache
// 2. if there is a hit, make sure it's fresh
// 3. if cached obj fails freshness check, fetch remote
// 4. if remote fails, return stale object, or error
$cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );
if (MAGPIE_DEBUG and $cache->ERROR) {
debug($cache->ERROR, E_USER_WARNING);
}
$cache_status = 0; // response of check_cache
$request_headers = array(); // HTTP headers to send with fetch
$rss = 0; // parsed RSS object
$errormsg = 0; // errors, if any
if (!$cache->ERROR) {
// return cache HIT, MISS, or STALE
$cache_status = $cache->check_cache( $url );
}
// if object cached, and cache is fresh, return cached obj
if ( $cache_status == 'HIT' ) {
$rss = $cache->get( $url );
if ( isset($rss) and $rss ) {
$rss->from_cache = 1;
if ( MAGPIE_DEBUG > 1) {
debug("MagpieRSS: Cache HIT", E_USER_NOTICE);
}
return $rss;
}
}
// else attempt a conditional get
// set up headers
if ( $cache_status == 'STALE' ) {
$rss = $cache->get( $url );
if ( isset($rss->etag) and $rss->last_modified ) {
$request_headers['If-None-Match'] = $rss->etag;
$request_headers['If-Last-Modified'] = $rss->last_modified;
}
}
$resp = _fetch_remote_file( $url, $request_headers );
if (isset($resp) and $resp) {
if ($resp->status == '304' ) {
// we have the most current copy
if ( MAGPIE_DEBUG > 1) {
debug("Got 304 for $url");
}
// reset cache on 304 (at minutillo insistent prodding)
$cache->set($url, $rss);
return $rss;
}
elseif ( is_success( $resp->status ) ) {
$rss = _response_to_rss( $resp );
if ( $rss ) {
if (MAGPIE_DEBUG > 1) {
debug("Fetch successful");
}
// add object to cache
$cache->set( $url, $rss );
return $rss;
}
}
else {
$errormsg = "Failed to fetch $url. ";
if ( $resp->error ) {
# compensate for Snoopy's annoying habbit to tacking
# on '\n'
$http_error = substr($resp->error, 0, -2);
$errormsg .= "(HTTP Error: $http_error)";
}
else {
$errormsg .= "(HTTP Response: " . $resp->response_code .')';
}
}
}
else {
$errormsg = "Unable to retrieve RSS file for unknown reasons.";
}
// else fetch failed
// attempt to return cached object
if ($rss) {
if ( MAGPIE_DEBUG ) {
debug("Returning STALE object for $url");
}
return $rss;
}
// else we totally failed
// error( $errormsg );
return false;
} // end if ( !MAGPIE_CACHE_ON ) {
} // end fetch_rss()
```
| Uses | Description |
| --- | --- |
| [RSSCache::\_\_construct()](../classes/rsscache/__construct) wp-includes/rss.php | PHP5 constructor. |
| [init()](init) wp-includes/rss.php | Set up constants with default values, unless user overrides. |
| [\_fetch\_remote\_file()](_fetch_remote_file) wp-includes/rss.php | Retrieve URL headers and content using WP HTTP Request API. |
| [is\_success()](is_success) wp-includes/rss.php | |
| [\_response\_to\_rss()](_response_to_rss) wp-includes/rss.php | Retrieve |
| Used By | Description |
| --- | --- |
| [wp\_rss()](wp_rss) wp-includes/rss.php | Display all RSS items in a HTML ordered list. |
| [get\_rss()](get_rss) wp-includes/rss.php | Display RSS items in HTML list items. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress _custom_background_cb() \_custom\_background\_cb()
==========================
Default custom background callback.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function _custom_background_cb() {
// $background is the saved custom image, or the default image.
$background = set_url_scheme( get_background_image() );
// $color is the saved custom color.
// A default has to be specified in style.css. It will not be printed here.
$color = get_background_color();
if ( get_theme_support( 'custom-background', 'default-color' ) === $color ) {
$color = false;
}
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
if ( ! $background && ! $color ) {
if ( is_customize_preview() ) {
printf( '<style%s id="custom-background-css"></style>', $type_attr );
}
return;
}
$style = $color ? "background-color: #$color;" : '';
if ( $background ) {
$image = ' background-image: url("' . sanitize_url( $background ) . '");';
// Background Position.
$position_x = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
$position_y = get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) );
if ( ! in_array( $position_x, array( 'left', 'center', 'right' ), true ) ) {
$position_x = 'left';
}
if ( ! in_array( $position_y, array( 'top', 'center', 'bottom' ), true ) ) {
$position_y = 'top';
}
$position = " background-position: $position_x $position_y;";
// Background Size.
$size = get_theme_mod( 'background_size', get_theme_support( 'custom-background', 'default-size' ) );
if ( ! in_array( $size, array( 'auto', 'contain', 'cover' ), true ) ) {
$size = 'auto';
}
$size = " background-size: $size;";
// Background Repeat.
$repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );
if ( ! in_array( $repeat, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) {
$repeat = 'repeat';
}
$repeat = " background-repeat: $repeat;";
// Background Scroll.
$attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );
if ( 'fixed' !== $attachment ) {
$attachment = 'scroll';
}
$attachment = " background-attachment: $attachment;";
$style .= $image . $position . $size . $repeat . $attachment;
}
?>
<style<?php echo $type_attr; ?> id="custom-background-css">
body.custom-background { <?php echo trim( $style ); ?> }
</style>
<?php
}
```
| Uses | Description |
| --- | --- |
| [is\_customize\_preview()](is_customize_preview) wp-includes/theme.php | Whether the site is being previewed in the Customizer. |
| [get\_background\_color()](get_background_color) wp-includes/theme.php | Retrieves value for custom background color. |
| [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. |
| [get\_background\_image()](get_background_image) wp-includes/theme.php | Retrieves background image for custom background. |
| [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. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress trackback( string $trackback_url, string $title, string $excerpt, int $ID ): int|false|void trackback( string $trackback\_url, string $title, string $excerpt, int $ID ): int|false|void
============================================================================================
Sends a Trackback.
Updates database when sending trackback to prevent duplicates.
`$trackback_url` string Required URL to send trackbacks. `$title` string Required Title of post. `$excerpt` string Required Excerpt of post. `$ID` int Required Post ID. int|false|void Database query from update.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function trackback( $trackback_url, $title, $excerpt, $ID ) {
global $wpdb;
if ( empty( $trackback_url ) ) {
return;
}
$options = array();
$options['timeout'] = 10;
$options['body'] = array(
'title' => $title,
'url' => get_permalink( $ID ),
'blog_name' => get_option( 'blogname' ),
'excerpt' => $excerpt,
);
$response = wp_safe_remote_post( $trackback_url, $options );
if ( is_wp_error( $response ) ) {
return;
}
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID ) );
return $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID ) );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [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. |
| Used By | Description |
| --- | --- |
| [trackback\_url\_list()](trackback_url_list) wp-includes/post.php | Does trackbacks for a list of URLs. |
| [do\_trackbacks()](do_trackbacks) wp-includes/comment.php | Performs trackbacks. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_enqueue_block_support_styles( string $style, int $priority = 10 ) wp\_enqueue\_block\_support\_styles( string $style, int $priority = 10 )
========================================================================
Hooks inline styles in the proper place, depending on the active theme.
`$style` string Required String containing the CSS styles to be added. `$priority` int Optional To set the priority for the add\_action. Default: `10`
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_enqueue_block_support_styles( $style, $priority = 10 ) {
$action_hook_name = 'wp_footer';
if ( wp_is_block_theme() ) {
$action_hook_name = 'wp_head';
}
add_action(
$action_hook_name,
static function () use ( $style ) {
echo "<style>$style</style>\n";
},
$priority
);
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_block\_theme()](wp_is_block_theme) wp-includes/theme.php | Returns whether the active theme is a block-based theme or not. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Added the `$priority` parameter. For block themes, styles are loaded in the head. For classic ones, styles are loaded in the body because the wp\_head action happens before render\_block. |
| [5.9.1](https://developer.wordpress.org/reference/since/5.9.1/) | Introduced. |
wordpress get_url_in_content( string $content ): string|false get\_url\_in\_content( string $content ): string|false
======================================================
Extracts and returns the first URL from passed content.
`$content` string Required A string which might contain a URL. string|false The found URL.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function get_url_in_content( $content ) {
if ( empty( $content ) ) {
return false;
}
if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) {
return sanitize_url( $matches[2] );
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress wp_get_update_php_url(): string wp\_get\_update\_php\_url(): string
===================================
Gets the URL to learn more about updating the PHP version the site is running on.
This URL can be overridden by specifying an environment variable `WP_UPDATE_PHP_URL` or by using the [‘wp\_update\_php\_url’](../hooks/wp_update_php_url) filter. Providing an empty string is not allowed and will result in the default URL being used. Furthermore the page the URL links to should preferably be localized in the site language.
string URL to learn more about updating PHP.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_get_update_php_url() {
$default_url = wp_get_default_update_php_url();
$update_url = $default_url;
if ( false !== getenv( 'WP_UPDATE_PHP_URL' ) ) {
$update_url = getenv( 'WP_UPDATE_PHP_URL' );
}
/**
* Filters the URL to learn more about updating the PHP version the site is running on.
*
* Providing an empty string is not allowed and will result in the default URL being used. Furthermore
* the page the URL links to should preferably be localized in the site language.
*
* @since 5.1.0
*
* @param string $update_url URL to learn more about updating PHP.
*/
$update_url = apply_filters( 'wp_update_php_url', $update_url );
if ( empty( $update_url ) ) {
$update_url = $default_url;
}
return $update_url;
}
```
[apply\_filters( 'wp\_update\_php\_url', string $update\_url )](../hooks/wp_update_php_url)
Filters the URL to learn more about updating the PHP version the site is running on.
| Uses | Description |
| --- | --- |
| [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. |
| [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\_update\_php\_annotation()](wp_get_update_php_annotation) wp-includes/functions.php | Returns the default annotation for the web hosting altering the “Update PHP” page URL. |
| [WP\_Site\_Health::get\_test\_php\_version()](../classes/wp_site_health/get_test_php_version) wp-admin/includes/class-wp-site-health.php | Tests if the supplied PHP version is supported. |
| [validate\_plugin\_requirements()](validate_plugin_requirements) wp-admin/includes/plugin.php | Validates the plugin requirements for WordPress version and PHP version. |
| [wp\_dashboard\_php\_nag()](wp_dashboard_php_nag) wp-admin/includes/dashboard.php | Displays the PHP update nag. |
| [WP\_Customize\_Theme\_Control::content\_template()](../classes/wp_customize_theme_control/content_template) wp-includes/customize/class-wp-customize-theme-control.php | Render a JS template for theme display. |
| [customize\_themes\_print\_templates()](customize_themes_print_templates) wp-admin/includes/theme.php | Prints JS templates for the theme-browsing UI in the Customizer. |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [wp\_plugin\_update\_row()](wp_plugin_update_row) wp-admin/includes/update.php | Displays update information for a plugin. |
| [wp\_theme\_update\_row()](wp_theme_update_row) wp-admin/includes/update.php | Displays update information for a theme. |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| [WP\_Plugin\_Install\_List\_Table::display\_rows()](../classes/wp_plugin_install_list_table/display_rows) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [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.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
| programming_docs |
wordpress wp_nav_menu_update_menu_items( int|string $nav_menu_selected_id, string $nav_menu_selected_title ): array wp\_nav\_menu\_update\_menu\_items( int|string $nav\_menu\_selected\_id, string $nav\_menu\_selected\_title ): array
====================================================================================================================
Saves nav menu items
`$nav_menu_selected_id` int|string Required ID, slug, or name of the currently-selected menu. `$nav_menu_selected_title` string Required Title of the currently-selected menu. array The menu updated message
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_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ) {
$unsorted_menu_items = wp_get_nav_menu_items(
$nav_menu_selected_id,
array(
'orderby' => 'ID',
'output' => ARRAY_A,
'output_key' => 'ID',
'post_status' => 'draft,publish',
)
);
$messages = array();
$menu_items = array();
// Index menu items by DB ID.
foreach ( $unsorted_menu_items as $_item ) {
$menu_items[ $_item->db_id ] = $_item;
}
$post_fields = array(
'menu-item-db-id',
'menu-item-object-id',
'menu-item-object',
'menu-item-parent-id',
'menu-item-position',
'menu-item-type',
'menu-item-title',
'menu-item-url',
'menu-item-description',
'menu-item-attr-title',
'menu-item-target',
'menu-item-classes',
'menu-item-xfn',
);
wp_defer_term_counting( true );
// Loop through all the menu items' POST variables.
if ( ! empty( $_POST['menu-item-db-id'] ) ) {
foreach ( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
// Menu item title can't be blank.
if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' === $_POST['menu-item-title'][ $_key ] ) {
continue;
}
$args = array();
foreach ( $post_fields as $field ) {
$args[ $field ] = isset( $_POST[ $field ][ $_key ] ) ? $_POST[ $field ][ $_key ] : '';
}
$menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][ $_key ] != $_key ? 0 : $_key ), $args );
if ( is_wp_error( $menu_item_db_id ) ) {
$messages[] = '<div id="message" class="error"><p>' . $menu_item_db_id->get_error_message() . '</p></div>';
} else {
unset( $menu_items[ $menu_item_db_id ] );
}
}
}
// Remove menu items from the menu that weren't in $_POST.
if ( ! empty( $menu_items ) ) {
foreach ( array_keys( $menu_items ) as $menu_item_id ) {
if ( is_nav_menu_item( $menu_item_id ) ) {
wp_delete_post( $menu_item_id );
}
}
}
// Store 'auto-add' pages.
$auto_add = ! empty( $_POST['auto-add-pages'] );
$nav_menu_option = (array) get_option( 'nav_menu_options' );
if ( ! isset( $nav_menu_option['auto_add'] ) ) {
$nav_menu_option['auto_add'] = array();
}
if ( $auto_add ) {
if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'], true ) ) {
$nav_menu_option['auto_add'][] = $nav_menu_selected_id;
}
} else {
$key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'], true );
if ( false !== $key ) {
unset( $nav_menu_option['auto_add'][ $key ] );
}
}
// Remove non-existent/deleted menus.
$nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) );
update_option( 'nav_menu_options', $nav_menu_option );
wp_defer_term_counting( false );
/** This action is documented in wp-includes/nav-menu.php */
do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' .
sprintf(
/* translators: %s: Nav menu title. */
__( '%s has been updated.' ),
'<strong>' . $nav_menu_selected_title . '</strong>'
) . '</p></div>';
unset( $menu_items, $unsorted_menu_items );
return $messages;
}
```
[do\_action( 'wp\_update\_nav\_menu', int $menu\_id, array $menu\_data )](../hooks/wp_update_nav_menu)
Fires after a navigation menu has been successfully updated.
| Uses | Description |
| --- | --- |
| [wp\_defer\_term\_counting()](wp_defer_term_counting) wp-includes/taxonomy.php | Enables or disables term counting. |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [wp\_get\_nav\_menu\_items()](wp_get_nav_menu_items) wp-includes/nav-menu.php | Retrieves all menu items of a navigation menu. |
| [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. |
| [is\_nav\_menu\_item()](is_nav_menu_item) wp-includes/nav-menu.php | Determines whether the given ID is a nav menu item. |
| [wp\_get\_nav\_menus()](wp_get_nav_menus) wp-includes/nav-menu.php | Returns all navigation menu objects. |
| [\_\_()](__) 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. |
| [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 |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress get_comment_time( string $format = '', bool $gmt = false, bool $translate = true ): string get\_comment\_time( string $format = '', bool $gmt = false, bool $translate = true ): string
============================================================================================
Retrieves the comment time of the current comment.
`$format` string Optional PHP time format. Defaults to the `'time_format'` option. Default: `''`
`$gmt` bool Optional Whether to use the GMT date. Default: `false`
`$translate` bool Optional Whether to translate the time (for use in feeds).
Default: `true`
string The formatted time.
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_comment_time( $format = '', $gmt = false, $translate = true ) {
$comment = get_comment();
$comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date;
$_format = ! empty( $format ) ? $format : get_option( 'time_format' );
$date = mysql2date( $_format, $comment_date, $translate );
/**
* Filters the returned comment time.
*
* @since 1.5.0
*
* @param string|int $date The comment time, formatted as a date string or Unix timestamp.
* @param string $format PHP date format.
* @param bool $gmt Whether the GMT date is in use.
* @param bool $translate Whether the time is translated.
* @param WP_Comment $comment The comment object.
*/
return apply_filters( 'get_comment_time', $date, $format, $gmt, $translate, $comment );
}
```
[apply\_filters( 'get\_comment\_time', string|int $date, string $format, bool $gmt, bool $translate, WP\_Comment $comment )](../hooks/get_comment_time)
Filters the returned comment time.
| Uses | Description |
| --- | --- |
| [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Used By | Description |
| --- | --- |
| [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\_time()](comment_time) wp-includes/comment-template.php | Displays the comment time of the current comment. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_scripts_get_suffix( string $type = '' ): string wp\_scripts\_get\_suffix( string $type = '' ): string
=====================================================
Returns the suffix that can be used for the scripts.
There are two suffix types, the normal one and the dev suffix.
`$type` string Optional The type of suffix to retrieve. Default: `''`
string The script suffix.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_scripts_get_suffix( $type = '' ) {
static $suffixes;
if ( null === $suffixes ) {
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$develop_src = false !== strpos( $wp_version, '-src' );
if ( ! defined( 'SCRIPT_DEBUG' ) ) {
define( 'SCRIPT_DEBUG', $develop_src );
}
$suffix = SCRIPT_DEBUG ? '' : '.min';
$dev_suffix = $develop_src ? '' : '.min';
$suffixes = array(
'suffix' => $suffix,
'dev_suffix' => $dev_suffix,
);
}
if ( 'dev' === $type ) {
return $suffixes['dev_suffix'];
}
return $suffixes['suffix'];
}
```
| 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\_add\_editor\_classic\_theme\_styles()](wp_add_editor_classic_theme_styles) wp-includes/script-loader.php | Loads classic theme styles on classic themes in the editor. |
| [wp\_register\_tinymce\_scripts()](wp_register_tinymce_scripts) wp-includes/script-loader.php | Registers TinyMCE scripts. |
| [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\_scripts()](wp_default_packages_scripts) wp-includes/script-loader.php | Registers all the WordPress packages scripts that are in the standardized `js/dist/` location. |
| [print\_embed\_scripts()](print_embed_scripts) wp-includes/embed.php | Prints the JavaScript in the embed iframe header. |
| [get\_post\_embed\_html()](get_post_embed_html) wp-includes/embed.php | Retrieves the embed code for a specific post. |
| [wp\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress wp_get_inline_script_tag( string $javascript, array $attributes = array() ): string wp\_get\_inline\_script\_tag( string $javascript, array $attributes = array() ): string
=======================================================================================
Wraps inline JavaScript in tag.
It is possible to inject attributes in the `<script>` tag via the [‘wp\_script\_attributes’](../hooks/wp_script_attributes) filter.
Automatically injects type attribute if needed.
`$javascript` string Required Inline JavaScript code. `$attributes` array Optional Key-value pairs representing `<script>` tag attributes. Default: `array()`
string String containing inline JavaScript code wrapped around `<script>` tag.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_get_inline_script_tag( $javascript, $attributes = array() ) {
if ( ! isset( $attributes['type'] ) && ! is_admin() && ! current_theme_supports( 'html5', 'script' ) ) {
$attributes['type'] = 'text/javascript';
}
/**
* Filters attributes to be added to a script tag.
*
* @since 5.7.0
*
* @param array $attributes Key-value pairs representing `<script>` tag attributes.
* Only the attribute name is added to the `<script>` tag for
* entries with a boolean value, and that are true.
* @param string $javascript Inline JavaScript code.
*/
$attributes = apply_filters( 'wp_inline_script_attributes', $attributes, $javascript );
$javascript = "\n" . trim( $javascript, "\n\r " ) . "\n";
return sprintf( "<script%s>%s</script>\n", wp_sanitize_script_attributes( $attributes ), $javascript );
}
```
[apply\_filters( 'wp\_inline\_script\_attributes', array $attributes, string $javascript )](../hooks/wp_inline_script_attributes)
Filters attributes to be added to a script tag.
| Uses | Description |
| --- | --- |
| [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. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_print\_inline\_script\_tag()](wp_print_inline_script_tag) wp-includes/script-loader.php | Prints inline JavaScript wrapped in tag. |
| [get\_post\_embed\_html()](get_post_embed_html) wp-includes/embed.php | Retrieves the embed code for a specific post. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress post_thumbnail_meta_box( WP_Post $post ) post\_thumbnail\_meta\_box( WP\_Post $post )
============================================
Displays post thumbnail meta box.
`$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_thumbnail_meta_box( $post ) {
$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID );
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_post\_thumbnail\_html()](_wp_post_thumbnail_html) wp-admin/includes/post.php | Returns HTML for the post thumbnail meta box. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress signup_get_available_languages(): string[] signup\_get\_available\_languages(): string[]
=============================================
Retrieves languages available during the site/user sign-up process.
* [get\_available\_languages()](get_available_languages)
string[] Array of available language codes. Language codes are formed by stripping the .mo extension from the language file names.
File: `wp-signup.php`. [View all references](https://developer.wordpress.org/reference/files/wp-signup.php/)
```
function signup_get_available_languages() {
/**
* Filters the list of available languages for front-end site sign-ups.
*
* Passing an empty array to this hook will disable output of the setting on the
* sign-up form, and the default language will be used when creating the site.
*
* Languages not already installed will be stripped.
*
* @since 4.4.0
*
* @param string[] $languages Array of available language codes. Language codes are formed by
* stripping the .mo extension from the language file names.
*/
$languages = (array) apply_filters( 'signup_get_available_languages', get_available_languages() );
/*
* Strip any non-installed languages and return.
*
* Re-call get_available_languages() here in case a language pack was installed
* in a callback hooked to the 'signup_get_available_languages' filter before this point.
*/
return array_intersect_assoc( $languages, get_available_languages() );
}
```
[apply\_filters( 'signup\_get\_available\_languages', string[] $languages )](../hooks/signup_get_available_languages)
Filters the list of available languages for front-end site sign-ups.
| 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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [validate\_another\_blog\_signup()](validate_another_blog_signup) wp-signup.php | Validates a new site sign-up for an existing user. |
| [validate\_blog\_signup()](validate_blog_signup) wp-signup.php | Validates new site signup. |
| [show\_blog\_form()](show_blog_form) wp-signup.php | Generates and displays the Sign-up and Create Site forms. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress the_content( string $more_link_text = null, bool $strip_teaser = false ) the\_content( string $more\_link\_text = null, bool $strip\_teaser = false )
============================================================================
Displays the post content.
`$more_link_text` string Optional Content for when there is more text. Default: `null`
`$strip_teaser` bool Optional Strip teaser content before the more text. Default: `false`
If the quicktag [<!--more-->](https://codex.wordpress.org/Writing_Posts#Visual_Versus_HTML_Editor "Writing Posts") is used in a post to designate the “cut-off” point for the post to be excerpted, [the\_content()](the_content) tag will only show the excerpt up to the <!--more--> quicktag point on non-single/non-[permalink](https://codex.wordpress.org/Glossary#Permalink "Glossary") post pages. By design, [the\_content()](the_content) tag includes a parameter for formatting the <!--more--> content and look, which creates a link to “continue reading” the full post.
**Notes about <!--more-->** : * No whitespaces are allowed **before** the “more” in the <!--more--> quicktag. In other words <!-- more --> will *not* work!
* *The <!--more--> quicktag will not operate and is ignored in [Templates](https://codex.wordpress.org/Templates "Templates") where just one post is displayed, such as **single.php**.*
* Read [Customizing the Read More](https://codex.wordpress.org/Customizing_the_Read_More "Customizing the Read More") for more details.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function the_content( $more_link_text = null, $strip_teaser = false ) {
$content = get_the_content( $more_link_text, $strip_teaser );
/**
* Filters the post content.
*
* @since 0.71
*
* @param string $content Content of the current post.
*/
$content = apply_filters( 'the_content', $content );
$content = str_replace( ']]>', ']]>', $content );
echo $content;
}
```
[apply\_filters( 'the\_content', string $content )](../hooks/the_content)
Filters the post content.
| Uses | Description |
| --- | --- |
| [get\_the\_content()](get_the_content) wp-includes/post-template.php | Retrieves the post content. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
| programming_docs |
wordpress is_user_spammy( string|WP_User $user = null ): bool is\_user\_spammy( string|WP\_User $user = null ): bool
======================================================
Determines whether a user is marked as a spammer, based on user login.
`$user` string|[WP\_User](../classes/wp_user) Optional Defaults to current user. [WP\_User](../classes/wp_user) object, or user login name as a string. Default: `null`
bool
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function is_user_spammy( $user = null ) {
if ( ! ( $user instanceof WP_User ) ) {
if ( $user ) {
$user = get_user_by( 'login', $user );
} else {
$user = wp_get_current_user();
}
}
return $user && isset( $user->spam ) && 1 == $user->spam;
}
```
| Uses | Description |
| --- | --- |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| Used By | Description |
| --- | --- |
| [get\_password\_reset\_key()](get_password_reset_key) wp-includes/user.php | Creates, stores, then returns a password reset key for user. |
| [wp\_authenticate\_spam\_check()](wp_authenticate_spam_check) wp-includes/user.php | For Multisite blogs, checks if the authenticated user has been marked as a spammer, or if the user’s primary blog has been marked as spam. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress wp_ajax_health_check_get_sizes() wp\_ajax\_health\_check\_get\_sizes()
=====================================
This function has been deprecated. Use [WP\_REST\_Site\_Health\_Controller::get\_directory\_sizes()](../classes/wp_rest_site_health_controller/get_directory_sizes) instead.
Ajax handler for site health check to get directories and database sizes.
* [WP\_REST\_Site\_Health\_Controller::get\_directory\_sizes()](../classes/wp_rest_site_health_controller/get_directory_sizes)
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_get_sizes() {
_doing_it_wrong(
'wp_ajax_health_check_get_sizes',
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_get_sizes',
'WP_REST_Site_Health_Controller::get_directory_sizes'
),
'5.6.0'
);
check_ajax_referer( 'health-check-site-status-result' );
if ( ! current_user_can( 'view_site_health_checks' ) || is_multisite() ) {
wp_send_json_error();
}
if ( ! class_exists( 'WP_Debug_Data' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-debug-data.php';
}
$sizes_data = WP_Debug_Data::get_sizes();
$all_sizes = array( 'raw' => 0 );
foreach ( $sizes_data as $name => $value ) {
$name = sanitize_text_field( $name );
$data = array();
if ( isset( $value['size'] ) ) {
if ( is_string( $value['size'] ) ) {
$data['size'] = sanitize_text_field( $value['size'] );
} else {
$data['size'] = (int) $value['size'];
}
}
if ( isset( $value['debug'] ) ) {
if ( is_string( $value['debug'] ) ) {
$data['debug'] = sanitize_text_field( $value['debug'] );
} else {
$data['debug'] = (int) $value['debug'];
}
}
if ( ! empty( $value['raw'] ) ) {
$data['raw'] = (int) $value['raw'];
}
$all_sizes[ $name ] = $data;
}
if ( isset( $all_sizes['total_size']['debug'] ) && 'not available' === $all_sizes['total_size']['debug'] ) {
wp_send_json_error( $all_sizes );
}
wp_send_json_success( $all_sizes );
}
```
| Uses | 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`. |
| [sanitize\_text\_field()](sanitize_text_field) wp-includes/formatting.php | Sanitizes a string from user input or from the database. |
| [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. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [\_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::get\_directory\_sizes()](../classes/wp_rest_site_health_controller/get_directory_sizes) |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress register_rest_route( string $namespace, string $route, array $args = array(), bool $override = false ): bool register\_rest\_route( string $namespace, string $route, array $args = array(), bool $override = false ): bool
==============================================================================================================
Registers a REST API route.
Note: Do not use before the [‘rest\_api\_init’](../hooks/rest_api_init) hook.
`$namespace` string Required The first URL segment after core prefix. Should be unique to your package/plugin. `$route` string Required The base URL for route you are adding. `$args` array Optional Either an array of options for the endpoint, or an array of arrays for multiple methods. Default: `array()`
`$override` bool Optional If the route already exists, should we override it? True overrides, false merges (with newer overriding if duplicate keys exist). Default: `false`
bool True on success, false on error.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function register_rest_route( $namespace, $route, $args = array(), $override = false ) {
if ( empty( $namespace ) ) {
/*
* Non-namespaced routes are not allowed, with the exception of the main
* and namespace indexes. If you really need to register a
* non-namespaced route, call `WP_REST_Server::register_route` directly.
*/
_doing_it_wrong( 'register_rest_route', __( 'Routes must be namespaced with plugin or theme name and version.' ), '4.4.0' );
return false;
} elseif ( empty( $route ) ) {
_doing_it_wrong( 'register_rest_route', __( 'Route must be specified.' ), '4.4.0' );
return false;
}
$clean_namespace = trim( $namespace, '/' );
if ( $clean_namespace !== $namespace ) {
_doing_it_wrong( __FUNCTION__, __( 'Namespace must not start or end with a slash.' ), '5.4.2' );
}
if ( ! did_action( 'rest_api_init' ) ) {
_doing_it_wrong(
'register_rest_route',
sprintf(
/* translators: %s: rest_api_init */
__( 'REST API routes must be registered on the %s action.' ),
'<code>rest_api_init</code>'
),
'5.1.0'
);
}
if ( isset( $args['args'] ) ) {
$common_args = $args['args'];
unset( $args['args'] );
} else {
$common_args = array();
}
if ( isset( $args['callback'] ) ) {
// Upgrade a single set to multiple.
$args = array( $args );
}
$defaults = array(
'methods' => 'GET',
'callback' => null,
'args' => array(),
);
foreach ( $args as $key => &$arg_group ) {
if ( ! is_numeric( $key ) ) {
// Route option, skip here.
continue;
}
$arg_group = array_merge( $defaults, $arg_group );
$arg_group['args'] = array_merge( $common_args, $arg_group['args'] );
if ( ! isset( $arg_group['permission_callback'] ) ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: 1: The REST API route being registered, 2: The argument name, 3: The suggested function name. */
__( 'The REST API route definition for %1$s is missing the required %2$s argument. For REST API routes that are intended to be public, use %3$s as the permission callback.' ),
'<code>' . $clean_namespace . '/' . trim( $route, '/' ) . '</code>',
'<code>permission_callback</code>',
'<code>__return_true</code>'
),
'5.5.0'
);
}
foreach ( $arg_group['args'] as $arg ) {
if ( ! is_array( $arg ) ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: 1: $args, 2: The REST API route being registered. */
__( 'REST API %1$s should be an array of arrays. Non-array value detected for %2$s.' ),
'<code>$args</code>',
'<code>' . $clean_namespace . '/' . trim( $route, '/' ) . '</code>'
),
'6.1.0'
);
break; // Leave the foreach loop once a non-array argument was found.
}
}
}
$full_route = '/' . $clean_namespace . '/' . trim( $route, '/' );
rest_get_server()->register_route( $clean_namespace, $full_route, $args, $override );
return true;
}
```
| Uses | Description |
| --- | --- |
| [rest\_get\_server()](rest_get_server) wp-includes/rest-api.php | Retrieves the current REST server instance. |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Block\_Patterns\_Controller::register\_routes()](../classes/wp_rest_block_patterns_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php | Registers the routes for the objects of the controller. |
| [WP\_REST\_Block\_Pattern\_Categories\_Controller::register\_routes()](../classes/wp_rest_block_pattern_categories_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php | Registers the routes for the objects of the controller. |
| [WP\_REST\_Global\_Styles\_Controller::register\_routes()](../classes/wp_rest_global_styles_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Registers the controllers routes. |
| [WP\_REST\_URL\_Details\_Controller::register\_routes()](../classes/wp_rest_url_details_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Registers the necessary REST API routes. |
| [WP\_REST\_Menu\_Locations\_Controller::register\_routes()](../classes/wp_rest_menu_locations_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Registers the routes for the objects of the controller. |
| [WP\_REST\_Edit\_Site\_Export\_Controller::register\_routes()](../classes/wp_rest_edit_site_export_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php | Registers the site export route. |
| [WP\_REST\_Widgets\_Controller::register\_routes()](../classes/wp_rest_widgets_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Registers the widget routes for the controller. |
| [WP\_REST\_Sidebars\_Controller::register\_routes()](../classes/wp_rest_sidebars_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Registers the controllers routes. |
| [WP\_REST\_Templates\_Controller::register\_routes()](../classes/wp_rest_templates_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Registers the controllers routes. |
| [WP\_REST\_Pattern\_Directory\_Controller::register\_routes()](../classes/wp_rest_pattern_directory_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php | Registers the necessary REST API routes. |
| [WP\_REST\_Widget\_Types\_Controller::register\_routes()](../classes/wp_rest_widget_types_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Registers the widget type routes. |
| [WP\_REST\_Site\_Health\_Controller::register\_routes()](../classes/wp_rest_site_health_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php | Registers API routes. |
| [WP\_REST\_Application\_Passwords\_Controller::register\_routes()](../classes/wp_rest_application_passwords_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Registers the REST API routes for the application passwords controller. |
| [WP\_REST\_Block\_Directory\_Controller::register\_routes()](../classes/wp_rest_block_directory_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php | Registers the necessary REST API routes. |
| [WP\_REST\_Plugins\_Controller::register\_routes()](../classes/wp_rest_plugins_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Registers the routes for the plugins controller. |
| [WP\_REST\_Block\_Types\_Controller::register\_routes()](../classes/wp_rest_block_types_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Registers the routes for block types. |
| [WP\_REST\_Attachments\_Controller::register\_routes()](../classes/wp_rest_attachments_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Registers the routes for attachments. |
| [WP\_REST\_Search\_Controller::register\_routes()](../classes/wp_rest_search_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php | Registers the routes for the search controller. |
| [WP\_REST\_Themes\_Controller::register\_routes()](../classes/wp_rest_themes_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Registers the routes for themes. |
| [WP\_REST\_Autosaves\_Controller::register\_routes()](../classes/wp_rest_autosaves_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Registers the routes for autosaves. |
| [WP\_REST\_Block\_Renderer\_Controller::register\_routes()](../classes/wp_rest_block_renderer_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php | Registers the necessary REST API routes, one for each dynamic block. |
| [WP\_REST\_Users\_Controller::register\_routes()](../classes/wp_rest_users_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Registers the routes for users. |
| [WP\_REST\_Revisions\_Controller::register\_routes()](../classes/wp_rest_revisions_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Registers the routes for revisions based on post types supporting revisions. |
| [WP\_REST\_Post\_Statuses\_Controller::register\_routes()](../classes/wp_rest_post_statuses_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Registers the routes for post statuses. |
| [WP\_REST\_Settings\_Controller::register\_routes()](../classes/wp_rest_settings_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php | Registers the routes for the site’s settings. |
| [WP\_REST\_Terms\_Controller::register\_routes()](../classes/wp_rest_terms_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Registers the routes for terms. |
| [WP\_REST\_Posts\_Controller::register\_routes()](../classes/wp_rest_posts_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Registers the routes for posts. |
| [WP\_REST\_Taxonomies\_Controller::register\_routes()](../classes/wp_rest_taxonomies_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Registers the routes for taxonomies. |
| [WP\_REST\_Post\_Types\_Controller::register\_routes()](../classes/wp_rest_post_types_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Registers the routes for post types. |
| [WP\_REST\_Comments\_Controller::register\_routes()](../classes/wp_rest_comments_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Registers the routes for comments. |
| [WP\_oEmbed\_Controller::register\_routes()](../classes/wp_oembed_controller/register_routes) wp-includes/class-wp-oembed-controller.php | Register the oEmbed REST API route. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Added a `_doing_it_wrong()` notice when the required `permission_callback` argument is not set. |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Added a `_doing_it_wrong()` notice when not called on or after the `rest_api_init` hook. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress comment_text_rss() comment\_text\_rss()
====================
Displays the current comment content for use in the feeds.
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function comment_text_rss() {
$comment_text = get_comment_text();
/**
* Filters the current comment content for use in a feed.
*
* @since 1.5.0
*
* @param string $comment_text The content of the current comment.
*/
$comment_text = apply_filters( 'comment_text_rss', $comment_text );
echo $comment_text;
}
```
[apply\_filters( 'comment\_text\_rss', string $comment\_text )](../hooks/comment_text_rss)
Filters the current comment content for use in a feed.
| Uses | Description |
| --- | --- |
| [get\_comment\_text()](get_comment_text) wp-includes/comment-template.php | Retrieves the text of the current comment. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress wp_set_auth_cookie( int $user_id, bool $remember = false, bool|string $secure = '', string $token = '' ) wp\_set\_auth\_cookie( int $user\_id, bool $remember = false, bool|string $secure = '', string $token = '' )
============================================================================================================
Sets the authentication cookies based on user ID.
The $remember parameter increases the time that the cookie will be kept. The default the cookie is kept without remembering is two days. When $remember is set, the cookies will be kept for 14 days or two weeks.
`$user_id` int Required User ID. `$remember` bool Optional Whether to remember the user. Default: `false`
`$secure` bool|string Optional Whether the auth cookie should only be sent over HTTPS. Default is an empty string which means the value of `is_ssl()` will be used. Default: `''`
`$token` string Optional User's session token to use for this cookie. Default: `''`
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_set_auth_cookie( $user_id, $remember = false, $secure = '', $token = '' ) {
if ( $remember ) {
/**
* Filters the duration of the authentication cookie expiration period.
*
* @since 2.8.0
*
* @param int $length Duration of the expiration period in seconds.
* @param int $user_id User ID.
* @param bool $remember Whether to remember the user login. Default false.
*/
$expiration = time() + apply_filters( 'auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember );
/*
* Ensure the browser will continue to send the cookie after the expiration time is reached.
* Needed for the login grace period in wp_validate_auth_cookie().
*/
$expire = $expiration + ( 12 * HOUR_IN_SECONDS );
} else {
/** This filter is documented in wp-includes/pluggable.php */
$expiration = time() + apply_filters( 'auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember );
$expire = 0;
}
if ( '' === $secure ) {
$secure = is_ssl();
}
// Front-end cookie is secure when the auth cookie is secure and the site's home URL uses HTTPS.
$secure_logged_in_cookie = $secure && 'https' === parse_url( get_option( 'home' ), PHP_URL_SCHEME );
/**
* Filters whether the auth cookie should only be sent over HTTPS.
*
* @since 3.1.0
*
* @param bool $secure Whether the cookie should only be sent over HTTPS.
* @param int $user_id User ID.
*/
$secure = apply_filters( 'secure_auth_cookie', $secure, $user_id );
/**
* Filters whether the logged in cookie should only be sent over HTTPS.
*
* @since 3.1.0
*
* @param bool $secure_logged_in_cookie Whether the logged in cookie should only be sent over HTTPS.
* @param int $user_id User ID.
* @param bool $secure Whether the auth cookie should only be sent over HTTPS.
*/
$secure_logged_in_cookie = apply_filters( 'secure_logged_in_cookie', $secure_logged_in_cookie, $user_id, $secure );
if ( $secure ) {
$auth_cookie_name = SECURE_AUTH_COOKIE;
$scheme = 'secure_auth';
} else {
$auth_cookie_name = AUTH_COOKIE;
$scheme = 'auth';
}
if ( '' === $token ) {
$manager = WP_Session_Tokens::get_instance( $user_id );
$token = $manager->create( $expiration );
}
$auth_cookie = wp_generate_auth_cookie( $user_id, $expiration, $scheme, $token );
$logged_in_cookie = wp_generate_auth_cookie( $user_id, $expiration, 'logged_in', $token );
/**
* Fires immediately before the authentication cookie is set.
*
* @since 2.5.0
* @since 4.9.0 The `$token` parameter was added.
*
* @param string $auth_cookie Authentication cookie value.
* @param int $expire The time the login grace period expires as a UNIX timestamp.
* Default is 12 hours past the cookie's expiration time.
* @param int $expiration The time when the authentication cookie expires as a UNIX timestamp.
* Default is 14 days from now.
* @param int $user_id User ID.
* @param string $scheme Authentication scheme. Values include 'auth' or 'secure_auth'.
* @param string $token User's session token to use for this cookie.
*/
do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme, $token );
/**
* Fires immediately before the logged-in authentication cookie is set.
*
* @since 2.6.0
* @since 4.9.0 The `$token` parameter was added.
*
* @param string $logged_in_cookie The logged-in cookie value.
* @param int $expire The time the login grace period expires as a UNIX timestamp.
* Default is 12 hours past the cookie's expiration time.
* @param int $expiration The time when the logged-in authentication cookie expires as a UNIX timestamp.
* Default is 14 days from now.
* @param int $user_id User ID.
* @param string $scheme Authentication scheme. Default 'logged_in'.
* @param string $token User's session token to use for this cookie.
*/
do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in', $token );
/**
* Allows preventing auth cookies from actually being sent to the client.
*
* @since 4.7.4
*
* @param bool $send Whether to send auth cookies to the client.
*/
if ( ! apply_filters( 'send_auth_cookies', true ) ) {
return;
}
setcookie( $auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true );
setcookie( $auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true );
setcookie( LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true );
if ( COOKIEPATH != SITECOOKIEPATH ) {
setcookie( LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true );
}
}
```
[apply\_filters( 'auth\_cookie\_expiration', int $length, int $user\_id, bool $remember )](../hooks/auth_cookie_expiration)
Filters the duration of the authentication cookie expiration period.
[apply\_filters( 'secure\_auth\_cookie', bool $secure, int $user\_id )](../hooks/secure_auth_cookie)
Filters whether the auth cookie should only be sent over HTTPS.
[apply\_filters( 'secure\_logged\_in\_cookie', bool $secure\_logged\_in\_cookie, int $user\_id, bool $secure )](../hooks/secure_logged_in_cookie)
Filters whether the logged in cookie should only be sent over HTTPS.
[apply\_filters( 'send\_auth\_cookies', bool $send )](../hooks/send_auth_cookies)
Allows preventing auth cookies from actually being sent to the client.
[do\_action( 'set\_auth\_cookie', string $auth\_cookie, int $expire, int $expiration, int $user\_id, string $scheme, string $token )](../hooks/set_auth_cookie)
Fires immediately before the authentication cookie is set.
[do\_action( 'set\_logged\_in\_cookie', string $logged\_in\_cookie, int $expire, int $expiration, int $user\_id, string $scheme, string $token )](../hooks/set_logged_in_cookie)
Fires immediately before the logged-in authentication cookie is set.
| 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. |
| [wp\_generate\_auth\_cookie()](wp_generate_auth_cookie) wp-includes/pluggable.php | Generates authentication cookie contents. |
| [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [wp\_signon()](wp_signon) wp-includes/user.php | Authenticates and logs a user in with ‘remember’ capability. |
| [wp\_setcookie()](wp_setcookie) wp-includes/pluggable-deprecated.php | Sets a cookie for a user who just logged in. This function is deprecated. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Added the `$token` parameter. |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
| programming_docs |
wordpress get_post_taxonomies( int|WP_Post $post ): string[] get\_post\_taxonomies( int|WP\_Post $post ): string[]
=====================================================
Retrieves all taxonomy names for the given post.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global $post. string[] An array of all taxonomy names for the given post.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function get_post_taxonomies( $post = 0 ) {
$post = get_post( $post );
return get_object_taxonomies( $post );
}
```
| Uses | Description |
| --- | --- |
| [get\_object\_taxonomies()](get_object_taxonomies) wp-includes/taxonomy.php | Returns the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name. |
| [get\_post()](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 the_posts_pagination( array $args = array() ) the\_posts\_pagination( array $args = array() )
===============================================
Displays a paginated navigation to next/previous set of posts, when applicable.
`$args` array Optional See [get\_the\_posts\_pagination()](get_the_posts_pagination) for available arguments.
More Arguments from get\_the\_posts\_pagination( ... $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()`
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function the_posts_pagination( $args = array() ) {
echo get_the_posts_pagination( $args );
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_posts\_pagination()](get_the_posts_pagination) wp-includes/link-template.php | Retrieves a paginated navigation to next/previous set of posts, when applicable. |
| Version | Description |
| --- | --- |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Introduced. |
wordpress rest_ensure_response( WP_REST_Response|WP_Error|WP_HTTP_Response|mixed $response ): WP_REST_Response|WP_Error rest\_ensure\_response( WP\_REST\_Response|WP\_Error|WP\_HTTP\_Response|mixed $response ): WP\_REST\_Response|WP\_Error
=======================================================================================================================
Ensures a REST response is a response object (for consistency).
This implements [WP\_REST\_Response](../classes/wp_rest_response), allowing usage of `set_status`/`header`/etc without needing to double-check the object. Will also allow [WP\_Error](../classes/wp_error) to indicate error responses, so users should immediately check for this value.
`$response` [WP\_REST\_Response](../classes/wp_rest_response)|[WP\_Error](../classes/wp_error)|[WP\_HTTP\_Response](../classes/wp_http_response)|mixed Required Response to check. [WP\_REST\_Response](../classes/wp_rest_response)|[WP\_Error](../classes/wp_error) If response generated an error, [WP\_Error](../classes/wp_error), if response is already an instance, [WP\_REST\_Response](../classes/wp_rest_response), otherwise returns a new [WP\_REST\_Response](../classes/wp_rest_response) instance.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_ensure_response( $response ) {
if ( is_wp_error( $response ) ) {
return $response;
}
if ( $response instanceof WP_REST_Response ) {
return $response;
}
// While WP_HTTP_Response is the base class of WP_REST_Response, it doesn't provide
// all the required methods used in WP_REST_Server::dispatch().
if ( $response instanceof WP_HTTP_Response ) {
return new WP_REST_Response(
$response->get_data(),
$response->get_status(),
$response->get_headers()
);
}
return new WP_REST_Response( $response );
}
```
| 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\_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. |
| [WP\_REST\_Block\_Patterns\_Controller::get\_items()](../classes/wp_rest_block_patterns_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php | Retrieves all block patterns. |
| [WP\_REST\_Block\_Patterns\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_block_patterns_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php | Prepare a raw block pattern before it gets output in a REST API response. |
| [WP\_REST\_Global\_Styles\_Controller::get\_theme\_items()](../classes/wp_rest_global_styles_controller/get_theme_items) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Returns the given theme global styles variations. |
| [WP\_REST\_Block\_Pattern\_Categories\_Controller::get\_items()](../classes/wp_rest_block_pattern_categories_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php | Retrieves all block pattern categories. |
| [WP\_REST\_Block\_Pattern\_Categories\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_block_pattern_categories_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php | Prepare a raw block pattern category before it gets output in a REST API response. |
| [WP\_REST\_Menu\_Items\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_menu_items_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares a single post output for response. |
| [WP\_REST\_Menu\_Items\_Controller::create\_item()](../classes/wp_rest_menu_items_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Creates a single post. |
| [WP\_REST\_Menu\_Items\_Controller::update\_item()](../classes/wp_rest_menu_items_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Updates a single nav menu item. |
| [WP\_REST\_Global\_Styles\_Controller::get\_theme\_item()](../classes/wp_rest_global_styles_controller/get_theme_item) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Returns the given theme global styles config. |
| [WP\_REST\_Global\_Styles\_Controller::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\_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. |
| [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::prepare\_item\_for\_response()](../classes/wp_rest_menus_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Prepares a single term output for response. |
| [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\_Menu\_Locations\_Controller::get\_items()](../classes/wp_rest_menu_locations_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Retrieves all menu locations, depending on user context. |
| [WP\_REST\_Menu\_Locations\_Controller::get\_item()](../classes/wp_rest_menu_locations_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Retrieves a specific menu location. |
| [WP\_REST\_Menu\_Locations\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_menu_locations_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Prepares a menu location object for serialization. |
| [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\_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::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\_REST\_Templates\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_templates_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Prepare a single template output for response |
| [WP\_REST\_Templates\_Controller::get\_items()](../classes/wp_rest_templates_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Returns a list of templates. |
| [WP\_REST\_Templates\_Controller::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\_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::prepare\_item\_for\_response()](../classes/wp_rest_widget_types_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Prepares a widget type object for serialization. |
| [WP\_REST\_Widget\_Types\_Controller::encode\_form\_data()](../classes/wp_rest_widget_types_controller/encode_form_data) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | An RPC-style endpoint which can be used by clients to turn user input in a widget admin form into an encoded instance object. |
| [WP\_REST\_Widget\_Types\_Controller::get\_items()](../classes/wp_rest_widget_types_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Retrieves the list of all widget types. |
| [WP\_REST\_Themes\_Controller::get\_item()](../classes/wp_rest_themes_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Retrieves a single theme. |
| [WP\_REST\_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\_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\_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::prepare\_item\_for\_response()](../classes/wp_rest_block_types_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Prepares a block type object for serialization. |
| [WP\_REST\_Block\_Types\_Controller::get\_items()](../classes/wp_rest_block_types_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Retrieves all post block types, depending on user context. |
| [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\_Themes\_Controller::get\_items()](../classes/wp_rest_themes_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Retrieves a collection of themes. |
| [WP\_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\_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\_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. |
| [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. |
| [WP\_REST\_Users\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_users_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Prepares a single user output for response. |
| [WP\_REST\_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::get\_current\_item()](../classes/wp_rest_users_controller/get_current_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves the current user. |
| [WP\_REST\_Users\_Controller::create\_item()](../classes/wp_rest_users_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Creates a single user. |
| [WP\_REST\_Users\_Controller::update\_item()](../classes/wp_rest_users_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Updates a single user. |
| [WP\_REST\_Users\_Controller::get\_items()](../classes/wp_rest_users_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves all users. |
| [WP\_REST\_Revisions\_Controller::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::prepare\_item\_for\_response()](../classes/wp_rest_revisions_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Prepares the revision for the REST response. |
| [WP\_REST\_Revisions\_Controller::get\_items()](../classes/wp_rest_revisions_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Gets a collection of revisions. |
| [WP\_REST\_Attachments\_Controller::create\_item()](../classes/wp_rest_attachments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Creates a single attachment. |
| [WP\_REST\_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::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\_REST\_Post\_Statuses\_Controller::get\_items()](../classes/wp_rest_post_statuses_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Retrieves all post statuses, depending on user context. |
| [WP\_REST\_Post\_Statuses\_Controller::get\_item()](../classes/wp_rest_post_statuses_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Retrieves a specific post status. |
| [WP\_REST\_Post\_Statuses\_Controller::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\_item\_for\_response()](../classes/wp_rest_terms_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Prepares a single term output for response. |
| [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()](../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::get\_items()](../classes/wp_rest_terms_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Retrieves terms associated with a taxonomy. |
| [WP\_REST\_Posts\_Controller::prepare\_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::create\_item()](../classes/wp_rest_posts_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Creates a single post. |
| [WP\_REST\_Posts\_Controller::update\_item()](../classes/wp_rest_posts_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Updates a single post. |
| [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\_Posts\_Controller::get\_items()](../classes/wp_rest_posts_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves a collection of posts. |
| [WP\_REST\_Taxonomies\_Controller::get\_item()](../classes/wp_rest_taxonomies_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Retrieves a specific taxonomy. |
| [WP\_REST\_Taxonomies\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_taxonomies_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Prepares a taxonomy object for serialization. |
| [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()](../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\_Post\_Types\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_post_types_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Prepares a post type object for serialization. |
| [WP\_REST\_Comments\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_comments_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Prepares a single comment output for response. |
| [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::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\_REST\_Comments\_Controller::get\_items()](../classes/wp_rest_comments_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Retrieves a list of comment items. |
| [WP\_REST\_Server::get\_namespace\_index()](../classes/wp_rest_server/get_namespace_index) wp-includes/rest-api/class-wp-rest-server.php | Retrieves the index for a namespace. |
| [WP\_REST\_Server::envelope\_response()](../classes/wp_rest_server/envelope_response) wp-includes/rest-api/class-wp-rest-server.php | Wraps the response in an envelope. |
| [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\_REST\_Server::embed\_links()](../classes/wp_rest_server/embed_links) wp-includes/rest-api/class-wp-rest-server.php | Embeds the links from the data into the request. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
| programming_docs |
wordpress is_taxonomy_hierarchical( string $taxonomy ): bool is\_taxonomy\_hierarchical( string $taxonomy ): bool
====================================================
Determines whether the taxonomy object is hierarchical.
Checks to make sure that the taxonomy is an object first. Then Gets the object, and finally returns the hierarchical value in the object.
A false return value might also mean that the taxonomy does not exist.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
`$taxonomy` string Required Name of taxonomy object. bool Whether the taxonomy is hierarchical.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function is_taxonomy_hierarchical( $taxonomy ) {
if ( ! taxonomy_exists( $taxonomy ) ) {
return false;
}
$taxonomy = get_taxonomy( $taxonomy );
return $taxonomy->hierarchical;
}
```
| Uses | Description |
| --- | --- |
| [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| Used By | Description |
| --- | --- |
| [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. |
| [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\_REST\_Terms\_Controller::create\_item\_permissions\_check()](../classes/wp_rest_terms_controller/create_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Checks if a request has access to create a term. |
| [WP\_REST\_Terms\_Controller::create\_item()](../classes/wp_rest_terms_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Creates a single term in a taxonomy. |
| [WP\_REST\_Terms\_Controller::update\_item()](../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\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. |
| [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. |
| [wp\_ajax\_add\_tag()](wp_ajax_add_tag) wp-admin/includes/ajax-actions.php | Ajax handler to add a tag. |
| [WP\_Terms\_List\_Table::prepare\_items()](../classes/wp_terms_list_table/prepare_items) wp-admin/includes/class-wp-terms-list-table.php | |
| [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 | |
| [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\_Tax\_Query::clean\_query()](../classes/wp_tax_query/clean_query) wp-includes/class-wp-tax-query.php | Validates a single query. |
| [WP\_Tax\_Query::transform\_query()](../classes/wp_tax_query/transform_query) wp-includes/class-wp-tax-query.php | Transforms a single query, from one field to another. |
| [\_get\_term\_hierarchy()](_get_term_hierarchy) wp-includes/taxonomy.php | Retrieves children of taxonomy as term IDs. |
| [\_pad\_term\_counts()](_pad_term_counts) wp-includes/taxonomy.php | Adds count of children to parent count. |
| [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\_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. |
| [\_wp\_menu\_item\_classes\_by\_context()](_wp_menu_item_classes_by_context) wp-includes/nav-menu-template.php | Adds the class property classes for the current context, if applicable. |
| [wp\_set\_post\_terms()](wp_set_post_terms) wp-includes/post.php | Sets the terms for a post. |
| [wp\_xmlrpc\_server::\_insert\_post()](../classes/wp_xmlrpc_server/_insert_post) wp-includes/class-wp-xmlrpc-server.php | Helper method for wp\_newPost() and wp\_editPost(), containing shared logic. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress admin_url( string $path = '', string $scheme = 'admin' ): string admin\_url( string $path = '', string $scheme = 'admin' ): string
=================================================================
Retrieves the URL to the admin area for the current site.
`$path` string Optional Path relative to the admin URL. Default: `''`
`$scheme` string Optional The scheme to use. Default is `'admin'`, which obeys [force\_ssl\_admin()](force_ssl_admin) and [is\_ssl()](is_ssl) .
`'http'` or `'https'` can be passed to force those schemes. Default: `'admin'`
string Admin URL link with optional path appended.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function admin_url( $path = '', $scheme = 'admin' ) {
return get_admin_url( null, $path, $scheme );
}
```
| Uses | Description |
| --- | --- |
| [get\_admin\_url()](get_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for a given site. |
| Used By | Description |
| --- | --- |
| [WP\_Widget\_Media::get\_l10n\_defaults()](../classes/wp_widget_media/get_l10n_defaults) wp-includes/widgets/class-wp-widget-media.php | Returns the default localized strings used by the widget. |
| [wp\_admin\_bar\_edit\_site\_menu()](wp_admin_bar_edit_site_menu) wp-includes/admin-bar.php | Adds the “Edit site” link to the Toolbar. |
| [deactivated\_plugins\_notice()](deactivated_plugins_notice) wp-admin/includes/plugin.php | Renders an admin notice when a plugin was deactivated during an update. |
| [rest\_add\_application\_passwords\_to\_index()](rest_add_application_passwords_to_index) wp-includes/rest-api.php | Adds Application Passwords info to the REST API index. |
| [WP\_Site\_Health::get\_test\_authorization\_header()](../classes/wp_site_health/get_test_authorization_header) wp-admin/includes/class-wp-site-health.php | Tests if the Authorization header has the expected values. |
| [WP\_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\_dashboard\_site\_health()](wp_dashboard_site_health) wp-admin/includes/dashboard.php | Displays the Site Health Status widget. |
| [WP\_Site\_Health::wp\_cron\_scheduled\_check()](../classes/wp_site_health/wp_cron_scheduled_check) wp-admin/includes/class-wp-site-health.php | Runs the scheduled event to check and update the latest site health status for the website. |
| [WP\_Privacy\_Requests\_Table::get\_admin\_url()](../classes/wp_privacy_requests_table/get_admin_url) wp-admin/includes/class-wp-privacy-requests-table.php | Normalize the admin URL to the current page (by request\_type). |
| [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\_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. |
| [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::get\_test\_wordpress\_version()](../classes/wp_site_health/get_test_wordpress_version) wp-admin/includes/class-wp-site-health.php | Tests for WordPress version and outputs it. |
| [WP\_Site\_Health::get\_test\_plugin\_version()](../classes/wp_site_health/get_test_plugin_version) wp-admin/includes/class-wp-site-health.php | Tests if plugins are outdated, or unnecessary. |
| [WP\_Site\_Health::get\_test\_theme\_version()](../classes/wp_site_health/get_test_theme_version) wp-admin/includes/class-wp-site-health.php | Tests if themes are outdated, or unnecessary. |
| [WP\_Site\_Health::get\_test\_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\_default\_packages\_inline\_scripts()](wp_default_packages_inline_scripts) wp-includes/script-loader.php | Adds inline scripts required for the WordPress JavaScript packages. |
| [the\_block\_editor\_meta\_boxes()](the_block_editor_meta_boxes) wp-admin/includes/post.php | Renders the meta boxes forms. |
| [\_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\_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::policy\_text\_changed\_notice()](../classes/wp_privacy_policy_content/policy_text_changed_notice) wp-admin/includes/class-wp-privacy-policy-content.php | Output a warning when some privacy info has changed. |
| [wp\_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\_Widget\_Media\_Audio::\_\_construct()](../classes/wp_widget_media_audio/__construct) wp-includes/widgets/class-wp-widget-media-audio.php | Constructor. |
| [WP\_Widget\_Media\_Video::\_\_construct()](../classes/wp_widget_media_video/__construct) wp-includes/widgets/class-wp-widget-media-video.php | Constructor. |
| [WP\_Widget\_Media\_Image::\_\_construct()](../classes/wp_widget_media_image/__construct) wp-includes/widgets/class-wp-widget-media-image.php | Constructor. |
| [wp\_print\_community\_events\_markup()](wp_print_community_events_markup) wp-admin/includes/dashboard.php | Prints the markup for the Community Events section of the Events and News Dashboard widget. |
| [WP\_Customize\_Manager::is\_cross\_domain()](../classes/wp_customize_manager/is_cross_domain) wp-includes/class-wp-customize-manager.php | Determines whether the admin and the frontend are on different domains. |
| [wp\_ajax\_install\_theme()](wp_ajax_install_theme) wp-admin/includes/ajax-actions.php | Ajax handler for installing a theme. |
| [wp\_ajax\_install\_plugin()](wp_ajax_install_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for installing a plugin. |
| [WP\_Customize\_Site\_Icon\_Control::content\_template()](../classes/wp_customize_site_icon_control/content_template) wp-includes/customize/class-wp-customize-site-icon-control.php | Renders a JS template for the content of the site icon control. |
| [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\_Customize\_Manager::customize\_pane\_settings()](../classes/wp_customize_manager/customize_pane_settings) wp-includes/class-wp-customize-manager.php | Prints JavaScript settings for parent window. |
| [WP\_Posts\_List\_Table::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. |
| [network\_step1()](network_step1) wp-admin/includes/network.php | Prints step 1 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. |
| [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. |
| [WP\_Plugins\_List\_Table::no\_items()](../classes/wp_plugins_list_table/no_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| [Theme\_Upgrader\_Skin::after()](../classes/theme_upgrader_skin/after) wp-admin/includes/class-theme-upgrader-skin.php | Action to perform following a single theme update. |
| [Plugin\_Installer\_Skin::after()](../classes/plugin_installer_skin/after) wp-admin/includes/class-plugin-installer-skin.php | Action to perform following a plugin install. |
| [Theme\_Installer\_Skin::after()](../classes/theme_installer_skin/after) wp-admin/includes/class-theme-installer-skin.php | Action to perform following a single theme install. |
| [WP\_List\_Table::comments\_bubble()](../classes/wp_list_table/comments_bubble) wp-admin/includes/class-wp-list-table.php | Displays a comment count bubble. |
| [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\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. |
| [wp\_welcome\_panel()](wp_welcome_panel) wp-admin/includes/dashboard.php | Displays a welcome panel to introduce users to WordPress. |
| [wp\_dashboard\_quota()](wp_dashboard_quota) wp-admin/includes/dashboard.php | Displays file upload quota on dashboard. |
| [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press) wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. |
| [wp\_dashboard\_recent\_drafts()](wp_dashboard_recent_drafts) wp-admin/includes/dashboard.php | Show recent drafts of the user on the dashboard. |
| [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. |
| [menu\_page\_url()](menu_page_url) wp-admin/includes/plugin.php | Gets the URL to access a particular menu page based on the slug it was registered with. |
| [iframe\_header()](iframe_header) wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. |
| [WP\_Themes\_List\_Table::no\_items()](../classes/wp_themes_list_table/no_items) wp-admin/includes/class-wp-themes-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\_type\_url\_form()](media_upload_type_url_form) wp-admin/includes/media.php | Outputs the legacy media upload form for external media. |
| [media\_upload\_gallery\_form()](media_upload_gallery_form) wp-admin/includes/media.php | Adds gallery form to upload iframe. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| [media\_upload\_flash\_bypass()](media_upload_flash_bypass) wp-admin/includes/media.php | Displays the multi-file uploader message. |
| [media\_upload\_max\_image\_resize()](media_upload_max_image_resize) wp-admin/includes/media.php | Displays the checkbox to scale images. |
| [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. |
| [wp\_iframe()](wp_iframe) wp-admin/includes/media.php | Outputs the iframe to display the media upload page. |
| [get\_upload\_iframe\_src()](get_upload_iframe_src) wp-admin/includes/media.php | Retrieves the upload iframe source URL. |
| [\_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\_query\_themes()](wp_ajax_query_themes) wp-admin/includes/ajax-actions.php | Ajax handler for getting themes from [themes\_api()](themes_api) . |
| [wp\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
| [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. |
| [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| [WP\_Comments\_List\_Table::column\_author()](../classes/wp_comments_list_table/column_author) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::get\_views()](../classes/wp_comments_list_table/get_views) wp-admin/includes/class-wp-comments-list-table.php | |
| [Walker\_Nav\_Menu\_Edit::start\_el()](../classes/walker_nav_menu_edit/start_el) wp-admin/includes/class-walker-nav-menu-edit.php | Start the element output. |
| [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::help()](../classes/custom_image_header/help) wp-admin/includes/class-custom-image-header.php | Adds contextual help. |
| [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| [wp\_customize\_url()](wp_customize_url) wp-includes/theme.php | Returns a URL to load the Customizer. |
| [wp\_customize\_support\_script()](wp_customize_support_script) wp-includes/theme.php | Prints a script to check whether or not the Customizer is supported, and apply either the no-customize-support or customize-support class to the body. |
| [\_wp\_customize\_loader\_settings()](_wp_customize_loader_settings) wp-includes/theme.php | Adds settings for the customize-loader script. |
| [wp\_safe\_redirect()](wp_safe_redirect) wp-includes/pluggable.php | Performs a safe (local) redirect, using [wp\_redirect()](wp_redirect) . |
| [wp\_notify\_postauthor()](wp_notify_postauthor) wp-includes/pluggable.php | Notifies an author (and/or others) of a comment/trackback/pingback on a post. |
| [wp\_notify\_moderator()](wp_notify_moderator) wp-includes/pluggable.php | Notifies the moderator of the site about a new comment that is awaiting approval. |
| [check\_admin\_referer()](check_admin_referer) wp-includes/pluggable.php | Ensures intent by verifying that a user was referred from another admin page with the correct security nonce. |
| [wp\_heartbeat\_settings()](wp_heartbeat_settings) wp-includes/general-template.php | Default settings for heartbeat. |
| [register\_admin\_color\_schemes()](register_admin_color_schemes) wp-includes/general-template.php | Registers the default admin color schemes. |
| [wp\_admin\_css\_uri()](wp_admin_css_uri) wp-includes/general-template.php | Displays the URL of a WordPress admin CSS file. |
| [wp\_register()](wp_register) wp-includes/general-template.php | Displays the Registration or Admin link. |
| [wp\_admin\_bar\_dashboard\_view\_site\_menu()](wp_admin_bar_dashboard_view_site_menu) wp-includes/deprecated.php | Add the “Dashboard”/”Visit Site” menu. |
| [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\_Embed::maybe\_run\_ajax\_cache()](../classes/wp_embed/maybe_run_ajax_cache) wp-includes/class-wp-embed.php | If a post/page was saved, then output JavaScript to make an Ajax request that will call [WP\_Embed::cache\_oembed()](../classes/wp_embed/cache_oembed). |
| [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\_dashboard\_url()](get_dashboard_url) wp-includes/link-template.php | Retrieves the URL to the user’s dashboard. |
| [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the network. |
| [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. |
| [get\_edit\_bookmark\_link()](get_edit_bookmark_link) wp-includes/link-template.php | Displays the edit bookmark link. |
| [get\_edit\_term\_link()](get_edit_term_link) wp-includes/link-template.php | Retrieves the URL for editing a given term. |
| [get\_allowed\_http\_origins()](get_allowed_http_origins) wp-includes/http.php | Retrieve list of allowed HTTP origins. |
| [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\_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\_user\_settings()](wp_user_settings) wp-includes/option.php | Saves and restores user interface settings stored in a cookie. |
| [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. |
| [wp\_redirect\_admin\_locations()](wp_redirect_admin_locations) wp-includes/canonical.php | Redirects a variety of shorthand URLs to the admin. |
| [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}/. |
| [wp\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. |
| [\_WP\_Editors::editor\_js()](../classes/_wp_editors/editor_js) wp-includes/class-wp-editor.php | Print (output) the TinyMCE configuration and initialization scripts. |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
| programming_docs |
wordpress do_feed_rdf() do\_feed\_rdf()
===============
Loads the RDF RSS 0.91 Feed template.
* [load\_template()](load_template)
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function do_feed_rdf() {
load_template( ABSPATH . WPINC . '/feed-rdf.php' );
}
```
| Uses | Description |
| --- | --- |
| [load\_template()](load_template) wp-includes/template.php | Requires the template file with WordPress environment. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_set_comment_status( int|WP_Comment $comment_id, string $comment_status, bool $wp_error = false ): bool|WP_Error wp\_set\_comment\_status( int|WP\_Comment $comment\_id, string $comment\_status, bool $wp\_error = false ): bool|WP\_Error
==========================================================================================================================
Sets the status of a comment.
The [‘wp\_set\_comment\_status’](../hooks/wp_set_comment_status) action is called after the comment is handled.
If the comment status is not in the list, then false is returned.
`$comment_id` int|[WP\_Comment](../classes/wp_comment) Required Comment ID or [WP\_Comment](../classes/wp_comment) object. `$comment_status` string Required New comment status, either `'hold'`, `'approve'`, `'spam'`, or `'trash'`. `$wp_error` bool Optional Whether to return a [WP\_Error](../classes/wp_error) object if there is a failure. Default: `false`
bool|[WP\_Error](../classes/wp_error) True on success, false or [WP\_Error](../classes/wp_error) on failure.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_set_comment_status( $comment_id, $comment_status, $wp_error = false ) {
global $wpdb;
switch ( $comment_status ) {
case 'hold':
case '0':
$status = '0';
break;
case 'approve':
case '1':
$status = '1';
add_action( 'wp_set_comment_status', 'wp_new_comment_notify_postauthor' );
break;
case 'spam':
$status = 'spam';
break;
case 'trash':
$status = 'trash';
break;
default:
return false;
}
$comment_old = clone get_comment( $comment_id );
if ( ! $wpdb->update( $wpdb->comments, array( 'comment_approved' => $status ), array( 'comment_ID' => $comment_old->comment_ID ) ) ) {
if ( $wp_error ) {
return new WP_Error( 'db_update_error', __( 'Could not update comment status.' ), $wpdb->last_error );
} else {
return false;
}
}
clean_comment_cache( $comment_old->comment_ID );
$comment = get_comment( $comment_old->comment_ID );
/**
* Fires immediately after transitioning a comment's status from one to another in the database
* and removing the comment from the object cache, but prior to all status transition hooks.
*
* @since 1.5.0
*
* @param string $comment_id Comment ID as a numeric string.
* @param string $comment_status Current comment status. Possible values include
* 'hold', '0', 'approve', '1', 'spam', and 'trash'.
*/
do_action( 'wp_set_comment_status', $comment->comment_ID, $comment_status );
wp_transition_comment_status( $comment_status, $comment_old->comment_approved, $comment );
wp_update_comment_count( $comment->comment_post_ID );
return true;
}
```
[do\_action( 'wp\_set\_comment\_status', string $comment\_id, string $comment\_status )](../hooks/wp_set_comment_status)
Fires immediately after transitioning a comment’s status from one to another in the database and removing the comment from the object cache, but prior to all status transition hooks.
| Uses | Description |
| --- | --- |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| [clean\_comment\_cache()](clean_comment_cache) wp-includes/comment.php | Removes a comment from the object cache. |
| [wp\_update\_comment\_count()](wp_update_comment_count) wp-includes/comment.php | Updates the comment count for post(s). |
| [wp\_transition\_comment\_status()](wp_transition_comment_status) wp-includes/comment.php | Calls hooks for when a comment status transition occurs. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| 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\_ajax\_dim\_comment()](wp_ajax_dim_comment) wp-admin/includes/ajax-actions.php | Ajax handler to dim a comment. |
| [wp\_ajax\_replyto\_comment()](wp_ajax_replyto_comment) wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. |
| [wp\_spam\_comment()](wp_spam_comment) wp-includes/comment.php | Marks a comment as Spam. |
| [wp\_unspam\_comment()](wp_unspam_comment) wp-includes/comment.php | Removes a comment from the Spam. |
| [wp\_trash\_comment()](wp_trash_comment) wp-includes/comment.php | Moves a comment to the Trash |
| [wp\_untrash\_comment()](wp_untrash_comment) wp-includes/comment.php | Removes a comment from the Trash |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress register_sidebar( array|string $args = array() ): string register\_sidebar( array|string $args = array() ): string
=========================================================
Builds the definition for a single sidebar and returns the ID.
Accepts either a string or an array and then parses that against a set of default arguments for the new sidebar. WordPress will automatically generate a sidebar ID and name based on the current number of registered sidebars if those arguments are not included.
When allowing for automatic generation of the name and ID parameters, keep in mind that the incrementor for your sidebar can change over time depending on what other plugins and themes are installed.
If theme support for ‘widgets’ has not yet been added when this function is called, it will be automatically enabled through the use of [add\_theme\_support()](add_theme_support)
`$args` array|string Optional Array or string of arguments for the sidebar being registered.
* `name`stringThe name or title of the sidebar displayed in the Widgets interface. Default 'Sidebar $instance'.
* `id`stringThe unique identifier by which the sidebar will be called.
Default `'sidebar-$instance'`.
* `description`stringDescription of the sidebar, displayed in the Widgets interface.
Default empty string.
* `class`stringExtra CSS class to assign to the sidebar in the Widgets interface.
* `before_widget`stringHTML content to prepend to each widget's HTML output when assigned to this sidebar. Receives the widget's ID attribute as `%1$s` and class name as `%2$s`. Default is an opening list item element.
* `after_widget`stringHTML content to append to each widget's HTML output when assigned to this sidebar. Default is a closing list item element.
* `before_title`stringHTML content to prepend to the sidebar title when displayed.
Default is an opening h2 element.
* `after_title`stringHTML content to append to the sidebar title when displayed.
Default is a closing h2 element.
* `before_sidebar`stringHTML content to prepend to the sidebar when displayed.
Receives the `$id` argument as `%1$s` and `$class` as `%2$s`.
Outputs after the ['dynamic\_sidebar\_before'](../hooks/dynamic_sidebar_before) action.
Default empty string.
* `after_sidebar`stringHTML content to append to the sidebar when displayed.
Outputs before the ['dynamic\_sidebar\_after'](../hooks/dynamic_sidebar_after) action.
Default empty string.
* `show_in_rest`boolWhether to show this sidebar publicly in the REST API.
Defaults to only showing the sidebar to administrator users.
Default: `array()`
string Sidebar ID added to $wp\_registered\_sidebars global.
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function register_sidebar( $args = array() ) {
global $wp_registered_sidebars;
$i = count( $wp_registered_sidebars ) + 1;
$id_is_empty = empty( $args['id'] );
$defaults = array(
/* translators: %d: Sidebar number. */
'name' => sprintf( __( 'Sidebar %d' ), $i ),
'id' => "sidebar-$i",
'description' => '',
'class' => '',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => "</li>\n",
'before_title' => '<h2 class="widgettitle">',
'after_title' => "</h2>\n",
'before_sidebar' => '',
'after_sidebar' => '',
'show_in_rest' => false,
);
/**
* Filters the sidebar default arguments.
*
* @since 5.3.0
*
* @see register_sidebar()
*
* @param array $defaults The default sidebar arguments.
*/
$sidebar = wp_parse_args( $args, apply_filters( 'register_sidebar_defaults', $defaults ) );
if ( $id_is_empty ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: 1: The 'id' argument, 2: Sidebar name, 3: Recommended 'id' value. */
__( 'No %1$s was set in the arguments array for the "%2$s" sidebar. Defaulting to "%3$s". Manually set the %1$s to "%3$s" to silence this notice and keep existing sidebar content.' ),
'<code>id</code>',
$sidebar['name'],
$sidebar['id']
),
'4.2.0'
);
}
$wp_registered_sidebars[ $sidebar['id'] ] = $sidebar;
add_theme_support( 'widgets' );
/**
* Fires once a sidebar has been registered.
*
* @since 3.0.0
*
* @param array $sidebar Parsed arguments for the registered sidebar.
*/
do_action( 'register_sidebar', $sidebar );
return $sidebar['id'];
}
```
[do\_action( 'register\_sidebar', array $sidebar )](../hooks/register_sidebar)
Fires once a sidebar has been registered.
[apply\_filters( 'register\_sidebar\_defaults', array $defaults )](../hooks/register_sidebar_defaults)
Filters the sidebar default arguments.
| Uses | Description |
| --- | --- |
| [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [register\_sidebars()](register_sidebars) wp-includes/widgets.php | Creates multiple sidebars. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Added the `show_in_rest` argument. |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Added the `before_sidebar` and `after_sidebar` arguments. |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress get_the_tag_list( string $before = '', string $sep = '', string $after = '', int $post_id ): string|false|WP_Error get\_the\_tag\_list( string $before = '', string $sep = '', string $after = '', int $post\_id ): string|false|WP\_Error
=======================================================================================================================
Retrieves the tags for a post formatted as a string.
`$before` string Optional String to use before the tags. Default: `''`
`$sep` string Optional String to use between the tags. Default: `''`
`$after` string Optional String to use after the tags. Default: `''`
`$post_id` int Optional Post ID. Defaults to the current post ID. string|false|[WP\_Error](../classes/wp_error) A list of tags on success, false if there are no terms, [WP\_Error](../classes/wp_error) on failure.
This function generates a HTML string of the tags associated with the current post. The name of each tag will be linked to the relevant ‘tag’ page. You can tell the function to put a string before and after all the tags, and in between each tag. Differently from <get_the_category_list>, this tag must be used inside The Loop.
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function get_the_tag_list( $before = '', $sep = '', $after = '', $post_id = 0 ) {
$tag_list = get_the_term_list( $post_id, 'post_tag', $before, $sep, $after );
/**
* Filters the tags list for a given post.
*
* @since 2.3.0
*
* @param string $tag_list List of tags.
* @param string $before String to use before the tags.
* @param string $sep String to use between the tags.
* @param string $after String to use after the tags.
* @param int $post_id Post ID.
*/
return apply_filters( 'the_tags', $tag_list, $before, $sep, $after, $post_id );
}
```
[apply\_filters( 'the\_tags', string $tag\_list, string $before, string $sep, string $after, int $post\_id )](../hooks/the_tags)
Filters the tags list for a given post.
| Uses | Description |
| --- | --- |
| [get\_the\_term\_list()](get_the_term_list) wp-includes/category-template.php | Retrieves a post’s terms as a list with specified format. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [the\_tags()](the_tags) wp-includes/category-template.php | Displays the tags for a post. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_get_sidebar( string $id ): array|null wp\_get\_sidebar( string $id ): array|null
==========================================
Retrieves the registered sidebar with the given ID.
`$id` string Required The sidebar ID. array|null The discovered sidebar, or null if it is not registered.
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function wp_get_sidebar( $id ) {
global $wp_registered_sidebars;
foreach ( (array) $wp_registered_sidebars as $sidebar ) {
if ( $sidebar['id'] === $id ) {
return $sidebar;
}
}
if ( 'wp_inactive_widgets' === $id ) {
return array(
'id' => 'wp_inactive_widgets',
'name' => __( 'Inactive widgets' ),
);
}
return null;
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Widgets\_Controller::check\_read\_sidebar\_permission()](../classes/wp_rest_widgets_controller/check_read_sidebar_permission) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Checks if a sidebar can be read publicly. |
| [WP\_REST\_Sidebars\_Controller::get\_sidebar()](../classes/wp_rest_sidebars_controller/get_sidebar) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Retrieves the registered sidebar with the given id. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress delete_option( string $option ): bool delete\_option( string $option ): bool
======================================
Removes option by name. Prevents removal of protected WordPress options.
`$option` string Required Name of the option to delete. Expected to not be SQL-escaped. bool True if the option was deleted, false otherwise.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function delete_option( $option ) {
global $wpdb;
if ( is_scalar( $option ) ) {
$option = trim( $option );
}
if ( empty( $option ) ) {
return false;
}
wp_protect_special_option( $option );
// Get the ID, if no ID then return.
$row = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option ) );
if ( is_null( $row ) ) {
return false;
}
/**
* Fires immediately before an option is deleted.
*
* @since 2.9.0
*
* @param string $option Name of the option to delete.
*/
do_action( 'delete_option', $option );
$result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) );
if ( ! wp_installing() ) {
if ( 'yes' === $row->autoload ) {
$alloptions = wp_load_alloptions( true );
if ( is_array( $alloptions ) && isset( $alloptions[ $option ] ) ) {
unset( $alloptions[ $option ] );
wp_cache_set( 'alloptions', $alloptions, 'options' );
}
} else {
wp_cache_delete( $option, 'options' );
}
}
if ( $result ) {
/**
* Fires after a specific option has been deleted.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* @since 3.0.0
*
* @param string $option Name of the deleted option.
*/
do_action( "delete_option_{$option}", $option );
/**
* Fires after an option has been deleted.
*
* @since 2.9.0
*
* @param string $option Name of the deleted option.
*/
do_action( 'deleted_option', $option );
return true;
}
return false;
}
```
[do\_action( 'deleted\_option', string $option )](../hooks/deleted_option)
Fires after an option has been deleted.
[do\_action( 'delete\_option', string $option )](../hooks/delete_option)
Fires immediately before an option is deleted.
[do\_action( "delete\_option\_{$option}", string $option )](../hooks/delete_option_option)
Fires after a specific option has been deleted.
| 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\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [wp\_load\_alloptions()](wp_load_alloptions) wp-includes/option.php | Loads and caches all autoloaded options, if available or all options. |
| [wp\_protect\_special\_option()](wp_protect_special_option) wp-includes/option.php | Protects WordPress special option from being modified. |
| [wpdb::get\_row()](../classes/wpdb/get_row) wp-includes/class-wpdb.php | Retrieves one row from the database. |
| [wpdb::delete()](../classes/wpdb/delete) wp-includes/class-wpdb.php | Deletes a row in the table. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [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. |
| [\_wp\_batch\_update\_comment\_type()](_wp_batch_update_comment_type) wp-includes/comment.php | Updates the comment type for a batch of comments. |
| [WP\_Recovery\_Mode\_Email\_Service::clear\_rate\_limit()](../classes/wp_recovery_mode_email_service/clear_rate_limit) wp-includes/class-wp-recovery-mode-email-service.php | Clears the rate limit, allowing a new recovery mode email to be sent immediately. |
| [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::delete\_all()](../classes/wp_paused_extensions_storage/delete_all) wp-includes/class-wp-paused-extensions-storage.php | Remove all paused extensions. |
| [clean\_taxonomy\_cache()](clean_taxonomy_cache) wp-includes/taxonomy.php | Cleans the caches for a taxonomy. |
| [\_wp\_menus\_changed()](_wp_menus_changed) wp-includes/nav-menu.php | Handles menu config after theme change. |
| [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\_Upgrader::release\_lock()](../classes/wp_upgrader/release_lock) wp-admin/includes/class-wp-upgrader.php | Releases an upgrader lock. |
| [delete\_network\_option()](delete_network_option) wp-includes/option.php | Removes a network option by name. |
| [\_wp\_batch\_split\_terms()](_wp_batch_split_terms) wp-includes/taxonomy.php | Splits a batch of shared taxonomy terms. |
| [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. |
| [update\_home\_siteurl()](update_home_siteurl) wp-admin/includes/misc.php | Flushes rewrite rules if siteurl, home or page\_on\_front changed. |
| [populate\_options()](populate_options) wp-admin/includes/schema.php | Create WordPress options and set the default values. |
| [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. |
| [remove\_theme\_mods()](remove_theme_mods) wp-includes/theme.php | Removes theme modifications option for the active theme. |
| [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. |
| [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. |
| [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. |
| [delete\_transient()](delete_transient) wp-includes/option.php | Deletes a transient. |
| [\_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. |
| [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}/. |
| [delete\_blog\_option()](delete_blog_option) wp-includes/ms-blogs.php | Removes option by name for a given blog ID. Prevents removal of protected WordPress options. |
| [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. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
| programming_docs |
wordpress get_month_link( int|false $year, int|false $month ): string get\_month\_link( int|false $year, int|false $month ): string
=============================================================
Retrieves the permalink for the month archives with year.
`$year` int|false Required Integer of year. False for current year. `$month` int|false Required Integer of month. False for current month. string The permalink for the specified month and year archive.
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.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_month_link( $year, $month ) {
global $wp_rewrite;
if ( ! $year ) {
$year = current_time( 'Y' );
}
if ( ! $month ) {
$month = current_time( 'm' );
}
$monthlink = $wp_rewrite->get_month_permastruct();
if ( ! empty( $monthlink ) ) {
$monthlink = str_replace( '%year%', $year, $monthlink );
$monthlink = str_replace( '%monthnum%', zeroise( (int) $month, 2 ), $monthlink );
$monthlink = home_url( user_trailingslashit( $monthlink, 'month' ) );
} else {
$monthlink = home_url( '?m=' . $year . zeroise( $month, 2 ) );
}
/**
* Filters the month archive permalink.
*
* @since 1.5.0
*
* @param string $monthlink Permalink for the month archive.
* @param int $year Year for the archive.
* @param int $month The month for the archive.
*/
return apply_filters( 'month_link', $monthlink, $year, $month );
}
```
[apply\_filters( 'month\_link', string $monthlink, int $year, int $month )](../hooks/month_link)
Filters the month archive permalink.
| Uses | Description |
| --- | --- |
| [zeroise()](zeroise) wp-includes/formatting.php | Add leading zeros when necessary. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [WP\_Rewrite::get\_month\_permastruct()](../classes/wp_rewrite/get_month_permastruct) wp-includes/class-wp-rewrite.php | Retrieves the month permalink structure without day and with year. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_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. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress user_trailingslashit( string $string, string $type_of_url = '' ): string user\_trailingslashit( string $string, string $type\_of\_url = '' ): string
===========================================================================
Retrieves a trailing-slashed string if the site is set for adding trailing slashes.
Conditionally adds a trailing slash if the permalink structure has a trailing slash, strips the trailing slash if not. The string is passed through the [‘user\_trailingslashit’](../hooks/user_trailingslashit) filter. Will remove trailing slash from string, if site is not set to have them.
`$string` string Required URL with or without a trailing slash. `$type_of_url` string Optional The type of URL being considered (e.g. single, category, etc) for use in the filter. Default: `''`
string The URL with the trailing slash appended or stripped.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function user_trailingslashit( $string, $type_of_url = '' ) {
global $wp_rewrite;
if ( $wp_rewrite->use_trailing_slashes ) {
$string = trailingslashit( $string );
} else {
$string = untrailingslashit( $string );
}
/**
* Filters the trailing-slashed string, depending on whether the site is set to use trailing slashes.
*
* @since 2.2.0
*
* @param string $string URL with or without a trailing slash.
* @param string $type_of_url The type of URL being considered. Accepts 'single', 'single_trackback',
* 'single_feed', 'single_paged', 'commentpaged', 'paged', 'home', 'feed',
* 'category', 'page', 'year', 'month', 'day', 'post_type_archive'.
*/
return apply_filters( 'user_trailingslashit', $string, $type_of_url );
}
```
[apply\_filters( 'user\_trailingslashit', string $string, string $type\_of\_url )](../hooks/user_trailingslashit)
Filters the trailing-slashed string, depending on whether the site is set to use trailing slashes.
| Uses | Description |
| --- | --- |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [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\_get\_canonical\_url()](wp_get_canonical_url) wp-includes/link-template.php | Returns the canonical URL for a post. |
| [get\_post\_embed\_url()](get_post_embed_url) wp-includes/embed.php | Retrieves the URL to embed a specific post in an iframe. |
| [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. |
| [get\_index\_rel\_link()](get_index_rel_link) wp-includes/deprecated.php | Get site index relational link. |
| [wp\_old\_slug\_redirect()](wp_old_slug_redirect) wp-includes/query.php | Redirect old slugs to the correct permalink. |
| [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| [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\_link()](get_post_type_archive_link) wp-includes/link-template.php | Retrieves the permalink for a post type archive. |
| [get\_term\_feed\_link()](get_term_feed_link) wp-includes/link-template.php | Retrieves the feed link for a term. |
| [get\_search\_link()](get_search_link) wp-includes/link-template.php | Retrieves the permalink for a search. |
| [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\_feed\_link()](get_feed_link) wp-includes/link-template.php | Retrieves the permalink for the feed type. |
| [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\_post\_permalink()](get_post_permalink) wp-includes/link-template.php | Retrieves the permalink for a post of a custom post type. |
| [\_get\_page\_link()](_get_page_link) wp-includes/link-template.php | Retrieves the page permalink. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [get\_year\_link()](get_year_link) wp-includes/link-template.php | Retrieves the permalink for the year archives. |
| [\_wp\_link\_page()](_wp_link_page) wp-includes/post-template.php | Helper function for [wp\_link\_pages()](wp_link_pages) . |
| [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. |
| [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. |
| [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. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress media_handle_sideload( string[] $file_array, int $post_id, string $desc = null, array $post_data = array() ): int|WP_Error media\_handle\_sideload( string[] $file\_array, int $post\_id, string $desc = null, array $post\_data = array() ): int|WP\_Error
================================================================================================================================
Handles a side-loaded file in the same way as an uploaded file is handled by [media\_handle\_upload()](media_handle_upload) .
`$file_array` string[] Required Array that represents a `$_FILES` upload array. `$post_id` int Optional The post ID the media is associated with. `$desc` string Optional Description of the side-loaded file. Default: `null`
`$post_data` array Optional Post data to override. Default: `array()`
int|[WP\_Error](../classes/wp_error) The ID of the attachment or a [WP\_Error](../classes/wp_error) on failure.
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function media_handle_sideload( $file_array, $post_id = 0, $desc = null, $post_data = array() ) {
$overrides = array( 'test_form' => false );
if ( isset( $post_data['post_date'] ) && substr( $post_data['post_date'], 0, 4 ) > 0 ) {
$time = $post_data['post_date'];
} else {
$post = get_post( $post_id );
if ( $post && substr( $post->post_date, 0, 4 ) > 0 ) {
$time = $post->post_date;
} else {
$time = current_time( 'mysql' );
}
}
$file = wp_handle_sideload( $file_array, $overrides, $time );
if ( isset( $file['error'] ) ) {
return new WP_Error( 'upload_error', $file['error'] );
}
$url = $file['url'];
$type = $file['type'];
$file = $file['file'];
$title = preg_replace( '/\.[^.]+$/', '', wp_basename( $file ) );
$content = '';
// Use image exif/iptc data for title and caption defaults if possible.
$image_meta = wp_read_image_metadata( $file );
if ( $image_meta ) {
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
$title = $image_meta['title'];
}
if ( trim( $image_meta['caption'] ) ) {
$content = $image_meta['caption'];
}
}
if ( isset( $desc ) ) {
$title = $desc;
}
// Construct the attachment array.
$attachment = array_merge(
array(
'post_mime_type' => $type,
'guid' => $url,
'post_parent' => $post_id,
'post_title' => $title,
'post_content' => $content,
),
$post_data
);
// This should never be set as it would then overwrite an existing attachment.
unset( $attachment['ID'] );
// Save the attachment metadata.
$attachment_id = wp_insert_attachment( $attachment, $file, $post_id, true );
if ( ! is_wp_error( $attachment_id ) ) {
wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
}
return $attachment_id;
}
```
| Uses | Description |
| --- | --- |
| [wp\_read\_image\_metadata()](wp_read_image_metadata) wp-admin/includes/image.php | Gets extended image metadata, exif or iptc as available. |
| [wp\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. |
| [wp\_handle\_sideload()](wp_handle_sideload) wp-admin/includes/file.php | Wrapper for [\_wp\_handle\_upload()](_wp_handle_upload) . |
| [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [wp\_insert\_attachment()](wp_insert_attachment) wp-includes/post.php | Inserts an attachment. |
| [wp\_update\_attachment\_metadata()](wp_update_attachment_metadata) wp-includes/post.php | Updates metadata for an attachment. |
| [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [WP\_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. |
| [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. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | The `$post_id` parameter was made optional. |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress wp_dashboard_quick_press( string|false $error_msg = false ) wp\_dashboard\_quick\_press( string|false $error\_msg = false )
===============================================================
The Quick Draft widget display and creation of drafts.
`$error_msg` string|false Optional Error message. 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_quick_press( $error_msg = false ) {
global $post_ID;
if ( ! current_user_can( 'edit_posts' ) ) {
return;
}
// Check if a new auto-draft (= no new post_ID) is needed or if the old can be used.
$last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID.
if ( $last_post_id ) {
$post = get_post( $last_post_id );
if ( empty( $post ) || 'auto-draft' !== $post->post_status ) { // auto-draft doesn't exist anymore.
$post = get_default_post_to_edit( 'post', true );
update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID.
} else {
$post->post_title = ''; // Remove the auto draft title.
}
} else {
$post = get_default_post_to_edit( 'post', true );
$user_id = get_current_user_id();
// Don't create an option if this is a super admin who does not belong to this site.
if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ), true ) ) {
update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID.
}
}
$post_ID = (int) $post->ID;
?>
<form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js">
<?php if ( $error_msg ) : ?>
<div class="error"><?php echo $error_msg; ?></div>
<?php endif; ?>
<div class="input-text-wrap" id="title-wrap">
<label for="title">
<?php
/** This filter is documented in wp-admin/edit-form-advanced.php */
echo apply_filters( 'enter_title_here', __( 'Title' ), $post );
?>
</label>
<input type="text" name="post_title" id="title" autocomplete="off" />
</div>
<div class="textarea-wrap" id="description-wrap">
<label for="content"><?php _e( 'Content' ); ?></label>
<textarea name="content" id="content" placeholder="<?php esc_attr_e( 'What’s on your mind?' ); ?>" class="mceEditor" rows="3" cols="15" autocomplete="off"></textarea>
</div>
<p class="submit">
<input type="hidden" name="action" id="quickpost-action" value="post-quickdraft-save" />
<input type="hidden" name="post_ID" value="<?php echo $post_ID; ?>" />
<input type="hidden" name="post_type" value="post" />
<?php wp_nonce_field( 'add-post' ); ?>
<?php submit_button( __( 'Save Draft' ), 'primary', 'save', false, array( 'id' => 'save-post' ) ); ?>
<br class="clear" />
</p>
</form>
<?php
wp_dashboard_recent_drafts();
}
```
[apply\_filters( 'enter\_title\_here', string $text, WP\_Post $post )](../hooks/enter_title_here)
Filters the title field placeholder text.
| Uses | Description |
| --- | --- |
| [wp\_dashboard\_recent\_drafts()](wp_dashboard_recent_drafts) wp-admin/includes/dashboard.php | Show recent drafts of the user on the dashboard. |
| [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. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [get\_blogs\_of\_user()](get_blogs_of_user) wp-includes/user.php | Gets the sites a user belongs to. |
| [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. |
| [update\_user\_option()](update_user_option) wp-includes/user.php | Updates user option with global blog capability. |
| [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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| [get\_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. |
| [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. |
| [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. |
| Used By | Description |
| --- | --- |
| [wp\_dashboard\_quick\_press\_output()](wp_dashboard_quick_press_output) wp-admin/includes/deprecated.php | Output the QuickPress dashboard widget. |
| Version | Description |
| --- | --- |
| [3.8.0](https://developer.wordpress.org/reference/since/3.8.0/) | Introduced. |
| programming_docs |
wordpress get_tag_template(): string get\_tag\_template(): string
============================
Retrieves path of tag template in current or parent template.
The hierarchy for this template looks like:
1. tag-{slug}.php
2. tag-{id}.php
3. tag.php
An example of this is:
1. tag-wordpress.php
2. tag-3.php
3. tag.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 ‘tag’.
* [get\_query\_template()](get_query_template)
string Full path to tag template file.
File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
```
function get_tag_template() {
$tag = get_queried_object();
$templates = array();
if ( ! empty( $tag->slug ) ) {
$slug_decoded = urldecode( $tag->slug );
if ( $slug_decoded !== $tag->slug ) {
$templates[] = "tag-{$slug_decoded}.php";
}
$templates[] = "tag-{$tag->slug}.php";
$templates[] = "tag-{$tag->term_id}.php";
}
$templates[] = 'tag.php';
return get_query_template( 'tag', $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 `tag-{slug}.php` was added to the top of the template hierarchy when the tag slug contains multibyte characters. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress confirm_delete_users( array $users ) confirm\_delete\_users( array $users )
======================================
`$users` array Required This function is used to display a confirmation on the Multisite Users administration panel before deleting users.
Parameter `$users` is An array of IDs of users to delete. Note that this parameter is currently not used by the function. $\_POST['allusers'] is used instead. See [ticket 17905](https://core.trac.wordpress.org/ticket/17905). Default is none.
This function returns FALSE if $users is not an array. Otherwise, TRUE. File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function confirm_delete_users( $users ) {
$current_user = wp_get_current_user();
if ( ! is_array( $users ) || empty( $users ) ) {
return false;
}
?>
<h1><?php esc_html_e( 'Users' ); ?></h1>
<?php if ( 1 === count( $users ) ) : ?>
<p><?php _e( 'You have chosen to delete the user from all networks and sites.' ); ?></p>
<?php else : ?>
<p><?php _e( 'You have chosen to delete the following users from all networks and sites.' ); ?></p>
<?php endif; ?>
<form action="users.php?action=dodelete" method="post">
<input type="hidden" name="dodelete" />
<?php
wp_nonce_field( 'ms-users-delete' );
$site_admins = get_super_admins();
$admin_out = '<option value="' . esc_attr( $current_user->ID ) . '">' . $current_user->user_login . '</option>';
?>
<table class="form-table" role="presentation">
<?php
$allusers = (array) $_POST['allusers'];
foreach ( $allusers as $user_id ) {
if ( '' !== $user_id && '0' !== $user_id ) {
$delete_user = get_userdata( $user_id );
if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) {
wp_die(
sprintf(
/* translators: %s: User login. */
__( 'Warning! User %s cannot be deleted.' ),
$delete_user->user_login
)
);
}
if ( in_array( $delete_user->user_login, $site_admins, true ) ) {
wp_die(
sprintf(
/* translators: %s: User login. */
__( 'Warning! User cannot be deleted. The user %s is a network administrator.' ),
'<em>' . $delete_user->user_login . '</em>'
)
);
}
?>
<tr>
<th scope="row"><?php echo $delete_user->user_login; ?>
<?php echo '<input type="hidden" name="user[]" value="' . esc_attr( $user_id ) . '" />' . "\n"; ?>
</th>
<?php
$blogs = get_blogs_of_user( $user_id, true );
if ( ! empty( $blogs ) ) {
?>
<td><fieldset><p><legend>
<?php
printf(
/* translators: %s: User login. */
__( 'What should be done with content owned by %s?' ),
'<em>' . $delete_user->user_login . '</em>'
);
?>
</legend></p>
<?php
foreach ( (array) $blogs as $key => $details ) {
$blog_users = get_users(
array(
'blog_id' => $details->userblog_id,
'fields' => array( 'ID', 'user_login' ),
)
);
if ( is_array( $blog_users ) && ! empty( $blog_users ) ) {
$user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
$user_dropdown = '<label for="reassign_user" class="screen-reader-text">' . __( 'Select a user' ) . '</label>';
$user_dropdown .= "<select name='blog[$user_id][$key]' id='reassign_user'>";
$user_list = '';
foreach ( $blog_users as $user ) {
if ( ! in_array( (int) $user->ID, $allusers, true ) ) {
$user_list .= "<option value='{$user->ID}'>{$user->user_login}</option>";
}
}
if ( '' === $user_list ) {
$user_list = $admin_out;
}
$user_dropdown .= $user_list;
$user_dropdown .= "</select>\n";
?>
<ul style="list-style:none;">
<li>
<?php
/* translators: %s: Link to user's site. */
printf( __( 'Site: %s' ), $user_site );
?>
</li>
<li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID; ?>]" value="delete" checked="checked" />
<?php _e( 'Delete all content.' ); ?></label></li>
<li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID; ?>]" value="reassign" />
<?php _e( 'Attribute all content to:' ); ?></label>
<?php echo $user_dropdown; ?></li>
</ul>
<?php
}
}
echo '</fieldset></td></tr>';
} else {
?>
<td><p><?php _e( 'User has no sites or content and will be deleted.' ); ?></p></td>
<?php } ?>
</tr>
<?php
}
}
?>
</table>
<?php
/** This action is documented in wp-admin/users.php */
do_action( 'delete_user_form', $current_user, $allusers );
if ( 1 === count( $users ) ) :
?>
<p><?php _e( 'Once you hit “Confirm Deletion”, the user will be permanently removed.' ); ?></p>
<?php else : ?>
<p><?php _e( 'Once you hit “Confirm Deletion”, these users will be permanently removed.' ); ?></p>
<?php
endif;
submit_button( __( 'Confirm Deletion' ), 'primary' );
?>
</form>
<?php
return true;
}
```
[do\_action( 'delete\_user\_form', WP\_User $current\_user, int[] $userids )](../hooks/delete_user_form)
Fires at the end of the delete users form prior to the confirm button.
| Uses | Description |
| --- | --- |
| [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). |
| [get\_super\_admins()](get_super_admins) wp-includes/capabilities.php | Retrieves a list of super admins. |
| [esc\_html\_e()](esc_html_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in HTML output. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
| [get\_home\_url()](get_home_url) wp-includes/link-template.php | Retrieves the URL for a given site where the front end is accessible. |
| [get\_blogs\_of\_user()](get_blogs_of_user) wp-includes/user.php | Gets the sites a user belongs to. |
| [get\_users()](get_users) wp-includes/user.php | Retrieves list of users matching criteria. |
| [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\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [wp\_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. |
wordpress rest_output_rsd() rest\_output\_rsd()
===================
Adds the REST API URL to the WP RSD endpoint.
* [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_rsd() {
$api_root = get_rest_url();
if ( empty( $api_root ) ) {
return;
}
?>
<api name="WP-API" blogID="1" preferred="false" apiLink="<?php echo esc_url( $api_root ); ?>" />
<?php
}
```
| Uses | Description |
| --- | --- |
| [get\_rest\_url()](get_rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint on a site. |
| [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 wp_ajax_parse_embed() wp\_ajax\_parse\_embed()
========================
Apply [embed] Ajax handlers to a string.
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_embed() {
global $post, $wp_embed, $content_width;
if ( empty( $_POST['shortcode'] ) ) {
wp_send_json_error();
}
$post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
if ( $post_id > 0 ) {
$post = get_post( $post_id );
if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) {
wp_send_json_error();
}
setup_postdata( $post );
} elseif ( ! current_user_can( 'edit_posts' ) ) { // See WP_oEmbed_Controller::get_proxy_item_permissions_check().
wp_send_json_error();
}
$shortcode = wp_unslash( $_POST['shortcode'] );
preg_match( '/' . get_shortcode_regex() . '/s', $shortcode, $matches );
$atts = shortcode_parse_atts( $matches[3] );
if ( ! empty( $matches[5] ) ) {
$url = $matches[5];
} elseif ( ! empty( $atts['src'] ) ) {
$url = $atts['src'];
} else {
$url = '';
}
$parsed = false;
$wp_embed->return_false_on_fail = true;
if ( 0 === $post_id ) {
/*
* Refresh oEmbeds cached outside of posts that are past their TTL.
* Posts are excluded because they have separate logic for refreshing
* their post meta caches. See WP_Embed::cache_oembed().
*/
$wp_embed->usecache = false;
}
if ( is_ssl() && 0 === strpos( $url, 'http://' ) ) {
// Admin is ssl and the user pasted non-ssl URL.
// Check if the provider supports ssl embeds and use that for the preview.
$ssl_shortcode = preg_replace( '%^(\\[embed[^\\]]*\\])http://%i', '$1https://', $shortcode );
$parsed = $wp_embed->run_shortcode( $ssl_shortcode );
if ( ! $parsed ) {
$no_ssl_support = true;
}
}
// Set $content_width so any embeds fit in the destination iframe.
if ( isset( $_POST['maxwidth'] ) && is_numeric( $_POST['maxwidth'] ) && $_POST['maxwidth'] > 0 ) {
if ( ! isset( $content_width ) ) {
$content_width = (int) $_POST['maxwidth'];
} else {
$content_width = min( $content_width, (int) $_POST['maxwidth'] );
}
}
if ( $url && ! $parsed ) {
$parsed = $wp_embed->run_shortcode( $shortcode );
}
if ( ! $parsed ) {
wp_send_json_error(
array(
'type' => 'not-embeddable',
/* translators: %s: URL that could not be embedded. */
'message' => sprintf( __( '%s failed to embed.' ), '<code>' . esc_html( $url ) . '</code>' ),
)
);
}
if ( has_shortcode( $parsed, 'audio' ) || has_shortcode( $parsed, 'video' ) ) {
$styles = '';
$mce_styles = wpview_media_sandbox_styles();
foreach ( $mce_styles as $style ) {
$styles .= sprintf( '<link rel="stylesheet" href="%s" />', $style );
}
$html = do_shortcode( $parsed );
global $wp_scripts;
if ( ! empty( $wp_scripts ) ) {
$wp_scripts->done = array();
}
ob_start();
wp_print_scripts( array( 'mediaelement-vimeo', 'wp-mediaelement' ) );
$scripts = ob_get_clean();
$parsed = $styles . $html . $scripts;
}
if ( ! empty( $no_ssl_support ) || ( is_ssl() && ( preg_match( '%<(iframe|script|embed) [^>]*src="http://%', $parsed ) ||
preg_match( '%<link [^>]*href="http://%', $parsed ) ) ) ) {
// Admin is ssl and the embed is not. Iframes, scripts, and other "active content" will be blocked.
wp_send_json_error(
array(
'type' => 'not-ssl',
'message' => __( 'This preview is unavailable in the editor.' ),
)
);
}
$return = array(
'body' => $parsed,
'attr' => $wp_embed->last_attr,
);
if ( strpos( $parsed, 'class="wp-embedded-content' ) ) {
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
$script_src = includes_url( 'js/wp-embed.js' );
} else {
$script_src = includes_url( 'js/wp-embed.min.js' );
}
$return['head'] = '<script src="' . $script_src . '"></script>';
$return['sandbox'] = true;
}
wp_send_json_success( $return );
}
```
| 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. |
| [WP\_Embed::run\_shortcode()](../classes/wp_embed/run_shortcode) wp-includes/class-wp-embed.php | Processes the [embed] shortcode. |
| [do\_shortcode()](do_shortcode) wp-includes/shortcodes.php | Searches content for shortcodes and filter shortcodes through their hooks. |
| [has\_shortcode()](has_shortcode) wp-includes/shortcodes.php | Determines whether the passed content contains the specified shortcode. |
| [shortcode\_parse\_atts()](shortcode_parse_atts) wp-includes/shortcodes.php | Retrieves all attributes from the shortcodes tag. |
| [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. |
| [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. |
| [get\_shortcode\_regex()](get_shortcode_regex) wp-includes/shortcodes.php | Retrieves the shortcode regular expression for searching. |
| [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. |
| [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. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [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. |
| [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 display_header_text(): bool display\_header\_text(): bool
=============================
Whether to display the header text.
bool
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function display_header_text() {
if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) {
return false;
}
$text_color = get_theme_mod( 'header_textcolor', get_theme_support( 'custom-header', 'default-text-color' ) );
return 'blank' !== $text_color;
}
```
| Uses | Description |
| --- | --- |
| [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. |
| [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| Used By | Description |
| --- | --- |
| [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::js\_1()](../classes/custom_image_header/js_1) wp-admin/includes/class-custom-image-header.php | Display JavaScript based on Step 1 and 3. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress update_comment_meta( int $comment_id, string $meta_key, mixed $meta_value, mixed $prev_value = '' ): int|bool update\_comment\_meta( int $comment\_id, string $meta\_key, mixed $meta\_value, mixed $prev\_value = '' ): int|bool
===================================================================================================================
Updates comment meta field based on comment ID.
Use the $prev\_value parameter to differentiate between meta fields with the same key and comment ID.
If the meta field for the comment does not exist, it will be added.
`$comment_id` int Required Comment 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/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function update_comment_meta( $comment_id, $meta_key, $meta_value, $prev_value = '' ) {
return update_metadata( 'comment', $comment_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\_update\_comment()](wp_update_comment) wp-includes/comment.php | Updates an existing comment in the database. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress wpmu_create_user( string $user_name, string $password, string $email ): int|false wpmu\_create\_user( string $user\_name, string $password, string $email ): int|false
====================================================================================
Creates a user.
This function runs when a user self-registers as well as when a Super Admin creates a new user. Hook to [‘wpmu\_new\_user’](../hooks/wpmu_new_user) for events that should affect all new users, but only on Multisite (otherwise use [‘user\_register’](../hooks/user_register)).
`$user_name` string Required The new user's login name. `$password` string Required The new user's password. `$email` string Required The new user's email address. int|false Returns false on failure, or int $user\_id on success
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function wpmu_create_user( $user_name, $password, $email ) {
$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
$user_id = wp_create_user( $user_name, $password, $email );
if ( is_wp_error( $user_id ) ) {
return false;
}
// Newly created users have no roles or caps until they are added to a blog.
delete_user_option( $user_id, 'capabilities' );
delete_user_option( $user_id, 'user_level' );
/**
* Fires immediately after a new user is created.
*
* @since MU (3.0.0)
*
* @param int $user_id User ID.
*/
do_action( 'wpmu_new_user', $user_id );
return $user_id;
}
```
[do\_action( 'wpmu\_new\_user', int $user\_id )](../hooks/wpmu_new_user)
Fires immediately after a new user is created.
| Uses | Description |
| --- | --- |
| [sanitize\_user()](sanitize_user) wp-includes/formatting.php | Sanitizes a username, stripping out unsafe characters. |
| [wp\_create\_user()](wp_create_user) wp-includes/user.php | Provides a simpler way of inserting a user into the database. |
| [delete\_user\_option()](delete_user_option) wp-includes/user.php | Deletes user option with global blog capability. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [WP\_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. |
| [wpmu\_activate\_signup()](wpmu_activate_signup) wp-includes/ms-functions.php | Activates a signup. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
| programming_docs |
wordpress post_submit_meta_box( WP_Post $post, array $args = array() ) post\_submit\_meta\_box( WP\_Post $post, array $args = array() )
================================================================
Displays post submit form fields.
`$post` [WP\_Post](../classes/wp_post) Required Current post object. `$args` array Optional Array of arguments for building the post submit meta box.
* `id`stringMeta box `'id'` attribute.
* `title`stringMeta box title.
* `callback`callableMeta box display callback.
* `args`arrayExtra meta box arguments.
Default: `array()`
File: `wp-admin/includes/meta-boxes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/meta-boxes.php/)
```
function post_submit_meta_box( $post, $args = array() ) {
global $action;
$post_id = (int) $post->ID;
$post_type = $post->post_type;
$post_type_object = get_post_type_object( $post_type );
$can_publish = current_user_can( $post_type_object->cap->publish_posts );
?>
<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="minor-publishing-actions">
<div id="save-action">
<?php
if ( ! in_array( $post->post_status, array( 'publish', 'future', 'pending' ), true ) ) {
$private_style = '';
if ( 'private' === $post->post_status ) {
$private_style = 'style="display:none"';
}
?>
<input <?php echo $private_style; ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save Draft' ); ?>" class="button" />
<span class="spinner"></span>
<?php } elseif ( 'pending' === $post->post_status && $can_publish ) { ?>
<input type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save as Pending' ); ?>" class="button" />
<span class="spinner"></span>
<?php } ?>
</div>
<?php
if ( is_post_type_viewable( $post_type_object ) ) :
?>
<div id="preview-action">
<?php
$preview_link = esc_url( get_preview_post_link( $post ) );
if ( 'publish' === $post->post_status ) {
$preview_button_text = __( 'Preview Changes' );
} else {
$preview_button_text = __( 'Preview' );
}
$preview_button = sprintf(
'%1$s<span class="screen-reader-text"> %2$s</span>',
$preview_button_text,
/* translators: Accessibility text. */
__( '(opens in a new tab)' )
);
?>
<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo $post_id; ?>" id="post-preview"><?php echo $preview_button; ?></a>
<input type="hidden" name="wp-preview" id="wp-preview" value="" />
</div>
<?php
endif;
/**
* Fires after the Save Draft (or Save as Pending) and Preview (or Preview Changes) buttons
* in the Publish meta box.
*
* @since 4.4.0
*
* @param WP_Post $post WP_Post object for the current post.
*/
do_action( 'post_submitbox_minor_actions', $post );
?>
<div class="clear"></div>
</div>
<div id="misc-publishing-actions">
<div class="misc-pub-section misc-pub-post-status">
<?php _e( 'Status:' ); ?>
<span id="post-status-display">
<?php
switch ( $post->post_status ) {
case 'private':
_e( 'Privately Published' );
break;
case 'publish':
_e( 'Published' );
break;
case 'future':
_e( 'Scheduled' );
break;
case 'pending':
_e( 'Pending Review' );
break;
case 'draft':
case 'auto-draft':
_e( 'Draft' );
break;
}
?>
</span>
<?php
if ( 'publish' === $post->post_status || 'private' === $post->post_status || $can_publish ) {
$private_style = '';
if ( 'private' === $post->post_status ) {
$private_style = 'style="display:none"';
}
?>
<a href="#post_status" <?php echo $private_style; ?> class="edit-post-status hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a>
<div id="post-status-select" class="hide-if-js">
<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ( 'auto-draft' === $post->post_status ) ? 'draft' : $post->post_status ); ?>" />
<label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ); ?></label>
<select name="post_status" id="post_status">
<?php if ( 'publish' === $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e( 'Published' ); ?></option>
<?php elseif ( 'private' === $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e( 'Privately Published' ); ?></option>
<?php elseif ( 'future' === $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e( 'Scheduled' ); ?></option>
<?php endif; ?>
<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e( 'Pending Review' ); ?></option>
<?php if ( 'auto-draft' === $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
<?php else : ?>
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
<?php endif; ?>
</select>
<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e( 'OK' ); ?></a>
<a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
</div>
<?php
}
?>
</div>
<div class="misc-pub-section misc-pub-visibility" id="visibility">
<?php _e( 'Visibility:' ); ?>
<span id="post-visibility-display">
<?php
if ( 'private' === $post->post_status ) {
$post->post_password = '';
$visibility = 'private';
$visibility_trans = __( 'Private' );
} elseif ( ! empty( $post->post_password ) ) {
$visibility = 'password';
$visibility_trans = __( 'Password protected' );
} elseif ( 'post' === $post_type && is_sticky( $post_id ) ) {
$visibility = 'public';
$visibility_trans = __( 'Public, Sticky' );
} else {
$visibility = 'public';
$visibility_trans = __( 'Public' );
}
echo esc_html( $visibility_trans );
?>
</span>
<?php if ( $can_publish ) { ?>
<a href="#visibility" class="edit-visibility hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a>
<div id="post-visibility-select" class="hide-if-js">
<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr( $post->post_password ); ?>" />
<?php if ( 'post' === $post_type ) : ?>
<input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked( is_sticky( $post_id ) ); ?> />
<?php endif; ?>
<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e( 'Public' ); ?></label><br />
<?php if ( 'post' === $post_type && current_user_can( 'edit_others_posts' ) ) : ?>
<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post_id ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span>
<?php endif; ?>
<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e( 'Password protected' ); ?></label><br />
<span id="password-span"><label for="post_password"><?php _e( 'Password:' ); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr( $post->post_password ); ?>" maxlength="255" /><br /></span>
<input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e( 'Private' ); ?></label><br />
<p>
<a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e( 'OK' ); ?></a>
<a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
</p>
</div>
<?php } ?>
</div>
<?php
/* translators: Publish box date string. 1: Date, 2: Time. See https://www.php.net/manual/datetime.format.php */
$date_string = __( '%1$s at %2$s' );
/* translators: Publish box date format, see https://www.php.net/manual/datetime.format.php */
$date_format = _x( 'M j, Y', 'publish box date format' );
/* translators: Publish box time format, see https://www.php.net/manual/datetime.format.php */
$time_format = _x( 'H:i', 'publish box time format' );
if ( 0 !== $post_id ) {
if ( 'future' === $post->post_status ) { // Scheduled for publishing at a future date.
/* translators: Post date information. %s: Date on which the post is currently scheduled to be published. */
$stamp = __( 'Scheduled for: %s' );
} elseif ( 'publish' === $post->post_status || 'private' === $post->post_status ) { // Already published.
/* translators: Post date information. %s: Date on which the post was published. */
$stamp = __( 'Published on: %s' );
} elseif ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { // Draft, 1 or more saves, no date specified.
$stamp = __( 'Publish <b>immediately</b>' );
} elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // Draft, 1 or more saves, future date specified.
/* translators: Post date information. %s: Date on which the post is to be published. */
$stamp = __( 'Schedule for: %s' );
} else { // Draft, 1 or more saves, date specified.
/* translators: Post date information. %s: Date on which the post is to be published. */
$stamp = __( 'Publish on: %s' );
}
$date = sprintf(
$date_string,
date_i18n( $date_format, strtotime( $post->post_date ) ),
date_i18n( $time_format, strtotime( $post->post_date ) )
);
} else { // Draft (no saves, and thus no date specified).
$stamp = __( 'Publish <b>immediately</b>' );
$date = sprintf(
$date_string,
date_i18n( $date_format, strtotime( current_time( 'mysql' ) ) ),
date_i18n( $time_format, strtotime( current_time( 'mysql' ) ) )
);
}
if ( ! empty( $args['args']['revisions_count'] ) ) :
?>
<div class="misc-pub-section misc-pub-revisions">
<?php
/* translators: Post revisions heading. %s: The number of available revisions. */
printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' );
?>
<a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><span aria-hidden="true"><?php _ex( 'Browse', 'revisions' ); ?></span> <span class="screen-reader-text"><?php _e( 'Browse revisions' ); ?></span></a>
</div>
<?php
endif;
if ( $can_publish ) : // Contributors don't get to choose the date of publish.
?>
<div class="misc-pub-section curtime misc-pub-curtime">
<span id="timestamp">
<?php printf( $stamp, '<b>' . $date . '</b>' ); ?>
</span>
<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" role="button">
<span aria-hidden="true"><?php _e( 'Edit' ); ?></span>
<span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span>
</a>
<fieldset id="timestampdiv" class="hide-if-js">
<legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
<?php touch_time( ( 'edit' === $action ), 1 ); ?>
</fieldset>
</div>
<?php
endif;
if ( 'draft' === $post->post_status && get_post_meta( $post_id, '_customize_changeset_uuid', true ) ) :
?>
<div class="notice notice-info notice-alt inline">
<p>
<?php
printf(
/* translators: %s: URL to the Customizer. */
__( 'This draft comes from your <a href="%s">unpublished customization changes</a>. You can edit, but there is no need to publish now. It will be published automatically with those changes.' ),
esc_url(
add_query_arg(
'changeset_uuid',
rawurlencode( get_post_meta( $post_id, '_customize_changeset_uuid', true ) ),
admin_url( 'customize.php' )
)
)
);
?>
</p>
</div>
<?php
endif;
/**
* Fires after the post time/date setting in the Publish meta box.
*
* @since 2.9.0
* @since 4.4.0 Added the `$post` parameter.
*
* @param WP_Post $post WP_Post object for the current post.
*/
do_action( 'post_submitbox_misc_actions', $post );
?>
</div>
<div class="clear"></div>
</div>
<div id="major-publishing-actions">
<?php
/**
* Fires at the beginning of the publishing actions section of the Publish meta box.
*
* @since 2.7.0
* @since 4.9.0 Added the `$post` parameter.
*
* @param WP_Post|null $post WP_Post object for the current post on Edit Post screen,
* null on Edit Link screen.
*/
do_action( 'post_submitbox_start', $post );
?>
<div id="delete-action">
<?php
if ( current_user_can( 'delete_post', $post_id ) ) {
if ( ! EMPTY_TRASH_DAYS ) {
$delete_text = __( 'Delete permanently' );
} else {
$delete_text = __( 'Move to Trash' );
}
?>
<a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post_id ); ?>"><?php echo $delete_text; ?></a>
<?php
}
?>
</div>
<div id="publishing-action">
<span class="spinner"></span>
<?php
if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private' ), true ) || 0 === $post_id ) {
if ( $can_publish ) :
if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) :
?>
<input name="original_publish" type="hidden" id="original_publish" value="<?php echo esc_attr_x( 'Schedule', 'post action/button label' ); ?>" />
<?php submit_button( _x( 'Schedule', 'post action/button label' ), 'primary large', 'publish', false ); ?>
<?php
else :
?>
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Publish' ); ?>" />
<?php submit_button( __( 'Publish' ), 'primary large', 'publish', false ); ?>
<?php
endif;
else :
?>
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Submit for Review' ); ?>" />
<?php submit_button( __( 'Submit for Review' ), 'primary large', 'publish', false ); ?>
<?php
endif;
} else {
?>
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" />
<?php submit_button( __( 'Update' ), 'primary large', 'save', false, array( 'id' => 'publish' ) ); ?>
<?php
}
?>
</div>
<div class="clear"></div>
</div>
</div>
<?php
}
```
[do\_action( 'post\_submitbox\_minor\_actions', WP\_Post $post )](../hooks/post_submitbox_minor_actions)
Fires after the Save Draft (or Save as Pending) and Preview (or Preview Changes) buttons in the Publish meta box.
[do\_action( 'post\_submitbox\_misc\_actions', WP\_Post $post )](../hooks/post_submitbox_misc_actions)
Fires after the post time/date setting in the Publish meta box.
[do\_action( 'post\_submitbox\_start', WP\_Post|null $post )](../hooks/post_submitbox_start)
Fires at the beginning of the publishing actions section of the Publish meta box.
| Uses | Description |
| --- | --- |
| [get\_preview\_post\_link()](get_preview_post_link) wp-includes/link-template.php | Retrieves the URL used for the post preview. |
| [\_ex()](_ex) wp-includes/l10n.php | Displays translated string with gettext context. |
| [checked()](checked) wp-includes/general-template.php | Outputs the HTML checked attribute. |
| [selected()](selected) wp-includes/general-template.php | Outputs the HTML selected attribute. |
| [is\_post\_type\_viewable()](is_post_type_viewable) wp-includes/post.php | Determines whether a post type is considered “viewable”. |
| [get\_edit\_post\_link()](get_edit_post_link) wp-includes/link-template.php | Retrieves the edit post link for post. |
| [esc\_attr\_x()](esc_attr_x) wp-includes/l10n.php | Translates string with gettext context, and escapes it for safe use in an attribute. |
| [get\_delete\_post\_link()](get_delete_post_link) wp-includes/link-template.php | Retrieves the delete posts link for post. |
| [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. |
| [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. |
| [is\_sticky()](is_sticky) wp-includes/post.php | Determines whether a post is sticky. |
| [touch\_time()](touch_time) wp-admin/includes/template.php | Prints out HTML form date elements for editing post or comment publish date. |
| [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [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. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_get_global_styles( array $path = array(), array $context = array() ): array wp\_get\_global\_styles( array $path = array(), array $context = array() ): array
=================================================================================
Gets the styles resulting of merging core, theme, and user data.
`$path` array Optional Path to the specific style to retrieve. Optional.
If empty, will return all styles. Default: `array()`
`$context` array Optional Metadata to know where to retrieve the $path from. Optional.
* `block_name`stringWhich block to retrieve the styles from.
If empty, it'll return the styles 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 styles 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_styles( $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';
}
$styles = WP_Theme_JSON_Resolver::get_merged_data( $origin )->get_raw_data()['styles'];
return _wp_array_get( $styles, $path, $styles );
}
```
| 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. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
| programming_docs |
wordpress wp_dependencies_unique_hosts(): string[] wp\_dependencies\_unique\_hosts(): string[]
===========================================
Retrieves a list of unique hosts of all enqueued scripts and styles.
string[] A list of unique hosts of enqueued scripts and styles.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_dependencies_unique_hosts() {
global $wp_scripts, $wp_styles;
$unique_hosts = array();
foreach ( array( $wp_scripts, $wp_styles ) as $dependencies ) {
if ( $dependencies instanceof WP_Dependencies && ! empty( $dependencies->queue ) ) {
foreach ( $dependencies->queue as $handle ) {
if ( ! isset( $dependencies->registered[ $handle ] ) ) {
continue;
}
/* @var _WP_Dependency $dependency */
$dependency = $dependencies->registered[ $handle ];
$parsed = wp_parse_url( $dependency->src );
if ( ! empty( $parsed['host'] )
&& ! in_array( $parsed['host'], $unique_hosts, true ) && $parsed['host'] !== $_SERVER['SERVER_NAME']
) {
$unique_hosts[] = $parsed['host'];
}
}
}
}
return $unique_hosts;
}
```
| Uses | Description |
| --- | --- |
| [wp\_parse\_url()](wp_parse_url) wp-includes/http.php | A wrapper for PHP’s parse\_url() function that handles consistency in the return values across PHP versions. |
| Used By | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress get_gmt_from_date( string $string, string $format = 'Y-m-d H:i:s' ): string get\_gmt\_from\_date( string $string, string $format = 'Y-m-d H:i:s' ): string
==============================================================================
Given a date in the timezone of the site, returns that date in UTC.
Requires and returns a date in the Y-m-d H:i:s format.
Return format can be overridden using the $format parameter.
`$string` string Required The date to be converted, in the timezone of the site. `$format` string Optional The format string for the returned date. Default: `'Y-m-d H:i:s'`
string Formatted version of the date, in UTC.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function get_gmt_from_date( $string, $format = 'Y-m-d H:i:s' ) {
$datetime = date_create( $string, wp_timezone() );
if ( false === $datetime ) {
return gmdate( $format, 0 );
}
return $datetime->setTimezone( new DateTimeZone( 'UTC' ) )->format( $format );
}
```
| Uses | Description |
| --- | --- |
| [wp\_timezone()](wp_timezone) wp-includes/functions.php | Retrieves the timezone of the site as a `DateTimeZone` object. |
| Used By | Description |
| --- | --- |
| [WP\_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. |
| [rest\_get\_date\_with\_gmt()](rest_get_date_with_gmt) wp-includes/rest-api.php | Parses a date into both its local and UTC equivalent, in MySQL datetime format. |
| [\_wp\_translate\_postdata()](_wp_translate_postdata) wp-admin/includes/post.php | Renames `$_POST` data from form names to DB post columns. |
| [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. |
| [\_future\_post\_hook()](_future_post_hook) wp-includes/post.php | Hook used to schedule publication for a post marked for the future. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [wp\_xmlrpc\_server::\_convert\_date\_gmt()](../classes/wp_xmlrpc_server/_convert_date_gmt) wp-includes/class-wp-xmlrpc-server.php | Convert a WordPress GMT date string to an [IXR\_Date](../classes/ixr_date) object. |
| [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. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress get_stylesheet(): string get\_stylesheet(): string
=========================
Retrieves name of the current stylesheet.
The theme name that is currently set as the front end theme.
For all intents and purposes, the template name and the stylesheet name are going to be the same for most cases.
string Stylesheet name.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_stylesheet() {
/**
* Filters the name of current stylesheet.
*
* @since 1.5.0
*
* @param string $stylesheet Name of the current stylesheet.
*/
return apply_filters( 'stylesheet', get_option( 'stylesheet' ) );
}
```
[apply\_filters( 'stylesheet', string $stylesheet )](../hooks/stylesheet)
Filters the name of current stylesheet.
| 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\_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). |
| [\_register\_theme\_block\_patterns()](_register_theme_block_patterns) wp-includes/block-patterns.php | Register any patterns that the active theme may provide under its `./patterns/` directory. Each pattern is defined as a PHP file and defines its metadata using plugin-style headers. The minimum required definition is: |
| [wp\_get\_global\_stylesheet()](wp_get_global_stylesheet) wp-includes/global-styles-and-settings.php | Returns the stylesheet resulting of merging core, theme, and user data. |
| [WP\_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. |
| [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. |
| [block\_template\_part()](block_template_part) wp-includes/block-template-utils.php | Prints a block template part. |
| [\_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. |
| [get\_block\_theme\_folders()](get_block_theme_folders) wp-includes/block-template-utils.php | For backward compatibility reasons, block themes might be using block-templates or block-template-parts, this function ensures we fallback to these folders properly. |
| [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. |
| [wp\_update\_custom\_css\_post()](wp_update_custom_css_post) wp-includes/theme.php | Updates the `custom_css` post for a given theme. |
| [wp\_get\_custom\_css\_post()](wp_get_custom_css_post) wp-includes/theme.php | Fetches the `custom_css` post for a given theme. |
| [wp\_get\_custom\_css()](wp_get_custom_css) wp-includes/theme.php | Fetches the saved Custom CSS content for rendering. |
| [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. |
| [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::bulk\_upgrade()](../classes/theme_upgrader/bulk_upgrade) wp-admin/includes/class-theme-upgrader.php | Upgrade several themes at once. |
| [wp\_prepare\_themes\_for\_js()](wp_prepare_themes_for_js) wp-admin/includes/theme.php | Prepares themes for JavaScript. |
| [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. |
| [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::customize\_set\_last\_used()](../classes/custom_image_header/customize_set_last_used) wp-admin/includes/class-custom-image-header.php | Updates the last-used postmeta on a header image attachment after saving a new header image via the Customizer. |
| [Custom\_Image\_Header::get\_uploaded\_header\_images()](../classes/custom_image_header/get_uploaded_header_images) wp-admin/includes/class-custom-image-header.php | Gets the previously uploaded header images. |
| [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). |
| [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::\_\_construct()](../classes/wp_customize_manager/__construct) wp-includes/class-wp-customize-manager.php | Constructor. |
| [validate\_current\_theme()](validate_current_theme) wp-includes/theme.php | Checks that the active theme has the required files. |
| [get\_stylesheet\_directory()](get_stylesheet_directory) wp-includes/theme.php | Retrieves stylesheet directory path for the active theme. |
| [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) wp-includes/theme.php | Retrieves stylesheet directory URI for the active theme. |
| [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\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_search_link( string $query = '' ): string get\_search\_link( string $query = '' ): string
===============================================
Retrieves the permalink for a search.
`$query` string Optional The query string to use. If empty the current query is used. Default: `''`
string The search permalink.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_search_link( $query = '' ) {
global $wp_rewrite;
if ( empty( $query ) ) {
$search = get_search_query( false );
} else {
$search = stripslashes( $query );
}
$permastruct = $wp_rewrite->get_search_permastruct();
if ( empty( $permastruct ) ) {
$link = home_url( '?s=' . urlencode( $search ) );
} else {
$search = urlencode( $search );
$search = str_replace( '%2F', '/', $search ); // %2F(/) is not valid within a URL, send it un-encoded.
$link = str_replace( '%search%', $search, $permastruct );
$link = home_url( user_trailingslashit( $link, 'search' ) );
}
/**
* Filters the search permalink.
*
* @since 3.0.0
*
* @param string $link Search permalink.
* @param string $search The URL-encoded search term.
*/
return apply_filters( 'search_link', $link, $search );
}
```
[apply\_filters( 'search\_link', string $link, string $search )](../hooks/search_link)
Filters the search permalink.
| Uses | Description |
| --- | --- |
| [get\_search\_query()](get_search_query) wp-includes/general-template.php | Retrieves the contents of the search WordPress query variable. |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [WP\_Rewrite::get\_search\_permastruct()](../classes/wp_rewrite/get_search_permastruct) wp-includes/class-wp-rewrite.php | Retrieves the search permalink structure. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [get\_search\_feed\_link()](get_search_feed_link) wp-includes/link-template.php | Retrieves the permalink for the search results feed. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_update_nav_menu_object( int $menu_id, array $menu_data = array() ): int|WP_Error wp\_update\_nav\_menu\_object( int $menu\_id, array $menu\_data = array() ): int|WP\_Error
==========================================================================================
Saves the properties of a menu or create a new menu with those properties.
Note that `$menu_data` is expected to be pre-slashed.
`$menu_id` int Required The ID of the menu or "0" to create a new menu. `$menu_data` array Optional The array of menu data. Default: `array()`
int|[WP\_Error](../classes/wp_error) Menu ID on success, [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_object( $menu_id = 0, $menu_data = array() ) {
// expected_slashed ($menu_data)
$menu_id = (int) $menu_id;
$_menu = wp_get_nav_menu_object( $menu_id );
$args = array(
'description' => ( isset( $menu_data['description'] ) ? $menu_data['description'] : '' ),
'name' => ( isset( $menu_data['menu-name'] ) ? $menu_data['menu-name'] : '' ),
'parent' => ( isset( $menu_data['parent'] ) ? (int) $menu_data['parent'] : 0 ),
'slug' => null,
);
// Double-check that we're not going to have one menu take the name of another.
$_possible_existing = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' );
if (
$_possible_existing &&
! is_wp_error( $_possible_existing ) &&
isset( $_possible_existing->term_id ) &&
$_possible_existing->term_id != $menu_id
) {
return new WP_Error(
'menu_exists',
sprintf(
/* translators: %s: Menu name. */
__( 'The menu name %s conflicts with another menu name. Please try another.' ),
'<strong>' . esc_html( $menu_data['menu-name'] ) . '</strong>'
)
);
}
// Menu doesn't already exist, so create a new menu.
if ( ! $_menu || is_wp_error( $_menu ) ) {
$menu_exists = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' );
if ( $menu_exists ) {
return new WP_Error(
'menu_exists',
sprintf(
/* translators: %s: Menu name. */
__( 'The menu name %s conflicts with another menu name. Please try another.' ),
'<strong>' . esc_html( $menu_data['menu-name'] ) . '</strong>'
)
);
}
$_menu = wp_insert_term( $menu_data['menu-name'], 'nav_menu', $args );
if ( is_wp_error( $_menu ) ) {
return $_menu;
}
/**
* Fires after a navigation menu is successfully created.
*
* @since 3.0.0
*
* @param int $term_id ID of the new menu.
* @param array $menu_data An array of menu data.
*/
do_action( 'wp_create_nav_menu', $_menu['term_id'], $menu_data );
return (int) $_menu['term_id'];
}
if ( ! $_menu || ! isset( $_menu->term_id ) ) {
return 0;
}
$menu_id = (int) $_menu->term_id;
$update_response = wp_update_term( $menu_id, 'nav_menu', $args );
if ( is_wp_error( $update_response ) ) {
return $update_response;
}
$menu_id = (int) $update_response['term_id'];
/**
* Fires after a navigation menu has been successfully updated.
*
* @since 3.0.0
*
* @param int $menu_id ID of the updated menu.
* @param array $menu_data An array of menu data.
*/
do_action( 'wp_update_nav_menu', $menu_id, $menu_data );
return $menu_id;
}
```
[do\_action( 'wp\_create\_nav\_menu', int $term\_id, array $menu\_data )](../hooks/wp_create_nav_menu)
Fires after a navigation menu is successfully created.
[do\_action( 'wp\_update\_nav\_menu', int $menu\_id, array $menu\_data )](../hooks/wp_update_nav_menu)
Fires after a navigation menu has been successfully updated.
| Uses | Description |
| --- | --- |
| [wp\_update\_term()](wp_update_term) wp-includes/taxonomy.php | Updates term based on arguments provided. |
| [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. |
| [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. |
| [wp\_get\_nav\_menu\_object()](wp_get_nav_menu_object) wp-includes/nav-menu.php | Returns a navigation menu object. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_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\_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\_create\_nav\_menu()](wp_create_nav_menu) wp-includes/nav-menu.php | Creates a navigation menu. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_ajax_destroy_sessions() wp\_ajax\_destroy\_sessions()
=============================
Ajax handler for destroying multiple open sessions for a user.
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_destroy_sessions() {
$user = get_userdata( (int) $_POST['user_id'] );
if ( $user ) {
if ( ! current_user_can( 'edit_user', $user->ID ) ) {
$user = false;
} elseif ( ! wp_verify_nonce( $_POST['nonce'], 'update-user_' . $user->ID ) ) {
$user = false;
}
}
if ( ! $user ) {
wp_send_json_error(
array(
'message' => __( 'Could not log out user sessions. Please try again.' ),
)
);
}
$sessions = WP_Session_Tokens::get_instance( $user->ID );
if ( get_current_user_id() === $user->ID ) {
$sessions->destroy_others( wp_get_session_token() );
$message = __( 'You are now logged out everywhere else.' );
} else {
$sessions->destroy_all();
/* translators: %s: User's display name. */
$message = sprintf( __( '%s has been logged out.' ), $user->display_name );
}
wp_send_json_success( array( 'message' => $message ) );
}
```
| 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. |
| [wp\_get\_session\_token()](wp_get_session_token) wp-includes/user.php | Retrieves the current session token from the logged\_in cookie. |
| [wp\_verify\_nonce()](wp_verify_nonce) wp-includes/pluggable.php | Verifies that a correct security nonce was used with time limit. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [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 |
| --- | --- |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Introduced. |
wordpress get_term_by( string $field, string|int $value, string $taxonomy = '', string $output = OBJECT, string $filter = 'raw' ): WP_Term|array|false get\_term\_by( string $field, string|int $value, string $taxonomy = '', string $output = OBJECT, string $filter = 'raw' ): WP\_Term|array|false
===============================================================================================================================================
Gets all term data from database by term field and data.
Warning: $value is not escaped for ‘name’ $field. You must do it yourself, if required.
The default $field is ‘id’, therefore it is possible to also use null for field, but not recommended that you do so.
If $value does not exist, the return value will be false. If $taxonomy exists and $field and $value combinations exist, the term will be returned.
This function will always return the first term that matches the `$field`– `$value`–`$taxonomy` combination specified in the parameters. If your query is likely to match more than one term (as is likely to be the case when `$field` is ‘name’, for example), consider using [get\_terms()](get_terms) instead; that way, you will get all matching terms, and can provide your own logic for deciding which one was intended.
* [sanitize\_term\_field()](sanitize_term_field) : The $context param lists the available values for [get\_term\_by()](get_term_by) $filter param.
`$field` string Required Either `'slug'`, `'name'`, `'term_id'` (or `'id'`, `'ID'`), or `'term_taxonomy_id'`. `$value` string|int Required Search for this term value. `$taxonomy` string Optional Taxonomy name. Optional, if `$field` is `'term_taxonomy_id'`. Default: `''`
`$output` string Optional The required return type. One of OBJECT, ARRAY\_A, or ARRAY\_N, which correspond to a [WP\_Term](../classes/wp_term) object, an associative array, or a numeric array, respectively. Default: `OBJECT`
`$filter` string Optional How to sanitize term fields. Default `'raw'`. Default: `'raw'`
[WP\_Term](../classes/wp_term)|array|false [WP\_Term](../classes/wp_term) instance (or array) on success, depending on the `$output` value.
False if `$taxonomy` does not exist or `$term` was not found.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function get_term_by( $field, $value, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) {
// 'term_taxonomy_id' lookups don't require taxonomy checks.
if ( 'term_taxonomy_id' !== $field && ! taxonomy_exists( $taxonomy ) ) {
return false;
}
// No need to perform a query for empty 'slug' or 'name'.
if ( 'slug' === $field || 'name' === $field ) {
$value = (string) $value;
if ( 0 === strlen( $value ) ) {
return false;
}
}
if ( 'id' === $field || 'ID' === $field || 'term_id' === $field ) {
$term = get_term( (int) $value, $taxonomy, $output, $filter );
if ( is_wp_error( $term ) || null === $term ) {
$term = false;
}
return $term;
}
$args = array(
'get' => 'all',
'number' => 1,
'taxonomy' => $taxonomy,
'update_term_meta_cache' => false,
'orderby' => 'none',
'suppress_filter' => true,
);
switch ( $field ) {
case 'slug':
$args['slug'] = $value;
break;
case 'name':
$args['name'] = $value;
break;
case 'term_taxonomy_id':
$args['term_taxonomy_id'] = $value;
unset( $args['taxonomy'] );
break;
default:
return false;
}
$terms = get_terms( $args );
if ( is_wp_error( $terms ) || empty( $terms ) ) {
return false;
}
$term = array_shift( $terms );
// In the case of 'term_taxonomy_id', override the provided `$taxonomy` with whatever we find in the DB.
if ( 'term_taxonomy_id' === $field ) {
$taxonomy = $term->taxonomy;
}
return get_term( $term, $taxonomy, $output, $filter );
}
```
| Uses | Description |
| --- | --- |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_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. |
| [get\_linksbyname()](get_linksbyname) wp-includes/deprecated.php | Gets the links associated with category $cat\_name. |
| [get\_linkobjectsbyname()](get_linkobjectsbyname) wp-includes/deprecated.php | Gets an array of link objects associated with category $cat\_name. |
| [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. |
| [get\_category\_by\_slug()](get_category_by_slug) wp-includes/category.php | Retrieves a category object by category slug. |
| [get\_cat\_ID()](get_cat_id) wp-includes/category.php | Retrieves the ID of a category from its name. |
| [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| [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\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. |
| [\_wp\_preview\_terms\_filter()](_wp_preview_terms_filter) wp-includes/revision.php | Filters terms lookup to set the post format. |
| [get\_bookmarks()](get_bookmarks) wp-includes/bookmark.php | Retrieves the list of bookmarks. |
| [get\_post\_format\_link()](get_post_format_link) wp-includes/post-formats.php | Returns a link to a post format index. |
| [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\_get\_nav\_menu\_object()](wp_get_nav_menu_object) wp-includes/nav-menu.php | Returns a navigation menu 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. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Added `'ID'` as an alias of `'id'` for the `$field` parameter. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | `$taxonomy` is optional if `$field` is `'term_taxonomy_id'`. Converted to return a [WP\_Term](../classes/wp_term) object if `$output` is `OBJECT`. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress permalink_single_rss( string $deprecated = '' ) permalink\_single\_rss( string $deprecated = '' )
=================================================
This function has been deprecated. Use [the\_permalink\_rss()](the_permalink_rss) instead.
Print the permalink to the RSS feed.
* [the\_permalink\_rss()](the_permalink_rss)
`$deprecated` string Optional Default: `''`
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function permalink_single_rss($deprecated = '') {
_deprecated_function( __FUNCTION__, '2.3.0', 'the_permalink_rss()' );
the_permalink_rss();
}
```
| Uses | Description |
| --- | --- |
| [the\_permalink\_rss()](the_permalink_rss) wp-includes/feed.php | Displays the permalink to the post for use in feeds. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Use [the\_permalink\_rss()](the_permalink_rss) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress gzip_compression() gzip\_compression()
===================
This function has been deprecated.
Unused function.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function gzip_compression() {
_deprecated_function( __FUNCTION__, '2.5.0' );
return false;
}
```
| 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/) | Introduced. |
wordpress wp_get_script_tag( array $attributes ): string wp\_get\_script\_tag( array $attributes ): string
=================================================
Formats loader tags.
It is possible to inject attributes in the `<script>` tag via the [‘wp\_script\_attributes’](../hooks/wp_script_attributes) filter.
Automatically injects type attribute if needed.
`$attributes` array Required Key-value pairs representing `<script>` tag attributes. string String containing `<script>` opening and closing tags.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_get_script_tag( $attributes ) {
if ( ! isset( $attributes['type'] ) && ! is_admin() && ! current_theme_supports( 'html5', 'script' ) ) {
$attributes['type'] = 'text/javascript';
}
/**
* Filters attributes to be added to a script tag.
*
* @since 5.7.0
*
* @param array $attributes Key-value pairs representing `<script>` tag attributes.
* Only the attribute name is added to the `<script>` tag for
* entries with a boolean value, and that are true.
*/
$attributes = apply_filters( 'wp_script_attributes', $attributes );
return sprintf( "<script%s></script>\n", wp_sanitize_script_attributes( $attributes ) );
}
```
[apply\_filters( 'wp\_script\_attributes', array $attributes )](../hooks/wp_script_attributes)
Filters attributes to be added to a script tag.
| Uses | Description |
| --- | --- |
| [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. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_print\_script\_tag()](wp_print_script_tag) wp-includes/script-loader.php | Prints formatted loader tag. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress wp_get_upload_dir(): array wp\_get\_upload\_dir(): array
=============================
Retrieves uploads directory information.
Same as [wp\_upload\_dir()](wp_upload_dir) but "light weight" as it doesn’t attempt to create the uploads directory.
Intended for use in themes, when only ‘basedir’ and ‘baseurl’ are needed, generally in all cases when not uploading files.
* [wp\_upload\_dir()](wp_upload_dir)
array See [wp\_upload\_dir()](wp_upload_dir) for description.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_get_upload_dir() {
return wp_upload_dir( null, false );
}
```
| Uses | Description |
| --- | --- |
| [wp\_upload\_dir()](wp_upload_dir) wp-includes/functions.php | Returns an array containing the current upload directory’s path and URL. |
| 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\_uninitialize\_site()](wp_uninitialize_site) wp-includes/ms-site.php | Runs the uninitialization routine for a given site. |
| [wp\_delete\_attachment\_files()](wp_delete_attachment_files) wp-includes/post.php | Deletes all files that belong to the given attachment. |
| [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. |
| [attachment\_url\_to\_postid()](attachment_url_to_postid) wp-includes/media.php | Tries to convert an attachment URL into a post ID. |
| [wp\_unique\_filename()](wp_unique_filename) wp-includes/functions.php | Gets a filename that is sanitized and unique for the given directory. |
| [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\_relative\_upload\_path()](_wp_relative_upload_path) wp-includes/post.php | Returns relative path to an uploaded file. |
| [discover\_pingback\_server\_uri()](discover_pingback_server_uri) wp-includes/comment.php | Finds a pingback server URI based on the given URL. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. |
wordpress post_comments_feed_link( string $link_text = '', int $post_id = '', string $feed = '' ) post\_comments\_feed\_link( string $link\_text = '', int $post\_id = '', string $feed = '' )
============================================================================================
Displays the comment feed link for a post.
Prints out the comment feed link for a post. Link text is placed in the anchor. If no link text is specified, default text is used. If no post ID is specified, the current post is used.
`$link_text` string Optional Descriptive link text. Default 'Comments Feed'. Default: `''`
`$post_id` int Optional Post ID. Default is the ID of the global `$post`. Default: `''`
`$feed` string Optional Feed type. Possible values include `'rss2'`, `'atom'`.
Default is the value of [get\_default\_feed()](get_default_feed) . Default: `''`
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
$url = get_post_comments_feed_link( $post_id, $feed );
if ( empty( $link_text ) ) {
$link_text = __( 'Comments Feed' );
}
$link = '<a href="' . esc_url( $url ) . '">' . $link_text . '</a>';
/**
* Filters the post comment feed link anchor tag.
*
* @since 2.8.0
*
* @param string $link The complete anchor tag for the comment feed link.
* @param int $post_id Post ID.
* @param string $feed The feed type. Possible values include 'rss2', 'atom',
* or an empty string for the default feed type.
*/
echo apply_filters( 'post_comments_feed_link_html', $link, $post_id, $feed );
}
```
[apply\_filters( 'post\_comments\_feed\_link\_html', string $link, int $post\_id, string $feed )](../hooks/post_comments_feed_link_html)
Filters the post comment feed link anchor tag.
| Uses | Description |
| --- | --- |
| [get\_post\_comments\_feed\_link()](get_post_comments_feed_link) wp-includes/link-template.php | Retrieves the permalink for the post comments feed. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [comments\_rss\_link()](comments_rss_link) wp-includes/deprecated.php | Print RSS comment feed link. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_ajax_inline_save() wp\_ajax\_inline\_save()
========================
Ajax handler for Quick Edit saving a post from a list table.
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_inline_save() {
global $mode;
check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
if ( ! isset( $_POST['post_ID'] ) || ! (int) $_POST['post_ID'] ) {
wp_die();
}
$post_ID = (int) $_POST['post_ID'];
if ( 'page' === $_POST['post_type'] ) {
if ( ! current_user_can( 'edit_page', $post_ID ) ) {
wp_die( __( 'Sorry, you are not allowed to edit this page.' ) );
}
} else {
if ( ! current_user_can( 'edit_post', $post_ID ) ) {
wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );
}
}
$last = wp_check_post_lock( $post_ID );
if ( $last ) {
$last_user = get_userdata( $last );
$last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
/* translators: %s: User's display name. */
$msg_template = __( 'Saving is disabled: %s is currently editing this post.' );
if ( 'page' === $_POST['post_type'] ) {
/* translators: %s: User's display name. */
$msg_template = __( 'Saving is disabled: %s is currently editing this page.' );
}
printf( $msg_template, esc_html( $last_user_name ) );
wp_die();
}
$data = &$_POST;
$post = get_post( $post_ID, ARRAY_A );
// Since it's coming from the database.
$post = wp_slash( $post );
$data['content'] = $post['post_content'];
$data['excerpt'] = $post['post_excerpt'];
// Rename.
$data['user_ID'] = get_current_user_id();
if ( isset( $data['post_parent'] ) ) {
$data['parent_id'] = $data['post_parent'];
}
// Status.
if ( isset( $data['keep_private'] ) && 'private' === $data['keep_private'] ) {
$data['visibility'] = 'private';
$data['post_status'] = 'private';
} else {
$data['post_status'] = $data['_status'];
}
if ( empty( $data['comment_status'] ) ) {
$data['comment_status'] = 'closed';
}
if ( empty( $data['ping_status'] ) ) {
$data['ping_status'] = 'closed';
}
// Exclude terms from taxonomies that are not supposed to appear in Quick Edit.
if ( ! empty( $data['tax_input'] ) ) {
foreach ( $data['tax_input'] as $taxonomy => $terms ) {
$tax_object = get_taxonomy( $taxonomy );
/** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
if ( ! apply_filters( 'quick_edit_show_taxonomy', $tax_object->show_in_quick_edit, $taxonomy, $post['post_type'] ) ) {
unset( $data['tax_input'][ $taxonomy ] );
}
}
}
// Hack: wp_unique_post_slug() doesn't work for drafts, so we will fake that our post is published.
if ( ! empty( $data['post_name'] ) && in_array( $post['post_status'], array( 'draft', 'pending' ), true ) ) {
$post['post_status'] = 'publish';
$data['post_name'] = wp_unique_post_slug( $data['post_name'], $post['ID'], $post['post_status'], $post['post_type'], $post['post_parent'] );
}
// Update the post.
edit_post();
$wp_list_table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => $_POST['screen'] ) );
$mode = 'excerpt' === $_POST['post_view'] ? 'excerpt' : 'list';
$level = 0;
if ( is_post_type_hierarchical( $wp_list_table->screen->post_type ) ) {
$request_post = array( get_post( $_POST['post_ID'] ) );
$parent = $request_post[0]->post_parent;
while ( $parent > 0 ) {
$parent_post = get_post( $parent );
$parent = $parent_post->post_parent;
$level++;
}
}
$wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ), $level );
wp_die();
}
```
[apply\_filters( 'quick\_edit\_show\_taxonomy', bool $show\_in\_quick\_edit, string $taxonomy\_name, string $post\_type )](../hooks/quick_edit_show_taxonomy)
Filters whether the current taxonomy should be shown in the Quick Edit panel.
| Uses | Description |
| --- | --- |
| [WP\_List\_Table::display\_rows()](../classes/wp_list_table/display_rows) wp-admin/includes/class-wp-list-table.php | Generates the table rows. |
| [\_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\_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. |
| [is\_post\_type\_hierarchical()](is_post_type_hierarchical) wp-includes/post.php | Determines whether the post type is hierarchical. |
| [wp\_check\_post\_lock()](wp_check_post_lock) wp-admin/includes/post.php | Determines whether the post is currently being edited by another user. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_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. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [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. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress wp_admin_bar_wp_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_wp\_menu( WP\_Admin\_Bar $wp\_admin\_bar )
==========================================================
Adds the WordPress logo 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_wp_menu( $wp_admin_bar ) {
if ( current_user_can( 'read' ) ) {
$about_url = self_admin_url( 'about.php' );
} elseif ( is_multisite() ) {
$about_url = get_dashboard_url( get_current_user_id(), 'about.php' );
} else {
$about_url = false;
}
$wp_logo_menu_args = array(
'id' => 'wp-logo',
'title' => '<span class="ab-icon" aria-hidden="true"></span><span class="screen-reader-text">' . __( 'About WordPress' ) . '</span>',
'href' => $about_url,
);
// Set tabindex="0" to make sub menus accessible when no URL is available.
if ( ! $about_url ) {
$wp_logo_menu_args['meta'] = array(
'tabindex' => 0,
);
}
$wp_admin_bar->add_node( $wp_logo_menu_args );
if ( $about_url ) {
// Add "About WordPress" link.
$wp_admin_bar->add_node(
array(
'parent' => 'wp-logo',
'id' => 'about',
'title' => __( 'About WordPress' ),
'href' => $about_url,
)
);
}
// Add WordPress.org link.
$wp_admin_bar->add_node(
array(
'parent' => 'wp-logo-external',
'id' => 'wporg',
'title' => __( 'WordPress.org' ),
'href' => __( 'https://wordpress.org/' ),
)
);
// Add documentation link.
$wp_admin_bar->add_node(
array(
'parent' => 'wp-logo-external',
'id' => 'documentation',
'title' => __( 'Documentation' ),
'href' => __( 'https://wordpress.org/support/' ),
)
);
// Add forums link.
$wp_admin_bar->add_node(
array(
'parent' => 'wp-logo-external',
'id' => 'support-forums',
'title' => __( 'Support' ),
'href' => __( 'https://wordpress.org/support/forums/' ),
)
);
// Add feedback link.
$wp_admin_bar->add_node(
array(
'parent' => 'wp-logo-external',
'id' => 'feedback',
'title' => __( 'Feedback' ),
'href' => __( 'https://wordpress.org/support/forum/requests-and-feedback' ),
)
);
}
```
| Uses | Description |
| --- | --- |
| [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\_dashboard\_url()](get_dashboard_url) wp-includes/link-template.php | Retrieves the URL to the user’s dashboard. |
| [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.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress wp_should_load_separate_core_block_assets(): bool wp\_should\_load\_separate\_core\_block\_assets(): bool
=======================================================
Checks whether separate styles should be loaded for core blocks on-render.
When this function returns true, other functions ensure that core blocks only load their assets on-render, and each block loads its own, individual assets. Third-party blocks only load their assets when rendered.
When this function returns false, all core block assets are loaded regardless of whether they are rendered in a page or not, because they are all part of the `block-library/style.css` file. Assets for third-party blocks are always enqueued regardless of whether they are rendered or not.
This only affects front end and not the block editor screens.
* [wp\_enqueue\_registered\_block\_scripts\_and\_styles()](wp_enqueue_registered_block_scripts_and_styles)
* [register\_block\_style\_handle()](register_block_style_handle)
bool Whether separate assets will be loaded.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_should_load_separate_core_block_assets() {
if ( is_admin() || is_feed() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {
return false;
}
/**
* Filters whether block styles should be loaded separately.
*
* Returning false loads all core block assets, regardless of whether they are rendered
* in a page or not. Returning true loads core block assets only when they are rendered.
*
* @since 5.8.0
*
* @param bool $load_separate_assets Whether separate assets will be loaded.
* Default false (all block assets are loaded, even when not used).
*/
return apply_filters( 'should_load_separate_core_block_assets', false );
}
```
[apply\_filters( 'should\_load\_separate\_core\_block\_assets', bool $load\_separate\_assets )](../hooks/should_load_separate_core_block_assets)
Filters whether block styles should be loaded separately.
| Uses | Description |
| --- | --- |
| [is\_feed()](is_feed) wp-includes/query.php | Determines whether the query is for a feed. |
| [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\_add\_global\_styles\_for\_blocks()](wp_add_global_styles_for_blocks) wp-includes/global-styles-and-settings.php | Adds global style rules to the inline style for each block. |
| [wp\_enqueue\_block\_style()](wp_enqueue_block_style) wp-includes/script-loader.php | Enqueues a stylesheet for a specific block. |
| [wp\_enqueue\_global\_styles()](wp_enqueue_global_styles) wp-includes/script-loader.php | Enqueues the global styles defined via theme.json. |
| [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. |
| [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). |
| [wp\_default\_styles()](wp_default_styles) wp-includes/script-loader.php | Assigns default styles to $styles object. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress wp_check_post_lock( int|WP_Post $post ): int|false wp\_check\_post\_lock( int|WP\_Post $post ): int|false
======================================================
Determines whether the post is currently being edited by another user.
`$post` int|[WP\_Post](../classes/wp_post) Required ID or object of the post to check for editing. int|false ID of the user with lock. False if the post does not exist, post is not locked, the user with lock does not exist, or the post is locked by current user.
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function wp_check_post_lock( $post ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$lock = get_post_meta( $post->ID, '_edit_lock', true );
if ( ! $lock ) {
return false;
}
$lock = explode( ':', $lock );
$time = $lock[0];
$user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true );
if ( ! get_userdata( $user ) ) {
return false;
}
/** This filter is documented in wp-admin/includes/ajax-actions.php */
$time_window = apply_filters( 'wp_check_post_lock_window', 150 );
if ( $time && $time > time() - $time_window && get_current_user_id() != $user ) {
return $user;
}
return false;
}
```
[apply\_filters( 'wp\_check\_post\_lock\_window', int $interval )](../hooks/wp_check_post_lock_window)
Filters the post lock window duration.
| Uses | Description |
| --- | --- |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| [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\_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\_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\_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\_Customize\_Manager::customize\_pane\_settings()](../classes/wp_customize_manager/customize_pane_settings) wp-includes/class-wp-customize-manager.php | Prints JavaScript settings for parent window. |
| [WP\_Posts\_List\_Table::column\_title()](../classes/wp_posts_list_table/column_title) wp-admin/includes/class-wp-posts-list-table.php | Handles the title column output. |
| [wp\_print\_revision\_templates()](wp_print_revision_templates) wp-admin/includes/revision.php | Print JavaScript templates required for the revisions experience. |
| [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. |
| [\_admin\_notice\_post\_locked()](_admin_notice_post_locked) wp-admin/includes/post.php | Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post. |
| [post\_preview()](post_preview) wp-admin/includes/post.php | Saves a draft or manually autosaves for the purpose of showing a post preview. |
| [wp\_autosave()](wp_autosave) wp-admin/includes/post.php | Saves a post submitted with XHR. |
| [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. |
| [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\_Posts\_List\_Table::single\_row()](../classes/wp_posts_list_table/single_row) wp-admin/includes/class-wp-posts-list-table.php | |
| [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. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress is_admin(): bool is\_admin(): bool
=================
Determines whether the current request is for an administrative interface page.
Does not check if the user is an administrator; use [current\_user\_can()](current_user_can) for checking roles and capabilities.
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 inside WordPress administration interface, false otherwise.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function is_admin() {
if ( isset( $GLOBALS['current_screen'] ) ) {
return $GLOBALS['current_screen']->in_admin();
} elseif ( defined( 'WP_ADMIN' ) ) {
return WP_ADMIN;
}
return false;
}
```
| Used By | Description |
| --- | --- |
| [wp\_get\_global\_styles\_svg\_filters()](wp_get_global_styles_svg_filters) wp-includes/global-styles-and-settings.php | Returns a string containing the SVGs to be referenced as filters (duotone). |
| [\_wp\_theme\_json\_webfonts\_handler()](_wp_theme_json_webfonts_handler) wp-includes/script-loader.php | Runs the theme.json webfonts handler. |
| [wp\_global\_styles\_render\_svg\_filters()](wp_global_styles_render_svg_filters) wp-includes/script-loader.php | Renders the SVG filters supplied by theme.json. |
| [wp\_get\_global\_stylesheet()](wp_get_global_stylesheet) wp-includes/global-styles-and-settings.php | Returns the stylesheet resulting of merging core, theme, and user data. |
| [wp\_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\_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\_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\_get\_inline\_script\_tag()](wp_get_inline_script_tag) wp-includes/script-loader.php | Wraps inline JavaScript in tag. |
| [wp\_sanitize\_script\_attributes()](wp_sanitize_script_attributes) wp-includes/script-loader.php | Sanitizes an attributes array into an attributes string to be placed inside a tag. |
| [wp\_get\_script\_tag()](wp_get_script_tag) wp-includes/script-loader.php | Formats loader tags. |
| [wp\_is\_site\_protected\_by\_basic\_auth()](wp_is_site_protected_by_basic_auth) wp-includes/load.php | Checks if this site is protected by HTTP Basic Auth. |
| [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. |
| [is\_protected\_endpoint()](is_protected_endpoint) wp-includes/load.php | Determines whether we are currently on an endpoint that should be protected against WSODs. |
| [WP\_Fatal\_Error\_Handler::handle()](../classes/wp_fatal_error_handler/handle) wp-includes/class-wp-fatal-error-handler.php | Runs the shutdown handler. |
| [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. |
| [determine\_locale()](determine_locale) wp-includes/l10n.php | Determines the current locale desired for the request. |
| [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). |
| [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\_add\_privacy\_policy\_content()](wp_add_privacy_policy_content) wp-admin/includes/plugin.php | Declares a helper function for adding content to the Privacy Policy Guide. |
| [WP\_Customize\_Manager::establish\_loaded\_changeset()](../classes/wp_customize_manager/establish_loaded_changeset) wp-includes/class-wp-customize-manager.php | Establishes the loaded changeset. |
| [\_WP\_Editors::enqueue\_default\_editor()](../classes/_wp_editors/enqueue_default_editor) wp-includes/class-wp-editor.php | Enqueue all editor scripts. |
| [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\_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. |
| [get\_rest\_url()](get_rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint on a site. |
| [wp\_admin\_bar\_customize\_menu()](wp_admin_bar_customize_menu) wp-includes/admin-bar.php | Adds the “Customize” link to the Toolbar. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::sort\_wp\_get\_nav\_menu\_items()](../classes/wp_customize_nav_menu_item_setting/sort_wp_get_nav_menu_items) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Re-apply the tail logic also applied on $items by [wp\_get\_nav\_menu\_items()](wp_get_nav_menu_items) . |
| [WP\_Customize\_Manager::wp\_loaded()](../classes/wp_customize_manager/wp_loaded) wp-includes/class-wp-customize-manager.php | Registers styles/scripts and initialize the preview of each setting |
| [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\_Styles::\_\_construct()](../classes/wp_styles/__construct) wp-includes/class-wp-styles.php | Constructor. |
| [remove\_editor\_styles()](remove_editor_styles) wp-includes/theme.php | Removes all visual editor stylesheets. |
| [\_custom\_header\_background\_just\_in\_time()](_custom_header_background_just_in_time) wp-includes/theme.php | Registers the internal custom header and background routines. |
| [\_wp\_customize\_include()](_wp_customize_include) wp-includes/theme.php | Includes and instantiates the [WP\_Customize\_Manager](../classes/wp_customize_manager) class. |
| [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. |
| [load\_default\_textdomain()](load_default_textdomain) wp-includes/l10n.php | Loads default translated strings based on locale. |
| [wp\_heartbeat\_settings()](wp_heartbeat_settings) wp-includes/general-template.php | Default settings for heartbeat. |
| [wp\_admin\_bar\_dashboard\_view\_site\_menu()](wp_admin_bar_dashboard_view_site_menu) wp-includes/deprecated.php | Add the “Dashboard”/”Visit Site” menu. |
| [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::handle\_404()](../classes/wp/handle_404) wp-includes/class-wp.php | Set the Headers for 404, if nothing is found for requested URL. |
| [WP::parse\_request()](../classes/wp/parse_request) wp-includes/class-wp.php | Parses the request to find the correct WordPress query. |
| [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\_deregister\_script()](wp_deregister_script) wp-includes/functions.wp-scripts.php | Remove a registered script. |
| [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\_widget\_rss\_output()](wp_widget_rss_output) wp-includes/widgets.php | Display the RSS entries in a list. |
| [get\_pagenum\_link()](get_pagenum_link) wp-includes/link-template.php | Retrieves the link for a page number. |
| [WP\_Admin\_Bar::\_render()](../classes/wp_admin_bar/_render) wp-includes/class-wp-admin-bar.php | |
| [wp\_admin\_bar\_sidebar\_toggle()](wp_admin_bar_sidebar_toggle) wp-includes/admin-bar.php | Adds the sidebar toggle button. |
| [wp\_admin\_bar\_site\_menu()](wp_admin_bar_site_menu) wp-includes/admin-bar.php | Adds the “Site Name” menu. |
| [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\_search\_menu()](wp_admin_bar_search_menu) wp-includes/admin-bar.php | Adds search form. |
| [is\_admin\_bar\_showing()](is_admin_bar_showing) wp-includes/admin-bar.php | Determines whether the admin bar should be showing. |
| [wp\_user\_settings()](wp_user_settings) wp-includes/option.php | Saves and restores user interface settings stored in a cookie. |
| [get\_post\_class()](get_post_class) wp-includes/post-template.php | Retrieves an array of the class names for the post container element. |
| [get\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. |
| [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. |
| [image\_constrain\_size\_for\_editor()](image_constrain_size_for_editor) wp-includes/media.php | Scales down the default size of an image. |
| [wp\_get\_attachment\_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. |
| [ms\_not\_installed()](ms_not_installed) wp-includes/ms-load.php | Displays a failure message. |
| [\_post\_format\_request()](_post_format_request) wp-includes/post-formats.php | Filters the request to allow for the format prefix. |
| [WP\_Scripts::init()](../classes/wp_scripts/init) wp-includes/class-wp-scripts.php | Initialize the class. |
| [wp\_get\_nav\_menu\_items()](wp_get_nav_menu_items) wp-includes/nav-menu.php | Retrieves all menu items of a navigation menu. |
| [dynamic\_sidebar()](dynamic_sidebar) wp-includes/widgets.php | Display dynamic sidebar. |
| [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. |
| [WP\_Customize\_Widgets::schedule\_customize\_register()](../classes/wp_customize_widgets/schedule_customize_register) wp-includes/class-wp-customize-widgets.php | Ensures widgets are available for all types of previews. |
| [script\_concat\_settings()](script_concat_settings) wp-includes/script-loader.php | Determines the concatenation and compression settings for scripts and styles. |
| [wp\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. |
| [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | |
| [\_WP\_Editors::editor\_js()](../classes/_wp_editors/editor_js) wp-includes/class-wp-editor.php | Print (output) the TinyMCE configuration and initialization scripts. |
| Version | Description |
| --- | --- |
| [1.5.1](https://developer.wordpress.org/reference/since/1.5.1/) | Introduced. |
| programming_docs |
wordpress wp_admin_bar_updates_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_updates\_menu( WP\_Admin\_Bar $wp\_admin\_bar )
===============================================================
Provides an update link if theme/plugin/core updates are available.
`$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_updates_menu( $wp_admin_bar ) {
$update_data = wp_get_update_data();
if ( ! $update_data['counts']['total'] ) {
return;
}
$updates_text = sprintf(
/* translators: %s: Total number of updates available. */
_n( '%s update available', '%s updates available', $update_data['counts']['total'] ),
number_format_i18n( $update_data['counts']['total'] )
);
$icon = '<span class="ab-icon" aria-hidden="true"></span>';
$title = '<span class="ab-label" aria-hidden="true">' . number_format_i18n( $update_data['counts']['total'] ) . '</span>';
$title .= '<span class="screen-reader-text updates-available-text">' . $updates_text . '</span>';
$wp_admin_bar->add_node(
array(
'id' => 'updates',
'title' => $icon . $title,
'href' => network_admin_url( 'update-core.php' ),
)
);
}
```
| Uses | Description |
| --- | --- |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the network. |
| [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. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress media_send_to_editor( string $html ) media\_send\_to\_editor( string $html )
=======================================
Adds image HTML to editor.
`$html` string Required File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function media_send_to_editor( $html ) {
?>
<script type="text/javascript">
var win = window.dialogArguments || opener || parent || top;
win.send_to_editor( <?php echo wp_json_encode( $html ); ?> );
</script>
<?php
exit;
}
```
| Uses | Description |
| --- | --- |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| Used By | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_admin_bar_render() wp\_admin\_bar\_render()
========================
Renders the admin bar to the page based on the $wp\_admin\_bar->menu member var.
This is called very early on the [‘wp\_body\_open’](../hooks/wp_body_open) action so that it will render before anything else being added to the page body.
For backward compatibility with themes not using the ‘wp\_body\_open’ action, the function is also called late on [‘wp\_footer’](../hooks/wp_footer).
It includes the [‘admin\_bar\_menu’](../hooks/admin_bar_menu) action which should be used to hook in and add new menus to the admin bar. That way you can be sure that you are adding at most optimal point, right before the admin bar is rendered. This also gives you access to the `$post` global, among others.
File: `wp-includes/admin-bar.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/admin-bar.php/)
```
function wp_admin_bar_render() {
global $wp_admin_bar;
static $rendered = false;
if ( $rendered ) {
return;
}
if ( ! is_admin_bar_showing() || ! is_object( $wp_admin_bar ) ) {
return;
}
/**
* Loads all necessary admin bar items.
*
* This is the hook used to add, remove, or manipulate admin bar items.
*
* @since 3.1.0
*
* @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance, passed by reference.
*/
do_action_ref_array( 'admin_bar_menu', array( &$wp_admin_bar ) );
/**
* Fires before the admin bar is rendered.
*
* @since 3.1.0
*/
do_action( 'wp_before_admin_bar_render' );
$wp_admin_bar->render();
/**
* Fires after the admin bar is rendered.
*
* @since 3.1.0
*/
do_action( 'wp_after_admin_bar_render' );
$rendered = true;
}
```
[do\_action\_ref\_array( 'admin\_bar\_menu', WP\_Admin\_Bar $wp\_admin\_bar )](../hooks/admin_bar_menu)
Loads all necessary admin bar items.
[do\_action( 'wp\_after\_admin\_bar\_render' )](../hooks/wp_after_admin_bar_render)
Fires after the admin bar is rendered.
[do\_action( 'wp\_before\_admin\_bar\_render' )](../hooks/wp_before_admin_bar_render)
Fires before the admin bar is rendered.
| Uses | Description |
| --- | --- |
| [WP\_Admin\_Bar::render()](../classes/wp_admin_bar/render) wp-includes/class-wp-admin-bar.php | |
| [is\_admin\_bar\_showing()](is_admin_bar_showing) wp-includes/admin-bar.php | Determines whether the admin bar should be showing. |
| [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. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Called on `'wp_body_open'` action first, with `'wp_footer'` as a fallback. |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_enqueue_code_editor( array $args ): array|false wp\_enqueue\_code\_editor( array $args ): array|false
=====================================================
Enqueues assets needed by the code editor for the given settings.
* [wp\_enqueue\_editor()](wp_enqueue_editor)
* [wp\_get\_code\_editor\_settings()](wp_get_code_editor_settings) ;
* [\_WP\_Editors::parse\_settings()](../classes/_wp_editors/parse_settings)
`$args` array Required Args.
* `type`stringThe MIME type of the file to be edited.
* `file`stringFilename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param.
* `theme`[WP\_Theme](../classes/wp_theme)Theme being edited when on the theme file editor.
* `plugin`stringPlugin being edited when on the plugin file editor.
* `codemirror`arrayAdditional CodeMirror setting overrides.
* `csslint`arrayCSSLint rule overrides.
* `jshint`arrayJSHint rule overrides.
* `htmlhint`arrayHTMLHint rule overrides.
array|false Settings for the enqueued code editor, or false if the editor was not enqueued.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_enqueue_code_editor( $args ) {
if ( is_user_logged_in() && 'false' === wp_get_current_user()->syntax_highlighting ) {
return false;
}
$settings = wp_get_code_editor_settings( $args );
if ( empty( $settings ) || empty( $settings['codemirror'] ) ) {
return false;
}
wp_enqueue_script( 'code-editor' );
wp_enqueue_style( 'code-editor' );
if ( isset( $settings['codemirror']['mode'] ) ) {
$mode = $settings['codemirror']['mode'];
if ( is_string( $mode ) ) {
$mode = array(
'name' => $mode,
);
}
if ( ! empty( $settings['codemirror']['lint'] ) ) {
switch ( $mode['name'] ) {
case 'css':
case 'text/css':
case 'text/x-scss':
case 'text/x-less':
wp_enqueue_script( 'csslint' );
break;
case 'htmlmixed':
case 'text/html':
case 'php':
case 'application/x-httpd-php':
case 'text/x-php':
wp_enqueue_script( 'htmlhint' );
wp_enqueue_script( 'csslint' );
wp_enqueue_script( 'jshint' );
if ( ! current_user_can( 'unfiltered_html' ) ) {
wp_enqueue_script( 'htmlhint-kses' );
}
break;
case 'javascript':
case 'application/ecmascript':
case 'application/json':
case 'application/javascript':
case 'application/ld+json':
case 'text/typescript':
case 'application/typescript':
wp_enqueue_script( 'jshint' );
wp_enqueue_script( 'jsonlint' );
break;
}
}
}
wp_add_inline_script( 'code-editor', sprintf( 'jQuery.extend( wp.codeEditor.defaultSettings, %s );', wp_json_encode( $settings ) ) );
/**
* Fires when scripts and styles are enqueued for the code editor.
*
* @since 4.9.0
*
* @param array $settings Settings for the enqueued code editor.
*/
do_action( 'wp_enqueue_code_editor', $settings );
return $settings;
}
```
[do\_action( 'wp\_enqueue\_code\_editor', array $settings )](../hooks/wp_enqueue_code_editor)
Fires when scripts and styles are enqueued for the code editor.
| Uses | Description |
| --- | --- |
| [wp\_get\_code\_editor\_settings()](wp_get_code_editor_settings) wp-includes/general-template.php | Generates and returns code editor settings. |
| [wp\_add\_inline\_script()](wp_add_inline_script) wp-includes/functions.wp-scripts.php | Adds extra code to a registered script. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| [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. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [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\_Code\_Editor\_Control::enqueue()](../classes/wp_customize_code_editor_control/enqueue) wp-includes/customize/class-wp-customize-code-editor-control.php | Enqueue control related scripts/styles. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
wordpress wp_login( string $username, string $password, string $deprecated = '' ): bool wp\_login( string $username, string $password, string $deprecated = '' ): bool
==============================================================================
This function has been deprecated. Use [wp\_signon()](wp_signon) instead.
Checks a users login information and logs them in if it checks out. This function is deprecated.
Use the global $error to get the reason why the login failed. If the username is blank, no error will be set, so assume blank username on that case.
Plugins extending this function should also provide the global $error and set what the error is, so that those checking the global for why there was a failure can utilize it later.
* [wp\_signon()](wp_signon)
`$username` string Required User's username `$password` string Required User's password `$deprecated` string Optional Not used Default: `''`
bool True on successful check, false on login failure.
File: `wp-includes/pluggable-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable-deprecated.php/)
```
function wp_login($username, $password, $deprecated = '') {
_deprecated_function( __FUNCTION__, '2.5.0', 'wp_signon()' );
global $error;
$user = wp_authenticate($username, $password);
if ( ! is_wp_error($user) )
return true;
$error = $user->get_error_message();
return false;
}
```
| Uses | Description |
| --- | --- |
| [wp\_authenticate()](wp_authenticate) wp-includes/pluggable.php | Authenticates a user, confirming the login credentials are valid. |
| [\_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 |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Use [wp\_signon()](wp_signon) |
| [1.2.2](https://developer.wordpress.org/reference/since/1.2.2/) | Introduced. |
wordpress the_block_template_skip_link() the\_block\_template\_skip\_link()
==================================
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.
Prints the skip-link script & styles.
File: `wp-includes/theme-templates.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme-templates.php/)
```
function the_block_template_skip_link() {
global $_wp_current_template_content;
// Early exit if not a block theme.
if ( ! current_theme_supports( 'block-templates' ) ) {
return;
}
// Early exit if not a block template.
if ( ! $_wp_current_template_content ) {
return;
}
?>
<?php
/**
* Print the skip-link styles.
*/
?>
<style id="skip-link-styles">
.skip-link.screen-reader-text {
border: 0;
clip: rect(1px,1px,1px,1px);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute !important;
width: 1px;
word-wrap: normal !important;
}
.skip-link.screen-reader-text:focus {
background-color: #eee;
clip: auto !important;
clip-path: none;
color: #444;
display: block;
font-size: 1em;
height: auto;
left: 5px;
line-height: normal;
padding: 15px 23px 14px;
text-decoration: none;
top: 5px;
width: auto;
z-index: 100000;
}
</style>
<?php
/**
* Print the skip-link script.
*/
?>
<script>
( function() {
var skipLinkTarget = document.querySelector( 'main' ),
sibling,
skipLinkTargetID,
skipLink;
// Early exit if a skip-link target can't be located.
if ( ! skipLinkTarget ) {
return;
}
// Get the site wrapper.
// The skip-link will be injected in the beginning of it.
sibling = document.querySelector( '.wp-site-blocks' );
// Early exit if the root element was not found.
if ( ! sibling ) {
return;
}
// Get the skip-link target's ID, and generate one if it doesn't exist.
skipLinkTargetID = skipLinkTarget.id;
if ( ! skipLinkTargetID ) {
skipLinkTargetID = 'wp--skip-link--target';
skipLinkTarget.id = skipLinkTargetID;
}
// Create the skip link.
skipLink = document.createElement( 'a' );
skipLink.classList.add( 'skip-link', 'screen-reader-text' );
skipLink.href = '#' + skipLinkTargetID;
skipLink.innerHTML = '<?php esc_html_e( 'Skip to content' ); ?>';
// Inject the skip link.
sibling.parentElement.insertBefore( skipLink, sibling );
}() );
</script>
<?php
}
```
| Uses | Description |
| --- | --- |
| [esc\_html\_e()](esc_html_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in HTML output. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress wp_ajax_fetch_list() wp\_ajax\_fetch\_list()
=======================
Ajax handler for fetching a list table.
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_fetch_list() {
$list_class = $_GET['list_args']['class'];
check_ajax_referer( "fetch-list-$list_class", '_ajax_fetch_list_nonce' );
$wp_list_table = _get_list_table( $list_class, array( 'screen' => $_GET['list_args']['screen']['id'] ) );
if ( ! $wp_list_table ) {
wp_die( 0 );
}
if ( ! $wp_list_table->ajax_user_can() ) {
wp_die( -1 );
}
$wp_list_table->ajax_response();
wp_die( 0 );
}
```
| Uses | Description |
| --- | --- |
| [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::ajax\_user\_can()](../classes/wp_list_table/ajax_user_can) wp-admin/includes/class-wp-list-table.php | Checks the current user’s permissions |
| [\_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. |
| [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_restore_image( int $post_id ): stdClass wp\_restore\_image( int $post\_id ): stdClass
=============================================
Restores the metadata for a given attachment.
`$post_id` int Required Attachment post ID. stdClass Image restoration message object.
File: `wp-admin/includes/image-edit.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image-edit.php/)
```
function wp_restore_image( $post_id ) {
$meta = wp_get_attachment_metadata( $post_id );
$file = get_attached_file( $post_id );
$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
$old_backup_sizes = $backup_sizes;
$restored = false;
$msg = new stdClass;
if ( ! is_array( $backup_sizes ) ) {
$msg->error = __( 'Cannot load image metadata.' );
return $msg;
}
$parts = pathinfo( $file );
$suffix = time() . rand( 100, 999 );
$default_sizes = get_intermediate_image_sizes();
if ( isset( $backup_sizes['full-orig'] ) && is_array( $backup_sizes['full-orig'] ) ) {
$data = $backup_sizes['full-orig'];
if ( $parts['basename'] != $data['file'] ) {
if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE ) {
// Delete only if it's an edited image.
if ( preg_match( '/-e[0-9]{13}\./', $parts['basename'] ) ) {
wp_delete_file( $file );
}
} elseif ( isset( $meta['width'], $meta['height'] ) ) {
$backup_sizes[ "full-$suffix" ] = array(
'width' => $meta['width'],
'height' => $meta['height'],
'file' => $parts['basename'],
);
}
}
$restored_file = path_join( $parts['dirname'], $data['file'] );
$restored = update_attached_file( $post_id, $restored_file );
$meta['file'] = _wp_relative_upload_path( $restored_file );
$meta['width'] = $data['width'];
$meta['height'] = $data['height'];
}
foreach ( $default_sizes as $default_size ) {
if ( isset( $backup_sizes[ "$default_size-orig" ] ) ) {
$data = $backup_sizes[ "$default_size-orig" ];
if ( isset( $meta['sizes'][ $default_size ] ) && $meta['sizes'][ $default_size ]['file'] != $data['file'] ) {
if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE ) {
// Delete only if it's an edited image.
if ( preg_match( '/-e[0-9]{13}-/', $meta['sizes'][ $default_size ]['file'] ) ) {
$delete_file = path_join( $parts['dirname'], $meta['sizes'][ $default_size ]['file'] );
wp_delete_file( $delete_file );
}
} else {
$backup_sizes[ "$default_size-{$suffix}" ] = $meta['sizes'][ $default_size ];
}
}
$meta['sizes'][ $default_size ] = $data;
} else {
unset( $meta['sizes'][ $default_size ] );
}
}
if ( ! wp_update_attachment_metadata( $post_id, $meta ) ||
( $old_backup_sizes !== $backup_sizes && ! update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes ) ) ) {
$msg->error = __( 'Cannot save image metadata.' );
return $msg;
}
if ( ! $restored ) {
$msg->error = __( 'Image metadata is inconsistent.' );
} else {
$msg->msg = __( 'Image restored successfully.' );
}
return $msg;
}
```
| Uses | Description |
| --- | --- |
| [wp\_delete\_file()](wp_delete_file) wp-includes/functions.php | Deletes a file. |
| [path\_join()](path_join) wp-includes/functions.php | Joins two filesystem paths together. |
| [get\_intermediate\_image\_sizes()](get_intermediate_image_sizes) wp-includes/media.php | Gets the available intermediate image size names. |
| [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. |
| [wp\_update\_attachment\_metadata()](wp_update_attachment_metadata) wp-includes/post.php | Updates metadata for an attachment. |
| [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. |
| [get\_attached\_file()](get_attached_file) wp-includes/post.php | Retrieves attached file path based on attachment ID. |
| [update\_attached\_file()](update_attached_file) wp-includes/post.php | Updates attachment file path based on attachment ID. |
| [\_wp\_relative\_upload\_path()](_wp_relative_upload_path) wp-includes/post.php | Returns relative path to an uploaded file. |
| [\_\_()](__) wp-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. |
| 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 wp_scripts(): WP_Scripts wp\_scripts(): WP\_Scripts
==========================
Initialize $wp\_scripts if it has not been set.
[WP\_Scripts](../classes/wp_scripts) [WP\_Scripts](../classes/wp_scripts) instance.
File: `wp-includes/functions.wp-scripts.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-scripts.php/)
```
function wp_scripts() {
global $wp_scripts;
if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
$wp_scripts = new WP_Scripts();
}
return $wp_scripts;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Scripts::\_\_construct()](../classes/wp_scripts/__construct) wp-includes/class-wp-scripts.php | Constructor. |
| Used By | Description |
| --- | --- |
| [\_wp\_get\_iframed\_editor\_assets()](_wp_get_iframed_editor_assets) wp-includes/block-editor.php | Collect the block editor assets that need to be loaded into the editor’s iframe. |
| [\_WP\_Editors::force\_uncompressed\_tinymce()](../classes/_wp_editors/force_uncompressed_tinymce) wp-includes/class-wp-editor.php | Force uncompressed TinyMCE when a custom theme has been defined. |
| [load\_script\_textdomain()](load_script_textdomain) wp-includes/l10n.php | Loads the script translated strings. |
| [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::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\_script\_add\_data()](wp_script_add_data) wp-includes/functions.wp-scripts.php | Add metadata to a script. |
| [\_wp\_customize\_loader\_settings()](_wp_customize_loader_settings) wp-includes/theme.php | Adds settings for the customize-loader script. |
| [wp\_print\_scripts()](wp_print_scripts) wp-includes/functions.wp-scripts.php | Prints scripts in document head that are in the $handles queue. |
| [wp\_register\_script()](wp_register_script) wp-includes/functions.wp-scripts.php | Register a new script. |
| [wp\_deregister\_script()](wp_deregister_script) wp-includes/functions.wp-scripts.php | Remove a registered script. |
| [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. |
| [wp\_dequeue\_script()](wp_dequeue_script) wp-includes/functions.wp-scripts.php | Remove a previously enqueued script. |
| [wp\_script\_is()](wp_script_is) wp-includes/functions.wp-scripts.php | Determines whether a script has been added to the queue. |
| [wp\_plupload\_default\_settings()](wp_plupload_default_settings) wp-includes/media.php | Prints default Plupload arguments. |
| [print\_head\_scripts()](print_head_scripts) wp-includes/script-loader.php | Prints the script queue in the HTML head on admin pages. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress wp_unique_post_slug( string $slug, int $post_ID, string $post_status, string $post_type, int $post_parent ): string wp\_unique\_post\_slug( string $slug, int $post\_ID, string $post\_status, string $post\_type, int $post\_parent ): string
==========================================================================================================================
Computes a unique slug for the post, when given the desired slug and some post details.
`$slug` string Required The desired 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. `$post_parent` int Required Post parent ID. string Unique slug for the post, based on $post\_name (with a -1, -2, etc. suffix)
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) {
if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ), true )
|| ( 'inherit' === $post_status && 'revision' === $post_type ) || 'user_request' === $post_type
) {
return $slug;
}
/**
* Filters the post slug before it is generated to be unique.
*
* Returning a non-null value will short-circuit the
* unique slug generation, returning the passed value instead.
*
* @since 5.1.0
*
* @param string|null $override_slug Short-circuit return value.
* @param string $slug The desired slug (post_name).
* @param int $post_ID Post ID.
* @param string $post_status The post status.
* @param string $post_type Post type.
* @param int $post_parent Post parent ID.
*/
$override_slug = apply_filters( 'pre_wp_unique_post_slug', null, $slug, $post_ID, $post_status, $post_type, $post_parent );
if ( null !== $override_slug ) {
return $override_slug;
}
global $wpdb, $wp_rewrite;
$original_slug = $slug;
$feeds = $wp_rewrite->feeds;
if ( ! is_array( $feeds ) ) {
$feeds = array();
}
if ( 'attachment' === $post_type ) {
// Attachment slugs must be unique across all types.
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1";
$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) );
/**
* Filters whether the post slug would make a bad attachment slug.
*
* @since 3.1.0
*
* @param bool $bad_slug Whether the slug would be bad as an attachment slug.
* @param string $slug The post slug.
*/
$is_bad_attachment_slug = apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug );
if ( $post_name_check
|| in_array( $slug, $feeds, true ) || 'embed' === $slug
|| $is_bad_attachment_slug
) {
$suffix = 2;
do {
$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_ID ) );
$suffix++;
} while ( $post_name_check );
$slug = $alt_post_name;
}
} elseif ( is_post_type_hierarchical( $post_type ) ) {
if ( 'nav_menu_item' === $post_type ) {
return $slug;
}
/*
* Page slugs must be unique within their own trees. Pages are in a separate
* namespace than posts so page slugs are allowed to overlap post slugs.
*/
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( %s, 'attachment' ) AND ID != %d AND post_parent = %d LIMIT 1";
$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID, $post_parent ) );
/**
* Filters whether the post slug would make a bad hierarchical post slug.
*
* @since 3.1.0
*
* @param bool $bad_slug Whether the post slug would be bad in a hierarchical post context.
* @param string $slug The post slug.
* @param string $post_type Post type.
* @param int $post_parent Post parent ID.
*/
$is_bad_hierarchical_slug = apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent );
if ( $post_name_check
|| in_array( $slug, $feeds, true ) || 'embed' === $slug
|| preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug )
|| $is_bad_hierarchical_slug
) {
$suffix = 2;
do {
$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID, $post_parent ) );
$suffix++;
} while ( $post_name_check );
$slug = $alt_post_name;
}
} else {
// Post slugs must be unique across all posts.
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) );
$post = get_post( $post_ID );
// Prevent new post slugs that could result in URLs that conflict with date archives.
$conflicts_with_date_archive = false;
if ( 'post' === $post_type && ( ! $post || $post->post_name !== $slug ) && preg_match( '/^[0-9]+$/', $slug ) ) {
$slug_num = (int) $slug;
if ( $slug_num ) {
$permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) );
$postname_index = array_search( '%postname%', $permastructs, true );
/*
* Potential date clashes are as follows:
*
* - Any integer in the first permastruct position could be a year.
* - An integer between 1 and 12 that follows 'year' conflicts with 'monthnum'.
* - An integer between 1 and 31 that follows 'monthnum' conflicts with 'day'.
*/
if ( 0 === $postname_index ||
( $postname_index && '%year%' === $permastructs[ $postname_index - 1 ] && 13 > $slug_num ) ||
( $postname_index && '%monthnum%' === $permastructs[ $postname_index - 1 ] && 32 > $slug_num )
) {
$conflicts_with_date_archive = true;
}
}
}
/**
* Filters whether the post slug would be bad as a flat slug.
*
* @since 3.1.0
*
* @param bool $bad_slug Whether the post slug would be bad as a flat slug.
* @param string $slug The post slug.
* @param string $post_type Post type.
*/
$is_bad_flat_slug = apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type );
if ( $post_name_check
|| in_array( $slug, $feeds, true ) || 'embed' === $slug
|| $conflicts_with_date_archive
|| $is_bad_flat_slug
) {
$suffix = 2;
do {
$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) );
$suffix++;
} while ( $post_name_check );
$slug = $alt_post_name;
}
}
/**
* Filters the unique post slug.
*
* @since 3.3.0
*
* @param string $slug The post slug.
* @param int $post_ID Post ID.
* @param string $post_status The post status.
* @param string $post_type Post type.
* @param int $post_parent Post parent ID
* @param string $original_slug The original post slug.
*/
return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug );
}
```
[apply\_filters( 'pre\_wp\_unique\_post\_slug', string|null $override\_slug, string $slug, int $post\_ID, string $post\_status, string $post\_type, int $post\_parent )](../hooks/pre_wp_unique_post_slug)
Filters the post slug before it is generated to be unique.
[apply\_filters( 'wp\_unique\_post\_slug', string $slug, int $post\_ID, string $post\_status, string $post\_type, int $post\_parent, string $original\_slug )](../hooks/wp_unique_post_slug)
Filters the unique post slug.
[apply\_filters( 'wp\_unique\_post\_slug\_is\_bad\_attachment\_slug', bool $bad\_slug, string $slug )](../hooks/wp_unique_post_slug_is_bad_attachment_slug)
Filters whether the post slug would make a bad attachment slug.
[apply\_filters( 'wp\_unique\_post\_slug\_is\_bad\_flat\_slug', bool $bad\_slug, string $slug, string $post\_type )](../hooks/wp_unique_post_slug_is_bad_flat_slug)
Filters whether the post slug would be bad as a flat slug.
[apply\_filters( 'wp\_unique\_post\_slug\_is\_bad\_hierarchical\_slug', bool $bad\_slug, string $slug, string $post\_type, int $post\_parent )](../hooks/wp_unique_post_slug_is_bad_hierarchical_slug)
Filters whether the post slug would make a bad hierarchical post slug.
| Uses | Description |
| --- | --- |
| [\_truncate\_post\_slug()](_truncate_post_slug) wp-includes/post.php | Truncates a post slug. |
| [is\_post\_type\_hierarchical()](is_post_type_hierarchical) wp-includes/post.php | Determines whether the post type is hierarchical. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Posts\_Controller::create\_item()](../classes/wp_rest_posts_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Creates a single post. |
| [WP\_REST\_Posts\_Controller::update\_item()](../classes/wp_rest_posts_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Updates a single post. |
| [get\_sample\_permalink()](get_sample_permalink) wp-admin/includes/post.php | Returns a sample permalink based on the post name. |
| [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\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress wp_maybe_update_user_counts( int|null $network_id = null ): bool wp\_maybe\_update\_user\_counts( int|null $network\_id = null ): bool
=====================================================================
Updates the total count of users on the site if live user counting is enabled.
`$network_id` int|null Optional ID of the network. Defaults to the current network. Default: `null`
bool Whether the update was successful.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_maybe_update_user_counts( $network_id = null ) {
if ( ! is_multisite() && null !== $network_id ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: %s: $network_id */
__( 'Unable to pass %s if not using multisite.' ),
'<code>$network_id</code>'
),
'6.0.0'
);
}
$is_small_network = ! wp_is_large_user_count( $network_id );
/** This filter is documented in wp-includes/ms-functions.php */
if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) ) {
return false;
}
return wp_update_user_counts( $network_id );
}
```
[apply\_filters( 'enable\_live\_network\_counts', bool $small\_network, string $context )](../hooks/enable_live_network_counts)
Filters whether to update network site or user counts when a new site is created.
| Uses | Description |
| --- | --- |
| [wp\_is\_large\_user\_count()](wp_is_large_user_count) wp-includes/user.php | Determines whether the site has a large number of users. |
| [wp\_update\_user\_counts()](wp_update_user_counts) wp-includes/user.php | Updates the total count of users on the site. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [\_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 |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress apply_filters( string $hook_name, mixed $value, mixed $args ): mixed apply\_filters( string $hook\_name, mixed $value, mixed $args ): mixed
======================================================================
Calls the callback functions that have been added to a filter hook.
This function invokes all functions attached to filter hook `$hook_name`.
It is possible to create new filter hooks by simply calling this function, specifying the name of the new hook using the `$hook_name` parameter.
The function also allows for multiple additional arguments to be passed to hooks.
Example usage:
```
// The filter callback function.
function example_callback( $string, $arg1, $arg2 ) {
// (maybe) modify $string.
return $string;
}
add_filter( 'example_filter', 'example_callback', 10, 3 );
/*
* Apply the filters by calling the 'example_callback()' function
* that's hooked onto `example_filter` above.
*
* - 'example_filter' is the filter hook.
* - 'filter me' is the value being filtered.
* - $arg1 and $arg2 are the additional arguments passed to the callback.
$value = apply_filters( 'example_filter', 'filter me', $arg1, $arg2 );
```
`$hook_name` string Required The name of the filter hook. `$value` mixed Required The value to filter. `$args` mixed Required Additional parameters to pass to the callback functions. mixed The filtered value after all hooked functions are applied to it.
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function apply_filters( $hook_name, $value, ...$args ) {
global $wp_filter, $wp_filters, $wp_current_filter;
if ( ! isset( $wp_filters[ $hook_name ] ) ) {
$wp_filters[ $hook_name ] = 1;
} else {
++$wp_filters[ $hook_name ];
}
// Do 'all' actions first.
if ( isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $hook_name;
$all_args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
_wp_call_all_hook( $all_args );
}
if ( ! isset( $wp_filter[ $hook_name ] ) ) {
if ( isset( $wp_filter['all'] ) ) {
array_pop( $wp_current_filter );
}
return $value;
}
if ( ! isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $hook_name;
}
// Pass the value to WP_Hook.
array_unshift( $args, $value );
$filtered = $wp_filter[ $hook_name ]->apply_filters( $value, $args );
array_pop( $wp_current_filter );
return $filtered;
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_call\_all\_hook()](_wp_call_all_hook) wp-includes/plugin.php | Calls the ‘all’ hook, which will process the functions hooked into it. |
| 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\_required\_field\_message()](wp_required_field_message) wp-includes/general-template.php | Creates a message to explain required form fields. |
| [wp\_required\_field\_indicator()](wp_required_field_indicator) wp-includes/general-template.php | Assigns a visual indicator for required form fields. |
| [wp\_preload\_resources()](wp_preload_resources) wp-includes/general-template.php | Prints resource preloads directives to browsers. |
| [WP\_REST\_Server::get\_json\_encode\_options()](../classes/wp_rest_server/get_json_encode_options) wp-includes/rest-api/class-wp-rest-server.php | Gets the encoding options passed to {@see wp\_json\_encode}. |
| [WP\_Theme\_JSON\_Resolver::get\_block\_data()](../classes/wp_theme_json_resolver/get_block_data) wp-includes/class-wp-theme-json-resolver.php | Gets the styles for blocks from the block.json file. |
| [WP\_Site\_Health::available\_object\_cache\_services()](../classes/wp_site_health/available_object_cache_services) wp-admin/includes/class-wp-site-health.php | Returns a list of available persistent object cache services. |
| [WP\_Site\_Health::get\_page\_cache\_headers()](../classes/wp_site_health/get_page_cache_headers) wp-admin/includes/class-wp-site-health.php | Returns a list of headers and its verification callback to verify if page cache is enabled or not. |
| [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\_good\_response\_time\_threshold()](../classes/wp_site_health/get_good_response_time_threshold) wp-admin/includes/class-wp-site-health.php | Gets the threshold below which a response time is considered good. |
| [WP\_Site\_Health::should\_suggest\_persistent\_object\_cache()](../classes/wp_site_health/should_suggest_persistent_object_cache) wp-admin/includes/class-wp-site-health.php | Determines whether to suggest using a persistent object cache. |
| [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. |
| [IXR\_Message::parse()](../classes/ixr_message/parse) wp-includes/IXR/class-IXR-message.php | |
| [\_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. |
| [wp\_filesize()](wp_filesize) wp-includes/functions.php | Wrapper for PHP filesize with filters and casting the result as an integer. |
| [wp\_maybe\_update\_user\_counts()](wp_maybe_update_user_counts) wp-includes/user.php | Updates the total count of users on the site if live user counting is enabled. |
| [wp\_is\_large\_user\_count()](wp_is_large_user_count) wp-includes/user.php | Determines whether the site has a large number of users. |
| [\_load\_remote\_featured\_patterns()](_load_remote_featured_patterns) wp-includes/block-patterns.php | Register `Featured` (category) patterns from wordpress.org/patterns. |
| [WP\_Theme\_JSON\_Resolver::get\_user\_data()](../classes/wp_theme_json_resolver/get_user_data) wp-includes/class-wp-theme-json-resolver.php | Returns the user’s origin config. |
| [WP\_REST\_Menu\_Items\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_menu_items_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares a single post output for response. |
| [WP\_REST\_Menu\_Items\_Controller::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\_URL\_Details\_Controller::set\_cache()](../classes/wp_rest_url_details_controller/set_cache) wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Utility function to cache a given data set at a given cache key. |
| [WP\_REST\_URL\_Details\_Controller::parse\_url\_details()](../classes/wp_rest_url_details_controller/parse_url_details) wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Retrieves the contents of the title tag from the HTML response. |
| [WP\_REST\_URL\_Details\_Controller::get\_remote\_url()](../classes/wp_rest_url_details_controller/get_remote_url) wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Retrieves the document title from a remote URL. |
| [WP\_REST\_Menus\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_menus_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Prepares a single term output for response. |
| [WP\_REST\_Menu\_Locations\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_menu_locations_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Prepares a menu location object for serialization. |
| [WP\_Theme::get\_file\_path()](../classes/wp_theme/get_file_path) wp-includes/class-wp-theme.php | Retrieves the path of a file in the theme. |
| [wp\_list\_users()](wp_list_users) wp-includes/user.php | Lists all the users of the site, with several options available. |
| [get\_block\_file\_template()](get_block_file_template) wp-includes/block-template-utils.php | Retrieves a unified template object based on a theme file. |
| [get\_allowed\_block\_template\_part\_areas()](get_allowed_block_template_part_areas) wp-includes/block-template-utils.php | Returns a filtered list of allowed area values for template parts. |
| [get\_default\_block\_template\_types()](get_default_block_template_types) wp-includes/block-template-utils.php | Returns a filtered list of default template types, containing their localized titles and descriptions. |
| [wp\_omit\_loading\_attr\_threshold()](wp_omit_loading_attr_threshold) wp-includes/media.php | Gets the threshold for how many of the first content media elements to not lazy-load. |
| [rest\_get\_route\_for\_post\_type\_items()](rest_get_route_for_post_type_items) wp-includes/rest-api.php | Gets the REST API route for a post type. |
| [rest\_get\_route\_for\_taxonomy\_items()](rest_get_route_for_taxonomy_items) wp-includes/rest-api.php | Gets the REST API route for a taxonomy. |
| [WP\_Widget\_Block::widget()](../classes/wp_widget_block/widget) wp-includes/widgets/class-wp-widget-block.php | Outputs the content for the current Block widget instance. |
| [WP\_Widget\_Block::get\_dynamic\_classname()](../classes/wp_widget_block/get_dynamic_classname) wp-includes/widgets/class-wp-widget-block.php | Calculates the classname to use in the block widget’s container HTML. |
| [\_load\_remote\_block\_patterns()](_load_remote_block_patterns) wp-includes/block-patterns.php | Register Core’s official patterns from wordpress.org/patterns. |
| [WP\_Theme\_JSON\_Resolver::get\_theme\_data()](../classes/wp_theme_json_resolver/get_theme_data) wp-includes/class-wp-theme-json-resolver.php | Returns the theme’s data. |
| [WP\_Theme\_JSON\_Resolver::get\_core\_data()](../classes/wp_theme_json_resolver/get_core_data) wp-includes/class-wp-theme-json-resolver.php | Returns core’s origin config. |
| [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\_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\_REST\_Templates\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_templates_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Prepare a single template output for response |
| [WP\_REST\_Pattern\_Directory\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_pattern_directory_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php | Prepare a raw block pattern before it gets output in a REST API response. |
| [WP\_REST\_Pattern\_Directory\_Controller::get\_collection\_params()](../classes/wp_rest_pattern_directory_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php | Retrieves the search parameters for the block pattern’s collection. |
| [WP\_REST\_Widget\_Types\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_widget_types_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Prepares a widget type object for serialization. |
| [WP\_REST\_Widget\_Types\_Controller::encode\_form\_data()](../classes/wp_rest_widget_types_controller/encode_form_data) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | An RPC-style endpoint which can be used by clients to turn user input in a widget admin form into an encoded instance object. |
| [WP\_REST\_Widget\_Types\_Controller::get\_widget\_form()](../classes/wp_rest_widget_types_controller/get_widget_form) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Returns the output of [WP\_Widget::form()](../classes/wp_widget/form) when called with the provided instance. Used by encode\_form\_data() to preview a widget’s form. |
| [get\_legacy\_widget\_block\_editor\_settings()](get_legacy_widget_block_editor_settings) wp-includes/block-editor.php | Returns the block editor settings needed to use the Legacy Widget block which is not registered by default. |
| [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\_default\_block\_editor\_settings()](get_default_block_editor_settings) wp-includes/block-editor.php | Returns the default block editor settings. |
| [wp\_render\_widget()](wp_render_widget) wp-includes/widgets.php | Calls the render callback of a widget and returns the output. |
| [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. |
| [wp\_xmlrpc\_server::set\_is\_enabled()](../classes/wp_xmlrpc_server/set_is_enabled) wp-includes/class-wp-xmlrpc-server.php | Set wp\_xmlrpc\_server::$is\_enabled property. |
| [wp\_maybe\_inline\_styles()](wp_maybe_inline_styles) wp-includes/script-loader.php | Allows small styles to be inlined. |
| [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\_Theme\_JSON::get\_style\_nodes()](../classes/wp_theme_json/get_style_nodes) wp-includes/class-wp-theme-json.php | Builds metadata for the style nodes, which returns in the form of: |
| [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. |
| [get\_adjacent\_image\_link()](get_adjacent_image_link) wp-includes/media.php | Gets the next or previous image link that has the same post parent. |
| [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. |
| [wp\_robots()](wp_robots) wp-includes/robots-template.php | Displays the robots meta tag as necessary. |
| [wp\_get\_inline\_script\_tag()](wp_get_inline_script_tag) wp-includes/script-loader.php | Wraps inline JavaScript in tag. |
| [wp\_get\_script\_tag()](wp_get_script_tag) wp-includes/script-loader.php | Formats loader tags. |
| [wp\_get\_update\_https\_url()](wp_get_update_https_url) wp-includes/functions.php | Gets the URL to learn more about updating the site to use HTTPS. |
| [wp\_get\_direct\_update\_https\_url()](wp_get_direct_update_https_url) wp-includes/functions.php | Gets the URL for directly updating the site to use HTTPS. |
| [is\_post\_status\_viewable()](is_post_status_viewable) wp-includes/post.php | Determines whether a post status is considered “viewable”. |
| [wp\_iframe\_tag\_add\_loading\_attr()](wp_iframe_tag_add_loading_attr) wp-includes/media.php | Adds `loading` attribute to an `iframe` HTML tag. |
| [wp\_update\_https\_detection\_errors()](wp_update_https_detection_errors) wp-includes/https-detection.php | Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors. |
| [wp\_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\_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\_is\_site\_protected\_by\_basic\_auth()](wp_is_site_protected_by_basic_auth) wp-includes/load.php | Checks if this site is protected by HTTP Basic Auth. |
| [wpmu\_new\_site\_admin\_notification()](wpmu_new_site_admin_notification) wp-includes/ms-functions.php | Notifies the Multisite network administrator that a new site was created. |
| [WP\_REST\_Server::get\_max\_batch\_size()](../classes/wp_rest_server/get_max_batch_size) wp-includes/rest-api/class-wp-rest-server.php | Gets the maximum number of requests that can be included in a batch. |
| [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\_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::prepare\_item\_for\_database()](../classes/wp_rest_application_passwords_controller/prepare_item_for_database) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Prepares an application password for a create or update operation. |
| [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\_Comments\_Controller::check\_is\_comment\_content\_allowed()](../classes/wp_rest_comments_controller/check_is_comment_content_allowed) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | If empty comments are not allowed, checks if the provided comment content is not empty. |
| [WP\_REST\_Term\_Search\_Handler::search\_items()](../classes/wp_rest_term_search_handler/search_items) wp-includes/rest-api/search/class-wp-rest-term-search-handler.php | Searches the object type content for a given search request. |
| [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\_should\_load\_block\_editor\_scripts\_and\_styles()](wp_should_load_block_editor_scripts_and_styles) wp-includes/script-loader.php | Checks if the editor scripts and styles for all registered block types should be enqueued on the current screen. |
| [wp\_is\_application\_passwords\_available()](wp_is_application_passwords_available) wp-includes/user.php | Checks if Application Passwords is globally available. |
| [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\_authenticate\_application\_password()](wp_authenticate_application_password) wp-includes/user.php | Authenticates the user using an application password. |
| [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| [wp\_is\_auto\_update\_forced\_for\_item()](wp_is_auto_update_forced_for_item) wp-admin/includes/update.php | Checks whether auto-updates are forced for an 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. |
| [core\_auto\_updates\_settings()](core_auto_updates_settings) wp-admin/update-core.php | Display WordPress auto-updates settings. |
| [esc\_xml()](esc_xml) wp-includes/formatting.php | Escaping for XML blocks. |
| [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. |
| [WP\_Block::render()](../classes/wp_block/render) wp-includes/class-wp-block.php | Generates the render output for the block. |
| [wp\_is\_maintenance\_mode()](wp_is_maintenance_mode) wp-includes/load.php | Check if maintenance mode is enabled. |
| [WP\_REST\_Block\_Directory\_Controller::get\_collection\_params()](../classes/wp_rest_block_directory_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php | Retrieves the search params for the blocks collection. |
| [WP\_REST\_Plugins\_Controller::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::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\_REST\_Block\_Types\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_block_types_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Prepares a block type object for serialization. |
| [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\_batch\_update\_comment\_type()](_wp_batch_update_comment_type) wp-includes/comment.php | Updates the comment type for a batch of comments. |
| [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\_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\_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\_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. |
| [wp\_filter\_content\_tags()](wp_filter_content_tags) wp-includes/media.php | Filters specific tags in post content and modifies their markup. |
| [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. |
| [rest\_get\_route\_for\_post()](rest_get_route_for_post) wp-includes/rest-api.php | Gets the REST API route for a post. |
| [rest\_get\_route\_for\_term()](rest_get_route_for_term) wp-includes/rest-api.php | Gets the REST API route for a term. |
| [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\_Embed::get\_embed\_handler\_html()](../classes/wp_embed/get_embed_handler_html) wp-includes/class-wp-embed.php | Returns embed HTML for a given URL from embed handlers. |
| [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\_sitemaps\_get\_max\_urls()](wp_sitemaps_get_max_urls) wp-includes/sitemaps.php | Gets the maximum number of URLs for a sitemap. |
| [WP\_Sitemaps\_Provider::get\_sitemap\_entries()](../classes/wp_sitemaps_provider/get_sitemap_entries) wp-includes/sitemaps/class-wp-sitemaps-provider.php | Lists sitemap pages exposed by this provider. |
| [WP\_Sitemaps\_Renderer::get\_sitemap\_index\_stylesheet\_url()](../classes/wp_sitemaps_renderer/get_sitemap_index_stylesheet_url) wp-includes/sitemaps/class-wp-sitemaps-renderer.php | Gets the URL for the sitemap index stylesheet. |
| [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\_Users::get\_url\_list()](../classes/wp_sitemaps_users/get_url_list) wp-includes/sitemaps/providers/class-wp-sitemaps-users.php | Gets a URL list for a user sitemap. |
| [WP\_Sitemaps\_Users::get\_max\_num\_pages()](../classes/wp_sitemaps_users/get_max_num_pages) wp-includes/sitemaps/providers/class-wp-sitemaps-users.php | Gets the max number of pages available for the object type. |
| [WP\_Sitemaps\_Users::get\_users\_query\_args()](../classes/wp_sitemaps_users/get_users_query_args) wp-includes/sitemaps/providers/class-wp-sitemaps-users.php | Returns the query args for retrieving users to list in the sitemap. |
| [WP\_Sitemaps\_Renderer::get\_sitemap\_stylesheet\_url()](../classes/wp_sitemaps_renderer/get_sitemap_stylesheet_url) wp-includes/sitemaps/class-wp-sitemaps-renderer.php | Gets the URL for the sitemap stylesheet. |
| [WP\_Sitemaps\_Taxonomies::get\_object\_subtypes()](../classes/wp_sitemaps_taxonomies/get_object_subtypes) wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php | Returns all public, registered taxonomies. |
| [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. |
| [WP\_Sitemaps\_Taxonomies::get\_max\_num\_pages()](../classes/wp_sitemaps_taxonomies/get_max_num_pages) wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php | Gets the max number of pages available for the object type. |
| [WP\_Sitemaps\_Taxonomies::get\_taxonomies\_query\_args()](../classes/wp_sitemaps_taxonomies/get_taxonomies_query_args) wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php | Returns the query args for retrieving taxonomy terms to list in the sitemap. |
| [WP\_Sitemaps\_Posts::get\_posts\_query\_args()](../classes/wp_sitemaps_posts/get_posts_query_args) wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php | Returns the query args for retrieving posts to list in the sitemap. |
| [WP\_Sitemaps\_Posts::get\_object\_subtypes()](../classes/wp_sitemaps_posts/get_object_subtypes) wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php | Returns the public post types, which excludes nav\_items and similar types. |
| [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\_Sitemaps\_Stylesheet::get\_stylesheet\_css()](../classes/wp_sitemaps_stylesheet/get_stylesheet_css) wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php | Gets the CSS to be included in sitemap XSL stylesheets. |
| [WP\_Sitemaps\_Registry::add\_provider()](../classes/wp_sitemaps_registry/add_provider) wp-includes/sitemaps/class-wp-sitemaps-registry.php | Adds a new sitemap provider. |
| [WP\_Sitemaps\_Stylesheet::get\_sitemap\_stylesheet()](../classes/wp_sitemaps_stylesheet/get_sitemap_stylesheet) wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php | Returns the escaped XSL for all sitemaps, except index. |
| [WP\_Sitemaps\_Stylesheet::get\_sitemap\_index\_stylesheet()](../classes/wp_sitemaps_stylesheet/get_sitemap_index_stylesheet) wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php | Returns the escaped XSL for the index sitemaps. |
| [wp\_admin\_viewport\_meta()](wp_admin_viewport_meta) wp-admin/includes/misc.php | Displays the viewport meta in the admin. |
| [wp\_opcache\_invalidate()](wp_opcache_invalidate) wp-admin/includes/file.php | Attempts to clear the opcode cache for an individual PHP file. |
| [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\_Automatic\_Updater::after\_plugin\_theme\_update()](../classes/wp_automatic_updater/after_plugin_theme_update) wp-admin/includes/class-wp-automatic-updater.php | If we tried to perform plugin or theme updates, check if we should send an email. |
| [wp\_is\_auto\_update\_enabled\_for\_type()](wp_is_auto_update_enabled_for_type) wp-admin/includes/update.php | Checks whether auto-updates are enabled. |
| [Plugin\_Installer\_Skin::do\_overwrite()](../classes/plugin_installer_skin/do_overwrite) wp-admin/includes/class-plugin-installer-skin.php | Check if the plugin can be overwritten and output the HTML for overwriting a plugin on upload. |
| [Theme\_Installer\_Skin::do\_overwrite()](../classes/theme_installer_skin/do_overwrite) wp-admin/includes/class-theme-installer-skin.php | Check if the theme can be overwritten and output the HTML for overwriting a theme on upload. |
| [WP\_MS\_Themes\_List\_Table::column\_autoupdates()](../classes/wp_ms_themes_list_table/column_autoupdates) wp-admin/includes/class-wp-ms-themes-list-table.php | Handles the auto-updates column output. |
| [wp\_ajax\_toggle\_auto\_updates()](wp_ajax_toggle_auto_updates) wp-admin/includes/ajax-actions.php | Ajax handler to enable or disable plugin and theme auto-updates. |
| [wp\_theme\_auto\_update\_setting\_template()](wp_theme_auto_update_setting_template) wp-admin/themes.php | Returns the JavaScript template used to display the auto-update setting for a theme. |
| [WP\_Site\_Health::perform\_test()](../classes/wp_site_health/perform_test) wp-admin/includes/class-wp-site-health.php | Runs a Site Health test directly. |
| [wpdb::log\_query()](../classes/wpdb/log_query) wp-includes/class-wpdb.php | Logs query data. |
| [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\_date()](wp_date) wp-includes/functions.php | Retrieves the date, in localized format. |
| [wp\_get\_original\_image\_path()](wp_get_original_image_path) wp-includes/post.php | Retrieves the path to an uploaded image file. |
| [wp\_get\_original\_image\_url()](wp_get_original_image_url) wp-includes/post.php | Retrieves the URL to an original attachment image. |
| [get\_post\_states()](get_post_states) wp-admin/includes/template.php | Retrieves an array of post states from a post. |
| [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\_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\_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\_MS\_Sites\_List\_Table::site\_states()](../classes/wp_ms_sites_list_table/site_states) wp-admin/includes/class-wp-ms-sites-list-table.php | Maybe output comma-separated site states. |
| [WP\_Privacy\_Data\_Export\_Requests\_List\_Table::column\_email()](../classes/wp_privacy_data_export_requests_list_table/column_email) wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php | Actions column. |
| [WP\_Privacy\_Data\_Export\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_export_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php | Displays the next steps column. |
| [WP\_Recovery\_Mode::get\_email\_rate\_limit()](../classes/wp_recovery_mode/get_email_rate_limit) wp-includes/class-wp-recovery-mode.php | Gets the rate limit between sending new recovery mode email links. |
| [WP\_Recovery\_Mode::get\_link\_ttl()](../classes/wp_recovery_mode/get_link_ttl) wp-includes/class-wp-recovery-mode.php | Gets the number of seconds the recovery mode link is valid for. |
| [wp\_is\_jsonp\_request()](wp_is_jsonp_request) wp-includes/load.php | Checks whether current request is a JSONP request, or is expecting a JSONP response. |
| [is\_protected\_endpoint()](is_protected_endpoint) wp-includes/load.php | Determines whether we are currently on an endpoint that should be protected against WSODs. |
| [is\_protected\_ajax\_action()](is_protected_ajax_action) wp-includes/load.php | Determines whether we are currently handling an Ajax action that should be protected against WSODs. |
| [get\_feed\_build\_date()](get_feed_build_date) wp-includes/feed.php | Gets the UTC time of the most recently modified post from [WP\_Query](../classes/wp_query). |
| [WP\_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\_Link\_Service::get\_recovery\_mode\_begin\_url()](../classes/wp_recovery_mode_link_service/get_recovery_mode_begin_url) wp-includes/class-wp-recovery-mode-link-service.php | Gets a URL to begin recovery mode. |
| [WP\_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\_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\_is\_fatal\_error\_handler\_enabled()](wp_is_fatal_error_handler_enabled) wp-includes/error-protection.php | Checks whether the fatal error handler is enabled. |
| [WP\_Fatal\_Error\_Handler::display\_default\_error\_template()](../classes/wp_fatal_error_handler/display_default_error_template) wp-includes/class-wp-fatal-error-handler.php | Displays the default PHP error template. |
| [WP\_Fatal\_Error\_Handler::should\_handle\_error()](../classes/wp_fatal_error_handler/should_handle_error) wp-includes/class-wp-fatal-error-handler.php | Determines whether we are dealing with an error that WordPress should handle in order to protect the admin backend against WSODs. |
| [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\_Query::generate\_postdata()](../classes/wp_query/generate_postdata) wp-includes/class-wp-query.php | Generate post data. |
| [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\_trusted\_keys()](wp_trusted_keys) wp-admin/includes/file.php | Retrieves the list of signing keys trusted by WordPress. |
| [WP\_Site\_Health::get\_test\_rest\_availability()](../classes/wp_site_health/get_test_rest_availability) wp-admin/includes/class-wp-site-health.php | Tests if the REST API is accessible. |
| [WP\_Site\_Health::get\_tests()](../classes/wp_site_health/get_tests) wp-admin/includes/class-wp-site-health.php | Returns a set of tests that belong to the site status page. |
| [WP\_Site\_Health::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\_php\_extensions()](../classes/wp_site_health/get_test_php_extensions) wp-admin/includes/class-wp-site-health.php | Tests if required PHP modules are installed on the host. |
| [WP\_Posts\_List\_Table::formats\_dropdown()](../classes/wp_posts_list_table/formats_dropdown) wp-admin/includes/class-wp-posts-list-table.php | Displays a formats drop-down for filtering items. |
| [WP\_Site\_Health\_Auto\_Updates::test\_accepts\_dev\_updates()](../classes/wp_site_health_auto_updates/test_accepts_dev_updates) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if the install is using a development branch and can use nightly packages. |
| [WP\_Site\_Health\_Auto\_Updates::test\_accepts\_minor\_updates()](../classes/wp_site_health_auto_updates/test_accepts_minor_updates) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if the site supports automatic minor updates. |
| [WP\_Site\_Health\_Auto\_Updates::test\_filters\_automatic\_updater\_disabled()](../classes/wp_site_health_auto_updates/test_filters_automatic_updater_disabled) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if automatic updates are disabled by a filter. |
| [WP\_Site\_Health\_Auto\_Updates::test\_vcs\_abspath()](../classes/wp_site_health_auto_updates/test_vcs_abspath) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if WordPress is controlled by a VCS (Git, Subversion etc). |
| [wp\_get\_direct\_php\_update\_url()](wp_get_direct_php_update_url) wp-includes/functions.php | Gets the URL for directly updating the PHP version the site is running on. |
| [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\_using\_themes()](wp_using_themes) wp-includes/load.php | Determines whether the current request should use themes. |
| [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\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. |
| [wp\_uninitialize\_site()](wp_uninitialize_site) wp-includes/ms-site.php | Runs the uninitialization routine for a given site. |
| [wp\_is\_site\_initialized()](wp_is_site_initialized) wp-includes/ms-site.php | Checks whether a site is initialized. |
| [wp\_prepare\_site\_data()](wp_prepare_site_data) wp-includes/ms-site.php | Prepares site data for insertion or update in the database. |
| [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. |
| [is\_avatar\_comment\_type()](is_avatar_comment_type) wp-includes/link-template.php | Check if this comment type allows avatars to be retrieved. |
| [wp\_check\_php\_version()](wp_check_php_version) wp-admin/includes/misc.php | Checks if the user needs to update PHP. |
| [populate\_network\_meta()](populate_network_meta) wp-admin/includes/schema.php | Creates WordPress network meta and sets the default values. |
| [populate\_site\_meta()](populate_site_meta) wp-admin/includes/schema.php | Creates WordPress site meta and sets the default values. |
| [load\_script\_translations()](load_script_translations) wp-includes/l10n.php | Loads the translation data for the given script handle and text domain. |
| [wp\_kses\_uri\_attributes()](wp_kses_uri_attributes) wp-includes/kses.php | Returns an array of HTML attribute names whose value contains a URL. |
| [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::get\_collection\_params()](../classes/wp_rest_themes_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Retrieves the search params for the themes collection. |
| [WP\_REST\_Autosaves\_Controller::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\_REST\_Revisions\_Controller::prepare\_items\_query()](../classes/wp_rest_revisions_controller/prepare_items_query) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Determines the allowed query\_vars for a get\_items() response and prepares them for [WP\_Query](../classes/wp_query). |
| [WP\_REST\_Post\_Search\_Handler::search\_items()](../classes/wp_rest_post_search_handler/search_items) wp-includes/rest-api/search/class-wp-rest-post-search-handler.php | Searches the object type content for a given search request. |
| [load\_script\_textdomain()](load_script_textdomain) wp-includes/l10n.php | Loads the script translated strings. |
| [determine\_locale()](determine_locale) wp-includes/l10n.php | Determines the current locale desired for the request. |
| [wp\_get\_script\_polyfill()](wp_get_script_polyfill) wp-includes/script-loader.php | Returns contents of an inline script used in appending polyfill scripts for browsers which fail the provided tests. The provided array is a mapping from a condition to verify feature support to its polyfill script handle. |
| [wp\_tinymce\_inline\_scripts()](wp_tinymce_inline_scripts) wp-includes/script-loader.php | Adds inline scripts required for the TinyMCE in the block editor. |
| [get\_oembed\_response\_data\_for\_url()](get_oembed_response_data_for_url) wp-includes/embed.php | Retrieves the oEmbed response data for a given URL. |
| [wp\_get\_code\_editor\_settings()](wp_get_code_editor_settings) wp-includes/general-template.php | Generates and returns code editor settings. |
| [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. |
| [WP\_Block\_Type::set\_props()](../classes/wp_block_type/set_props) wp-includes/class-wp-block-type.php | Sets block type properties. |
| [parse\_blocks()](parse_blocks) wp-includes/blocks.php | Parses blocks out of a content string. |
| [excerpt\_remove\_blocks()](excerpt_remove_blocks) wp-includes/blocks.php | Parses blocks out of a content string, and renders those appropriate for the excerpt. |
| [render\_block()](render_block) wp-includes/blocks.php | Renders a single block into a HTML string. |
| [the\_block\_editor\_meta\_boxes()](the_block_editor_meta_boxes) wp-admin/includes/post.php | Renders the meta boxes forms. |
| [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. |
| [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. |
| [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. |
| [get\_object\_subtype()](get_object_subtype) wp-includes/meta.php | Returns the object subtype for a given object ID of a specific type. |
| [wp\_comments\_personal\_data\_eraser()](wp_comments_personal_data_eraser) wp-includes/comment.php | Erases personal data associated with an email address from the comments table. |
| [wp\_privacy\_delete\_old\_export\_files()](wp_privacy_delete_old_export_files) wp-includes/functions.php | Cleans up export files older than three days old. |
| [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\_privacy\_anonymize\_data()](wp_privacy_anonymize_data) wp-includes/functions.php | Returns uniform “anonymous” data by type. |
| [wp\_validate\_user\_request\_key()](wp_validate_user_request_key) wp-includes/user.php | Validates a user request by comparing the key with the request’s key. |
| [\_wp\_privacy\_send\_request\_confirmation\_notification()](_wp_privacy_send_request_confirmation_notification) wp-includes/user.php | Notifies the site administrator via email when a request is confirmed. |
| [\_wp\_privacy\_send\_erasure\_fulfillment\_notification()](_wp_privacy_send_erasure_fulfillment_notification) wp-includes/user.php | Notifies the user when their erasure request is fulfilled. |
| [\_wp\_privacy\_account\_request\_confirmed\_message()](_wp_privacy_account_request_confirmed_message) wp-includes/user.php | Returns request confirmation message HTML. |
| [wp\_user\_request\_action\_description()](wp_user_request_action_description) wp-includes/user.php | Gets action description from the name and return a string. |
| [wp\_send\_user\_request()](wp_send_user_request) wp-includes/user.php | Send a confirmation request email to confirm an action. |
| [wp\_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. |
| [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\_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\_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\_process\_personal\_data\_erasure\_page()](wp_privacy_process_personal_data_erasure_page) wp-admin/includes/privacy-tools.php | Mark erasure requests as completed after processing is finished. |
| [\_wp\_personal\_data\_cleanup\_requests()](_wp_personal_data_cleanup_requests) wp-admin/includes/privacy-tools.php | Cleans up failed and expired requests before displaying the list table. |
| [wp\_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\_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\_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\_Customize\_Manager::trash\_changeset\_post()](../classes/wp_customize_manager/trash_changeset_post) wp-includes/class-wp-customize-manager.php | Trashes or deletes a changeset post. |
| [WP\_Customize\_Manager::branching()](../classes/wp_customize_manager/branching) wp-includes/class-wp-customize-manager.php | Whether the changeset branching is allowed. |
| [get\_the\_post\_type\_description()](get_the_post_type_description) wp-includes/general-template.php | Retrieves the description for a post type archive. |
| [wp\_get\_nav\_menu\_name()](wp_get_nav_menu_name) wp-includes/nav-menu.php | Returns the name of a navigation menu. |
| [wp\_site\_admin\_email\_change\_notification()](wp_site_admin_email_change_notification) wp-includes/functions.php | Sends an email to the old site admin email address when the site admin email address changes. |
| [WP\_Widget\_Media\_Gallery::get\_instance\_schema()](../classes/wp_widget_media_gallery/get_instance_schema) wp-includes/widgets/class-wp-widget-media-gallery.php | Get schema for properties of a widget instance (item). |
| [WP\_Widget\_Custom\_HTML::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. |
| [update\_network\_option\_new\_admin\_email()](update_network_option_new_admin_email) wp-includes/ms-functions.php | Sends a confirmation request email when a change of network admin email address is attempted. |
| [wp\_network\_admin\_email\_change\_notification()](wp_network_admin_email_change_notification) wp-includes/ms-functions.php | Sends an email to the old network admin email address when the network admin email address changes. |
| [wp\_admin\_headers()](wp_admin_headers) wp-admin/includes/misc.php | Sends a referrer policy header so referrers are not sent externally from administration screens. |
| [wp\_get\_plugin\_file\_editable\_extensions()](wp_get_plugin_file_editable_extensions) wp-admin/includes/file.php | Gets the list of file extensions that are editable in plugins. |
| [wp\_get\_theme\_file\_editable\_extensions()](wp_get_theme_file_editable_extensions) wp-admin/includes/file.php | Gets the list of file extensions that are editable for a given theme. |
| [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\_doing\_cron()](wp_doing_cron) wp-includes/load.php | Determines whether the current request is a WordPress cron request. |
| [wp\_is\_file\_mod\_allowed()](wp_is_file_mod_allowed) wp-includes/load.php | Determines whether file modifications are allowed. |
| [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\_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::get\_instance\_schema()](../classes/wp_widget_media/get_instance_schema) wp-includes/widgets/class-wp-widget-media.php | Get schema for properties of a widget instance (item). |
| [WP\_Widget\_Media::widget()](../classes/wp_widget_media/widget) wp-includes/widgets/class-wp-widget-media.php | Displays the widget on the front-end. |
| [rest\_get\_avatar\_sizes()](rest_get_avatar_sizes) wp-includes/rest-api.php | Retrieves the pixel sizes for avatars. |
| [create\_initial\_rest\_routes()](create_initial_rest_routes) wp-includes/rest-api.php | Registers default REST API routes. |
| [wp\_doing\_ajax()](wp_doing_ajax) wp-includes/load.php | Determines whether the current request is a WordPress Ajax request. |
| [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. |
| [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. |
| [get\_theme\_starter\_content()](get_theme_starter_content) wp-includes/theme.php | Expands a theme’s starter content configuration using core-provided 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\_get\_custom\_css()](wp_get_custom_css) wp-includes/theme.php | Fetches the saved Custom CSS content for rendering. |
| [get\_header\_video\_url()](get_header_video_url) wp-includes/theme.php | Retrieves header video URL for custom header. |
| [get\_header\_video\_settings()](get_header_video_settings) wp-includes/theme.php | Retrieves header video settings. |
| [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. |
| [WP\_REST\_Users\_Controller::check\_username()](../classes/wp_rest_users_controller/check_username) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Check a username for the REST API. |
| [WP\_REST\_Users\_Controller::get\_collection\_params()](../classes/wp_rest_users_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves the query params for collections. |
| [WP\_REST\_Users\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_users_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Prepares a single user output for response. |
| [WP\_REST\_Users\_Controller::prepare\_item\_for\_database()](../classes/wp_rest_users_controller/prepare_item_for_database) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Prepares a single user for creation or update. |
| [WP\_REST\_Users\_Controller::get\_items()](../classes/wp_rest_users_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves all users. |
| [WP\_REST\_Revisions\_Controller::prepare\_excerpt\_response()](../classes/wp_rest_revisions_controller/prepare_excerpt_response) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Checks the post excerpt and prepare it for single post output. |
| [WP\_REST\_Revisions\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_revisions_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Prepares the revision for the REST response. |
| [WP\_REST\_Revisions\_Controller::get\_items()](../classes/wp_rest_revisions_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Gets a collection of revisions. |
| [WP\_REST\_Attachments\_Controller::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\_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\_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\_Terms\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_terms_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Prepares a single term output for response. |
| [WP\_REST\_Terms\_Controller::get\_collection\_params()](../classes/wp_rest_terms_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Retrieves the query params for collections. |
| [WP\_REST\_Terms\_Controller::prepare\_item\_for\_database()](../classes/wp_rest_terms_controller/prepare_item_for_database) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Prepares a single term for create or update. |
| [WP\_REST\_Terms\_Controller::get\_items()](../classes/wp_rest_terms_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Retrieves terms associated with a taxonomy. |
| [WP\_REST\_Posts\_Controller::get\_item\_schema()](../classes/wp_rest_posts_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves the post’s schema, conforming to JSON Schema. |
| [WP\_REST\_Posts\_Controller::get\_collection\_params()](../classes/wp_rest_posts_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves the query params for the posts collection. |
| [WP\_REST\_Posts\_Controller::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\_items\_query()](../classes/wp_rest_posts_controller/prepare_items_query) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Determines the allowed query\_vars for a get\_items() response and prepares them for [WP\_Query](../classes/wp_query). |
| [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::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\_items()](../classes/wp_rest_posts_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves a collection of posts. |
| [WP\_REST\_Taxonomies\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_taxonomies_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Prepares a taxonomy object for serialization. |
| [WP\_REST\_Post\_Types\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_post_types_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Prepares a post type object for serialization. |
| [WP\_REST\_Comments\_Controller::get\_collection\_params()](../classes/wp_rest_comments_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Retrieves the query params for collections. |
| [WP\_REST\_Comments\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_comments_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Prepares a single comment output for response. |
| [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::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::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()](../classes/wp_rest_comments_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Retrieves a list of comment items. |
| [WP\_Taxonomy::set\_props()](../classes/wp_taxonomy/set_props) wp-includes/class-wp-taxonomy.php | Sets taxonomy properties. |
| [sanitize\_textarea\_field()](sanitize_textarea_field) wp-includes/formatting.php | Sanitizes a multiline string from user input or from the database. |
| [wp\_check\_comment\_flood()](wp_check_comment_flood) wp-includes/comment.php | Checks whether comment flooding is occurring. |
| [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\_parent\_theme\_file\_uri()](get_parent_theme_file_uri) wp-includes/link-template.php | Retrieves the URL 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. |
| [get\_theme\_file\_uri()](get_theme_file_uri) wp-includes/link-template.php | Retrieves the URL of a file in the theme. |
| [WP\_Customize\_Custom\_CSS\_Setting::value()](../classes/wp_customize_custom_css_setting/value) wp-includes/customize/class-wp-customize-custom-css-setting.php | Fetch the value of the setting. Will return the previewed value when `preview()` is called. |
| [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\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. |
| [WP\_Term\_Query::parse\_orderby()](../classes/wp_term_query/parse_orderby) wp-includes/class-wp-term-query.php | Parse and sanitize ‘orderby’ keys passed to the term query. |
| [WP\_Term\_Query::parse\_query()](../classes/wp_term_query/parse_query) wp-includes/class-wp-term-query.php | Parse arguments passed to the term query with default query parameters. |
| [WP\_Customize\_Manager::validate\_setting\_values()](../classes/wp_customize_manager/validate_setting_values) wp-includes/class-wp-customize-manager.php | Validates setting values. |
| [WP\_Customize\_Setting::validate()](../classes/wp_customize_setting/validate) wp-includes/class-wp-customize-setting.php | Validates an input. |
| [WP\_Network\_Query::set\_found\_networks()](../classes/wp_network_query/set_found_networks) wp-includes/class-wp-network-query.php | Populates found\_networks and max\_num\_pages properties for the current query if the limit clause was used. |
| [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. |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. |
| [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\_Comment\_Query::set\_found\_comments()](../classes/wp_comment_query/set_found_comments) wp-includes/class-wp-comment-query.php | Populates found\_comments and max\_num\_pages properties for the current query if the limit clause was used. |
| [the\_post\_thumbnail\_caption()](the_post_thumbnail_caption) wp-includes/post-thumbnail-template.php | Displays the post thumbnail caption. |
| [wp\_raise\_memory\_limit()](wp_raise_memory_limit) wp-includes/functions.php | Attempts to raise the PHP memory limit for memory intensive processes. |
| [\_deprecated\_hook()](_deprecated_hook) wp-includes/functions.php | Marks a deprecated action or filter hook as deprecated and throws a notice. |
| [wp\_get\_ext\_types()](wp_get_ext_types) wp-includes/functions.php | Retrieves the list of common file extensions and their types. |
| [wp\_get\_canonical\_url()](wp_get_canonical_url) wp-includes/link-template.php | Returns the canonical URL for a post. |
| [wp\_get\_attachment\_caption()](wp_get_attachment_caption) wp-includes/post.php | Retrieves the caption for an attachment. |
| [WP\_Site\_Query::get\_site\_ids()](../classes/wp_site_query/get_site_ids) wp-includes/class-wp-site-query.php | Used internally to get a list of site IDs matching the query vars. |
| [WP\_Site\_Query::set\_found\_sites()](../classes/wp_site_query/set_found_sites) wp-includes/class-wp-site-query.php | Populates found\_sites and max\_num\_pages properties for the current query if the limit clause was used. |
| [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. |
| [network\_edit\_site\_nav()](network_edit_site_nav) wp-admin/includes/ms.php | Outputs the HTML for a network’s “Edit Site” tabular interface. |
| [wxr\_term\_meta()](wxr_term_meta) wp-admin/includes/export.php | Outputs term meta XML tags for a given term object. |
| [rest\_get\_server()](rest_get_server) wp-includes/rest-api.php | Retrieves the current REST server instance. |
| [the\_embed\_site\_title()](the_embed_site_title) wp-includes/embed.php | Prints the necessary markup for the site title in an embed template. |
| [WP\_Customize\_Manager::get\_nonces()](../classes/wp_customize_manager/get_nonces) wp-includes/class-wp-customize-manager.php | Gets nonces for the Customizer. |
| [WP\_Customize\_Manager::get\_previewable\_devices()](../classes/wp_customize_manager/get_previewable_devices) wp-includes/class-wp-customize-manager.php | Returns a list of devices to allow previewing. |
| [WP\_Image\_Editor\_Imagick::thumbnail\_image()](../classes/wp_image_editor_imagick/thumbnail_image) wp-includes/class-wp-image-editor-imagick.php | Efficiently resize the current image |
| [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\_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\_REST\_Response::get\_curies()](../classes/wp_rest_response/get_curies) wp-includes/rest-api/class-wp-rest-response.php | Retrieves the CURIEs (compact URIs) used for relations. |
| [\_wp\_get\_current\_user()](_wp_get_current_user) wp-includes/user.php | Retrieves the current user object. |
| [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\_Customize\_Partial::render()](../classes/wp_customize_partial/render) wp-includes/customize/class-wp-customize-partial.php | Renders the template partial involving the associated settings. |
| [WP\_Customize\_Selective\_Refresh::add\_dynamic\_partials()](../classes/wp_customize_selective_refresh/add_dynamic_partials) wp-includes/customize/class-wp-customize-selective-refresh.php | Registers dynamically-created partials. |
| [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\_Customize\_Selective\_Refresh::add\_partial()](../classes/wp_customize_selective_refresh/add_partial) wp-includes/customize/class-wp-customize-selective-refresh.php | Adds a partial. |
| [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\_rest\_url()](get_rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint on a site. |
| [rest\_get\_url\_prefix()](rest_get_url_prefix) wp-includes/rest-api.php | Retrieves the URL prefix for any API resource. |
| [the\_excerpt\_embed()](the_excerpt_embed) wp-includes/embed.php | Displays the post excerpt for the embed template. |
| [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\_oembed\_endpoint\_url()](get_oembed_endpoint_url) wp-includes/embed.php | Retrieves the oEmbed endpoint URL for a given permalink. |
| [get\_post\_embed\_html()](get_post_embed_html) wp-includes/embed.php | Retrieves the embed code for a specific post. |
| [get\_oembed\_response\_data()](get_oembed_response_data) wp-includes/embed.php | Retrieves the oEmbed response data for a given post. |
| [get\_header\_image\_tag()](get_header_image_tag) wp-includes/theme.php | Creates image tag markup for a custom header image. |
| [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\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. |
| [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\_REST\_Request::get\_parameter\_order()](../classes/wp_rest_request/get_parameter_order) wp-includes/rest-api/class-wp-rest-request.php | Retrieves the parameter priority order. |
| [WP\_REST\_Server::get\_data\_for\_routes()](../classes/wp_rest_server/get_data_for_routes) wp-includes/rest-api/class-wp-rest-server.php | Retrieves the publicly-visible data for routes. |
| [WP\_REST\_Server::dispatch()](../classes/wp_rest_server/dispatch) wp-includes/rest-api/class-wp-rest-server.php | Matches the request to a callback and call it. |
| [WP\_REST\_Server::get\_index()](../classes/wp_rest_server/get_index) wp-includes/rest-api/class-wp-rest-server.php | Retrieves the site index. |
| [WP\_REST\_Server::get\_namespace\_index()](../classes/wp_rest_server/get_namespace_index) wp-includes/rest-api/class-wp-rest-server.php | Retrieves the index for a namespace. |
| [WP\_REST\_Server::envelope\_response()](../classes/wp_rest_server/envelope_response) wp-includes/rest-api/class-wp-rest-server.php | Wraps the response in an envelope. |
| [WP\_REST\_Server::get\_routes()](../classes/wp_rest_server/get_routes) wp-includes/rest-api/class-wp-rest-server.php | Retrieves the route map. |
| [WP\_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\_REST\_Server::embed\_links()](../classes/wp_rest_server/embed_links) wp-includes/rest-api/class-wp-rest-server.php | Embeds the links from the data into the request. |
| [WP\_REST\_Server::check\_authentication()](../classes/wp_rest_server/check_authentication) wp-includes/rest-api/class-wp-rest-server.php | Checks the authentication headers if supplied. |
| [WP\_oEmbed\_Controller::get\_item()](../classes/wp_oembed_controller/get_item) wp-includes/class-wp-oembed-controller.php | Callback for the embed API endpoint. |
| [WP\_oEmbed\_Controller::register\_routes()](../classes/wp_oembed_controller/register_routes) wp-includes/class-wp-oembed-controller.php | Register the oEmbed REST API route. |
| [get\_password\_reset\_key()](get_password_reset_key) wp-includes/user.php | Creates, stores, then returns a password reset key for user. |
| [get\_the\_post\_thumbnail\_url()](get_the_post_thumbnail_url) wp-includes/post-thumbnail-template.php | Returns the post thumbnail URL. |
| [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. |
| [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\_moderator()](wp_new_comment_notify_moderator) wp-includes/comment.php | Sends a comment moderation notification to the comment moderator. |
| [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\_preview\_post\_link()](get_preview_post_link) wp-includes/link-template.php | Retrieves the URL used for the post preview. |
| [is\_post\_type\_viewable()](is_post_type_viewable) wp-includes/post.php | Determines whether a post type is considered “viewable”. |
| [update\_network\_option()](update_network_option) wp-includes/option.php | Updates the value of a network option that was already added. |
| [add\_network\_option()](add_network_option) wp-includes/option.php | Adds a new network option. |
| [get\_network\_option()](get_network_option) wp-includes/option.php | Retrieves a network’s option value based on the option name. |
| [get\_subdirectory\_reserved\_names()](get_subdirectory_reserved_names) wp-includes/ms-functions.php | Retrieves a list of reserved site on a sub-directory Multisite installation. |
| [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\_Users\_List\_Table::get\_role\_list()](../classes/wp_users_list_table/get_role_list) wp-admin/includes/class-wp-users-list-table.php | Returns an array of translated user role names for a given user object. |
| [signup\_get\_available\_languages()](signup_get_available_languages) wp-signup.php | Retrieves languages available during the site/user sign-up process. |
| [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\_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::sanitize()](../classes/wp_customize_nav_menu_item_setting/sanitize) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Sanitize an input. |
| [get\_language\_attributes()](get_language_attributes) wp-includes/general-template.php | Gets the language attributes for the ‘html’ tag. |
| [wp\_site\_icon()](wp_site_icon) wp-includes/general-template.php | Displays site icon meta tags. |
| [get\_site\_icon\_url()](get_site_icon_url) wp-includes/general-template.php | Returns the Site Icon URL. |
| [get\_main\_network\_id()](get_main_network_id) wp-includes/functions.php | Gets the main network ID. |
| [\_deprecated\_constructor()](_deprecated_constructor) wp-includes/functions.php | Marks a constructor as deprecated and informs when it has been used. |
| [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::available\_item\_types()](../classes/wp_customize_nav_menus/available_item_types) wp-includes/class-wp-customize-nav-menus.php | Returns an array of all the available item types. |
| [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\_Posts\_List\_Table::column\_cb()](../classes/wp_posts_list_table/column_cb) wp-admin/includes/class-wp-posts-list-table.php | Handles the checkbox column output. |
| [WP\_Posts\_List\_Table::column\_title()](../classes/wp_posts_list_table/column_title) wp-admin/includes/class-wp-posts-list-table.php | Handles the title column output. |
| [WP\_Posts\_List\_Table::column\_date()](../classes/wp_posts_list_table/column_date) wp-admin/includes/class-wp-posts-list-table.php | Handles the post date column output. |
| [WP\_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\_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\_Site\_Icon::insert\_attachment()](../classes/wp_site_icon/insert_attachment) wp-admin/includes/class-wp-site-icon.php | Inserts an attachment. |
| [WP\_Site\_Icon::additional\_sizes()](../classes/wp_site_icon/additional_sizes) wp-admin/includes/class-wp-site-icon.php | Adds additional sizes to be made when creating the site icon images. |
| [WP\_Site\_Icon::intermediate\_image\_sizes()](../classes/wp_site_icon/intermediate_image_sizes) wp-admin/includes/class-wp-site-icon.php | Adds Site Icon sizes to the array of image sizes on demand. |
| [WP\_Comments\_List\_Table::handle\_row\_actions()](../classes/wp_comments_list_table/handle_row_actions) wp-admin/includes/class-wp-comments-list-table.php | Generates and displays row actions links. |
| [wp\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [WP\_List\_Table::get\_primary\_column\_name()](../classes/wp_list_table/get_primary_column_name) wp-admin/includes/class-wp-list-table.php | Gets the name of the primary column. |
| [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\_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\_default()](../classes/wp_ms_users_list_table/column_default) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the default column output. |
| [WP\_Media\_List\_Table::column\_date()](../classes/wp_media_list_table/column_date) wp-admin/includes/class-wp-media-list-table.php | Handles the date column output. |
| [wp\_should\_upgrade\_global\_tables()](wp_should_upgrade_global_tables) wp-admin/includes/upgrade.php | Determine if global tables should be upgraded. |
| [WP\_Customize\_Manager::add\_dynamic\_settings()](../classes/wp_customize_manager/add_dynamic_settings) wp-includes/class-wp-customize-manager.php | Registers any dynamically-created settings, such as those from $\_POST[‘customized’] that have no corresponding setting created. |
| [wpdb::get\_table\_charset()](../classes/wpdb/get_table_charset) wp-includes/class-wpdb.php | Retrieves the character set for the given table. |
| [wpdb::get\_col\_charset()](../classes/wpdb/get_col_charset) wp-includes/class-wpdb.php | Retrieves the character set for the given column. |
| [wp\_delete\_file()](wp_delete_file) wp-includes/functions.php | Deletes a file. |
| [wp\_staticize\_emoji()](wp_staticize_emoji) wp-includes/formatting.php | Converts emoji to a static img element. |
| [wp\_staticize\_emoji\_for\_email()](wp_staticize_emoji_for_email) wp-includes/formatting.php | Converts emoji in emails into static images. |
| [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. |
| [the\_meta()](the_meta) wp-includes/post-template.php | Displays a list of post custom fields. |
| [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\_Meta\_Query::find\_compatible\_table\_alias()](../classes/wp_meta_query/find_compatible_table_alias) wp-includes/class-wp-meta-query.php | Identify an existing table alias that is compatible with the current query clause. |
| [WP\_Customize\_Panel::active()](../classes/wp_customize_panel/active) wp-includes/class-wp-customize-panel.php | Check whether panel is active to current Customizer preview. |
| [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. |
| [wp\_get\_password\_hint()](wp_get_password_hint) wp-includes/user.php | Gets the text suggesting how to create strong passwords. |
| [\_navigation\_markup()](_navigation_markup) wp-includes/link-template.php | Wraps passed links in navigational markup. |
| [get\_the\_posts\_pagination()](get_the_posts_pagination) wp-includes/link-template.php | Retrieves a paginated navigation to next/previous set of posts, when applicable. |
| [WP\_Customize\_Section::active()](../classes/wp_customize_section/active) wp-includes/class-wp-customize-section.php | Check whether section is active to current Customizer preview. |
| [WP\_Session\_Tokens::create()](../classes/wp_session_tokens/create) wp-includes/class-wp-session-tokens.php | Generates a session token and attaches session information to it. |
| [WP\_Session\_Tokens::destroy\_all\_for\_all\_users()](../classes/wp_session_tokens/destroy_all_for_all_users) wp-includes/class-wp-session-tokens.php | Destroys all sessions for all users. |
| [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. |
| [WP\_Customize\_Control::active()](../classes/wp_customize_control/active) wp-includes/class-wp-customize-control.php | Check whether control is active to current Customizer preview. |
| [get\_editor\_stylesheets()](get_editor_stylesheets) wp-includes/theme.php | Retrieves any registered editor stylesheet URLs. |
| [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. |
| [attachment\_url\_to\_postid()](attachment_url_to_postid) wp-includes/media.php | Tries to convert an attachment URL into a post ID. |
| [wp\_embed\_handler\_youtube()](wp_embed_handler_youtube) wp-includes/embed.php | YouTube iframe embed handler callback. |
| [wp\_spaces\_regexp()](wp_spaces_regexp) wp-includes/formatting.php | Returns the regexp for common whitespace characters. |
| [WP\_Media\_List\_Table::views()](../classes/wp_media_list_table/views) wp-admin/includes/class-wp-media-list-table.php | Override parent views so we can use the filter bar display. |
| [\_wp\_handle\_upload()](_wp_handle_upload) wp-admin/includes/file.php | Handles PHP uploads in WordPress. |
| [WP\_Plugin\_Install\_List\_Table::views()](../classes/wp_plugin_install_list_table/views) wp-admin/includes/class-wp-plugin-install-list-table.php | Overrides parent views so we can use the filter bar display. |
| [translations\_api()](translations_api) wp-admin/includes/translation-install.php | Retrieve translations from WordPress Translation API. |
| [login\_footer()](login_footer) wp-login.php | Outputs the footer for the login page. |
| [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. |
| [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. |
| [validate\_user\_signup()](validate_user_signup) wp-signup.php | Validates the new user sign-up. |
| [signup\_blog()](signup_blog) wp-signup.php | Shows a form for a user or visitor to sign up for a new site. |
| [validate\_blog\_signup()](validate_blog_signup) wp-signup.php | Validates new site signup. |
| [allow\_subdirectory\_install()](allow_subdirectory_install) wp-admin/includes/network.php | Allow subdirectory installation. |
| [WP\_Automatic\_Updater::run()](../classes/wp_automatic_updater/run) wp-admin/includes/class-wp-automatic-updater.php | Kicks off the background update process, looping through all pending updates. |
| [WP\_Automatic\_Updater::send\_email()](../classes/wp_automatic_updater/send_email) wp-admin/includes/class-wp-automatic-updater.php | Sends an email upon the completion or failure of a background core update. |
| [WP\_Automatic\_Updater::send\_debug\_email()](../classes/wp_automatic_updater/send_debug_email) wp-admin/includes/class-wp-automatic-updater.php | Prepares and sends an email of a full log of background update results, useful for debugging and geekery. |
| [WP\_Automatic\_Updater::is\_disabled()](../classes/wp_automatic_updater/is_disabled) wp-admin/includes/class-wp-automatic-updater.php | Determines whether the entire automatic updater is disabled. |
| [WP\_Automatic\_Updater::is\_vcs\_checkout()](../classes/wp_automatic_updater/is_vcs_checkout) wp-admin/includes/class-wp-automatic-updater.php | Checks for version control checkouts. |
| [WP\_Automatic\_Updater::should\_update()](../classes/wp_automatic_updater/should_update) wp-admin/includes/class-wp-automatic-updater.php | Tests to see if we can and should update a specific item. |
| [WP\_Automatic\_Updater::send\_core\_update\_notification\_email()](../classes/wp_automatic_updater/send_core_update_notification_email) wp-admin/includes/class-wp-automatic-updater.php | Notifies an administrator of a core update. |
| [Core\_Upgrader::upgrade()](../classes/core_upgrader/upgrade) wp-admin/includes/class-core-upgrader.php | Upgrade WordPress core. |
| [Core\_Upgrader::should\_update\_to\_version()](../classes/core_upgrader/should_update_to_version) wp-admin/includes/class-core-upgrader.php | Determines if this WordPress Core version should update to an offered version or not. |
| [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. |
| [WP\_Upgrader::download\_package()](../classes/wp_upgrader/download_package) wp-admin/includes/class-wp-upgrader.php | Download a package. |
| [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. |
| [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\_Users\_List\_Table::get\_columns()](../classes/wp_ms_users_list_table/get_columns) 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. |
| [WP\_Screen::show\_screen\_options()](../classes/wp_screen/show_screen_options) wp-admin/includes/class-wp-screen.php | |
| [WP\_Screen::render\_screen\_options()](../classes/wp_screen/render_screen_options) wp-admin/includes/class-wp-screen.php | Renders the screen options tab. |
| [WP\_Screen::render\_per\_page\_options()](../classes/wp_screen/render_per_page_options) wp-admin/includes/class-wp-screen.php | Renders the items per page option. |
| [themes\_api()](themes_api) wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. |
| [WP\_Screen::render\_screen\_meta()](../classes/wp_screen/render_screen_meta) wp-admin/includes/class-wp-screen.php | Renders the screen’s help section. |
| [WP\_Screen::get()](../classes/wp_screen/get) wp-admin/includes/class-wp-screen.php | Fetches a screen object. |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [get\_column\_headers()](get_column_headers) wp-admin/includes/screen.php | Get the column headers for a screen |
| [get\_hidden\_columns()](get_hidden_columns) wp-admin/includes/screen.php | Get a list of hidden columns. |
| [get\_hidden\_meta\_boxes()](get_hidden_meta_boxes) wp-admin/includes/screen.php | Gets an array of IDs of hidden meta boxes. |
| [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. |
| [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. |
| [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. |
| [Language\_Pack\_Upgrader\_Skin::bulk\_footer()](../classes/language_pack_upgrader_skin/bulk_footer) wp-admin/includes/class-language-pack-upgrader-skin.php | |
| [Theme\_Upgrader\_Skin::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. |
| [WP\_List\_Table::get\_items\_per\_page()](../classes/wp_list_table/get_items_per_page) wp-admin/includes/class-wp-list-table.php | Gets the number of items to display on a single page. |
| [WP\_List\_Table::get\_column\_info()](../classes/wp_list_table/get_column_info) wp-admin/includes/class-wp-list-table.php | Gets a list of all, hidden, and sortable columns, with filter applied. |
| [WP\_List\_Table::views()](../classes/wp_list_table/views) wp-admin/includes/class-wp-list-table.php | Displays the list of views available on this table. |
| [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. |
| [can\_edit\_network()](can_edit_network) wp-admin/includes/ms.php | Whether or not we can edit this network from this page. |
| [format\_code\_lang()](format_code_lang) wp-admin/includes/ms.php | Returns the language for a language code. |
| [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\_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\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. |
| [wp\_stream\_image()](wp_stream_image) wp-admin/includes/image-edit.php | Streams image in [WP\_Image\_Editor](../classes/wp_image_editor) to browser. |
| [WP\_MS\_Themes\_List\_Table::prepare\_items()](../classes/wp_ms_themes_list_table/prepare_items) wp-admin/includes/class-wp-ms-themes-list-table.php | |
| [insert\_with\_markers()](insert_with_markers) wp-admin/includes/misc.php | Inserts an array of strings into a file (.htaccess), placing it between BEGIN and END markers. |
| [wp\_doc\_link\_parse()](wp_doc_link_parse) wp-admin/includes/misc.php | |
| [set\_screen\_options()](set_screen_options) wp-admin/includes/misc.php | Saves option for number of rows when listing posts, pages, comments, etc. |
| [got\_mod\_rewrite()](got_mod_rewrite) wp-admin/includes/misc.php | Returns whether the server is running Apache with the mod\_rewrite module loaded. |
| [got\_url\_rewrite()](got_url_rewrite) wp-admin/includes/misc.php | Returns whether the server supports URL rewriting. |
| [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 | |
| [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. |
| [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\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. |
| [wp\_read\_image\_metadata()](wp_read_image_metadata) wp-admin/includes/image.php | Gets extended image metadata, exif or iptc as available. |
| [file\_is\_displayable\_image()](file_is_displayable_image) wp-admin/includes/image.php | Validates that file is suitable for displaying within a web page. |
| [load\_image\_to\_edit()](load_image_to_edit) wp-admin/includes/image.php | Loads an image resource for editing. |
| [\_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. |
| [plugins\_api()](plugins_api) wp-admin/includes/plugin-install.php | Retrieves plugin installer pages from the WordPress.org Plugins API. |
| [wp\_dashboard\_recent\_posts()](wp_dashboard_recent_posts) wp-admin/includes/dashboard.php | Generates Publishing Soon and Recently Published sections. |
| [wp\_dashboard\_primary()](wp_dashboard_primary) wp-admin/includes/dashboard.php | ‘WordPress Events and News’ dashboard widget. |
| [wp\_dashboard\_browser\_nag()](wp_dashboard_browser_nag) wp-admin/includes/dashboard.php | Displays the browser update nag. |
| [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\_quick\_press()](wp_dashboard_quick_press) wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. |
| [wp\_dashboard\_recent\_drafts()](wp_dashboard_recent_drafts) wp-admin/includes/dashboard.php | Show recent drafts of the user on the dashboard. |
| [\_wp\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. |
| [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. |
| [dbDelta()](dbdelta) wp-admin/includes/upgrade.php | Modifies the database based on specified SQL statements. |
| [wp\_new\_blog\_notification()](wp_new_blog_notification) wp-admin/includes/upgrade.php | Notifies the site admin that the installation of WordPress is complete. |
| [register\_setting()](register_setting) wp-includes/option.php | Registers a setting and its data. |
| [\_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. |
| [get\_plugin\_files()](get_plugin_files) wp-admin/includes/plugin.php | Gets a list of a plugin’s files. |
| [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 |
| [get\_editable\_roles()](get_editable_roles) wp-admin/includes/user.php | Fetch a filtered list of user roles that the current user is allowed to edit. |
| [get\_users\_drafts()](get_users_drafts) wp-admin/includes/user.php | Retrieve the user’s drafts. |
| [wp\_delete\_user()](wp_delete_user) wp-admin/includes/user.php | Remove user and optionally reassign posts and links to another user. |
| [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 | |
| [Walker\_Category\_Checklist::start\_el()](../classes/walker_category_checklist/start_el) wp-admin/includes/class-walker-category-checklist.php | Start the element output. |
| [iframe\_header()](iframe_header) wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. |
| [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\_import\_upload\_form()](wp_import_upload_form) wp-admin/includes/template.php | Outputs the form used by the importers to accept the data to be imported. |
| [WP\_Themes\_List\_Table::display\_rows()](../classes/wp_themes_list_table/display_rows) wp-admin/includes/class-wp-themes-list-table.php | |
| [wp\_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\_link\_category\_checklist()](wp_link_category_checklist) wp-admin/includes/template.php | Outputs a link category checklist element. |
| [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\_MS\_Sites\_List\_Table::get\_columns()](../classes/wp_ms_sites_list_table/get_columns) wp-admin/includes/class-wp-ms-sites-list-table.php | |
| [WP\_Users\_List\_Table::single\_row()](../classes/wp_users_list_table/single_row) wp-admin/includes/class-wp-users-list-table.php | Generate HTML for a single row on the users.php admin panel. |
| [WP\_Users\_List\_Table::prepare\_items()](../classes/wp_users_list_table/prepare_items) wp-admin/includes/class-wp-users-list-table.php | Prepare the users list for display. |
| [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. |
| [media\_upload\_type\_form()](media_upload_type_form) wp-admin/includes/media.php | Outputs the legacy media upload form for a given media type. |
| [media\_upload\_type\_url\_form()](media_upload_type_url_form) wp-admin/includes/media.php | Outputs the legacy media upload form for external media. |
| [media\_upload\_gallery\_form()](media_upload_gallery_form) wp-admin/includes/media.php | Adds gallery form to upload iframe. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| [wp\_media\_insert\_url\_form()](wp_media_insert_url_form) wp-admin/includes/media.php | Creates the form for external url. |
| [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()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. |
| [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\_size\_input\_fields()](image_size_input_fields) wp-admin/includes/media.php | Retrieves HTML for the size radio buttons with the specified one checked. |
| [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. |
| [image\_add\_caption()](image_add_caption) wp-admin/includes/media.php | Adds image shortcode with caption to editor. |
| [get\_upload\_iframe\_src()](get_upload_iframe_src) wp-admin/includes/media.php | Retrieves the upload iframe source URL. |
| [get\_sample\_permalink\_html()](get_sample_permalink_html) wp-admin/includes/post.php | Returns the HTML of the sample permalink slug editor. |
| [\_wp\_post\_thumbnail\_html()](_wp_post_thumbnail_html) wp-admin/includes/post.php | Returns HTML for the post thumbnail meta box. |
| [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. |
| [media\_upload\_tabs()](media_upload_tabs) wp-admin/includes/media.php | Defines the default media upload tabs. |
| [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. |
| [postbox\_classes()](postbox_classes) wp-admin/includes/post.php | Returns the list of classes to be used by a meta box. |
| [get\_sample\_permalink()](get_sample_permalink) wp-admin/includes/post.php | Returns a sample permalink based on the post name. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [get\_default\_post\_to\_edit()](get_default_post_to_edit) wp-admin/includes/post.php | Returns default post information to use when populating the “Write Post” form. |
| [wp\_ajax\_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\_heartbeat()](wp_ajax_heartbeat) wp-admin/includes/ajax-actions.php | Ajax handler for the Heartbeat API. |
| [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\_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\_query\_attachments()](wp_ajax_query_attachments) wp-admin/includes/ajax-actions.php | Ajax handler for querying attachments. |
| [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\_menu\_get\_metabox()](wp_ajax_menu_get_metabox) wp-admin/includes/ajax-actions.php | Ajax handler for retrieving menu meta boxes. |
| [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\_get\_revision\_ui\_diff()](wp_get_revision_ui_diff) wp-admin/includes/revision.php | Get the revision UI diff. |
| [wp\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
| [wp\_ajax\_nopriv\_heartbeat()](wp_ajax_nopriv_heartbeat) wp-admin/includes/ajax-actions.php | Ajax handler for the Heartbeat API in the no-privilege context. |
| [wp\_ajax\_ajax\_tag\_search()](wp_ajax_ajax_tag_search) wp-admin/includes/ajax-actions.php | Ajax handler for tag search. |
| [wp\_ajax\_autocomplete\_user()](wp_ajax_autocomplete_user) wp-admin/includes/ajax-actions.php | Ajax handler for user autocomplete. |
| [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. |
| [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. |
| [post\_categories\_meta\_box()](post_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays post categories form fields. |
| [add\_menu\_classes()](add_menu_classes) wp-admin/includes/menu.php | Adds CSS classes for top-level administration menu items. |
| [WP\_Media\_List\_Table::get\_columns()](../classes/wp_media_list_table/get_columns) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Media\_List\_Table::\_get\_row\_actions()](../classes/wp_media_list_table/_get_row_actions) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Comments\_List\_Table::column\_author()](../classes/wp_comments_list_table/column_author) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::get\_views()](../classes/wp_comments_list_table/get_views) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::column\_comment()](../classes/wp_comments_list_table/column_comment) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::prepare\_items()](../classes/wp_comments_list_table/prepare_items) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::get\_per\_page()](../classes/wp_comments_list_table/get_per_page) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Terms\_List\_Table::column\_name()](../classes/wp_terms_list_table/column_name) wp-admin/includes/class-wp-terms-list-table.php | |
| [WP\_Terms\_List\_Table::column\_slug()](../classes/wp_terms_list_table/column_slug) wp-admin/includes/class-wp-terms-list-table.php | |
| [WP\_Terms\_List\_Table::column\_default()](../classes/wp_terms_list_table/column_default) wp-admin/includes/class-wp-terms-list-table.php | |
| [WP\_Terms\_List\_Table::prepare\_items()](../classes/wp_terms_list_table/prepare_items) wp-admin/includes/class-wp-terms-list-table.php | |
| [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\_post\_type\_meta\_boxes()](wp_nav_menu_post_type_meta_boxes) wp-admin/includes/nav-menu.php | Creates meta boxes for any post type menu item. |
| [wp\_nav\_menu\_taxonomy\_meta\_boxes()](wp_nav_menu_taxonomy_meta_boxes) wp-admin/includes/nav-menu.php | Creates meta boxes for any taxonomy menu item. |
| [wp\_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\_get\_nav\_menu\_to\_edit()](wp_get_nav_menu_to_edit) wp-admin/includes/nav-menu.php | Returns the menu formatted to edit. |
| [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. |
| [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. |
| [WP\_Filesystem()](wp_filesystem) wp-admin/includes/file.php | Initializes and connects the WordPress Filesystem Abstraction classes. |
| [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\_columns()](../classes/wp_posts_list_table/get_columns) wp-admin/includes/class-wp-posts-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 | |
| [get\_comment\_to\_edit()](get_comment_to_edit) wp-admin/includes/comment.php | Returns a [WP\_Comment](../classes/wp_comment) object based on comment ID. |
| [Custom\_Image\_Header::insert\_attachment()](../classes/custom_image_header/insert_attachment) wp-admin/includes/class-custom-image-header.php | Insert an attachment and its metadata. |
| [Custom\_Image\_Header::ajax\_header\_crop()](../classes/custom_image_header/ajax_header_crop) wp-admin/includes/class-custom-image-header.php | Gets attachment uploaded by Media Manager, crops it, then saves it as a new object. Returns JSON-encoded object details. |
| [Custom\_Image\_Header::step\_2()](../classes/custom_image_header/step_2) wp-admin/includes/class-custom-image-header.php | Display second step of custom header image page. |
| [Custom\_Image\_Header::step\_3()](../classes/custom_image_header/step_3) wp-admin/includes/class-custom-image-header.php | Display third step of custom header image page. |
| [redirect\_post()](redirect_post) wp-admin/includes/post.php | Redirects to previous page. |
| [Custom\_Background::wp\_set\_background\_image()](../classes/custom_background/wp_set_background_image) wp-admin/includes/class-custom-background.php | |
| [WP\_User::has\_cap()](../classes/wp_user/has_cap) wp-includes/class-wp-user.php | Returns whether the user has the specified capability. |
| [WP\_Role::has\_cap()](../classes/wp_role/has_cap) wp-includes/class-wp-role.php | Determines whether the role has the given capability. |
| [WP\_Customize\_Manager::add\_setting()](../classes/wp_customize_manager/add_setting) wp-includes/class-wp-customize-manager.php | Adds a customize setting. |
| [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::\_\_construct()](../classes/wp_customize_manager/__construct) wp-includes/class-wp-customize-manager.php | Constructor. |
| [WP\_Styles::all\_deps()](../classes/wp_styles/all_deps) wp-includes/class-wp-styles.php | Determines style dependencies. |
| [WP\_Styles::\_css\_href()](../classes/wp_styles/_css_href) wp-includes/class-wp-styles.php | Generates an enqueued style’s fully-qualified URL. |
| [WP\_Styles::do\_item()](../classes/wp_styles/do_item) wp-includes/class-wp-styles.php | Processes a style dependency. |
| [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\_get\_schedule()](wp_get_schedule) wp-includes/cron.php | Retrieve the recurrence schedule for an event. |
| [wp\_get\_schedules()](wp_get_schedules) wp-includes/cron.php | Retrieve supported event recurrence schedules. |
| [wp\_schedule\_single\_event()](wp_schedule_single_event) wp-includes/cron.php | Schedules an event to run only once. |
| [Walker\_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. |
| [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. |
| [wp\_tag\_cloud()](wp_tag_cloud) wp-includes/category-template.php | Displays a tag cloud. |
| [wp\_generate\_tag\_cloud()](wp_generate_tag_cloud) wp-includes/category-template.php | Generates a tag cloud (heatmap) from provided data. |
| [get\_the\_tags()](get_the_tags) wp-includes/category-template.php | Retrieves the tags for a post. |
| [get\_the\_tag\_list()](get_the_tag_list) wp-includes/category-template.php | Retrieves the tags for a post formatted as a string. |
| [get\_the\_terms()](get_the_terms) wp-includes/category-template.php | Retrieves the terms of the taxonomy that are attached to the post. |
| [get\_the\_category()](get_the_category) wp-includes/category-template.php | Retrieves post categories. |
| [get\_the\_category\_list()](get_the_category_list) wp-includes/category-template.php | Retrieves category list for a post in either HTML list or custom format. |
| [wp\_dropdown\_categories()](wp_dropdown_categories) wp-includes/category-template.php | Displays or retrieves the HTML dropdown list of categories. |
| [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [set\_theme\_mod()](set_theme_mod) wp-includes/theme.php | Updates theme modification value for the active theme. |
| [get\_header\_image()](get_header_image) wp-includes/theme.php | Retrieves header image for custom header. |
| [get\_theme\_root()](get_theme_root) wp-includes/theme.php | Retrieves path to themes directory. |
| [get\_theme\_root\_uri()](get_theme_root_uri) wp-includes/theme.php | Retrieves URI for themes directory. |
| [validate\_current\_theme()](validate_current_theme) wp-includes/theme.php | Checks that the active theme has the required files. |
| [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. |
| [get\_stylesheet\_directory()](get_stylesheet_directory) wp-includes/theme.php | Retrieves stylesheet directory path for the active theme. |
| [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) wp-includes/theme.php | Retrieves stylesheet directory URI for the active theme. |
| [get\_stylesheet\_uri()](get_stylesheet_uri) wp-includes/theme.php | Retrieves stylesheet URI for the active theme. |
| [get\_template()](get_template) wp-includes/theme.php | Retrieves name of the active theme. |
| [get\_template\_directory()](get_template_directory) wp-includes/theme.php | Retrieves template directory path for the active theme. |
| [get\_template\_directory\_uri()](get_template_directory_uri) wp-includes/theme.php | Retrieves template directory URI for the active theme. |
| [search\_theme\_directories()](search_theme_directories) wp-includes/theme.php | Searches all registered theme directories for complete and valid themes. |
| [get\_locale\_stylesheet\_uri()](get_locale_stylesheet_uri) wp-includes/theme.php | Retrieves the localized stylesheet URI. |
| [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. |
| [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. |
| [load\_textdomain()](load_textdomain) wp-includes/l10n.php | Loads a .mo file into the text domain $domain. |
| [unload\_textdomain()](unload_textdomain) wp-includes/l10n.php | Unloads translations for a text domain. |
| [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. |
| [translate()](translate) wp-includes/l10n.php | Retrieves the translation of $text. |
| [translate\_with\_gettext\_context()](translate_with_gettext_context) wp-includes/l10n.php | Retrieves the translation of $text in the context defined in $context. |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [\_nx()](_nx) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number, with gettext context. |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [sanitize\_text\_field()](sanitize_text_field) wp-includes/formatting.php | Sanitizes a string from user input or from the database. |
| [sanitize\_mime\_type()](sanitize_mime_type) wp-includes/formatting.php | Sanitizes a mime type |
| [sanitize\_trackback\_urls()](sanitize_trackback_urls) wp-includes/formatting.php | Sanitizes space or carriage return separated URLs that are used to send trackbacks. |
| [esc\_textarea()](esc_textarea) wp-includes/formatting.php | Escaping for textarea values. |
| [tag\_escape()](tag_escape) wp-includes/formatting.php | Escapes an HTML tag name. |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [wp\_parse\_str()](wp_parse_str) wp-includes/formatting.php | Parses a string into variables to be stored in an array. |
| [wp\_sprintf()](wp_sprintf) wp-includes/formatting.php | WordPress implementation of PHP sprintf() with filters. |
| [wp\_sprintf\_l()](wp_sprintf_l) wp-includes/formatting.php | Localizes list items before the rest of the content. |
| [wp\_htmledit\_pre()](wp_htmledit_pre) wp-includes/deprecated.php | Formats text for the HTML editor. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [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\_richedit\_pre()](wp_richedit_pre) wp-includes/deprecated.php | Formats text for the rich text editor. |
| [sanitize\_email()](sanitize_email) wp-includes/formatting.php | Strips out all characters that are not allowable in an email. |
| [human\_time\_diff()](human_time_diff) wp-includes/formatting.php | Determines the difference between two timestamps. |
| [wp\_trim\_excerpt()](wp_trim_excerpt) wp-includes/formatting.php | Generates an excerpt from the content, if needed. |
| [wp\_trim\_words()](wp_trim_words) wp-includes/formatting.php | Trims text to a certain number of words. |
| [ent2ncr()](ent2ncr) wp-includes/formatting.php | Converts named entities into numbered entities. |
| [\_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. |
| [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. |
| [sanitize\_file\_name()](sanitize_file_name) wp-includes/formatting.php | Sanitizes a filename, replacing whitespace with dashes. |
| [sanitize\_user()](sanitize_user) wp-includes/formatting.php | Sanitizes a username, stripping out unsafe characters. |
| [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. |
| [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
| [sanitize\_html\_class()](sanitize_html_class) wp-includes/formatting.php | Sanitizes an HTML classname to ensure it only contains valid characters. |
| [format\_to\_edit()](format_to_edit) wp-includes/formatting.php | Acts on text which is about to be edited. |
| [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. |
| [wptexturize()](wptexturize) wp-includes/formatting.php | Replaces common plain text characters with formatted entities. |
| [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\_nonce\_tick()](wp_nonce_tick) wp-includes/pluggable.php | Returns the time-dependent variable for nonce creation. |
| [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\_check\_password()](wp_check_password) wp-includes/pluggable.php | Checks the plaintext password against the encrypted Password. |
| [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. |
| [wp\_salt()](wp_salt) wp-includes/pluggable.php | Returns a salt to add to hashes. |
| [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. |
| [wp\_safe\_redirect()](wp_safe_redirect) wp-includes/pluggable.php | Performs a safe (local) redirect, using [wp\_redirect()](wp_redirect) . |
| [wp\_validate\_redirect()](wp_validate_redirect) wp-includes/pluggable.php | Validates a URL for use in a redirect. |
| [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. |
| [wp\_clear\_auth\_cookie()](wp_clear_auth_cookie) wp-includes/pluggable.php | Removes all of the cookies associated with authentication. |
| [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\_authenticate()](wp_authenticate) wp-includes/pluggable.php | Authenticates a user, confirming the login credentials are valid. |
| [wp\_generate\_auth\_cookie()](wp_generate_auth_cookie) wp-includes/pluggable.php | Generates authentication cookie contents. |
| [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| [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. |
| [wp\_admin\_css\_uri()](wp_admin_css_uri) wp-includes/general-template.php | Displays the URL of a WordPress admin CSS file. |
| [wp\_admin\_css()](wp_admin_css) wp-includes/general-template.php | Enqueues or directly prints a stylesheet link to the specified CSS file. |
| [wp\_generator()](wp_generator) wp-includes/general-template.php | Displays the XHTML generator that is generated on the wp\_head hook. |
| [the\_generator()](the_generator) wp-includes/general-template.php | Displays the generator XML or Comment for RSS, ATOM, etc. |
| [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. |
| [user\_can\_richedit()](user_can_richedit) wp-includes/general-template.php | Determines whether the user can access the visual editor. |
| [wp\_default\_editor()](wp_default_editor) wp-includes/general-template.php | Finds out which editor should be displayed by default. |
| [get\_search\_query()](get_search_query) wp-includes/general-template.php | Retrieves the contents of the search WordPress query variable. |
| [get\_the\_modified\_date()](get_the_modified_date) wp-includes/general-template.php | Retrieves the date on which the post was last modified. |
| [the\_time()](the_time) wp-includes/general-template.php | Displays the time at which the post was written. |
| [get\_the\_time()](get_the_time) wp-includes/general-template.php | Retrieves the time at which the post was written. |
| [get\_post\_time()](get_post_time) wp-includes/general-template.php | Retrieves the time at which the post was written. |
| [the\_modified\_time()](the_modified_time) wp-includes/general-template.php | Displays the time at which the post was last modified. |
| [get\_the\_modified\_time()](get_the_modified_time) wp-includes/general-template.php | Retrieves the time at which the post was last modified. |
| [get\_post\_modified\_time()](get_post_modified_time) wp-includes/general-template.php | Retrieves the time at which the post was last modified. |
| [the\_weekday()](the_weekday) wp-includes/general-template.php | Displays the weekday on which the post was written. |
| [the\_weekday\_date()](the_weekday_date) wp-includes/general-template.php | Displays the weekday on which the post was written. |
| [get\_archives\_link()](get_archives_link) wp-includes/general-template.php | Retrieves archive link content based on predefined or custom code. |
| [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. |
| [the\_date()](the_date) wp-includes/general-template.php | Displays or retrieves the date the current post was written (once per date) |
| [get\_the\_date()](get_the_date) wp-includes/general-template.php | Retrieves the date on which the post was written. |
| [the\_modified\_date()](the_modified_date) wp-includes/general-template.php | Displays the date on which the post was last modified. |
| [single\_post\_title()](single_post_title) wp-includes/general-template.php | Displays or retrieves page title for post. |
| [post\_type\_archive\_title()](post_type_archive_title) wp-includes/general-template.php | Displays or retrieves title for a post type archive. |
| [single\_term\_title()](single_term_title) wp-includes/general-template.php | Displays or retrieves page title for taxonomy term archive. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [wp\_title()](wp_title) wp-includes/general-template.php | Displays or retrieves page title for all areas of blog. |
| [wp\_loginout()](wp_loginout) wp-includes/general-template.php | Displays the Log In/Out link. |
| [wp\_logout\_url()](wp_logout_url) wp-includes/general-template.php | Retrieves the logout URL. |
| [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. |
| [wp\_registration\_url()](wp_registration_url) wp-includes/general-template.php | Returns the URL that allows the user to register on the site. |
| [wp\_login\_form()](wp_login_form) wp-includes/general-template.php | Provides a simple login form for use anywhere within WordPress. |
| [wp\_lostpassword\_url()](wp_lostpassword_url) wp-includes/general-template.php | Returns the URL that allows the user to reset the lost password. |
| [wp\_register()](wp_register) wp-includes/general-template.php | Displays the Registration or Admin link. |
| [get\_search\_form()](get_search_form) wp-includes/general-template.php | Displays search form. |
| [get\_theme\_data()](get_theme_data) wp-includes/deprecated.php | Retrieve theme data from parsed theme file. |
| [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\_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. |
| [the\_content\_rss()](the_content_rss) wp-includes/deprecated.php | Display the post content for the feed. |
| [get\_links\_list()](get_links_list) wp-includes/deprecated.php | Output entire list of links by category. |
| [safecss\_filter\_attr()](safecss_filter_attr) wp-includes/kses.php | Filters an inline style attribute and removes disallowed rules. |
| [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\_Theme::get\_allowed()](../classes/wp_theme/get_allowed) wp-includes/class-wp-theme.php | Returns array of stylesheet names of themes allowed on the site or network. |
| [WP\_Theme::get\_allowed\_on\_network()](../classes/wp_theme/get_allowed_on_network) wp-includes/class-wp-theme.php | Returns array of stylesheet names of themes allowed on the network. |
| [WP\_Theme::get\_allowed\_on\_site()](../classes/wp_theme/get_allowed_on_site) wp-includes/class-wp-theme.php | Returns array of stylesheet names of themes allowed on the site. |
| [wp\_kses\_allowed\_html()](wp_kses_allowed_html) wp-includes/kses.php | Returns an array of allowed HTML tags and attributes for a given context. |
| [wp\_kses\_hook()](wp_kses_hook) wp-includes/kses.php | You add any KSES hooks here. |
| [WP\_Theme::get\_page\_templates()](../classes/wp_theme/get_page_templates) wp-includes/class-wp-theme.php | Returns the theme’s post templates for a given post type. |
| [WP\_Theme::scandir()](../classes/wp_theme/scandir) wp-includes/class-wp-theme.php | Scans a directory for files of a certain extension. |
| [WP\_Theme::\_\_construct()](../classes/wp_theme/__construct) wp-includes/class-wp-theme.php | Constructor for [WP\_Theme](../classes/wp_theme). |
| [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\_is\_mobile()](wp_is_mobile) wp-includes/vars.php | Test if the current browser runs on a mobile device (smart phone, tablet, etc.) |
| [WP::parse\_request()](../classes/wp/parse_request) wp-includes/class-wp.php | Parses the request to find the correct WordPress query. |
| [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\_Query::get\_search\_stopwords()](../classes/wp_query/get_search_stopwords) wp-includes/class-wp-query.php | Retrieve stopwords used when parsing search terms. |
| [wp\_old\_slug\_redirect()](wp_old_slug_redirect) wp-includes/query.php | Redirect old slugs to the correct permalink. |
| [get\_tags()](get_tags) wp-includes/category.php | Retrieves all post tags. |
| [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. |
| [wp\_start\_object\_cache()](wp_start_object_cache) wp-includes/load.php | Start the WordPress object cache. |
| [wp\_debug\_mode()](wp_debug_mode) wp-includes/load.php | Set PHP error reporting based on WordPress debug settings. |
| [WP\_Http\_Cookie::getHeaderValue()](../classes/wp_http_cookie/getheadervalue) wp-includes/class-wp-http-cookie.php | Convert cookie name and value back to header string. |
| [WP\_Http\_Encoding::accept\_encoding()](../classes/wp_http_encoding/accept_encoding) wp-includes/class-wp-http-encoding.php | What encoding types to accept and their priority values. |
| [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\_Curl::test()](../classes/wp_http_curl/test) wp-includes/class-wp-http-curl.php | Determines whether this class can be used for retrieving a URL. |
| [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\_Http\_Streams::request()](../classes/wp_http_streams/request) wp-includes/class-wp-http-streams.php | Send a HTTP request to a URI using PHP Streams. |
| [WP\_Http\_Streams::test()](../classes/wp_http_streams/test) wp-includes/class-wp-http-streams.php | Determines whether this class can be used for retrieving a URL. |
| [WP\_Http\_Curl::request()](../classes/wp_http_curl/request) wp-includes/class-wp-http-curl.php | Send a HTTP request to a URI using cURL extension. |
| [WP\_Http::\_get\_first\_available\_transport()](../classes/wp_http/_get_first_available_transport) wp-includes/class-wp-http.php | Tests which transports are capable of supporting the request. |
| [WP\_Http::\_dispatch\_request()](../classes/wp_http/_dispatch_request) wp-includes/class-wp-http.php | Dispatches a HTTP request to a supporting transport. |
| [WP\_Http::request()](../classes/wp_http/request) wp-includes/class-wp-http.php | Send an HTTP request to a URI. |
| [wp\_allowed\_protocols()](wp_allowed_protocols) wp-includes/functions.php | Retrieves a list of protocols to allow in HTML attributes. |
| [wp\_checkdate()](wp_checkdate) wp-includes/functions.php | Tests if the supplied date is valid for the Gregorian calendar. |
| [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\_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. |
| [get\_file\_data()](get_file_data) wp-includes/functions.php | Retrieves metadata from a file. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [\_deprecated\_file()](_deprecated_file) wp-includes/functions.php | Marks a file as deprecated and inform when it has been used. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| [iis7\_supports\_permalinks()](iis7_supports_permalinks) wp-includes/functions.php | Checks if IIS 7+ supports pretty permalinks. |
| [wp\_maybe\_load\_widgets()](wp_maybe_load_widgets) wp-includes/functions.php | Determines if Widgets library should be loaded. |
| [smilies\_init()](smilies_init) wp-includes/functions.php | Converts smiley code to the icon graphic file equivalent. |
| [wp\_upload\_bits()](wp_upload_bits) wp-includes/functions.php | Creates a file in the upload folder with given content. |
| [wp\_check\_filetype\_and\_ext()](wp_check_filetype_and_ext) wp-includes/functions.php | Attempts to determine the real file type of a file. |
| [wp\_get\_mime\_types()](wp_get_mime_types) wp-includes/functions.php | Retrieves the list of mime types and file extensions. |
| [get\_allowed\_mime\_types()](get_allowed_mime_types) wp-includes/functions.php | Retrieves the list of allowed mime types and file extensions. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [do\_robots()](do_robots) wp-includes/functions.php | Displays the default robots.txt file content. |
| [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. |
| [status\_header()](status_header) wp-includes/functions.php | Sets HTTP status header. |
| [wp\_get\_nocache\_headers()](wp_get_nocache_headers) wp-includes/functions.php | Gets the header information to prevent caching. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| [do\_enclose()](do_enclose) wp-includes/functions.php | Checks content for video and audio links to add as enclosures. |
| [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\_Nav\_Menu\_Widget::widget()](../classes/wp_nav_menu_widget/widget) wp-includes/widgets/class-wp-nav-menu-widget.php | Outputs the content for the current Navigation Menu widget instance. |
| [WP\_Widget\_Tag\_Cloud::widget()](../classes/wp_widget_tag_cloud/widget) wp-includes/widgets/class-wp-widget-tag-cloud.php | Outputs the content for the current Tag Cloud widget instance. |
| [WP\_Widget\_RSS::widget()](../classes/wp_widget_rss/widget) wp-includes/widgets/class-wp-widget-rss.php | Outputs the content for the current RSS widget instance. |
| [WP\_Widget\_Recent\_Comments::recent\_comments\_style()](../classes/wp_widget_recent_comments/recent_comments_style) wp-includes/widgets/class-wp-widget-recent-comments.php | Outputs the default styles for the Recent Comments widget. |
| [WP\_Widget\_Recent\_Comments::widget()](../classes/wp_widget_recent_comments/widget) wp-includes/widgets/class-wp-widget-recent-comments.php | Outputs the content for the current Recent Comments widget instance. |
| [WP\_Widget\_Recent\_Posts::widget()](../classes/wp_widget_recent_posts/widget) wp-includes/widgets/class-wp-widget-recent-posts.php | Outputs the content for the current Recent Posts widget instance. |
| [WP\_Widget\_Categories::widget()](../classes/wp_widget_categories/widget) wp-includes/widgets/class-wp-widget-categories.php | Outputs the content for the current Categories widget instance. |
| [WP\_Widget\_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\_Widget\_Calendar::widget()](../classes/wp_widget_calendar/widget) wp-includes/widgets/class-wp-widget-calendar.php | Outputs the content for the current Calendar widget instance. |
| [WP\_Widget\_Meta::widget()](../classes/wp_widget_meta/widget) wp-includes/widgets/class-wp-widget-meta.php | Outputs the content for the current Meta widget instance. |
| [WP\_Widget\_Archives::widget()](../classes/wp_widget_archives/widget) wp-includes/widgets/class-wp-widget-archives.php | Outputs the content for the current Archives widget instance. |
| [WP\_Widget\_Search::widget()](../classes/wp_widget_search/widget) wp-includes/widgets/class-wp-widget-search.php | Outputs the content for the current Search widget instance. |
| [WP\_Widget\_Links::widget()](../classes/wp_widget_links/widget) wp-includes/widgets/class-wp-widget-links.php | Outputs the content for the current Links widget instance. |
| [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\_Embed::cache\_oembed()](../classes/wp_embed/cache_oembed) wp-includes/class-wp-embed.php | Triggers a caching of all oEmbed results. |
| [WP\_Embed::maybe\_make\_link()](../classes/wp_embed/maybe_make_link) wp-includes/class-wp-embed.php | Conditionally makes a hyperlink based on an internal class variable. |
| [WP\_Embed::shortcode()](../classes/wp_embed/shortcode) wp-includes/class-wp-embed.php | The [do\_shortcode()](do_shortcode) callback function. |
| [WP\_Feed\_Cache\_Transient::\_\_construct()](../classes/wp_feed_cache_transient/__construct) wp-includes/class-wp-feed-cache-transient.php | Constructor. |
| [\_update\_post\_term\_count()](_update_post_term_count) wp-includes/taxonomy.php | Updates term count based on object types of the current taxonomy. |
| [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| [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\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. |
| [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. |
| [sanitize\_term\_field()](sanitize_term_field) wp-includes/taxonomy.php | Sanitizes the field value in the term based on the context. |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [create\_initial\_taxonomies()](create_initial_taxonomies) wp-includes/taxonomy.php | Creates the initial taxonomies. |
| [get\_taxonomy\_labels()](get_taxonomy_labels) wp-includes/taxonomy.php | Builds an object with all taxonomy labels out of a taxonomy object. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [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. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [get\_dashboard\_url()](get_dashboard_url) wp-includes/link-template.php | Retrieves the URL to the user’s dashboard. |
| [get\_edit\_profile\_url()](get_edit_profile_url) wp-includes/link-template.php | Retrieves the URL to the user’s profile editor. |
| [wp\_get\_shortlink()](wp_get_shortlink) wp-includes/link-template.php | Returns a shortlink for a post, page, attachment, or site. |
| [the\_shortlink()](the_shortlink) wp-includes/link-template.php | Displays the shortlink for a post. |
| [get\_admin\_url()](get_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for a given site. |
| [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. |
| [content\_url()](content_url) wp-includes/link-template.php | Retrieves the URL to the content directory. |
| [plugins\_url()](plugins_url) wp-includes/link-template.php | Retrieves a URL within the plugins or mu-plugins directory. |
| [network\_site\_url()](network_site_url) wp-includes/link-template.php | Retrieves the site URL for the current network. |
| [network\_home\_url()](network_home_url) wp-includes/link-template.php | Retrieves the home URL for the current network. |
| [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the network. |
| [user\_admin\_url()](user_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current user. |
| [get\_comments\_pagenum\_link()](get_comments_pagenum_link) wp-includes/link-template.php | Retrieves the comments page number link. |
| [get\_next\_comments\_link()](get_next_comments_link) wp-includes/link-template.php | Retrieves the link to the next comments page. |
| [get\_previous\_comments\_link()](get_previous_comments_link) wp-includes/link-template.php | Retrieves the link to the previous comments page. |
| [get\_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\_shortcut\_link()](get_shortcut_link) wp-includes/deprecated.php | Retrieves the Press This bookmarklet link. |
| [get\_adjacent\_post\_link()](get_adjacent_post_link) wp-includes/link-template.php | Retrieves the adjacent post link. |
| [get\_pagenum\_link()](get_pagenum_link) wp-includes/link-template.php | Retrieves the link for a page number. |
| [get\_next\_posts\_link()](get_next_posts_link) wp-includes/link-template.php | Retrieves the next posts page link. |
| [get\_previous\_posts\_link()](get_previous_posts_link) wp-includes/link-template.php | Retrieves the previous posts page link. |
| [get\_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\_adjacent\_post\_rel\_link()](get_adjacent_post_rel_link) wp-includes/link-template.php | Retrieves the adjacent post relational link. |
| [get\_search\_comments\_feed\_link()](get_search_comments_feed_link) wp-includes/link-template.php | Retrieves the permalink for the search results comments feed. |
| [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\_edit\_post\_link()](get_edit_post_link) wp-includes/link-template.php | Retrieves the edit post link for post. |
| [edit\_post\_link()](edit_post_link) wp-includes/link-template.php | Displays 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\_term\_feed\_link()](get_term_feed_link) wp-includes/link-template.php | Retrieves the feed link for a term. |
| [get\_edit\_tag\_link()](get_edit_tag_link) wp-includes/link-template.php | Retrieves the edit link for a tag. |
| [edit\_tag\_link()](edit_tag_link) wp-includes/link-template.php | Displays or retrieves the edit link for a tag with formatting. |
| [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. |
| [get\_search\_link()](get_search_link) wp-includes/link-template.php | Retrieves the permalink for a search. |
| [get\_search\_feed\_link()](get_search_feed_link) wp-includes/link-template.php | Retrieves the permalink for the search results feed. |
| [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. |
| [the\_feed\_link()](the_feed_link) wp-includes/link-template.php | Displays the permalink for the feed type. |
| [get\_feed\_link()](get_feed_link) wp-includes/link-template.php | Retrieves the permalink for the feed type. |
| [get\_post\_comments\_feed\_link()](get_post_comments_feed_link) wp-includes/link-template.php | Retrieves the permalink for the post comments feed. |
| [post\_comments\_feed\_link()](post_comments_feed_link) wp-includes/link-template.php | Displays the comment feed link for a post. |
| [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\_post\_permalink()](get_post_permalink) wp-includes/link-template.php | Retrieves the permalink for a post of a custom post type. |
| [get\_page\_link()](get_page_link) wp-includes/link-template.php | Retrieves the permalink for the current page or page ID. |
| [\_get\_page\_link()](_get_page_link) wp-includes/link-template.php | Retrieves the page permalink. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [get\_year\_link()](get_year_link) wp-includes/link-template.php | Retrieves the permalink for the year archives. |
| [the\_permalink()](the_permalink) wp-includes/link-template.php | Displays the permalink for the current post. |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [is\_allowed\_http\_origin()](is_allowed_http_origin) wp-includes/http.php | Determines if the HTTP origin is an authorized one. |
| [wp\_http\_validate\_url()](wp_http_validate_url) wp-includes/http.php | Validate a URL for safe use in the HTTP API. |
| [wp\_version\_check()](wp_version_check) wp-includes/update.php | Checks WordPress version against the newest version. |
| [wp\_update\_plugins()](wp_update_plugins) wp-includes/update.php | Checks for available updates to plugins based on the latest versions hosted on WordPress.org. |
| [wp\_update\_themes()](wp_update_themes) wp-includes/update.php | Checks for available updates to themes based on the latest versions hosted on WordPress.org. |
| [wp\_get\_update\_data()](wp_get_update_data) wp-includes/update.php | Collects counts and UI strings for available updates. |
| [get\_http\_origin()](get_http_origin) wp-includes/http.php | Get the HTTP Origin of the current request. |
| [get\_allowed\_http\_origins()](get_allowed_http_origins) wp-includes/http.php | Retrieve list of allowed HTTP origins. |
| [WP\_Date\_Query::validate\_column()](../classes/wp_date_query/validate_column) wp-includes/class-wp-date-query.php | Validates a column name parameter. |
| [WP\_Date\_Query::get\_sql()](../classes/wp_date_query/get_sql) wp-includes/class-wp-date-query.php | Generates WHERE clause to be appended to a main query. |
| [do\_shortcode\_tag()](do_shortcode_tag) wp-includes/shortcodes.php | Regular Expression callable for [do\_shortcode()](do_shortcode) for calling shortcode hook. |
| [shortcode\_atts()](shortcode_atts) wp-includes/shortcodes.php | Combines user attributes with known attributes and fill in defaults when needed. |
| [strip\_shortcodes()](strip_shortcodes) wp-includes/shortcodes.php | Removes all shortcode tags from the given content. |
| [WP\_Image\_Editor::set\_quality()](../classes/wp_image_editor/set_quality) wp-includes/class-wp-image-editor.php | Sets Image Compression quality on a 1-100% scale. |
| [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\_oEmbed::\_\_construct()](../classes/wp_oembed/__construct) wp-includes/class-wp-oembed.php | Constructor. |
| [WP\_oEmbed::get\_html()](../classes/wp_oembed/get_html) wp-includes/class-wp-oembed.php | The do-it-all function that takes a URL and attempts to return the HTML. |
| [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. |
| [WP\_oEmbed::fetch()](../classes/wp_oembed/fetch) wp-includes/class-wp-oembed.php | Connects to a oEmbed provider and returns the result. |
| [WP\_oEmbed::\_fetch\_with\_format()](../classes/wp_oembed/_fetch_with_format) wp-includes/class-wp-oembed.php | Fetches result from an oEmbed provider for a specific format and complete provider URL |
| [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\_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. |
| [\_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. |
| [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. |
| [self\_link()](self_link) wp-includes/feed.php | Displays the link for the currently displayed feed in a XSS safe way. |
| [feed\_content\_type()](feed_content_type) wp-includes/feed.php | Returns the content type for specified feed type. |
| [fetch\_feed()](fetch_feed) wp-includes/feed.php | Builds SimplePie object based on RSS or Atom feed from URL. |
| [get\_the\_content\_feed()](get_the_content_feed) wp-includes/feed.php | Retrieves the post content for feeds. |
| [the\_excerpt\_rss()](the_excerpt_rss) wp-includes/feed.php | Displays the post excerpt for the feed. |
| [the\_permalink\_rss()](the_permalink_rss) wp-includes/feed.php | Displays the permalink to the post for use in feeds. |
| [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. |
| [comment\_link()](comment_link) wp-includes/feed.php | Displays the link to the comments. |
| [get\_comment\_author\_rss()](get_comment_author_rss) wp-includes/feed.php | Retrieves the current comment author for use in the feeds. |
| [comment\_text\_rss()](comment_text_rss) wp-includes/feed.php | Displays the current comment content for use in the feeds. |
| [get\_bloginfo\_rss()](get_bloginfo_rss) wp-includes/feed.php | Retrieves RSS container for the bloginfo function. |
| [bloginfo\_rss()](bloginfo_rss) wp-includes/feed.php | Displays RSS container for the bloginfo function. |
| [get\_default\_feed()](get_default_feed) wp-includes/feed.php | Retrieves the default feed. |
| [get\_wp\_title\_rss()](get_wp_title_rss) wp-includes/feed.php | Retrieves the blog title for the feed title. |
| [wp\_title\_rss()](wp_title_rss) wp-includes/feed.php | Displays the blog title for display of the feed title. |
| [get\_the\_title\_rss()](get_the_title_rss) wp-includes/feed.php | Retrieves the current post title for the feed. |
| [WP\_Customize\_Setting::value()](../classes/wp_customize_setting/value) wp-includes/class-wp-customize-setting.php | Fetch the value of the setting. |
| [WP\_Customize\_Setting::js\_value()](../classes/wp_customize_setting/js_value) wp-includes/class-wp-customize-setting.php | Sanitize the setting’s value for use in JavaScript. |
| [WP\_Customize\_Setting::sanitize()](../classes/wp_customize_setting/sanitize) wp-includes/class-wp-customize-setting.php | Sanitize an input. |
| [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [get\_transient()](get_transient) wp-includes/option.php | Retrieves the value of a transient. |
| [set\_transient()](set_transient) wp-includes/option.php | Sets/updates the value of a transient. |
| [wp\_load\_alloptions()](wp_load_alloptions) wp-includes/option.php | Loads and caches all autoloaded options, if available or all options. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [add\_option()](add_option) wp-includes/option.php | Adds a new option. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [WP\_User\_Query::prepare\_query()](../classes/wp_user_query/prepare_query) wp-includes/class-wp-user-query.php | Prepares the query variables. |
| [WP\_User\_Query::query()](../classes/wp_user_query/query) wp-includes/class-wp-user-query.php | Executes the query, with the current variables. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [wp\_get\_user\_contact\_methods()](wp_get_user_contact_methods) wp-includes/user.php | Sets up the user contact methods. |
| [check\_password\_reset\_key()](check_password_reset_key) wp-includes/user.php | Retrieves a user row based on password reset key and login. |
| [register\_new\_user()](register_new_user) wp-includes/user.php | Handles registering a new user. |
| [username\_exists()](username_exists) wp-includes/user.php | Determines whether the given username exists. |
| [email\_exists()](email_exists) wp-includes/user.php | Determines whether the given email exists. |
| [validate\_username()](validate_username) wp-includes/user.php | Checks whether a username is valid. |
| [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. |
| [count\_users()](count_users) wp-includes/user.php | Counts number of users who have each of the user roles. |
| [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. |
| [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\_authenticate\_spam\_check()](wp_authenticate_spam_check) wp-includes/user.php | For Multisite blogs, checks if the authenticated user has been marked as a spammer, or if the user’s primary blog has been marked as spam. |
| [count\_user\_posts()](count_user_posts) wp-includes/user.php | Gets the number of posts a user has written. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [wp\_list\_bookmarks()](wp_list_bookmarks) wp-includes/bookmark-template.php | Retrieves or echoes all of the bookmarks. |
| [get\_query\_template()](get_query_template) wp-includes/template.php | Retrieves path to a template. |
| [WP\_Image\_Editor\_GD::\_save()](../classes/wp_image_editor_gd/_save) wp-includes/class-wp-image-editor-gd.php | |
| [Walker\_Nav\_Menu::start\_el()](../classes/walker_nav_menu/start_el) wp-includes/class-walker-nav-menu.php | Starts the element output. |
| [has\_post\_thumbnail()](has_post_thumbnail) wp-includes/post-thumbnail-template.php | Determines whether a post has an image attached. |
| [get\_post\_thumbnail\_id()](get_post_thumbnail_id) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail ID. |
| [get\_the\_post\_thumbnail()](get_the_post_thumbnail) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail. |
| [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\_get\_attachment\_link()](wp_get_attachment_link) wp-includes/post-template.php | Retrieves an attachment page link using an image or icon, if possible. |
| [prepend\_attachment()](prepend_attachment) wp-includes/post-template.php | Wraps attachment in paragraph tag before content. |
| [get\_the\_password\_form()](get_the_password_form) wp-includes/post-template.php | Retrieves protected post password form content. |
| [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). |
| [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\_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\_list\_pages()](wp_list_pages) wp-includes/post-template.php | Retrieves or displays a list of pages (or hierarchical post type items) in list (li) format. |
| [wp\_page\_menu()](wp_page_menu) wp-includes/post-template.php | Displays or retrieves a list of pages with an optional home link. |
| [get\_the\_guid()](get_the_guid) wp-includes/post-template.php | Retrieves the Post Global Unique Identifier (guid). |
| [the\_content()](the_content) wp-includes/post-template.php | Displays the post content. |
| [get\_the\_content()](get_the_content) wp-includes/post-template.php | Retrieves the post content. |
| [the\_excerpt()](the_excerpt) wp-includes/post-template.php | Displays the post excerpt. |
| [get\_the\_excerpt()](get_the_excerpt) wp-includes/post-template.php | Retrieves the post excerpt. |
| [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. |
| [get\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. |
| [the\_guid()](the_guid) wp-includes/post-template.php | Displays the Post Global Unique Identifier (guid). |
| [get\_media\_embedded\_in\_content()](get_media_embedded_in_content) wp-includes/media.php | Checks the HTML content for a audio, video, object, embed, or iframe tags. |
| [get\_post\_galleries()](get_post_galleries) wp-includes/media.php | Retrieves galleries from the passed post’s content. |
| [get\_post\_gallery()](get_post_gallery) wp-includes/media.php | Checks a specified post’s content for gallery and, if present, return the first |
| [wp\_max\_upload\_size()](wp_max_upload_size) wp-includes/media.php | Determines the maximum upload size allowed in php.ini. |
| [wp\_get\_image\_editor()](wp_get_image_editor) wp-includes/media.php | Returns a [WP\_Image\_Editor](../classes/wp_image_editor) instance and loads file into it. |
| [wp\_plupload\_default\_settings()](wp_plupload_default_settings) wp-includes/media.php | Prints default Plupload arguments. |
| [wp\_prepare\_attachment\_for\_js()](wp_prepare_attachment_for_js) wp-includes/media.php | Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model. |
| [wp\_enqueue\_media()](wp_enqueue_media) wp-includes/media.php | Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. |
| [get\_attached\_media()](get_attached_media) wp-includes/media.php | Retrieves media attached to the passed post. |
| [wp\_embed\_defaults()](wp_embed_defaults) wp-includes/embed.php | Creates default array of embed parameters. |
| [wp\_maybe\_load\_embeds()](wp_maybe_load_embeds) wp-includes/embed.php | Determines if default embed handlers should be loaded. |
| [wp\_embed\_handler\_audio()](wp_embed_handler_audio) wp-includes/embed.php | Audio embed handler callback. |
| [wp\_embed\_handler\_video()](wp_embed_handler_video) wp-includes/embed.php | Video embed handler callback. |
| [wp\_get\_video\_extensions()](wp_get_video_extensions) wp-includes/media.php | Returns a filtered list of supported video formats. |
| [wp\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. |
| [gallery\_shortcode()](gallery_shortcode) wp-includes/media.php | Builds the Gallery shortcode output. |
| [wp\_playlist\_shortcode()](wp_playlist_shortcode) wp-includes/media.php | Builds the Playlist shortcode output. |
| [wp\_mediaelement\_fallback()](wp_mediaelement_fallback) wp-includes/media.php | Provides a No-JS Flash fallback as a last resort for audio / video. |
| [wp\_get\_audio\_extensions()](wp_get_audio_extensions) wp-includes/media.php | Returns a filtered list of supported audio formats. |
| [wp\_get\_attachment\_id3\_keys()](wp_get_attachment_id3_keys) wp-includes/media.php | Returns useful keys to use to lookup data from an attachment’s stored metadata. |
| [wp\_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. |
| [wp\_constrain\_dimensions()](wp_constrain_dimensions) wp-includes/media.php | Calculates the new dimensions for a down-sampled image. |
| [image\_resize\_dimensions()](image_resize_dimensions) wp-includes/media.php | Retrieves calculated resize dimensions for use in [WP\_Image\_Editor](../classes/wp_image_editor). |
| [image\_get\_intermediate\_size()](image_get_intermediate_size) wp-includes/media.php | Retrieves the image’s intermediate size (resized) path, width, and height. |
| [get\_intermediate\_image\_sizes()](get_intermediate_image_sizes) wp-includes/media.php | Gets the available intermediate image size names. |
| [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) wp-includes/media.php | Retrieves an image to represent an attachment. |
| [wp\_get\_attachment\_image()](wp_get_attachment_image) wp-includes/media.php | Gets an HTML img element representing an image attachment. |
| [img\_caption\_shortcode()](img_caption_shortcode) wp-includes/media.php | Builds the Caption shortcode output. |
| [image\_downsize()](image_downsize) wp-includes/media.php | Scales an image to fit a particular size (such as ‘thumb’ or ‘medium’). |
| [image\_constrain\_size\_for\_editor()](image_constrain_size_for_editor) wp-includes/media.php | Scales down the default size of an image. |
| [wp\_mime\_type\_icon()](wp_mime_type_icon) wp-includes/post.php | Retrieves the icon for a MIME type or attachment. |
| [get\_lastpostdate()](get_lastpostdate) wp-includes/post.php | Retrieves the most recent time that a post on the site was published. |
| [get\_lastpostmodified()](get_lastpostmodified) wp-includes/post.php | Gets the most recent time that a post on the site was modified. |
| [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. |
| [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. |
| [wp\_update\_attachment\_metadata()](wp_update_attachment_metadata) wp-includes/post.php | Updates metadata for an attachment. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [wp\_get\_attachment\_thumb\_url()](wp_get_attachment_thumb_url) wp-includes/post.php | Retrieves URL for an attachment thumbnail. |
| [wp\_get\_attachment\_thumb\_file()](wp_get_attachment_thumb_file) wp-includes/deprecated.php | Retrieves thumbnail for an attachment. |
| [get\_enclosed()](get_enclosed) wp-includes/post.php | Retrieves enclosures already enclosed for a post. |
| [get\_pung()](get_pung) wp-includes/post.php | Retrieves URLs already pinged for a post. |
| [get\_to\_ping()](get_to_ping) wp-includes/post.php | Retrieves URLs that need to be pinged. |
| [get\_page\_uri()](get_page_uri) wp-includes/post.php | Builds the URI path for a page. |
| [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| [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. |
| [add\_ping()](add_ping) wp-includes/post.php | Adds a URL to those already pinged. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [get\_post\_mime\_types()](get_post_mime_types) wp-includes/post.php | Gets default post mime types. |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [wp\_trash\_post()](wp_trash_post) wp-includes/post.php | Moves a post or page to the Trash |
| [wp\_untrash\_post()](wp_untrash_post) wp-includes/post.php | Restores a post from the Trash. |
| [wp\_count\_posts()](wp_count_posts) wp-includes/post.php | Counts number of posts of a post type and if user has permissions to view. |
| [wp\_count\_attachments()](wp_count_attachments) wp-includes/post.php | Counts number of attachments for the mime type(s). |
| [is\_sticky()](is_sticky) wp-includes/post.php | Determines whether a post is sticky. |
| [sanitize\_post\_field()](sanitize_post_field) wp-includes/post.php | Sanitizes a post field based on context. |
| [get\_post\_type\_labels()](get_post_type_labels) wp-includes/post.php | Builds an object with all post type labels out of a post type object. |
| [get\_post\_status()](get_post_status) wp-includes/post.php | Retrieves the post status based on the post ID. |
| [get\_attached\_file()](get_attached_file) wp-includes/post.php | Retrieves attached file path based on attachment ID. |
| [update\_attached\_file()](update_attached_file) wp-includes/post.php | Updates attachment file path based on attachment ID. |
| [\_wp\_relative\_upload\_path()](_wp_relative_upload_path) wp-includes/post.php | Returns relative path to an uploaded file. |
| [WP\_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::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. |
| [WP\_Rewrite::flush\_rules()](../classes/wp_rewrite/flush_rules) wp-includes/class-wp-rewrite.php | Removes rewrite rules and then recreate rewrite rules. |
| [WP\_Rewrite::rewrite\_rules()](../classes/wp_rewrite/rewrite_rules) wp-includes/class-wp-rewrite.php | Constructs rewrite matches and queries from 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. |
| [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\_revisions\_to\_keep()](wp_revisions_to_keep) wp-includes/revision.php | Determines how many revisions to retain for a given post. |
| [\_wp\_post\_revision\_fields()](_wp_post_revision_fields) wp-includes/revision.php | Determines which fields of posts are to be saved in revisions. |
| [wp\_save\_post\_revision()](wp_save_post_revision) wp-includes/revision.php | Creates a revision for the current version of a post. |
| [get\_space\_used()](get_space_used) wp-includes/ms-functions.php | Returns the space used by the current site. |
| [get\_space\_allowed()](get_space_allowed) wp-includes/ms-functions.php | Returns the upload quota for the current blog. |
| [wp\_is\_large\_network()](wp_is_large_network) wp-includes/ms-functions.php | Determines whether or not we have a large 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. |
| [wp\_maybe\_update\_network\_user\_counts()](wp_maybe_update_network_user_counts) wp-includes/ms-functions.php | Updates the network-wide users count. |
| [wpmu\_welcome\_user\_notification()](wpmu_welcome_user_notification) wp-includes/ms-functions.php | Notifies a user that their account activation has been successful. |
| [maybe\_redirect\_404()](maybe_redirect_404) wp-includes/ms-functions.php | Corrects 404 redirects when NOBLOGREDIRECT is defined. |
| [recurse\_dirsize()](recurse_dirsize) wp-includes/functions.php | Gets the size of a directory recursively. |
| [newblog\_notify\_siteadmin()](newblog_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new site has been activated. |
| [newuser\_notify\_siteadmin()](newuser_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new user has been activated. |
| [domain\_exists()](domain_exists) wp-includes/ms-functions.php | Checks whether a site name is already taken. |
| [wpmu\_welcome\_notification()](wpmu_welcome_notification) wp-includes/ms-functions.php | Notifies the site administrator that their site activation was successful. |
| [is\_email\_address\_unsafe()](is_email_address_unsafe) wp-includes/ms-functions.php | Checks an email address against a list of banned domains. |
| [wpmu\_validate\_user\_signup()](wpmu_validate_user_signup) wp-includes/ms-functions.php | Sanitizes and validates data required for a user sign-up. |
| [wpmu\_validate\_blog\_signup()](wpmu_validate_blog_signup) wp-includes/ms-functions.php | Processes new site registrations. |
| [wpmu\_signup\_blog()](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\_signup\_blog\_notification()](wpmu_signup_blog_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
| [wpmu\_signup\_user\_notification()](wpmu_signup_user_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked. |
| [sanitize\_bookmark\_field()](sanitize_bookmark_field) wp-includes/bookmark.php | Sanitizes a bookmark field. |
| [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\_bookmarks()](get_bookmarks) wp-includes/bookmark.php | Retrieves the list of bookmarks. |
| [get\_site\_by\_path()](get_site_by_path) wp-includes/ms-load.php | Retrieves the closest matching site object by its domain and path. |
| [graceful\_fail()](graceful_fail) wp-includes/ms-deprecated.php | Deprecated functionality to gracefully fail. |
| [ms\_site\_check()](ms_site_check) wp-includes/ms-load.php | Checks status of current blog. |
| [WP\_Scripts::do\_item()](../classes/wp_scripts/do_item) wp-includes/class-wp-scripts.php | Processes a script dependency. |
| [WP\_Scripts::all\_deps()](../classes/wp_scripts/all_deps) wp-includes/class-wp-scripts.php | Determines script dependencies. |
| [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. |
| [get\_the\_author\_link()](get_the_author_link) wp-includes/author-template.php | Retrieves either author’s link or author’s name. |
| [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. |
| [is\_multi\_author()](is_multi_author) wp-includes/author-template.php | Determines whether this site has more than one author. |
| [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\_author()](get_the_author) wp-includes/author-template.php | Retrieves 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. |
| [get\_blog\_option()](get_blog_option) wp-includes/ms-blogs.php | Retrieve option value for a given blog id based on name of option. |
| [wp\_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. |
| [has\_nav\_menu()](has_nav_menu) wp-includes/nav-menu.php | Determines whether a registered nav menu location has a menu assigned to it. |
| [wp\_get\_nav\_menus()](wp_get_nav_menus) wp-includes/nav-menu.php | Returns all navigation menu objects. |
| [wp\_get\_nav\_menu\_items()](wp_get_nav_menu_items) wp-includes/nav-menu.php | Retrieves all menu items of a navigation menu. |
| [wp\_get\_nav\_menu\_object()](wp_get_nav_menu_object) wp-includes/nav-menu.php | Returns a navigation menu object. |
| [wp\_xmlrpc\_server::mt\_supportedTextFilters()](../classes/wp_xmlrpc_server/mt_supportedtextfilters) wp-includes/class-wp-xmlrpc-server.php | Retrieve an empty array because we don’t support per-post text filters. |
| [wp\_xmlrpc\_server::pingback\_ping()](../classes/wp_xmlrpc_server/pingback_ping) wp-includes/class-wp-xmlrpc-server.php | Retrieves a pingback and registers it. |
| [wp\_xmlrpc\_server::pingback\_error()](../classes/wp_xmlrpc_server/pingback_error) wp-includes/class-wp-xmlrpc-server.php | Sends a pingback error based on the given error code and message. |
| [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::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\_newComment()](../classes/wp_xmlrpc_server/wp_newcomment) wp-includes/class-wp-xmlrpc-server.php | Create new 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\_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::\_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\_comment()](../classes/wp_xmlrpc_server/_prepare_comment) wp-includes/class-wp-xmlrpc-server.php | Prepares comment data for return in an XML-RPC object. |
| [wp\_xmlrpc\_server::\_prepare\_user()](../classes/wp_xmlrpc_server/_prepare_user) wp-includes/class-wp-xmlrpc-server.php | Prepares user 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. |
| [wp\_xmlrpc\_server::wp\_getPost()](../classes/wp_xmlrpc_server/wp_getpost) wp-includes/class-wp-xmlrpc-server.php | Retrieve a post. |
| [wp\_xmlrpc\_server::\_prepare\_taxonomy()](../classes/wp_xmlrpc_server/_prepare_taxonomy) wp-includes/class-wp-xmlrpc-server.php | Prepares taxonomy data for return in an XML-RPC object. |
| [wp\_xmlrpc\_server::\_prepare\_term()](../classes/wp_xmlrpc_server/_prepare_term) wp-includes/class-wp-xmlrpc-server.php | Prepares term 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. |
| [wp\_xmlrpc\_server::\_prepare\_post\_type()](../classes/wp_xmlrpc_server/_prepare_post_type) wp-includes/class-wp-xmlrpc-server.php | Prepares post data for return in an XML-RPC object. |
| [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. |
| [wp\_xmlrpc\_server::\_\_construct()](../classes/wp_xmlrpc_server/__construct) wp-includes/class-wp-xmlrpc-server.php | Registers all of the XMLRPC methods that XMLRPC server understands. |
| [wp\_xmlrpc\_server::login()](../classes/wp_xmlrpc_server/login) wp-includes/class-wp-xmlrpc-server.php | Log user in. |
| [wp\_xmlrpc\_server::initialise\_blog\_option\_info()](../classes/wp_xmlrpc_server/initialise_blog_option_info) wp-includes/class-wp-xmlrpc-server.php | Set up blog options property. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [wpdb::set\_sql\_mode()](../classes/wpdb/set_sql_mode) wp-includes/class-wpdb.php | Changes the current SQL mode, and ensures its WordPress compatibility. |
| [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). |
| [WP\_Widget::form\_callback()](../classes/wp_widget/form_callback) wp-includes/class-wp-widget.php | Generates the widget control form (Do NOT override). |
| [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. |
| [wp\_get\_sidebars\_widgets()](wp_get_sidebars_widgets) wp-includes/widgets.php | Retrieve full list of sidebars and their widget instance IDs. |
| [the\_widget()](the_widget) wp-includes/widgets.php | Output an arbitrary widget as a template tag. |
| [register\_sidebar()](register_sidebar) wp-includes/widgets.php | Builds the definition for a single sidebar and returns the ID. |
| [get\_post\_reply\_link()](get_post_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to post link. |
| [get\_cancel\_comment\_reply\_link()](get_cancel_comment_reply_link) wp-includes/comment-template.php | Retrieves HTML content for cancel comment reply link. |
| [get\_comment\_id\_fields()](get_comment_id_fields) wp-includes/comment-template.php | Retrieves hidden input HTML for replying to comments. |
| [wp\_list\_comments()](wp_list_comments) wp-includes/comment-template.php | Displays a list of comments. |
| [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\_open()](comments_open) wp-includes/comment-template.php | Determines whether the current post is open for comments. |
| [pings\_open()](pings_open) wp-includes/comment-template.php | Determines whether the current post is open for pings. |
| [comments\_template()](comments_template) wp-includes/comment-template.php | Loads the comment template specified in $file. |
| [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. |
| [get\_comments\_number()](get_comments_number) wp-includes/comment-template.php | Retrieves the amount of comments a post has. |
| [get\_comment\_text()](get_comment_text) wp-includes/comment-template.php | Retrieves the text of the current comment. |
| [comment\_text()](comment_text) wp-includes/comment-template.php | Displays the text of the current comment. |
| [get\_comment\_time()](get_comment_time) wp-includes/comment-template.php | Retrieves the comment time of the current comment. |
| [get\_comment\_type()](get_comment_type) wp-includes/comment-template.php | Retrieves the comment type of the current comment. |
| [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\_class()](get_comment_class) wp-includes/comment-template.php | Returns the classes for the comment div as an array. |
| [get\_comment\_date()](get_comment_date) wp-includes/comment-template.php | Retrieves the comment date of the current comment. |
| [get\_comment\_excerpt()](get_comment_excerpt) wp-includes/comment-template.php | Retrieves the excerpt of the given comment. |
| [comment\_excerpt()](comment_excerpt) wp-includes/comment-template.php | Displays the excerpt of the current comment. |
| [get\_comment\_ID()](get_comment_id) wp-includes/comment-template.php | Retrieves the comment ID of the current comment. |
| [get\_comment\_author()](get_comment_author) wp-includes/comment-template.php | Retrieves the author of the current comment. |
| [comment\_author()](comment_author) wp-includes/comment-template.php | Displays the author of the current comment. |
| [get\_comment\_author\_email()](get_comment_author_email) wp-includes/comment-template.php | Retrieves the email of the author of the current comment. |
| [comment\_author\_email()](comment_author_email) wp-includes/comment-template.php | Displays the email of the author of the current global $comment. |
| [get\_comment\_author\_email\_link()](get_comment_author_email_link) wp-includes/comment-template.php | Returns the HTML email link to the author of the current comment. |
| [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. |
| [get\_comment\_author\_IP()](get_comment_author_ip) wp-includes/comment-template.php | Retrieves the IP address of the author of the current comment. |
| [get\_comment\_author\_url()](get_comment_author_url) wp-includes/comment-template.php | Retrieves the URL of the author of the current comment, not linked. |
| [WP\_Customize\_Widgets::capture\_filter\_pre\_get\_option()](../classes/wp_customize_widgets/capture_filter_pre_get_option) wp-includes/class-wp-customize-widgets.php | Pre-filters captured option values before retrieving. |
| [WP\_Customize\_Widgets::get\_setting\_args()](../classes/wp_customize_widgets/get_setting_args) wp-includes/class-wp-customize-widgets.php | Retrieves common arguments to supply when constructing a Customizer setting. |
| [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\_Customize\_Widgets::is\_wide\_widget()](../classes/wp_customize_widgets/is_wide_widget) wp-includes/class-wp-customize-widgets.php | Determines whether the widget is considered “wide”. |
| [print\_head\_scripts()](print_head_scripts) wp-includes/script-loader.php | Prints the script queue in the HTML head on admin pages. |
| [print\_footer\_scripts()](print_footer_scripts) wp-includes/script-loader.php | Prints the scripts that were queued for the footer or too late for the HTML head. |
| [print\_admin\_styles()](print_admin_styles) wp-includes/script-loader.php | Prints the styles queue in the HTML head on admin pages. |
| [print\_late\_styles()](print_late_styles) wp-includes/script-loader.php | Prints the styles that were queued too late for the HTML head. |
| [wp\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. |
| [\_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. |
| [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. |
| [wp\_update\_comment\_count\_now()](wp_update_comment_count_now) wp-includes/comment.php | Updates the comment count for the post. |
| [do\_trackbacks()](do_trackbacks) wp-includes/comment.php | Performs trackbacks. |
| [pingback()](pingback) wp-includes/comment.php | Pings back the links found in a post. |
| [wp\_get\_current\_commenter()](wp_get_current_commenter) wp-includes/comment.php | Gets current commenter’s name, email, and URL. |
| [wp\_filter\_comment()](wp_filter_comment) wp-includes/comment.php | Filters and sanitizes comment data. |
| [get\_page\_of\_comment()](get_page_of_comment) wp-includes/comment.php | Calculates what page number a comment will appear on for comment paging. |
| [wp\_count\_comments()](wp_count_comments) wp-includes/comment.php | Retrieves the total comment counts for the whole site or a single post. |
| [wp\_set\_comment\_cookies()](wp_set_comment_cookies) wp-includes/comment.php | Sets the cookies used to store an unauthenticated commentator’s identity. Typically used to recall previous comments by this commentator that are still held in moderation. |
| [sanitize\_comment\_cookies()](sanitize_comment_cookies) wp-includes/comment.php | Sanitizes the cookies sent to the user already. |
| [wp\_allow\_comment()](wp_allow_comment) wp-includes/comment.php | Validates whether this comment is allowed to be made. |
| [is\_protected\_meta()](is_protected_meta) wp-includes/meta.php | Determines whether a meta key is considered protected. |
| [sanitize\_meta()](sanitize_meta) wp-includes/meta.php | Sanitizes meta value. |
| [register\_meta()](register_meta) wp-includes/meta.php | Registers a meta key. |
| [check\_comment()](check_comment) wp-includes/comment.php | Checks whether a comment passes internal checks to be allowed to add. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| [delete\_metadata()](delete_metadata) wp-includes/meta.php | Deletes metadata for the specified object. |
| [metadata\_exists()](metadata_exists) wp-includes/meta.php | Determines if a meta field with the given key exists for the given object ID. |
| [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. |
| [delete\_metadata\_by\_mid()](delete_metadata_by_mid) wp-includes/meta.php | Deletes metadata by meta ID. |
| [update\_meta\_cache()](update_meta_cache) wp-includes/meta.php | Updates the metadata cache for the specified objects. |
| [\_WP\_Editors::wp\_link\_query()](../classes/_wp_editors/wp_link_query) wp-includes/class-wp-editor.php | Performs post queries for internal linking. |
| [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. |
| [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | |
| [\_WP\_Editors::wp\_mce\_translation()](../classes/_wp_editors/wp_mce_translation) wp-includes/class-wp-editor.php | Translates the default TinyMCE strings and returns them as JSON encoded object ready to be loaded with tinymce.addI18n(), or as JS snippet that should run after tinymce.js is loaded. |
| [\_WP\_Editors::parse\_settings()](../classes/_wp_editors/parse_settings) wp-includes/class-wp-editor.php | Parse default arguments for the editor instance. |
| [\_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 |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Formalized the existing and already documented `...$args` parameter by adding it to the function signature. |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
| programming_docs |
wordpress get_tag_feed_link( int|WP_Term|object $tag, string $feed = '' ): string get\_tag\_feed\_link( int|WP\_Term|object $tag, string $feed = '' ): string
===========================================================================
Retrieves the permalink for a tag feed.
`$tag` int|[WP\_Term](../classes/wp_term)|object Required The ID or term object whose feed link will be retrieved. `$feed` string Optional Feed type. Possible values include `'rss2'`, `'atom'`.
Default is the value of [get\_default\_feed()](get_default_feed) . Default: `''`
string The feed permalink for the given tag.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_tag_feed_link( $tag, $feed = '' ) {
return get_term_feed_link( $tag, 'post_tag', $feed );
}
```
| Uses | Description |
| --- | --- |
| [get\_term\_feed\_link()](get_term_feed_link) wp-includes/link-template.php | Retrieves the feed link for a term. |
| Used By | Description |
| --- | --- |
| [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. |
| [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. |
wordpress get_category_by_path( string $category_path, bool $full_match = true, string $output = OBJECT ): WP_Term|array|WP_Error|null get\_category\_by\_path( string $category\_path, bool $full\_match = true, string $output = OBJECT ): WP\_Term|array|WP\_Error|null
===================================================================================================================================
Retrieves a category based on URL containing the category slug.
Breaks the $category\_path parameter up to get the category slug.
Tries to find the child path and will return it. If it doesn’t find a match, then it will return the first category matching slug, if $full\_match, is set to false. If it does not, then it will return null.
It is also possible that it will return a [WP\_Error](../classes/wp_error) object on failure. Check for it when using this function.
`$category_path` string Required URL containing category slugs. `$full_match` bool Optional Whether full path should be matched. Default: `true`
`$output` string Optional The required return type. One of OBJECT, ARRAY\_A, or ARRAY\_N, which correspond to a [WP\_Term](../classes/wp_term) object, an associative array, or a numeric array, respectively. Default: `OBJECT`
[WP\_Term](../classes/wp_term)|array|[WP\_Error](../classes/wp_error)|null Type is based on $output value.
File: `wp-includes/category.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category.php/)
```
function get_category_by_path( $category_path, $full_match = true, $output = OBJECT ) {
$category_path = rawurlencode( urldecode( $category_path ) );
$category_path = str_replace( '%2F', '/', $category_path );
$category_path = str_replace( '%20', ' ', $category_path );
$category_paths = '/' . trim( $category_path, '/' );
$leaf_path = sanitize_title( basename( $category_paths ) );
$category_paths = explode( '/', $category_paths );
$full_path = '';
foreach ( (array) $category_paths as $pathdir ) {
$full_path .= ( '' !== $pathdir ? '/' : '' ) . sanitize_title( $pathdir );
}
$categories = get_terms(
array(
'taxonomy' => 'category',
'get' => 'all',
'slug' => $leaf_path,
)
);
if ( empty( $categories ) ) {
return;
}
foreach ( $categories as $category ) {
$path = '/' . $leaf_path;
$curcategory = $category;
while ( ( 0 != $curcategory->parent ) && ( $curcategory->parent != $curcategory->term_id ) ) {
$curcategory = get_term( $curcategory->parent, 'category' );
if ( is_wp_error( $curcategory ) ) {
return $curcategory;
}
$path = '/' . $curcategory->slug . $path;
}
if ( $path == $full_path ) {
$category = get_term( $category->term_id, 'category', $output );
_make_cat_compat( $category );
return $category;
}
}
// If full matching is not required, return the first cat that matches the leaf.
if ( ! $full_match ) {
$category = get_term( reset( $categories )->term_id, 'category', $output );
_make_cat_compat( $category );
return $category;
}
}
```
| 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. |
| [\_make\_cat\_compat()](_make_cat_compat) wp-includes/category.php | Updates category structure to old pre-2.3 from new taxonomy structure. |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [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 |
| --- | --- |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_dropdown_users( array|string $args = '' ): string wp\_dropdown\_users( array|string $args = '' ): string
======================================================
Creates dropdown HTML content of users.
The content can either be displayed, which it is by default or retrieved by setting the ‘echo’ argument. The ‘include’ and ‘exclude’ arguments do not need to be used; all users will be displayed in that case. Only one can be used, either ‘include’ or ‘exclude’, but not both.
The available arguments are as follows:
`$args` array|string Optional Array or string of arguments to generate a drop-down of users.
See [WP\_User\_Query::prepare\_query()](../classes/wp_user_query/prepare_query) for additional available arguments.
* `show_option_all`stringText to show as the drop-down default (all).
* `show_option_none`stringText to show as the drop-down default when no users were found.
* `option_none_value`int|stringValue to use for $show\_option\_non when no users were found. Default -1.
* `hide_if_only_one_author`stringWhether to skip generating the drop-down if only one user was found.
* `orderby`stringField to order found users by. Accepts user fields.
Default `'display_name'`.
* `order`stringWhether to order users in ascending or descending order. Accepts `'ASC'` (ascending) or `'DESC'` (descending).
Default `'ASC'`.
* `include`int[]|stringArray or comma-separated list of user IDs to include.
* `exclude`int[]|stringArray or comma-separated list of user IDs to exclude.
* `multi`bool|intWhether to skip the ID attribute on the `'select'` element.
Accepts `1|true` or `0|false`. Default `0|false`.
* `show`stringUser data to display. If the selected item is empty then the `'user_login'` will be displayed in parentheses.
Accepts any user field, or `'display_name_with_login'` to show the display name with user\_login in parentheses.
Default `'display_name'`.
* `echo`int|boolWhether to echo or return the drop-down. Accepts `1|true` (echo) or `0|false` (return). Default `1|true`.
* `selected`intWhich user ID should be selected. Default 0.
* `include_selected`boolWhether to always include the selected user ID in the drop- down. Default false.
* `name`stringName attribute of select element. Default `'user'`.
* `id`stringID attribute of the select element. Default is the value of $name.
* `class`stringClass attribute of the select element.
* `blog_id`intID of blog (Multisite only). Default is ID of the current blog.
* `who`stringWhich type of users to query. Accepts only an empty string or `'authors'`.
* `role`string|arrayAn array or a comma-separated list of role names that users must match to be included in results. Note that this is an inclusive list: users must match \*each\* role.
* `role__in`string[]An array of role names. Matched users must have at least one of these roles. Default empty array.
* `role__not_in`string[]An array of role names to exclude. Users matching one or more of these roles will not be included in results. Default empty array.
More Arguments from WP\_User\_Query::prepare\_query( ... $query ) Array or string of Query parameters.
* `blog_id`intThe site ID. Default is the current site.
* `role`string|string[]An array or a comma-separated list of role names that users must match to be included in results. Note that this is an inclusive list: users must match \*each\* role.
* `role__in`string[]An array of role names. Matched users must have at least one of these roles.
* `role__not_in`string[]An array of role names to exclude. Users matching one or more of these roles will not be included in results.
* `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.
* `capability`string|string[]An array or a comma-separated list of capability names that users must match to be included in results. Note that this is an inclusive list: users must match \*each\* capability.
Does NOT work for capabilities not in the database or filtered via ['map\_meta\_cap'](../hooks/map_meta_cap).
* `capability__in`string[]An array of capability names. Matched users must have at least one of these capabilities.
Does NOT work for capabilities not in the database or filtered via ['map\_meta\_cap'](../hooks/map_meta_cap).
* `capability__not_in`string[]An array of capability names to exclude. Users matching one or more of these capabilities will not be included in results.
Does NOT work for capabilities not in the database or filtered via ['map\_meta\_cap'](../hooks/map_meta_cap).
* `include`int[]An array of user IDs to include.
* `exclude`int[]An array of user IDs to exclude.
* `search`stringSearch keyword. Searches for possible string matches on columns.
When `$search_columns` is left empty, it tries to determine which column to search in based on search string.
* `search_columns`string[]Array of column names to be searched. Accepts `'ID'`, `'user_login'`, `'user_email'`, `'user_url'`, `'user_nicename'`, `'display_name'`.
* `orderby`string|arrayField(s) to sort the retrieved users by. May be a single value, an array of values, or a multi-dimensional array with fields as keys and orders (`'ASC'` or `'DESC'`) as values. Accepted values are:
+ `'ID'`
+ `'display_name'` (or `'name'`)
+ `'include'`
+ `'user_login'` (or `'login'`)
+ `'login__in'`
+ `'user_nicename'` (or `'nicename'`),
+ `'nicename__in'`
+ 'user\_email (or `'email'`)
+ `'user_url'` (or `'url'`),
+ `'user_registered'` (or `'registered'`)
+ `'post_count'`
+ `'meta_value'`,
+ `'meta_value_num'`
+ The value of `$meta_key`
+ An array key of `$meta_query` To use `'meta_value'` or `'meta_value_num'`, `$meta_key` must be also be defined. Default `'user_login'`.
* `order`stringDesignates ascending or descending order of users. Order values passed as part of an `$orderby` array take precedence over this parameter. Accepts `'ASC'`, `'DESC'`. Default `'ASC'`.
* `offset`intNumber of users to offset in retrieved results. Can be used in conjunction with pagination. Default 0.
* `number`intNumber of users to limit the query for. Can be used in conjunction with pagination. Value -1 (all) is supported, but should be used with caution on larger sites.
Default -1 (all users).
* `paged`intWhen used with number, defines the page of results to return.
Default 1.
* `count_total`boolWhether to count the total number of users found. If pagination is not needed, setting this to false can improve performance.
Default true.
* `fields`string|string[]Which fields to return. Single or all fields (string), or array of fields. Accepts:
+ `'ID'`
+ `'display_name'`
+ `'user_login'`
+ `'user_nicename'`
+ `'user_email'`
+ `'user_url'`
+ `'user_registered'`
+ `'user_pass'`
+ `'user_activation_key'`
+ `'user_status'`
+ `'spam'` (only available on multisite installs)
+ `'deleted'` (only available on multisite installs)
+ `'all'` for all fields and loads user meta.
+ `'all_with_meta'` Deprecated. Use `'all'`. Default `'all'`.
* `who`stringType of users to query. Accepts `'authors'`.
Default empty (all users).
* `has_published_posts`bool|string[]Pass an array of post types to filter results to users who have published posts in those post types. `true` is an alias for all public post types.
* `nicename`stringThe user nicename.
* `nicename__in`string[]An array of nicenames to include. Users matching one of these nicenames will be included in results.
* `nicename__not_in`string[]An array of nicenames to exclude. Users matching one of these nicenames will not be included in results.
* `login`stringThe user login.
* `login__in`string[]An array of logins to include. Users matching one of these logins will be included in results.
* `login__not_in`string[]An array of logins to exclude. Users matching one of these logins will not be included in results.
Default: `''`
string HTML dropdown list of users.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_dropdown_users( $args = '' ) {
$defaults = array(
'show_option_all' => '',
'show_option_none' => '',
'hide_if_only_one_author' => '',
'orderby' => 'display_name',
'order' => 'ASC',
'include' => '',
'exclude' => '',
'multi' => 0,
'show' => 'display_name',
'echo' => 1,
'selected' => 0,
'name' => 'user',
'class' => '',
'id' => '',
'blog_id' => get_current_blog_id(),
'who' => '',
'include_selected' => false,
'option_none_value' => -1,
'role' => '',
'role__in' => array(),
'role__not_in' => array(),
'capability' => '',
'capability__in' => array(),
'capability__not_in' => array(),
);
$defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0;
$parsed_args = wp_parse_args( $args, $defaults );
$query_args = wp_array_slice_assoc(
$parsed_args,
array(
'blog_id',
'include',
'exclude',
'orderby',
'order',
'who',
'role',
'role__in',
'role__not_in',
'capability',
'capability__in',
'capability__not_in',
)
);
$fields = array( 'ID', 'user_login' );
$show = ! empty( $parsed_args['show'] ) ? $parsed_args['show'] : 'display_name';
if ( 'display_name_with_login' === $show ) {
$fields[] = 'display_name';
} else {
$fields[] = $show;
}
$query_args['fields'] = $fields;
$show_option_all = $parsed_args['show_option_all'];
$show_option_none = $parsed_args['show_option_none'];
$option_none_value = $parsed_args['option_none_value'];
/**
* Filters the query arguments for the list of users in the dropdown.
*
* @since 4.4.0
*
* @param array $query_args The query arguments for get_users().
* @param array $parsed_args The arguments passed to wp_dropdown_users() combined with the defaults.
*/
$query_args = apply_filters( 'wp_dropdown_users_args', $query_args, $parsed_args );
$users = get_users( $query_args );
$output = '';
if ( ! empty( $users ) && ( empty( $parsed_args['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) {
$name = esc_attr( $parsed_args['name'] );
if ( $parsed_args['multi'] && ! $parsed_args['id'] ) {
$id = '';
} else {
$id = $parsed_args['id'] ? " id='" . esc_attr( $parsed_args['id'] ) . "'" : " id='$name'";
}
$output = "<select name='{$name}'{$id} class='" . $parsed_args['class'] . "'>\n";
if ( $show_option_all ) {
$output .= "\t<option value='0'>$show_option_all</option>\n";
}
if ( $show_option_none ) {
$_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['include_selected'] && ( $parsed_args['selected'] > 0 ) ) {
$found_selected = false;
$parsed_args['selected'] = (int) $parsed_args['selected'];
foreach ( (array) $users as $user ) {
$user->ID = (int) $user->ID;
if ( $user->ID === $parsed_args['selected'] ) {
$found_selected = true;
}
}
if ( ! $found_selected ) {
$selected_user = get_userdata( $parsed_args['selected'] );
if ( $selected_user ) {
$users[] = $selected_user;
}
}
}
foreach ( (array) $users as $user ) {
if ( 'display_name_with_login' === $show ) {
/* translators: 1: User's display name, 2: User login. */
$display = sprintf( _x( '%1$s (%2$s)', 'user dropdown' ), $user->display_name, $user->user_login );
} elseif ( ! empty( $user->$show ) ) {
$display = $user->$show;
} else {
$display = '(' . $user->user_login . ')';
}
$_selected = selected( $user->ID, $parsed_args['selected'], false );
$output .= "\t<option value='$user->ID'$_selected>" . esc_html( $display ) . "</option>\n";
}
$output .= '</select>';
}
/**
* Filters the wp_dropdown_users() HTML output.
*
* @since 2.3.0
*
* @param string $output HTML output generated by wp_dropdown_users().
*/
$html = apply_filters( 'wp_dropdown_users', $output );
if ( $parsed_args['echo'] ) {
echo $html;
}
return $html;
}
```
[apply\_filters( 'wp\_dropdown\_users', string $output )](../hooks/wp_dropdown_users)
Filters the [wp\_dropdown\_users()](wp_dropdown_users) HTML output.
[apply\_filters( 'wp\_dropdown\_users\_args', array $query\_args, array $parsed\_args )](../hooks/wp_dropdown_users_args)
Filters the query arguments for the list of users in the dropdown.
| Uses | Description |
| --- | --- |
| [selected()](selected) wp-includes/general-template.php | Outputs the HTML selected attribute. |
| [is\_author()](is_author) wp-includes/query.php | Determines whether the query is for an existing author 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. |
| [wp\_array\_slice\_assoc()](wp_array_slice_assoc) wp-includes/functions.php | Extracts a slice of an array, given a list of keys. |
| [get\_users()](get_users) wp-includes/user.php | Retrieves list of users matching criteria. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [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 |
| --- | --- |
| [post\_author\_meta\_box()](post_author_meta_box) wp-admin/includes/meta-boxes.php | Displays form field with list of authors. |
| [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 `$role`, `$role__in`, and `$role__not_in` parameters. |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Added the `'display_name_with_login'` value for `'show'`. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
| programming_docs |
wordpress wpmu_log_new_registrations( WP_Site|int $blog_id, int|array $user_id ) wpmu\_log\_new\_registrations( WP\_Site|int $blog\_id, int|array $user\_id )
============================================================================
Logs the user email, IP, and registration date of a new site.
`$blog_id` [WP\_Site](../classes/wp_site)|int Required The new site's object or ID. `$user_id` int|array Required User ID, or array of arguments including `'user_id'`. File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function wpmu_log_new_registrations( $blog_id, $user_id ) {
global $wpdb;
if ( is_object( $blog_id ) ) {
$blog_id = $blog_id->blog_id;
}
if ( is_array( $user_id ) ) {
$user_id = ! empty( $user_id['user_id'] ) ? $user_id['user_id'] : 0;
}
$user = get_userdata( (int) $user_id );
if ( $user ) {
$wpdb->insert(
$wpdb->registration_log,
array(
'email' => $user->user_email,
'IP' => preg_replace( '/[^0-9., ]/', '', wp_unslash( $_SERVER['REMOTE_ADDR'] ) ),
'blog_id' => $blog_id,
'date_registered' => current_time( 'mysql' ),
)
);
}
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| 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 validate_user_signup(): bool validate\_user\_signup(): bool
==============================
Validates the new user sign-up.
bool True if new user 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_user_signup() {
$result = validate_user_form();
$user_name = $result['user_name'];
$user_email = $result['user_email'];
$errors = $result['errors'];
if ( $errors->has_errors() ) {
signup_user( $user_name, $user_email, $errors );
return false;
}
if ( 'blog' === $_POST['signup_for'] ) {
signup_blog( $user_name, $user_email );
return false;
}
/** This filter is documented in wp-signup.php */
wpmu_signup_user( $user_name, $user_email, apply_filters( 'add_signup_meta', array() ) );
confirm_user_signup( $user_name, $user_email );
return true;
}
```
[apply\_filters( 'add\_signup\_meta', array $meta )](../hooks/add_signup_meta)
Filters the new default site meta variables.
| Uses | Description |
| --- | --- |
| [validate\_user\_form()](validate_user_form) wp-signup.php | Validates user sign-up name and email. |
| [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\_user\_signup()](confirm_user_signup) wp-signup.php | Shows a message confirming that the new user has been registered and is awaiting activation. |
| [wpmu\_signup\_user()](wpmu_signup_user) wp-includes/ms-functions.php | Records user signup information for future activation. |
| [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 wp_set_all_user_settings( array $user_settings ): bool|null wp\_set\_all\_user\_settings( array $user\_settings ): 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.
Private. Sets all user interface settings.
`$user_settings` array Required User settings. bool|null True if set successfully, false if the current user could not be found.
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 wp_set_all_user_settings( $user_settings ) {
global $_updated_user_settings;
$user_id = get_current_user_id();
if ( ! $user_id ) {
return false;
}
if ( ! is_user_member_of_blog() ) {
return;
}
$settings = '';
foreach ( $user_settings as $name => $value ) {
$_name = preg_replace( '/[^A-Za-z0-9_-]+/', '', $name );
$_value = preg_replace( '/[^A-Za-z0-9_-]+/', '', $value );
if ( ! empty( $_name ) ) {
$settings .= $_name . '=' . $_value . '&';
}
}
$settings = rtrim( $settings, '&' );
parse_str( $settings, $_updated_user_settings );
update_user_option( $user_id, 'user-settings', $settings, false );
update_user_option( $user_id, 'user-settings-time', time(), false );
return true;
}
```
| 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. |
| [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. |
| Used By | Description |
| --- | --- |
| [set\_user\_setting()](set_user_setting) wp-includes/option.php | Adds or updates user interface setting. |
| [delete\_user\_setting()](delete_user_setting) wp-includes/option.php | Deletes user interface settings. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress make_site_theme_from_oldschool( string $theme_name, string $template ): bool make\_site\_theme\_from\_oldschool( string $theme\_name, string $template ): bool
=================================================================================
Creates a site theme from an existing theme.
`$theme_name` string Required The name of the theme. `$template` string Required The directory name of the theme. bool
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function make_site_theme_from_oldschool( $theme_name, $template ) {
$home_path = get_home_path();
$site_dir = WP_CONTENT_DIR . "/themes/$template";
if ( ! file_exists( "$home_path/index.php" ) ) {
return false;
}
/*
* Copy files from the old locations to the site theme.
* TODO: This does not copy arbitrary include dependencies. Only the standard WP files are copied.
*/
$files = array(
'index.php' => 'index.php',
'wp-layout.css' => 'style.css',
'wp-comments.php' => 'comments.php',
'wp-comments-popup.php' => 'comments-popup.php',
);
foreach ( $files as $oldfile => $newfile ) {
if ( 'index.php' === $oldfile ) {
$oldpath = $home_path;
} else {
$oldpath = ABSPATH;
}
// Check to make sure it's not a new index.
if ( 'index.php' === $oldfile ) {
$index = implode( '', file( "$oldpath/$oldfile" ) );
if ( strpos( $index, 'WP_USE_THEMES' ) !== false ) {
if ( ! copy( WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile" ) ) {
return false;
}
// Don't copy anything.
continue;
}
}
if ( ! copy( "$oldpath/$oldfile", "$site_dir/$newfile" ) ) {
return false;
}
chmod( "$site_dir/$newfile", 0777 );
// Update the blog header include in each file.
$lines = explode( "\n", implode( '', file( "$site_dir/$newfile" ) ) );
if ( $lines ) {
$f = fopen( "$site_dir/$newfile", 'w' );
foreach ( $lines as $line ) {
if ( preg_match( '/require.*wp-blog-header/', $line ) ) {
$line = '//' . $line;
}
// Update stylesheet references.
$line = str_replace( "<?php echo __get_option('siteurl'); ?>/wp-layout.css", "<?php bloginfo('stylesheet_url'); ?>", $line );
// Update comments template inclusion.
$line = str_replace( "<?php include(ABSPATH . 'wp-comments.php'); ?>", '<?php comments_template(); ?>', $line );
fwrite( $f, "{$line}\n" );
}
fclose( $f );
}
}
// Add a theme header.
$header = "/*\nTheme Name: $theme_name\nTheme URI: " . __get_option( 'siteurl' ) . "\nDescription: A theme automatically created by the update.\nVersion: 1.0\nAuthor: Moi\n*/\n";
$stylelines = file_get_contents( "$site_dir/style.css" );
if ( $stylelines ) {
$f = fopen( "$site_dir/style.css", 'w' );
fwrite( $f, $header );
fwrite( $f, $stylelines );
fclose( $f );
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [get\_home\_path()](get_home_path) wp-admin/includes/file.php | Gets the absolute filesystem path to the root of the WordPress installation. |
| Used By | Description |
| --- | --- |
| [make\_site\_theme()](make_site_theme) wp-admin/includes/upgrade.php | Creates a site theme. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress rest_get_avatar_sizes(): int[] rest\_get\_avatar\_sizes(): int[]
=================================
Retrieves the pixel sizes for avatars.
int[] List of pixel sizes for avatars. Default `[ 24, 48, 96 ]`.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_get_avatar_sizes() {
/**
* Filters the REST avatar sizes.
*
* Use this filter to adjust the array of sizes returned by the
* `rest_get_avatar_sizes` function.
*
* @since 4.4.0
*
* @param int[] $sizes An array of int values that are the pixel sizes for avatars.
* Default `[ 24, 48, 96 ]`.
*/
return apply_filters( 'rest_avatar_sizes', array( 24, 48, 96 ) );
}
```
[apply\_filters( 'rest\_avatar\_sizes', int[] $sizes )](../hooks/rest_avatar_sizes)
Filters the REST avatar sizes.
| 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 |
| --- | --- |
| [rest\_get\_avatar\_urls()](rest_get_avatar_urls) wp-includes/rest-api.php | Retrieves the avatar urls in various sizes. |
| [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\_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. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress wp_ajax_crop_image() wp\_ajax\_crop\_image()
=======================
Ajax handler for cropping an 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_crop_image() {
$attachment_id = absint( $_POST['id'] );
check_ajax_referer( 'image_editor-' . $attachment_id, 'nonce' );
if ( empty( $attachment_id ) || ! current_user_can( 'edit_post', $attachment_id ) ) {
wp_send_json_error();
}
$context = str_replace( '_', '-', $_POST['context'] );
$data = array_map( 'absint', $_POST['cropDetails'] );
$cropped = wp_crop_image( $attachment_id, $data['x1'], $data['y1'], $data['width'], $data['height'], $data['dst_width'], $data['dst_height'] );
if ( ! $cropped || is_wp_error( $cropped ) ) {
wp_send_json_error( array( 'message' => __( 'Image could not be processed.' ) ) );
}
switch ( $context ) {
case 'site-icon':
require_once ABSPATH . 'wp-admin/includes/class-wp-site-icon.php';
$wp_site_icon = new WP_Site_Icon();
// Skip creating a new attachment if the attachment is a Site Icon.
if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) == $context ) {
// Delete the temporary cropped file, we don't need it.
wp_delete_file( $cropped );
// Additional sizes in wp_prepare_attachment_for_js().
add_filter( 'image_size_names_choose', array( $wp_site_icon, 'additional_sizes' ) );
break;
}
/** This filter is documented in wp-admin/includes/class-custom-image-header.php */
$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.
$attachment = $wp_site_icon->create_attachment_object( $cropped, $attachment_id );
unset( $attachment['ID'] );
// Update the attachment.
add_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) );
$attachment_id = $wp_site_icon->insert_attachment( $attachment, $cropped );
remove_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) );
// Additional sizes in wp_prepare_attachment_for_js().
add_filter( 'image_size_names_choose', array( $wp_site_icon, 'additional_sizes' ) );
break;
default:
/**
* Fires before a cropped image is saved.
*
* Allows to add filters to modify the way a cropped image is saved.
*
* @since 4.3.0
*
* @param string $context The Customizer control requesting the cropped image.
* @param int $attachment_id The attachment ID of the original image.
* @param string $cropped Path to the cropped image file.
*/
do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped );
/** This filter is documented in wp-admin/includes/class-custom-image-header.php */
$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.
$parent_url = wp_get_attachment_url( $attachment_id );
$parent_basename = wp_basename( $parent_url );
$url = str_replace( $parent_basename, wp_basename( $cropped ), $parent_url );
$size = wp_getimagesize( $cropped );
$image_type = ( $size ) ? $size['mime'] : 'image/jpeg';
// Get the original image's post to pre-populate the cropped image.
$original_attachment = get_post( $attachment_id );
$sanitized_post_title = sanitize_file_name( $original_attachment->post_title );
$use_original_title = (
( '' !== trim( $original_attachment->post_title ) ) &&
/*
* Check if the original image has a title other than the "filename" default,
* meaning the image had a title when originally uploaded or its title was edited.
*/
( $parent_basename !== $sanitized_post_title ) &&
( pathinfo( $parent_basename, PATHINFO_FILENAME ) !== $sanitized_post_title )
);
$use_original_description = ( '' !== trim( $original_attachment->post_content ) );
$attachment = array(
'post_title' => $use_original_title ? $original_attachment->post_title : wp_basename( $cropped ),
'post_content' => $use_original_description ? $original_attachment->post_content : $url,
'post_mime_type' => $image_type,
'guid' => $url,
'context' => $context,
);
// Copy the image caption attribute (post_excerpt field) from the original image.
if ( '' !== trim( $original_attachment->post_excerpt ) ) {
$attachment['post_excerpt'] = $original_attachment->post_excerpt;
}
// Copy the image alt text attribute from the original image.
if ( '' !== trim( $original_attachment->_wp_attachment_image_alt ) ) {
$attachment['meta_input'] = array(
'_wp_attachment_image_alt' => wp_slash( $original_attachment->_wp_attachment_image_alt ),
);
}
$attachment_id = wp_insert_attachment( $attachment, $cropped );
$metadata = wp_generate_attachment_metadata( $attachment_id, $cropped );
/**
* Filters the cropped image attachment metadata.
*
* @since 4.3.0
*
* @see wp_generate_attachment_metadata()
*
* @param array $metadata Attachment metadata.
*/
$metadata = apply_filters( 'wp_ajax_cropped_attachment_metadata', $metadata );
wp_update_attachment_metadata( $attachment_id, $metadata );
/**
* Filters the attachment ID for a cropped image.
*
* @since 4.3.0
*
* @param int $attachment_id The attachment ID of the cropped image.
* @param string $context The Customizer control requesting the cropped image.
*/
$attachment_id = apply_filters( 'wp_ajax_cropped_attachment_id', $attachment_id, $context );
}
wp_send_json_success( wp_prepare_attachment_for_js( $attachment_id ) );
}
```
[apply\_filters( 'wp\_ajax\_cropped\_attachment\_id', int $attachment\_id, string $context )](../hooks/wp_ajax_cropped_attachment_id)
Filters the attachment ID for a cropped image.
[apply\_filters( 'wp\_ajax\_cropped\_attachment\_metadata', array $metadata )](../hooks/wp_ajax_cropped_attachment_metadata)
Filters the cropped image attachment metadata.
[do\_action( 'wp\_ajax\_crop\_image\_pre\_save', string $context, int $attachment\_id, string $cropped )](../hooks/wp_ajax_crop_image_pre_save)
Fires before a cropped image is saved.
[do\_action( 'wp\_create\_file\_in\_uploads', string $file, int $attachment\_id )](../hooks/wp_create_file_in_uploads)
Fires after the header image is set or an error is returned.
| Uses | Description |
| --- | --- |
| [wp\_getimagesize()](wp_getimagesize) wp-includes/media.php | Allows PHP’s getimagesize() to be debuggable when necessary. |
| [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\_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\_Site\_Icon::insert\_attachment()](../classes/wp_site_icon/insert_attachment) wp-admin/includes/class-wp-site-icon.php | Inserts an attachment. |
| [wp\_delete\_file()](wp_delete_file) wp-includes/functions.php | Deletes a 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. |
| [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. |
| [wp\_update\_attachment\_metadata()](wp_update_attachment_metadata) wp-includes/post.php | Updates metadata for an attachment. |
| [wp\_insert\_attachment()](wp_insert_attachment) wp-includes/post.php | Inserts an attachment. |
| [sanitize\_file\_name()](sanitize_file_name) wp-includes/formatting.php | Sanitizes a filename, replacing whitespace with dashes. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [WP\_Site\_Icon::\_\_construct()](../classes/wp_site_icon/__construct) wp-admin/includes/class-wp-site-icon.php | Registers actions and filters. |
| [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. |
| [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. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| [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. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
| programming_docs |
wordpress get_blog_permalink( int $blog_id, int $post_id ): string get\_blog\_permalink( int $blog\_id, int $post\_id ): string
============================================================
Gets the permalink for a post on another blog.
`$blog_id` int Required ID of the source blog. `$post_id` int Required ID of the desired post. string The post's permalink
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function get_blog_permalink( $blog_id, $post_id ) {
switch_to_blog( $blog_id );
$link = get_permalink( $post_id );
restore_current_blog();
return $link;
}
```
| Uses | Description |
| --- | --- |
| [restore\_current\_blog()](restore_current_blog) wp-includes/ms-blogs.php | Restore the current blog, after calling [switch\_to\_blog()](switch_to_blog) . |
| [switch\_to\_blog()](switch_to_blog) wp-includes/ms-blogs.php | Switch the current blog. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| Version | Description |
| --- | --- |
| [MU (3.0.0) 1.0](https://developer.wordpress.org/reference/since/mu.3.0.0.1.0/) | Introduced. |
wordpress is_network_only_plugin( string $plugin ): bool is\_network\_only\_plugin( string $plugin ): bool
=================================================
Checks for “Network: true” in the plugin header to see if this should be activated only as a network wide plugin. The plugin would also work when Multisite is not enabled.
Checks for "Site Wide Only: true" for backward compatibility.
`$plugin` string Required Path to the plugin file relative to the plugins directory. bool True if plugin is network only, false otherwise.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function is_network_only_plugin( $plugin ) {
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
if ( $plugin_data ) {
return $plugin_data['Network'];
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [get\_plugin\_data()](get_plugin_data) wp-admin/includes/plugin.php | Parses the plugin contents to retrieve plugin’s metadata. |
| Used By | Description |
| --- | --- |
| [WP\_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::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\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Plugins\_List\_Table::prepare\_items()](../classes/wp_plugins_list_table/prepare_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| [activate\_plugin()](activate_plugin) wp-admin/includes/plugin.php | Attempts activation of plugin in a “sandbox” and redirects on success. |
| [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. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress _wp_get_current_user(): WP_User \_wp\_get\_current\_user(): WP\_User
====================================
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\_get\_current\_user()](wp_get_current_user) instead.
Retrieves the current user object.
Will set the current user, if the current user is not set. The current user will be set to the logged-in person. If no user is logged-in, then it will set the current user to 0, which is invalid and won’t have any permissions.
This function is used by the pluggable functions [wp\_get\_current\_user()](wp_get_current_user) and [get\_currentuserinfo()](get_currentuserinfo) , the latter of which is deprecated but used for backward compatibility.
* [wp\_get\_current\_user()](wp_get_current_user)
[WP\_User](../classes/wp_user) Current [WP\_User](../classes/wp_user) instance.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function _wp_get_current_user() {
global $current_user;
if ( ! empty( $current_user ) ) {
if ( $current_user instanceof WP_User ) {
return $current_user;
}
// Upgrade stdClass to WP_User.
if ( is_object( $current_user ) && isset( $current_user->ID ) ) {
$cur_id = $current_user->ID;
$current_user = null;
wp_set_current_user( $cur_id );
return $current_user;
}
// $current_user has a junk value. Force to WP_User with ID 0.
$current_user = null;
wp_set_current_user( 0 );
return $current_user;
}
if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
wp_set_current_user( 0 );
return $current_user;
}
/**
* Filters the current user.
*
* The default filters use this to determine the current user from the
* request's cookies, if available.
*
* Returning a value of false will effectively short-circuit setting
* the current user.
*
* @since 3.9.0
*
* @param int|false $user_id User ID if one has been determined, false otherwise.
*/
$user_id = apply_filters( 'determine_current_user', false );
if ( ! $user_id ) {
wp_set_current_user( 0 );
return $current_user;
}
wp_set_current_user( $user_id );
return $current_user;
}
```
[apply\_filters( 'determine\_current\_user', int|false $user\_id )](../hooks/determine_current_user)
Filters the current user.
| Uses | Description |
| --- | --- |
| [wp\_set\_current\_user()](wp_set_current_user) wp-includes/pluggable.php | Changes the current user by ID or name. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [get\_currentuserinfo()](get_currentuserinfo) wp-includes/pluggable-deprecated.php | Populate global variables with information about the currently logged in user. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. |
wordpress _navigation_markup( string $links, string $class = 'posts-navigation', string $screen_reader_text = '', string $aria_label = '' ): string \_navigation\_markup( string $links, string $class = 'posts-navigation', string $screen\_reader\_text = '', string $aria\_label = '' ): 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.
Wraps passed links in navigational markup.
`$links` string Required Navigational links. `$class` string Optional Custom class for the nav element.
Default `'posts-navigation'`. Default: `'posts-navigation'`
`$screen_reader_text` string Optional Screen reader text for the nav element.
Default 'Posts navigation'. Default: `''`
`$aria_label` string Optional ARIA label for the nav element.
Defaults to the value of `$screen_reader_text`. Default: `''`
string Navigation template tag.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function _navigation_markup( $links, $class = 'posts-navigation', $screen_reader_text = '', $aria_label = '' ) {
if ( empty( $screen_reader_text ) ) {
$screen_reader_text = __( 'Posts navigation' );
}
if ( empty( $aria_label ) ) {
$aria_label = $screen_reader_text;
}
$template = '
<nav class="navigation %1$s" aria-label="%4$s">
<h2 class="screen-reader-text">%2$s</h2>
<div class="nav-links">%3$s</div>
</nav>';
/**
* Filters the navigation markup template.
*
* Note: The filtered template HTML must contain specifiers for the navigation
* class (%1$s), the screen-reader-text value (%2$s), placement of the navigation
* links (%3$s), and ARIA label text if screen-reader-text does not fit that (%4$s):
*
* <nav class="navigation %1$s" aria-label="%4$s">
* <h2 class="screen-reader-text">%2$s</h2>
* <div class="nav-links">%3$s</div>
* </nav>
*
* @since 4.4.0
*
* @param string $template The default template.
* @param string $class The class passed by the calling function.
* @return string Navigation template.
*/
$template = apply_filters( 'navigation_markup_template', $template, $class );
return sprintf( $template, sanitize_html_class( $class ), esc_html( $screen_reader_text ), $links, esc_html( $aria_label ) );
}
```
[apply\_filters( 'navigation\_markup\_template', string $template, string $class )](../hooks/navigation_markup_template)
Filters the navigation markup template.
| Uses | Description |
| --- | --- |
| [sanitize\_html\_class()](sanitize_html_class) wp-includes/formatting.php | Sanitizes an HTML classname to ensure it only contains valid characters. |
| [\_\_()](__) 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 |
| --- | --- |
| [get\_the\_comments\_navigation()](get_the_comments_navigation) wp-includes/link-template.php | Retrieves navigation to next/previous set of comments, when applicable. |
| [get\_the\_comments\_pagination()](get_the_comments_pagination) wp-includes/link-template.php | Retrieves a paginated navigation to next/previous set of comments, when applicable. |
| [get\_the\_post\_navigation()](get_the_post_navigation) wp-includes/link-template.php | Retrieves the navigation to next/previous post, when applicable. |
| [get\_the\_posts\_navigation()](get_the_posts_navigation) wp-includes/link-template.php | Returns the navigation to next/previous set of posts, when applicable. |
| [get\_the\_posts\_pagination()](get_the_posts_pagination) wp-includes/link-template.php | Retrieves a paginated navigation to next/previous set of posts, when applicable. |
| Version | Description |
| --- | --- |
| [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. |
wordpress rest_get_combining_operation_error( array $value, string $param, array $errors ): WP_Error rest\_get\_combining\_operation\_error( array $value, string $param, array $errors ): WP\_Error
===============================================================================================
Gets the error of combining operation.
`$value` array Required The value to validate. `$param` string Required The parameter name, used in error messages. `$errors` array Required The errors array, to search for possible error. [WP\_Error](../classes/wp_error) The combining operation error.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_get_combining_operation_error( $value, $param, $errors ) {
// If there is only one error, simply return it.
if ( 1 === count( $errors ) ) {
return rest_format_combining_operation_error( $param, $errors[0] );
}
// Filter out all errors related to type validation.
$filtered_errors = array();
foreach ( $errors as $error ) {
$error_code = $error['error_object']->get_error_code();
$error_data = $error['error_object']->get_error_data();
if ( 'rest_invalid_type' !== $error_code || ( isset( $error_data['param'] ) && $param !== $error_data['param'] ) ) {
$filtered_errors[] = $error;
}
}
// If there is only one error left, simply return it.
if ( 1 === count( $filtered_errors ) ) {
return rest_format_combining_operation_error( $param, $filtered_errors[0] );
}
// If there are only errors related to object validation, try choosing the most appropriate one.
if ( count( $filtered_errors ) > 1 && 'object' === $filtered_errors[0]['schema']['type'] ) {
$result = null;
$number = 0;
foreach ( $filtered_errors as $error ) {
if ( isset( $error['schema']['properties'] ) ) {
$n = count( array_intersect_key( $error['schema']['properties'], $value ) );
if ( $n > $number ) {
$result = $error;
$number = $n;
}
}
}
if ( null !== $result ) {
return rest_format_combining_operation_error( $param, $result );
}
}
// If each schema has a title, include those titles in the error message.
$schema_titles = array();
foreach ( $errors as $error ) {
if ( isset( $error['schema']['title'] ) ) {
$schema_titles[] = $error['schema']['title'];
}
}
if ( count( $schema_titles ) === count( $errors ) ) {
/* translators: 1: Parameter, 2: Schema titles. */
return new WP_Error( 'rest_no_matching_schema', wp_sprintf( __( '%1$s is not a valid %2$l.' ), $param, $schema_titles ) );
}
/* translators: %s: Parameter. */
return new WP_Error( 'rest_no_matching_schema', sprintf( __( '%s does not match any of the expected formats.' ), $param ) );
}
```
| Uses | Description |
| --- | --- |
| [rest\_format\_combining\_operation\_error()](rest_format_combining_operation_error) wp-includes/rest-api.php | Formats a combining operation error into a [WP\_Error](../classes/wp_error) object. |
| [wp\_sprintf()](wp_sprintf) wp-includes/formatting.php | WordPress implementation of PHP sprintf() with filters. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [rest\_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. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress wp_ext2type( string $ext ): string|void wp\_ext2type( string $ext ): string|void
========================================
Retrieves the file type based on the extension name.
`$ext` string Required The extension to search. string|void The file type, example: audio, video, document, spreadsheet, etc.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_ext2type( $ext ) {
$ext = strtolower( $ext );
$ext2type = wp_get_ext_types();
foreach ( $ext2type as $type => $exts ) {
if ( in_array( $ext, $exts, true ) ) {
return $type;
}
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_ext\_types()](wp_get_ext_types) wp-includes/functions.php | Retrieves the list of common file extensions and their types. |
| Used By | Description |
| --- | --- |
| [wp\_media\_upload\_handler()](wp_media_upload_handler) wp-admin/includes/media.php | Handles the process of uploading media. |
| [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\_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 media_upload_gallery_form( array $errors ) media\_upload\_gallery\_form( array $errors )
=============================================
Adds gallery form to upload iframe.
`$errors` array Required File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function media_upload_gallery_form( $errors ) {
global $redir_tab, $type;
$redir_tab = 'gallery';
media_upload_header();
$post_id = (int) $_REQUEST['post_id'];
$form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
/** This filter is documented in wp-admin/includes/media.php */
$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
$form_class = 'media-upload-form validate';
if ( get_user_setting( 'uploader' ) ) {
$form_class .= ' html-uploader';
}
?>
<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="sort-buttons" class="hide-if-no-js">
<span>
<?php _e( 'All Tabs:' ); ?>
<a href="#" id="showall"><?php _e( 'Show' ); ?></a>
<a href="#" id="hideall" style="display:none;"><?php _e( 'Hide' ); ?></a>
</span>
<?php _e( 'Sort Order:' ); ?>
<a href="#" id="asc"><?php _e( 'Ascending' ); ?></a> |
<a href="#" id="desc"><?php _e( 'Descending' ); ?></a> |
<a href="#" id="clear"><?php _ex( 'Clear', 'verb' ); ?></a>
</div>
<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="gallery-form">
<?php wp_nonce_field( 'media-form' ); ?>
<table class="widefat">
<thead><tr>
<th><?php _e( 'Media' ); ?></th>
<th class="order-head"><?php _e( 'Order' ); ?></th>
<th class="actions-head"><?php _e( 'Actions' ); ?></th>
</tr></thead>
</table>
<div id="media-items">
<?php add_filter( 'attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2 ); ?>
<?php echo get_media_items( $post_id, $errors ); ?>
</div>
<p class="ml-submit">
<?php
submit_button(
__( 'Save all changes' ),
'savebutton',
'save',
false,
array(
'id' => 'save-all',
'style' => 'display: none;',
)
);
?>
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
<input type="hidden" name="type" value="<?php echo esc_attr( $GLOBALS['type'] ); ?>" />
<input type="hidden" name="tab" value="<?php echo esc_attr( $GLOBALS['tab'] ); ?>" />
</p>
<div id="gallery-settings" style="display:none;">
<div class="title"><?php _e( 'Gallery Settings' ); ?></div>
<table id="basic" class="describe"><tbody>
<tr>
<th scope="row" class="label">
<label>
<span class="alignleft"><?php _e( 'Link thumbnails to:' ); ?></span>
</label>
</th>
<td class="field">
<input type="radio" name="linkto" id="linkto-file" value="file" />
<label for="linkto-file" class="radio"><?php _e( 'Image File' ); ?></label>
<input type="radio" checked="checked" name="linkto" id="linkto-post" value="post" />
<label for="linkto-post" class="radio"><?php _e( 'Attachment Page' ); ?></label>
</td>
</tr>
<tr>
<th scope="row" class="label">
<label>
<span class="alignleft"><?php _e( 'Order images by:' ); ?></span>
</label>
</th>
<td class="field">
<select id="orderby" name="orderby">
<option value="menu_order" selected="selected"><?php _e( 'Menu order' ); ?></option>
<option value="title"><?php _e( 'Title' ); ?></option>
<option value="post_date"><?php _e( 'Date/Time' ); ?></option>
<option value="rand"><?php _e( 'Random' ); ?></option>
</select>
</td>
</tr>
<tr>
<th scope="row" class="label">
<label>
<span class="alignleft"><?php _e( 'Order:' ); ?></span>
</label>
</th>
<td class="field">
<input type="radio" checked="checked" name="order" id="order-asc" value="asc" />
<label for="order-asc" class="radio"><?php _e( 'Ascending' ); ?></label>
<input type="radio" name="order" id="order-desc" value="desc" />
<label for="order-desc" class="radio"><?php _e( 'Descending' ); ?></label>
</td>
</tr>
<tr>
<th scope="row" class="label">
<label>
<span class="alignleft"><?php _e( 'Gallery columns:' ); ?></span>
</label>
</th>
<td class="field">
<select id="columns" name="columns">
<option value="1">1</option>
<option value="2">2</option>
<option value="3" selected="selected">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
</td>
</tr>
</tbody></table>
<p class="ml-submit">
<input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="insert-gallery" id="insert-gallery" value="<?php esc_attr_e( 'Insert gallery' ); ?>" />
<input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="update-gallery" id="update-gallery" value="<?php esc_attr_e( 'Update gallery settings' ); ?>" />
</p>
</div>
</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. |
| [get\_media\_items()](get_media_items) wp-admin/includes/media.php | Retrieves HTML for media items of post gallery. |
| [\_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\_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\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [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. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
| programming_docs |
wordpress wp_prepare_revisions_for_js( WP_Post|int $post, int $selected_revision_id, int $from = null ): array wp\_prepare\_revisions\_for\_js( WP\_Post|int $post, int $selected\_revision\_id, int $from = null ): array
===========================================================================================================
Prepare revisions for JavaScript.
`$post` [WP\_Post](../classes/wp_post)|int Required The post object or post ID. `$selected_revision_id` int Required The selected revision ID. `$from` int Optional The revision ID to compare from. Default: `null`
array An associative array of revision data and related settings.
File: `wp-admin/includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/revision.php/)
```
function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null ) {
$post = get_post( $post );
$authors = array();
$now_gmt = time();
$revisions = wp_get_post_revisions(
$post->ID,
array(
'order' => 'ASC',
'check_enabled' => false,
)
);
// If revisions are disabled, we only want autosaves and the current post.
if ( ! wp_revisions_enabled( $post ) ) {
foreach ( $revisions as $revision_id => $revision ) {
if ( ! wp_is_post_autosave( $revision ) ) {
unset( $revisions[ $revision_id ] );
}
}
$revisions = array( $post->ID => $post ) + $revisions;
}
$show_avatars = get_option( 'show_avatars' );
cache_users( wp_list_pluck( $revisions, 'post_author' ) );
$can_restore = current_user_can( 'edit_post', $post->ID );
$current_id = false;
foreach ( $revisions as $revision ) {
$modified = strtotime( $revision->post_modified );
$modified_gmt = strtotime( $revision->post_modified_gmt . ' +0000' );
if ( $can_restore ) {
$restore_link = str_replace(
'&',
'&',
wp_nonce_url(
add_query_arg(
array(
'revision' => $revision->ID,
'action' => 'restore',
),
admin_url( 'revision.php' )
),
"restore-post_{$revision->ID}"
)
);
}
if ( ! isset( $authors[ $revision->post_author ] ) ) {
$authors[ $revision->post_author ] = array(
'id' => (int) $revision->post_author,
'avatar' => $show_avatars ? get_avatar( $revision->post_author, 32 ) : '',
'name' => get_the_author_meta( 'display_name', $revision->post_author ),
);
}
$autosave = (bool) wp_is_post_autosave( $revision );
$current = ! $autosave && $revision->post_modified_gmt === $post->post_modified_gmt;
if ( $current && ! empty( $current_id ) ) {
// If multiple revisions have the same post_modified_gmt, highest ID is current.
if ( $current_id < $revision->ID ) {
$revisions[ $current_id ]['current'] = false;
$current_id = $revision->ID;
} else {
$current = false;
}
} elseif ( $current ) {
$current_id = $revision->ID;
}
$revisions_data = array(
'id' => $revision->ID,
'title' => get_the_title( $post->ID ),
'author' => $authors[ $revision->post_author ],
'date' => date_i18n( __( 'M j, Y @ H:i' ), $modified ),
'dateShort' => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), $modified ),
/* translators: %s: Human-readable time difference. */
'timeAgo' => sprintf( __( '%s ago' ), human_time_diff( $modified_gmt, $now_gmt ) ),
'autosave' => $autosave,
'current' => $current,
'restoreUrl' => $can_restore ? $restore_link : false,
);
/**
* Filters the array of revisions used on the revisions screen.
*
* @since 4.4.0
*
* @param array $revisions_data {
* The bootstrapped data for the revisions screen.
*
* @type int $id Revision ID.
* @type string $title Title for the revision's parent WP_Post object.
* @type int $author Revision post author ID.
* @type string $date Date the revision was modified.
* @type string $dateShort Short-form version of the date the revision was modified.
* @type string $timeAgo GMT-aware amount of time ago the revision was modified.
* @type bool $autosave Whether the revision is an autosave.
* @type bool $current Whether the revision is both not an autosave and the post
* modified date matches the revision modified date (GMT-aware).
* @type bool|false $restoreUrl URL if the revision can be restored, false otherwise.
* }
* @param WP_Post $revision The revision's WP_Post object.
* @param WP_Post $post The revision's parent WP_Post object.
*/
$revisions[ $revision->ID ] = apply_filters( 'wp_prepare_revision_for_js', $revisions_data, $revision, $post );
}
/**
* If we only have one revision, the initial revision is missing; This happens
* when we have an autsosave and the user has clicked 'View the Autosave'
*/
if ( 1 === count( $revisions ) ) {
$revisions[ $post->ID ] = array(
'id' => $post->ID,
'title' => get_the_title( $post->ID ),
'author' => $authors[ $revision->post_author ],
'date' => date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_modified ) ),
'dateShort' => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), strtotime( $post->post_modified ) ),
/* translators: %s: Human-readable time difference. */
'timeAgo' => sprintf( __( '%s ago' ), human_time_diff( strtotime( $post->post_modified_gmt ), $now_gmt ) ),
'autosave' => false,
'current' => true,
'restoreUrl' => false,
);
$current_id = $post->ID;
}
/*
* If a post has been saved since the latest revision (no revisioned fields
* were changed), we may not have a "current" revision. Mark the latest
* revision as "current".
*/
if ( empty( $current_id ) ) {
if ( $revisions[ $revision->ID ]['autosave'] ) {
$revision = end( $revisions );
while ( $revision['autosave'] ) {
$revision = prev( $revisions );
}
$current_id = $revision['id'];
} else {
$current_id = $revision->ID;
}
$revisions[ $current_id ]['current'] = true;
}
// Now, grab the initial diff.
$compare_two_mode = is_numeric( $from );
if ( ! $compare_two_mode ) {
$found = array_search( $selected_revision_id, array_keys( $revisions ), true );
if ( $found ) {
$from = array_keys( array_slice( $revisions, $found - 1, 1, true ) );
$from = reset( $from );
} else {
$from = 0;
}
}
$from = absint( $from );
$diffs = array(
array(
'id' => $from . ':' . $selected_revision_id,
'fields' => wp_get_revision_ui_diff( $post->ID, $from, $selected_revision_id ),
),
);
return array(
'postId' => $post->ID,
'nonce' => wp_create_nonce( 'revisions-ajax-nonce' ),
'revisionData' => array_values( $revisions ),
'to' => $selected_revision_id,
'from' => $from,
'diffData' => $diffs,
'baseUrl' => parse_url( admin_url( 'revision.php' ), PHP_URL_PATH ),
'compareTwoMode' => absint( $compare_two_mode ), // Apparently booleans are not allowed.
'revisionIds' => array_keys( $revisions ),
);
}
```
[apply\_filters( 'wp\_prepare\_revision\_for\_js', array $revisions\_data, WP\_Post $revision, WP\_Post $post )](../hooks/wp_prepare_revision_for_js)
Filters the array of revisions used on the revisions screen.
| Uses | Description |
| --- | --- |
| [wp\_get\_revision\_ui\_diff()](wp_get_revision_ui_diff) wp-admin/includes/revision.php | Get the revision UI diff. |
| [wp\_list\_pluck()](wp_list_pluck) wp-includes/functions.php | Plucks a certain field out of each object or array in an array. |
| [wp\_is\_post\_autosave()](wp_is_post_autosave) wp-includes/revision.php | Determines if the specified post is an autosave. |
| [wp\_revisions\_enabled()](wp_revisions_enabled) wp-includes/revision.php | Determines whether revisions are enabled for a given post. |
| [wp\_get\_post\_revisions()](wp_get_post_revisions) wp-includes/revision.php | Returns all revisions of specified post. |
| [get\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. |
| [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\_the\_author\_meta()](get_the_author_meta) wp-includes/author-template.php | Retrieves the requested data of the author of the current post. |
| [cache\_users()](cache_users) wp-includes/pluggable.php | Retrieves info for user lists to prevent multiple queries by [get\_userdata()](get_userdata) . |
| [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. |
| [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. |
| [human\_time\_diff()](human_time_diff) wp-includes/formatting.php | Determines the difference between two timestamps. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [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\_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. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [\_\_()](__) 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. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress get_http_origin(): string get\_http\_origin(): string
===========================
Get the HTTP Origin of the current request.
string URL of the origin. Empty string if no origin.
File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/)
```
function get_http_origin() {
$origin = '';
if ( ! empty( $_SERVER['HTTP_ORIGIN'] ) ) {
$origin = $_SERVER['HTTP_ORIGIN'];
}
/**
* Change the origin of an HTTP request.
*
* @since 3.4.0
*
* @param string $origin The original origin for the request.
*/
return apply_filters( 'http_origin', $origin );
}
```
[apply\_filters( 'http\_origin', string $origin )](../hooks/http_origin)
Change the origin of an HTTP 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 |
| --- | --- |
| [rest\_send\_cors\_headers()](rest_send_cors_headers) wp-includes/rest-api.php | Sends Cross-Origin Resource Sharing headers with API requests. |
| [is\_allowed\_http\_origin()](is_allowed_http_origin) wp-includes/http.php | Determines if the HTTP origin is an authorized one. |
| [send\_origin\_headers()](send_origin_headers) wp-includes/http.php | Send Access-Control-Allow-Origin and related headers if the current request is from an allowed origin. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress disabled( mixed $disabled, mixed $current = true, bool $echo = true ): string disabled( mixed $disabled, mixed $current = true, bool $echo = true ): string
=============================================================================
Outputs the HTML disabled attribute.
Compares the first two arguments and if identical marks as disabled.
`$disabled` mixed Required One of the values to compare. `$current` mixed Optional The other value to compare if not just true.
Default: `true`
`$echo` bool Optional Whether to echo or just return the string.
Default: `true`
string HTML attribute or empty string.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function disabled( $disabled, $current = true, $echo = true ) {
return __checked_selected_helper( $disabled, $current, $echo, 'disabled' );
}
```
| Uses | Description |
| --- | --- |
| [\_\_checked\_selected\_helper()](__checked_selected_helper) wp-includes/general-template.php | Private helper function for checked, selected, disabled and readonly. |
| Used By | Description |
| --- | --- |
| [Walker\_Category\_Checklist::start\_el()](../classes/walker_category_checklist/start_el) wp-admin/includes/class-walker-category-checklist.php | Start the element output. |
| [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. |
| [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. |
| [post\_tags\_meta\_box()](post_tags_meta_box) wp-admin/includes/meta-boxes.php | Displays post tags form fields. |
| [wp\_nav\_menu\_disabled\_check()](wp_nav_menu_disabled_check) wp-admin/includes/nav-menu.php | Check whether to disable the Menu Locations meta box submit button and inputs. |
| [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. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_ajax_toggle_auto_updates() wp\_ajax\_toggle\_auto\_updates()
=================================
Ajax handler to enable or disable plugin and theme auto-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_toggle_auto_updates() {
check_ajax_referer( 'updates' );
if ( empty( $_POST['type'] ) || empty( $_POST['asset'] ) || empty( $_POST['state'] ) ) {
wp_send_json_error( array( 'error' => __( 'Invalid data. No selected item.' ) ) );
}
$asset = sanitize_text_field( urldecode( $_POST['asset'] ) );
if ( 'enable' !== $_POST['state'] && 'disable' !== $_POST['state'] ) {
wp_send_json_error( array( 'error' => __( 'Invalid data. Unknown state.' ) ) );
}
$state = $_POST['state'];
if ( 'plugin' !== $_POST['type'] && 'theme' !== $_POST['type'] ) {
wp_send_json_error( array( 'error' => __( 'Invalid data. Unknown type.' ) ) );
}
$type = $_POST['type'];
switch ( $type ) {
case 'plugin':
if ( ! current_user_can( 'update_plugins' ) ) {
$error_message = __( 'Sorry, you are not allowed to modify plugins.' );
wp_send_json_error( array( 'error' => $error_message ) );
}
$option = 'auto_update_plugins';
/** This filter is documented in wp-admin/includes/class-wp-plugins-list-table.php */
$all_items = apply_filters( 'all_plugins', get_plugins() );
break;
case 'theme':
if ( ! current_user_can( 'update_themes' ) ) {
$error_message = __( 'Sorry, you are not allowed to modify themes.' );
wp_send_json_error( array( 'error' => $error_message ) );
}
$option = 'auto_update_themes';
$all_items = wp_get_themes();
break;
default:
wp_send_json_error( array( 'error' => __( 'Invalid data. Unknown type.' ) ) );
}
if ( ! array_key_exists( $asset, $all_items ) ) {
$error_message = __( 'Invalid data. The item does not exist.' );
wp_send_json_error( array( 'error' => $error_message ) );
}
$auto_updates = (array) get_site_option( $option, array() );
if ( 'disable' === $state ) {
$auto_updates = array_diff( $auto_updates, array( $asset ) );
} else {
$auto_updates[] = $asset;
$auto_updates = array_unique( $auto_updates );
}
// Remove items that have been deleted since the site option was last updated.
$auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) );
update_site_option( $option, $auto_updates );
wp_send_json_success();
}
```
[apply\_filters( 'all\_plugins', array $all\_plugins )](../hooks/all_plugins)
Filters the full array of plugins to list in the Plugins list table.
| Uses | Description |
| --- | --- |
| [get\_plugins()](get_plugins) wp-admin/includes/plugin.php | Checks the plugins directory and retrieve all plugin files with plugin data. |
| [wp\_get\_themes()](wp_get_themes) wp-includes/theme.php | Returns an array of [WP\_Theme](../classes/wp_theme) objects based on the arguments. |
| [sanitize\_text\_field()](sanitize_text_field) wp-includes/formatting.php | Sanitizes a string from user input or from the database. |
| [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. |
| [\_\_()](__) 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\_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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress wp_check_filetype( string $filename, string[] $mimes = null ): array wp\_check\_filetype( string $filename, string[] $mimes = null ): array
======================================================================
Retrieves the file type from the file name.
You can optionally define the mime array, if needed.
`$filename` string Required File name or path. `$mimes` string[] Optional Array of allowed mime types keyed by their file extension regex. Default: `null`
array Values for the extension and mime type.
* `ext`string|falseFile extension, or false if the file doesn't match a mime type.
* `type`string|falseFile mime type, or false if the file doesn't match a mime type.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_check_filetype( $filename, $mimes = null ) {
if ( empty( $mimes ) ) {
$mimes = get_allowed_mime_types();
}
$type = false;
$ext = false;
foreach ( $mimes as $ext_preg => $mime_match ) {
$ext_preg = '!\.(' . $ext_preg . ')$!i';
if ( preg_match( $ext_preg, $filename, $ext_matches ) ) {
$type = $mime_match;
$ext = $ext_matches[1];
break;
}
}
return compact( 'ext', 'type' );
}
```
| Uses | Description |
| --- | --- |
| [get\_allowed\_mime\_types()](get_allowed_mime_types) wp-includes/functions.php | Retrieves the list of allowed mime types and file extensions. |
| Used By | Description |
| --- | --- |
| [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\_header\_video\_settings()](get_header_video_settings) wp-includes/theme.php | Retrieves header video settings. |
| [wp\_attachment\_is()](wp_attachment_is) wp-includes/post.php | Verifies an attachment is of a given type. |
| [sanitize\_file\_name()](sanitize_file_name) wp-includes/formatting.php | Sanitizes a filename, replacing whitespace with dashes. |
| [wp\_upload\_bits()](wp_upload_bits) wp-includes/functions.php | Creates a file in the upload folder with given content. |
| [wp\_check\_filetype\_and\_ext()](wp_check_filetype_and_ext) wp-includes/functions.php | Attempts to determine the real file type of a file. |
| [wp\_unique\_filename()](wp_unique_filename) wp-includes/functions.php | Gets a filename that is sanitized and unique for the given directory. |
| [wp\_get\_image\_editor()](wp_get_image_editor) wp-includes/media.php | Returns a [WP\_Image\_Editor](../classes/wp_image_editor) instance and loads file into it. |
| [wp\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. |
| [wp\_playlist\_shortcode()](wp_playlist_shortcode) wp-includes/media.php | Builds the Playlist shortcode output. |
| [wp\_audio\_shortcode()](wp_audio_shortcode) wp-includes/media.php | Builds the Audio shortcode output. |
| Version | Description |
| --- | --- |
| [2.0.4](https://developer.wordpress.org/reference/since/2.0.4/) | Introduced. |
| programming_docs |
wordpress get_available_languages( string $dir = null ): string[] get\_available\_languages( string $dir = null ): string[]
=========================================================
Gets all available languages based on the presence of \*.mo files in a given directory.
The default directory is WP\_LANG\_DIR.
`$dir` string Optional A directory to search for language files.
Default WP\_LANG\_DIR. Default: `null`
string[] An array of language codes or an empty array if no languages are present. Language codes are formed by stripping the .mo extension from the language file names.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function get_available_languages( $dir = null ) {
$languages = array();
$lang_files = glob( ( is_null( $dir ) ? WP_LANG_DIR : $dir ) . '/*.mo' );
if ( $lang_files ) {
foreach ( $lang_files as $lang_file ) {
$lang_file = basename( $lang_file, '.mo' );
if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) &&
0 !== strpos( $lang_file, 'admin-' ) ) {
$languages[] = $lang_file;
}
}
}
/**
* Filters the list of available language codes.
*
* @since 4.7.0
*
* @param string[] $languages An array of available language codes.
* @param string $dir The directory where the language files were found.
*/
return apply_filters( 'get_available_languages', $languages, $dir );
}
```
[apply\_filters( 'get\_available\_languages', string[] $languages, string $dir )](../hooks/get_available_languages)
Filters the list of available language codes.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_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\_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\_Locale\_Switcher::\_\_construct()](../classes/wp_locale_switcher/__construct) wp-includes/class-wp-locale-switcher.php | Constructor. |
| [signup\_get\_available\_languages()](signup_get_available_languages) wp-signup.php | Retrieves languages available during the site/user sign-up process. |
| [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. |
| [wp\_download\_language\_pack()](wp_download_language_pack) wp-admin/includes/translation-install.php | Download a language pack. |
| [login\_footer()](login_footer) wp-login.php | Outputs the footer for the login page. |
| [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [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. |
| [register\_new\_user()](register_new_user) wp-includes/user.php | Handles registering a new user. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | The results are now filterable with the ['get\_available\_languages'](../hooks/get_available_languages) filter. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress make_db_current( string $tables = 'all' ) make\_db\_current( string $tables = 'all' )
===========================================
Updates the database tables to a new schema.
By default, updates all the tables to use the latest defined schema, but can also be used to update a specific set of tables in [wp\_get\_db\_schema()](wp_get_db_schema) .
`$tables` string Optional Which set of tables to update. Default is `'all'`. Default: `'all'`
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function make_db_current( $tables = 'all' ) {
$alterations = dbDelta( $tables );
echo "<ol>\n";
foreach ( $alterations as $alteration ) {
echo "<li>$alteration</li>\n";
}
echo "</ol>\n";
}
```
| Uses | Description |
| --- | --- |
| [dbDelta()](dbdelta) wp-admin/includes/upgrade.php | Modifies the database based on specified SQL statements. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_check_for_changed_dates( int $post_id, WP_Post $post, WP_Post $post_before ) wp\_check\_for\_changed\_dates( int $post\_id, WP\_Post $post, WP\_Post $post\_before )
=======================================================================================
Checks for changed dates for published post objects and save the old date.
The function is used when a post object of any type is updated, by comparing the current and previous post objects.
If the date was changed and not already part of the old dates then it will be added to the post meta field (‘\_wp\_old\_date’) for storing old dates 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_dates( $post_id, $post, $post_before ) {
$previous_date = gmdate( 'Y-m-d', strtotime( $post_before->post_date ) );
$new_date = gmdate( 'Y-m-d', strtotime( $post->post_date ) );
// Don't bother if it hasn't changed.
if ( $new_date == $previous_date ) {
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_dates = (array) get_post_meta( $post_id, '_wp_old_date' );
// If we haven't added this old date before, add it now.
if ( ! empty( $previous_date ) && ! in_array( $previous_date, $old_dates, true ) ) {
add_post_meta( $post_id, '_wp_old_date', $previous_date );
}
// If the new slug was used previously, delete it from the list.
if ( in_array( $new_date, $old_dates, true ) ) {
delete_post_meta( $post_id, '_wp_old_date', $new_date );
}
}
```
| 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 |
| --- | --- |
| [4.9.3](https://developer.wordpress.org/reference/since/4.9.3/) | Introduced. |
wordpress wp_preload_dialogs() wp\_preload\_dialogs()
======================
This function has been deprecated. Use [wp\_editor()](wp_editor) instead.
Preloads TinyMCE dialogs.
* [wp\_editor()](wp_editor)
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function wp_preload_dialogs() {
_deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
}
```
| 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.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress wp_signon( array $credentials = array(), string|bool $secure_cookie = '' ): WP_User|WP_Error wp\_signon( array $credentials = array(), string|bool $secure\_cookie = '' ): WP\_User|WP\_Error
================================================================================================
Authenticates and logs a user in with ‘remember’ capability.
The credentials is an array that has ‘user\_login’, ‘user\_password’, and ‘remember’ indices. If the credentials is not given, then the log in form will be assumed and used if set.
The various authentication cookies will be set by this function and will be set for a longer period depending on if the ‘remember’ credential is set to true.
Note: [wp\_signon()](wp_signon) doesn’t handle setting the current user. This means that if the function is called before the [‘init’](../hooks/init) hook is fired, [is\_user\_logged\_in()](is_user_logged_in) will evaluate as false until that point. If [is\_user\_logged\_in()](is_user_logged_in) is needed in conjunction with [wp\_signon()](wp_signon) , [wp\_set\_current\_user()](wp_set_current_user) should be called explicitly.
`$credentials` array Optional User info in order to sign on. Default: `array()`
`$secure_cookie` string|bool Optional Whether to use secure cookie. Default: `''`
[WP\_User](../classes/wp_user)|[WP\_Error](../classes/wp_error) [WP\_User](../classes/wp_user) on success, [WP\_Error](../classes/wp_error) on failure.
If you don’t provide $credentials, wp\_signon uses the $\_POST variable (the keys being “log”, “pwd” and “rememberme”).
This function sends headers to the page. It must be run before any content is returned.
This function sets an authentication cookie. Users will not be logged in if it is not sent.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_signon( $credentials = array(), $secure_cookie = '' ) {
if ( empty( $credentials ) ) {
$credentials = array(); // Back-compat for plugins passing an empty string.
if ( ! empty( $_POST['log'] ) ) {
$credentials['user_login'] = wp_unslash( $_POST['log'] );
}
if ( ! empty( $_POST['pwd'] ) ) {
$credentials['user_password'] = $_POST['pwd'];
}
if ( ! empty( $_POST['rememberme'] ) ) {
$credentials['remember'] = $_POST['rememberme'];
}
}
if ( ! empty( $credentials['remember'] ) ) {
$credentials['remember'] = true;
} else {
$credentials['remember'] = false;
}
/**
* Fires before the user is authenticated.
*
* The variables passed to the callbacks are passed by reference,
* and can be modified by callback functions.
*
* @since 1.5.1
*
* @todo Decide whether to deprecate the wp_authenticate action.
*
* @param string $user_login Username (passed by reference).
* @param string $user_password User password (passed by reference).
*/
do_action_ref_array( 'wp_authenticate', array( &$credentials['user_login'], &$credentials['user_password'] ) );
if ( '' === $secure_cookie ) {
$secure_cookie = is_ssl();
}
/**
* Filters whether to use a secure sign-on cookie.
*
* @since 3.1.0
*
* @param bool $secure_cookie Whether to use a secure sign-on cookie.
* @param array $credentials {
* Array of entered sign-on data.
*
* @type string $user_login Username.
* @type string $user_password Password entered.
* @type bool $remember Whether to 'remember' the user. Increases the time
* that the cookie will be kept. Default false.
* }
*/
$secure_cookie = apply_filters( 'secure_signon_cookie', $secure_cookie, $credentials );
global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie().
$auth_secure_cookie = $secure_cookie;
add_filter( 'authenticate', 'wp_authenticate_cookie', 30, 3 );
$user = wp_authenticate( $credentials['user_login'], $credentials['user_password'] );
if ( is_wp_error( $user ) ) {
return $user;
}
wp_set_auth_cookie( $user->ID, $credentials['remember'], $secure_cookie );
/**
* Fires after the user has successfully logged in.
*
* @since 1.5.0
*
* @param string $user_login Username.
* @param WP_User $user WP_User object of the logged-in user.
*/
do_action( 'wp_login', $user->user_login, $user );
return $user;
}
```
[apply\_filters( 'secure\_signon\_cookie', bool $secure\_cookie, array $credentials )](../hooks/secure_signon_cookie)
Filters whether to use a secure sign-on cookie.
[do\_action\_ref\_array( 'wp\_authenticate', string $user\_login, string $user\_password )](../hooks/wp_authenticate)
Fires before the user is authenticated.
[do\_action( 'wp\_login', string $user\_login, WP\_User $user )](../hooks/wp_login)
Fires after the user has successfully logged in.
| Uses | Description |
| --- | --- |
| [wp\_set\_auth\_cookie()](wp_set_auth_cookie) wp-includes/pluggable.php | Sets the authentication cookies based on user ID. |
| [wp\_authenticate()](wp_authenticate) wp-includes/pluggable.php | Authenticates a user, confirming the login credentials are valid. |
| [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. |
| [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. |
| [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. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [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 comments_number( string|false $zero = false, string|false $one = false, string|false $more = false, int|WP_Post $post ) comments\_number( string|false $zero = false, string|false $one = false, string|false $more = false, int|WP\_Post $post )
=========================================================================================================================
Displays the language string for the number of comments the current post has.
`$zero` string|false Optional Text for no comments. Default: `false`
`$one` string|false Optional Text for one comment. Default: `false`
`$more` string|false 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`. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function comments_number( $zero = false, $one = false, $more = false, $post = 0 ) {
echo get_comments_number_text( $zero, $one, $more, $post );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| Used By | Description |
| --- | --- |
| [comments\_popup\_link()](comments_popup_link) wp-includes/comment-template.php | Displays the link to the comments for the current post ID. |
| Version | Description |
| --- | --- |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | The `$deprecated` parameter was changed to `$post`. |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress _default_wp_die_handler( string|WP_Error $message, string $title = '', string|array $args = array() ) \_default\_wp\_die\_handler( string|WP\_Error $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 HTML page with an error message.
This is the default handler for [wp\_die()](wp_die) . If you want a custom one, you can override this using the [‘wp\_die\_handler’](../hooks/wp_die_handler) filter in [wp\_die()](wp_die) .
`$message` string|[WP\_Error](../classes/wp_error) Required Error message or [WP\_Error](../classes/wp_error) object. `$title` string Optional Error title. Default: `''`
`$args` string|array Optional Arguments to control behavior. Default: `array()`
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _default_wp_die_handler( $message, $title = '', $args = array() ) {
list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args );
if ( is_string( $message ) ) {
if ( ! empty( $parsed_args['additional_errors'] ) ) {
$message = array_merge(
array( $message ),
wp_list_pluck( $parsed_args['additional_errors'], 'message' )
);
$message = "<ul>\n\t\t<li>" . implode( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>";
}
$message = sprintf(
'<div class="wp-die-message">%s</div>',
$message
);
}
$have_gettext = function_exists( '__' );
if ( ! empty( $parsed_args['link_url'] ) && ! empty( $parsed_args['link_text'] ) ) {
$link_url = $parsed_args['link_url'];
if ( function_exists( 'esc_url' ) ) {
$link_url = esc_url( $link_url );
}
$link_text = $parsed_args['link_text'];
$message .= "\n<p><a href='{$link_url}'>{$link_text}</a></p>";
}
if ( isset( $parsed_args['back_link'] ) && $parsed_args['back_link'] ) {
$back_text = $have_gettext ? __( '« Back' ) : '« Back';
$message .= "\n<p><a href='javascript:history.back()'>$back_text</a></p>";
}
if ( ! did_action( 'admin_head' ) ) :
if ( ! headers_sent() ) {
header( "Content-Type: text/html; charset={$parsed_args['charset']}" );
status_header( $parsed_args['response'] );
nocache_headers();
}
$text_direction = $parsed_args['text_direction'];
$dir_attr = "dir='$text_direction'";
// If `text_direction` was not explicitly passed,
// use get_language_attributes() if available.
if ( empty( $args['text_direction'] )
&& function_exists( 'language_attributes' ) && function_exists( 'is_rtl' )
) {
$dir_attr = get_language_attributes();
}
?>
<!DOCTYPE html>
<html <?php echo $dir_attr; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $parsed_args['charset']; ?>" />
<meta name="viewport" content="width=device-width">
<?php
if ( function_exists( 'wp_robots' ) && function_exists( 'wp_robots_no_robots' ) && function_exists( 'add_filter' ) ) {
add_filter( 'wp_robots', 'wp_robots_no_robots' );
wp_robots();
}
?>
<title><?php echo $title; ?></title>
<style type="text/css">
html {
background: #f1f1f1;
}
body {
background: #fff;
border: 1px solid #ccd0d4;
color: #444;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
margin: 2em auto;
padding: 1em 2em;
max-width: 700px;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
}
h1 {
border-bottom: 1px solid #dadada;
clear: both;
color: #666;
font-size: 24px;
margin: 30px 0 0 0;
padding: 0;
padding-bottom: 7px;
}
#error-page {
margin-top: 50px;
}
#error-page p,
#error-page .wp-die-message {
font-size: 14px;
line-height: 1.5;
margin: 25px 0 20px;
}
#error-page code {
font-family: Consolas, Monaco, monospace;
}
ul li {
margin-bottom: 10px;
font-size: 14px ;
}
a {
color: #0073aa;
}
a:hover,
a:active {
color: #006799;
}
a:focus {
color: #124964;
-webkit-box-shadow:
0 0 0 1px #5b9dd9,
0 0 2px 1px rgba(30, 140, 190, 0.8);
box-shadow:
0 0 0 1px #5b9dd9,
0 0 2px 1px rgba(30, 140, 190, 0.8);
outline: none;
}
.button {
background: #f3f5f6;
border: 1px solid #016087;
color: #016087;
display: inline-block;
text-decoration: none;
font-size: 13px;
line-height: 2;
height: 28px;
margin: 0;
padding: 0 10px 1px;
cursor: pointer;
-webkit-border-radius: 3px;
-webkit-appearance: none;
border-radius: 3px;
white-space: nowrap;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
vertical-align: top;
}
.button.button-large {
line-height: 2.30769231;
min-height: 32px;
padding: 0 12px;
}
.button:hover,
.button:focus {
background: #f1f1f1;
}
.button:focus {
background: #f3f5f6;
border-color: #007cba;
-webkit-box-shadow: 0 0 0 1px #007cba;
box-shadow: 0 0 0 1px #007cba;
color: #016087;
outline: 2px solid transparent;
outline-offset: 0;
}
.button:active {
background: #f3f5f6;
border-color: #7e8993;
-webkit-box-shadow: none;
box-shadow: none;
}
<?php
if ( 'rtl' === $text_direction ) {
echo 'body { font-family: Tahoma, Arial; }';
}
?>
</style>
</head>
<body id="error-page">
<?php endif; // ! did_action( 'admin_head' ) ?>
<?php echo $message; ?>
</body>
</html>
<?php
if ( $parsed_args['exit'] ) {
die();
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_robots()](wp_robots) wp-includes/robots-template.php | Displays the robots meta tag as necessary. |
| [\_wp\_die\_process\_input()](_wp_die_process_input) wp-includes/functions.php | Processes arguments passed to [wp\_die()](wp_die) consistently for its handlers. |
| [get\_language\_attributes()](get_language_attributes) wp-includes/general-template.php | Gets the language attributes for the ‘html’ tag. |
| [wp\_list\_pluck()](wp_list_pluck) wp-includes/functions.php | Plucks a certain field out of each object or array in an array. |
| [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. |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress _wp_menus_changed() \_wp\_menus\_changed()
======================
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.
Handles menu config after theme change.
File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function _wp_menus_changed() {
$old_nav_menu_locations = get_option( 'theme_switch_menu_locations', array() );
$new_nav_menu_locations = get_nav_menu_locations();
$mapped_nav_menu_locations = wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locations );
set_theme_mod( 'nav_menu_locations', $mapped_nav_menu_locations );
delete_option( 'theme_switch_menu_locations' );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [set\_theme\_mod()](set_theme_mod) wp-includes/theme.php | Updates theme modification value for the active theme. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [get\_nav\_menu\_locations()](get_nav_menu_locations) wp-includes/nav-menu.php | Retrieves all registered navigation menu locations and the menus assigned to them. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
wordpress _wp_preview_post_thumbnail_filter( null|array|string $value, int $post_id, string $meta_key ): null|array \_wp\_preview\_post\_thumbnail\_filter( null|array|string $value, int $post\_id, string $meta\_key ): 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.
Filters post thumbnail lookup to set the post thumbnail.
`$value` null|array|string Required The value to return - a single metadata value, or an array of values. `$post_id` int Required Post ID. `$meta_key` string Required Meta key. null|array The default return value or the post thumbnail meta array.
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) {
$post = get_post();
if ( ! $post ) {
return $value;
}
if ( empty( $_REQUEST['_thumbnail_id'] ) ||
empty( $_REQUEST['preview_id'] ) ||
$post->ID != $post_id ||
'_thumbnail_id' !== $meta_key ||
'revision' === $post->post_type ||
$post_id != $_REQUEST['preview_id'] ) {
return $value;
}
$thumbnail_id = (int) $_REQUEST['_thumbnail_id'];
if ( $thumbnail_id <= 0 ) {
return '';
}
return (string) $thumbnail_id;
}
```
| Uses | Description |
| --- | --- |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress get_cat_name( int $cat_id ): string get\_cat\_name( int $cat\_id ): string
======================================
Retrieves the name of a category from its ID.
`$cat_id` int Required Category ID. string Category name, or an empty string if the category doesn't exist.
File: `wp-includes/category.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category.php/)
```
function get_cat_name( $cat_id ) {
$cat_id = (int) $cat_id;
$category = get_term( $cat_id, 'category' );
if ( ! $category || is_wp_error( $category ) ) {
return '';
}
return $category->name;
}
```
| Uses | Description |
| --- | --- |
| [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\_catname()](get_catname) wp-includes/deprecated.php | Retrieve the category name by the category ID. |
| [wp\_xmlrpc\_server::mt\_getPostCategories()](../classes/wp_xmlrpc_server/mt_getpostcategories) wp-includes/class-wp-xmlrpc-server.php | Retrieve post categories. |
| [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 get_category( int|object $category, string $output = OBJECT, string $filter = 'raw' ): object|array|WP_Error|null get\_category( int|object $category, string $output = OBJECT, string $filter = 'raw' ): object|array|WP\_Error|null
===================================================================================================================
Retrieves category data given a category ID or category object.
If you pass the $category parameter an object, which is assumed to be the category row object retrieved the database. It will cache the category data.
If you pass $category an integer of the category ID, then that category will be retrieved from the database, if it isn’t already cached, and pass it back.
If you look at [get\_term()](get_term) , then both types will be passed through several filters and finally sanitized based on the $filter parameter value.
`$category` int|object Required Category ID or category row object. `$output` string Optional The required return type. One of OBJECT, ARRAY\_A, or ARRAY\_N, which correspond to a [WP\_Term](../classes/wp_term) object, an associative array, or a numeric array, respectively. Default: `OBJECT`
`$filter` string Optional How to sanitize category fields. Default `'raw'`. Default: `'raw'`
object|array|[WP\_Error](../classes/wp_error)|null Category data in type defined by $output parameter.
[WP\_Error](../classes/wp_error) if $category is empty, null if it does not exist.
File: `wp-includes/category.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category.php/)
```
function get_category( $category, $output = OBJECT, $filter = 'raw' ) {
$category = get_term( $category, 'category', $output, $filter );
if ( is_wp_error( $category ) ) {
return $category;
}
_make_cat_compat( $category );
return $category;
}
```
| Uses | Description |
| --- | --- |
| [\_make\_cat\_compat()](_make_cat_compat) wp-includes/category.php | Updates category structure to old pre-2.3 from new taxonomy structure. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [get\_category\_children()](get_category_children) wp-includes/deprecated.php | Retrieve category children list separated before and after the term IDs. |
| [get\_linkcatname()](get_linkcatname) wp-includes/deprecated.php | Gets the name of category by ID. |
| Version | Description |
| --- | --- |
| [1.5.1](https://developer.wordpress.org/reference/since/1.5.1/) | Introduced. |
wordpress get_the_author_nickname(): string get\_the\_author\_nickname(): string
====================================
This function has been deprecated. Use [get\_the\_author\_meta()](get_the_author_meta) instead.
Retrieve the nickname of the author of the current post.
* [get\_the\_author\_meta()](get_the_author_meta)
string The author's nickname.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_the_author_nickname() {
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'nickname\')' );
return get_the_author_meta('nickname');
}
```
| 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 the_widget( string $widget, array $instance = array(), array $args = array() ) the\_widget( string $widget, array $instance = array(), array $args = array() )
===============================================================================
Output an arbitrary widget as a template tag.
`$widget` string Required The widget's PHP class name (see class-wp-widget.php). `$instance` array Optional The widget's instance settings. Default: `array()`
`$args` array Optional Array of arguments to configure the display of the widget.
* `before_widget`stringHTML content that will be prepended to the widget's HTML output.
Default `<div class="widget %s">`, where `%s` is the widget's class name.
* `after_widget`stringHTML content that will be appended to the widget's HTML output.
Default `</div>`.
* `before_title`stringHTML content that will be prepended to the widget's title when displayed.
Default `<h2 class="widgettitle">`.
* `after_title`stringHTML content that will be appended to the widget's title when displayed.
Default `</h2>`.
Default: `array()`
For parameter `$widget`, The classes for the widgets included with WordPress are:
* [WP\_Widget\_Archives](../classes/wp_widget_archives) — Archives
* [WP\_Widget\_Calendar](../classes/wp_widget_calendar) — Calendar
* [WP\_Widget\_Categories](../classes/wp_widget_categories) — Categories
* [WP\_Widget\_Links](../classes/wp_widget_links) — Links
* [WP\_Widget\_Meta](../classes/wp_widget_meta) — Meta
* [WP\_Widget\_Pages](../classes/wp_widget_pages) — Pages
* [WP\_Widget\_Recent\_Comments](../classes/wp_widget_recent_comments) — Recent Comments
* [WP\_Widget\_Recent\_Posts](../classes/wp_widget_recent_posts) — Recent Posts
* [WP\_Widget\_RSS](../classes/wp_widget_rss) — RSS
* [WP\_Widget\_Search](../classes/wp_widget_search) — Search (a search from)
* [WP\_Widget\_Tag\_Cloud](../classes/wp_widget_tag_cloud) — Tag Cloud
* [WP\_Widget\_Text](../classes/wp_widget_text) — Text
* [WP\_Nav\_Menu\_Widget](../classes/wp_nav_menu_widget)
Display a monthly archive list.
`<?php the_widget( 'WP_Widget_Archives', $instance, $args ); ?>`
* widget’s classname: `widget_archive`
* instance: title The title of archive list. Default: `__('Archives')`
count Display number of posts in each archive (1). The *show\_post\_count* parameter of [wp\_get\_archives](https://codex.wordpress.org/Template_Tags/wp_get_archives "Template Tags/wp get archives"). Default: 0 (hide) dropdown Display as drop-down list (1). Default: 0 (an unordered list)
Default usage: `<?php the_widget( 'WP_Widget_Archives' ); ?>`
Display drop-down list: `<?php the_widget( 'WP_Widget_Archives', 'dropdown=1' ); ?>`
Displays a Calendar.
`<?php the_widget( 'WP_Widget_Calendar', $instance, $args ); ?>`
* widget’s classname: `widget_calendar`
* instance: title The title of calendar. Default:
Default usage: `<?php the_widget( 'WP_Widget_Calendar' ); ?>`
Displays a list of categories.
`<?php the_widget( 'WP_Widget_Categories', $instance, $args ); ?>`
* widget’s classname: `widget_categories`
* instance: title The title of categories list. Default: `__( 'Categories' )`
count Display number of posts in each category. The *show\_count* parameter of [wp\_dropdown\_categories](https://codex.wordpress.org/Template_Tags/wp_dropdown_categories "Template Tags/wp dropdown categories") or [wp\_list\_categories](https://codex.wordpress.org/Template_Tags/wp_list_categories "Template Tags/wp list categories"). Default: 0 (hide) hierarchical Display sub-categories as nested items inside the parent category (1). Default: 0 (in-line) dropdown Display as dropdown list (1). Default: 0 (an unordered list)
Default usage: `<?php the_widget('WP_Widget_Categories'); ?>`
Display a dropdown list with number of posts. `<?php the_widget( 'WP_Widget_Categories', 'dropdown=1&count=1' ); ?>`
Displays arbitrary HTML. `<?php the_widget( 'WP_Widget_Custom_HTML', $instance, $args ); ?>`
* widget’s classname: `widget_custom_html`
* instance: title The title for the content. Default:
content arbitrary HTML. Default:
Default usage: `<?php the_widget('WP_Widget_Custom_HTML', array('title' => 'Example', 'content' => '<p>Basic example.</p>')); ?>`
Displays a list of links (blogroll) in categories.
`<?php the_widget( 'WP_Widget_Links', $instance, $args ); ?>`
* widget’s classname:
* instance: title The title of the Links section. category Link category IDs , separated by commas, to display. The *category* parameter of [wp\_list\_bookmarks](https://codex.wordpress.org/Template_Tags/wp_list_bookmarks "Template Tags/wp list bookmarks"). Default: false (display all of link categories) description Display description of link (1 – true). The *show\_description* parameter. Default: false (hide) rating Display rating of link (1- true). The *show\_rating* parameter. Default: false (hide) images Display image of link (1 – true). The *show\_images* parameter. Default: true (show) name If display link image, output link name to the `alt` attribute. The *show\_name* parameter. Default: false
Default usage: `<?php the_widget( 'WP_Widget_Links' ); ?>`
Display lists in category IDs 2 or 3: `<?php the_widget( 'WP_Widget_Links', 'category=2,3' ); ?>`
Display site meta. (Log in/out, admin, feed and WordPress links )
`<?php the_widget( 'WP_Widget_Meta', $instance, $args ); ?>`
* widget’s classname: `widget_meta`
* instance: title The title of meta section. Default: `__( 'Meta' )`
Default usage: `<?php the_widget( 'WP_Widget_Meta' ); ?>`
Display a list of [Pages](https://codex.wordpress.org/Pages "Pages").
`<?php the_widget( 'WP_Widget_Pages', $instance, $args ); ?>`
* widget’s classname: `widget_pages`
* instance: title The title of Pages list. Default: `__( 'Pages' )`
sortby The *sort\_column* parameter of [wp\_list\_pages](https://codex.wordpress.org/Template_Tags/wp_list_pages "Template Tags/wp list pages"). Default: `menu_order`
exclude Page IDs, separated by commas, to be excluded from the list. Default: null (show all of Pages)
Default usage:
```
the_widget( 'WP_Widget_Pages' );
```
as the heading, sort by last modified date:
```
the_widget('WP_Widget_Pages', 'title=Contents&sortby=post_modified', 'before_title=<h3>&after_title=</h3>');
```
Display to a list of recent comments.
`<?php the_widget( 'WP_Widget_Recent_Comments', $instance, $args ); ?>`
* widget’s classname: `widget_recent_comments`
* instance: title The title of comment list. Default: `__( 'Recent Comments' )`
number Number of comments to show (at most 15). Default: 5
Default usage: `<?php the_widget( 'WP_Widget_Recent_Comments' ); ?>`
Display to a list of recent posts.
`<?php the_widget( 'WP_Widget_Recent_Posts', $instance, $args ); ?>`
* widget’s classname: `widget_recent_entries`
* instance: title The title of post list. Default: `__('Recent Posts')`
number Number of posts to show (at most 15). Default: 10
Default usage: `<?php the_widget( 'WP_Widget_Recent_Posts' ); ?>`
Display a list of entries from any RSS or Atom feed.
`<?php the_widget( 'WP_Widget_RSS', $instance, $args ); ?>`
* widget’s classname:
* instance : title The title of list Default: the title inherited from the RSS or Atom feed url RSS or Atom feed URL to include. items the number of RSS or Atom items to display show\_summary show\_author show\_date
Default usage: `<?php the_widget( 'WP_Widget_RSS' ); ?>`
`<?php the_widget( 'WP_Widget_Search', $instance, $args ); ?>`
* widget’s classname: `widget_search`
* instance: title The title of search form. Default: null
Default usage: `<?php the_widget( 'WP_Widget_Search' ); ?>`
`<?php the_widget( 'WP_Widget_Tag_Cloud', $instance, $args ); ?>`
* widget’s classname:
* instance: title The title of tag cloud. default: `__( 'Tags' )`
taxonomy The taxonomy the cloud will draw tags from. default: `post_tag`
Default usage: `<?php the_widget( 'WP_Widget_Tag_Cloud' ); ?>`
`<?php the_widget( 'WP_Widget_Text', $instance, $args ); ?>`
* widget’s classname: `widget_text`
* instance:
+ title
+ text
+ filter
Default usage: `<?php the_widget( 'WP_Widget_Text' ); ?>`
Display custom widget in template.
`<?php the_widget( 'My_Custom_Widget', $instance, $args ); ?>`
* widget’s classname: WIDGET CLASS NAME (for example see below)
* instance: (optional)
* arguments: (optional)
Default usage:
`class **My\_Custom\_Widget** extends WP_Widget
{
/* your code* /
}`
`<?php the_widget( 'My_Custom_Widget' ); ?>`
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function the_widget( $widget, $instance = array(), $args = array() ) {
global $wp_widget_factory;
if ( ! isset( $wp_widget_factory->widgets[ $widget ] ) ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: %s: register_widget() */
__( 'Widgets need to be registered using %s, before they can be displayed.' ),
'<code>register_widget()</code>'
),
'4.9.0'
);
return;
}
$widget_obj = $wp_widget_factory->widgets[ $widget ];
if ( ! ( $widget_obj instanceof WP_Widget ) ) {
return;
}
$default_args = array(
'before_widget' => '<div class="widget %s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
);
$args = wp_parse_args( $args, $default_args );
$args['before_widget'] = sprintf( $args['before_widget'], $widget_obj->widget_options['classname'] );
$instance = wp_parse_args( $instance );
/** This filter is documented in wp-includes/class-wp-widget.php */
$instance = apply_filters( 'widget_display_callback', $instance, $widget_obj, $args );
if ( false === $instance ) {
return;
}
/**
* Fires before rendering the requested widget.
*
* @since 3.0.0
*
* @param string $widget The widget's class name.
* @param array $instance The current widget instance's settings.
* @param array $args An array of the widget's sidebar arguments.
*/
do_action( 'the_widget', $widget, $instance, $args );
$widget_obj->_set( -1 );
$widget_obj->widget( $args, $instance );
}
```
[do\_action( 'the\_widget', string $widget, array $instance, array $args )](../hooks/the_widget)
Fires before rendering the requested widget.
[apply\_filters( 'widget\_display\_callback', array $instance, WP\_Widget $widget, array $args )](../hooks/widget_display_callback)
Filters the settings for a particular widget instance.
| 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. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Widget\_Types\_Controller::get\_widget\_preview()](../classes/wp_rest_widget_types_controller/get_widget_preview) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Returns the output of [WP\_Widget::widget()](../classes/wp_widget/widget) when called with the provided instance. Used by encode\_form\_data() to preview a widget. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
| programming_docs |
wordpress retrieve_password( string $user_login = null ): true|WP_Error retrieve\_password( string $user\_login = null ): true|WP\_Error
================================================================
Handles sending a password retrieval email to a user.
`$user_login` string Optional Username to send a password retrieval email for.
Defaults to `$_POST['user_login']` if not set. Default: `null`
true|[WP\_Error](../classes/wp_error) True when finished, [WP\_Error](../classes/wp_error) object on error.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function retrieve_password( $user_login = null ) {
$errors = new WP_Error();
$user_data = false;
// Use the passed $user_login if available, otherwise use $_POST['user_login'].
if ( ! $user_login && ! empty( $_POST['user_login'] ) ) {
$user_login = $_POST['user_login'];
}
$user_login = trim( wp_unslash( $user_login ) );
if ( empty( $user_login ) ) {
$errors->add( 'empty_username', __( '<strong>Error:</strong> Please enter a username or email address.' ) );
} elseif ( strpos( $user_login, '@' ) ) {
$user_data = get_user_by( 'email', $user_login );
if ( empty( $user_data ) ) {
$user_data = get_user_by( 'login', $user_login );
}
if ( empty( $user_data ) ) {
$errors->add( 'invalid_email', __( '<strong>Error:</strong> There is no account with that username or email address.' ) );
}
} else {
$user_data = get_user_by( 'login', $user_login );
}
/**
* Filters the user data during a password reset request.
*
* Allows, for example, custom validation using data other than username or email address.
*
* @since 5.7.0
*
* @param WP_User|false $user_data WP_User object if found, false if the user does not exist.
* @param WP_Error $errors A WP_Error object containing any errors generated
* by using invalid credentials.
*/
$user_data = apply_filters( 'lostpassword_user_data', $user_data, $errors );
/**
* Fires before errors are returned from a password reset request.
*
* @since 2.1.0
* @since 4.4.0 Added the `$errors` parameter.
* @since 5.4.0 Added the `$user_data` parameter.
*
* @param WP_Error $errors A WP_Error object containing any errors generated
* by using invalid credentials.
* @param WP_User|false $user_data WP_User object if found, false if the user does not exist.
*/
do_action( 'lostpassword_post', $errors, $user_data );
/**
* Filters the errors encountered on a password reset request.
*
* The filtered WP_Error object may, for example, contain errors for an invalid
* username or email address. A WP_Error object should always be returned,
* but may or may not contain errors.
*
* If any errors are present in $errors, this will abort the password reset request.
*
* @since 5.5.0
*
* @param WP_Error $errors A WP_Error object containing any errors generated
* by using invalid credentials.
* @param WP_User|false $user_data WP_User object if found, false if the user does not exist.
*/
$errors = apply_filters( 'lostpassword_errors', $errors, $user_data );
if ( $errors->has_errors() ) {
return $errors;
}
if ( ! $user_data ) {
$errors->add( 'invalidcombo', __( '<strong>Error:</strong> There is no account with that username or email address.' ) );
return $errors;
}
/**
* Filters whether to send the retrieve password email.
*
* Return false to disable sending the email.
*
* @since 6.0.0
*
* @param bool $send Whether to send the email.
* @param string $user_login The username for the user.
* @param WP_User $user_data WP_User object.
*/
if ( ! apply_filters( 'send_retrieve_password_email', true, $user_login, $user_data ) ) {
return true;
}
// Redefining user_login ensures we return the right case in the email.
$user_login = $user_data->user_login;
$user_email = $user_data->user_email;
$key = get_password_reset_key( $user_data );
if ( is_wp_error( $key ) ) {
return $key;
}
// Localize password reset message content for user.
$locale = get_user_locale( $user_data );
$switched_locale = switch_to_locale( $locale );
if ( is_multisite() ) {
$site_name = get_network()->site_name;
} else {
/*
* The blogname option is escaped with esc_html on the way into the database
* in sanitize_option. We want to reverse this for the plain text arena of emails.
*/
$site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
}
$message = __( 'Someone has requested a password reset for the following account:' ) . "\r\n\r\n";
/* translators: %s: Site name. */
$message .= sprintf( __( 'Site Name: %s' ), $site_name ) . "\r\n\r\n";
/* translators: %s: User login. */
$message .= sprintf( __( 'Username: %s' ), $user_login ) . "\r\n\r\n";
$message .= __( 'If this was a mistake, ignore this email and nothing will happen.' ) . "\r\n\r\n";
$message .= __( 'To reset your password, visit the following address:' ) . "\r\n\r\n";
$message .= network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ), 'login' ) . '&wp_lang=' . $locale . "\r\n\r\n";
if ( ! is_user_logged_in() ) {
$requester_ip = $_SERVER['REMOTE_ADDR'];
if ( $requester_ip ) {
$message .= sprintf(
/* translators: %s: IP address of password reset requester. */
__( 'This password reset request originated from the IP address %s.' ),
$requester_ip
) . "\r\n";
}
}
/* translators: Password reset notification email subject. %s: Site title. */
$title = sprintf( __( '[%s] Password Reset' ), $site_name );
/**
* Filters the subject of the password reset email.
*
* @since 2.8.0
* @since 4.4.0 Added the `$user_login` and `$user_data` parameters.
*
* @param string $title Email subject.
* @param string $user_login The username for the user.
* @param WP_User $user_data WP_User object.
*/
$title = apply_filters( 'retrieve_password_title', $title, $user_login, $user_data );
/**
* Filters the message body of the password reset mail.
*
* If the filtered message is empty, the password reset email will not be sent.
*
* @since 2.8.0
* @since 4.1.0 Added `$user_login` and `$user_data` parameters.
*
* @param string $message Email message.
* @param string $key The activation key.
* @param string $user_login The username for the user.
* @param WP_User $user_data WP_User object.
*/
$message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data );
// Short-circuit on falsey $message value for backwards compatibility.
if ( ! $message ) {
return true;
}
/*
* Wrap the single notification email arguments in an array
* to pass them to the retrieve_password_notification_email filter.
*/
$defaults = array(
'to' => $user_email,
'subject' => $title,
'message' => $message,
'headers' => '',
);
/**
* Filters the contents of the reset password notification email sent to the user.
*
* @since 6.0.0
*
* @param array $defaults {
* The default notification email arguments. Used to build wp_mail().
*
* @type string $to The intended recipient - user email address.
* @type string $subject The subject of the email.
* @type string $message The body of the email.
* @type string $headers The headers of the email.
* }
* @type string $key The activation key.
* @type string $user_login The username for the user.
* @type WP_User $user_data WP_User object.
*/
$notification_email = apply_filters( 'retrieve_password_notification_email', $defaults, $key, $user_login, $user_data );
if ( $switched_locale ) {
restore_previous_locale();
}
if ( is_array( $notification_email ) ) {
// Force key order and merge defaults in case any value is missing in the filtered array.
$notification_email = array_merge( $defaults, $notification_email );
} else {
$notification_email = $defaults;
}
list( $to, $subject, $message, $headers ) = array_values( $notification_email );
$subject = wp_specialchars_decode( $subject );
if ( ! wp_mail( $to, $subject, $message, $headers ) ) {
$errors->add(
'retrieve_password_email_failure',
sprintf(
/* translators: %s: Documentation URL. */
__( '<strong>Error:</strong> The email could not be sent. Your site may not be correctly configured to send emails. <a href="%s">Get support for resetting your password</a>.' ),
esc_url( __( 'https://wordpress.org/support/article/resetting-your-password/' ) )
)
);
return $errors;
}
return true;
}
```
[apply\_filters( 'lostpassword\_errors', WP\_Error $errors, WP\_User|false $user\_data )](../hooks/lostpassword_errors)
Filters the errors encountered on a password reset request.
[do\_action( 'lostpassword\_post', WP\_Error $errors, WP\_User|false $user\_data )](../hooks/lostpassword_post)
Fires before errors are returned from a password reset request.
[apply\_filters( 'lostpassword\_user\_data', WP\_User|false $user\_data, WP\_Error $errors )](../hooks/lostpassword_user_data)
Filters the user data during a password reset request.
[apply\_filters( 'retrieve\_password\_message', string $message, string $key, string $user\_login, WP\_User $user\_data )](../hooks/retrieve_password_message)
Filters the message body of the password reset mail.
[apply\_filters( 'retrieve\_password\_notification\_email', array $defaults )](../hooks/retrieve_password_notification_email)
Filters the contents of the reset password notification email sent to the user.
[apply\_filters( 'retrieve\_password\_title', string $title, string $user\_login, WP\_User $user\_data )](../hooks/retrieve_password_title)
Filters the subject of the password reset email.
[apply\_filters( 'send\_retrieve\_password\_email', bool $send, string $user\_login, WP\_User $user\_data )](../hooks/send_retrieve_password_email)
Filters whether to send the retrieve password email.
| Uses | Description |
| --- | --- |
| [restore\_previous\_locale()](restore_previous_locale) wp-includes/l10n.php | Restores the translations according to the previous locale. |
| [network\_site\_url()](network_site_url) wp-includes/link-template.php | Retrieves the site URL for the current network. |
| [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [get\_password\_reset\_key()](get_password_reset_key) wp-includes/user.php | Creates, stores, then returns a password reset key for user. |
| [wp\_specialchars\_decode()](wp_specialchars_decode) wp-includes/formatting.php | Converts a number of HTML entities into their special characters. |
| [switch\_to\_locale()](switch_to_locale) wp-includes/l10n.php | Switches the translations according to the given locale. |
| [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. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_send\_password\_reset()](wp_ajax_send_password_reset) wp-admin/includes/ajax-actions.php | Ajax handler sends a password reset link. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Added `$user_login` parameter. |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress metadata_exists( string $meta_type, int $object_id, string $meta_key ): bool metadata\_exists( string $meta\_type, int $object\_id, string $meta\_key ): bool
================================================================================
Determines if a meta field with the given key exists for the given object ID.
`$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. bool Whether a meta field with the given key exists.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function metadata_exists( $meta_type, $object_id, $meta_key ) {
if ( ! $meta_type || ! is_numeric( $object_id ) ) {
return false;
}
$object_id = absint( $object_id );
if ( ! $object_id ) {
return false;
}
/** This filter is documented in wp-includes/meta.php */
$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true, $meta_type );
if ( null !== $check ) {
return (bool) $check;
}
$meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
if ( ! $meta_cache ) {
$meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
$meta_cache = $meta_cache[ $object_id ];
}
if ( isset( $meta_cache[ $meta_key ] ) ) {
return true;
}
return false;
}
```
[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 |
| --- | --- |
| [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\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. |
| [WP\_User::\_\_isset()](../classes/wp_user/__isset) wp-includes/class-wp-user.php | Magic method for checking the existence of a certain custom field. |
| [WP\_Post::\_\_isset()](../classes/wp_post/__isset) wp-includes/class-wp-post.php | Isset-er. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress get_header_textcolor(): string get\_header\_textcolor(): string
================================
Retrieves the custom header text color in 3- or 6-digit hexadecimal form.
string Header text color in 3- or 6-digit hexadecimal form (minus the hash symbol).
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_header_textcolor() {
return get_theme_mod( 'header_textcolor', get_theme_support( 'custom-header', 'default-text-color' ) );
}
```
| 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 |
| --- | --- |
| [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. |
| [header\_textcolor()](header_textcolor) wp-includes/theme.php | Displays the custom header text color in 3- or 6-digit hexadecimal form (minus the hash symbol). |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_getimagesize( string $filename, array $image_info = null ): array|false wp\_getimagesize( string $filename, array $image\_info = null ): array|false
============================================================================
Allows PHP’s getimagesize() to be debuggable when necessary.
`$filename` string Required The file path. `$image_info` array Optional Extended image information (passed by reference). Default: `null`
array|false Array of image information or false on failure.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_getimagesize( $filename, array &$image_info = null ) {
// Don't silence errors when in debug mode, unless running unit tests.
if ( defined( 'WP_DEBUG' ) && WP_DEBUG
&& ! defined( 'WP_RUN_CORE_TESTS' )
) {
if ( 2 === func_num_args() ) {
$info = getimagesize( $filename, $image_info );
} else {
$info = getimagesize( $filename );
}
} else {
/*
* Silencing notice and warning is intentional.
*
* getimagesize() has a tendency to generate errors, such as
* "corrupt JPEG data: 7191 extraneous bytes before marker",
* even when it's able to provide image size information.
*
* See https://core.trac.wordpress.org/ticket/42480
*/
if ( 2 === func_num_args() ) {
// phpcs:ignore WordPress.PHP.NoSilencedErrors
$info = @getimagesize( $filename, $image_info );
} else {
// phpcs:ignore WordPress.PHP.NoSilencedErrors
$info = @getimagesize( $filename );
}
}
if ( false !== $info ) {
return $info;
}
// For PHP versions that don't support WebP images,
// extract the image size info from the file headers.
if ( 'image/webp' === wp_get_image_mime( $filename ) ) {
$webp_info = wp_get_webp_info( $filename );
$width = $webp_info['width'];
$height = $webp_info['height'];
// Mimic the native return format.
if ( $width && $height ) {
return array(
$width,
$height,
IMAGETYPE_WEBP,
sprintf(
'width="%d" height="%d"',
$width,
$height
),
'mime' => 'image/webp',
);
}
}
// The image could not be parsed.
return false;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_webp\_info()](wp_get_webp_info) wp-includes/media.php | Extracts meta information about a WebP file: width, height, and type. |
| [wp\_get\_image\_mime()](wp_get_image_mime) wp-includes/functions.php | Returns the real mime type of an image file. |
| 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\_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\_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\_read\_image\_metadata()](wp_read_image_metadata) wp-admin/includes/image.php | Gets extended image metadata, exif or iptc as available. |
| [file\_is\_valid\_image()](file_is_valid_image) wp-admin/includes/image.php | Validates that file is an image. |
| [file\_is\_displayable\_image()](file_is_displayable_image) wp-admin/includes/image.php | Validates that file is suitable for displaying within a web page. |
| [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. |
| [get\_attachment\_icon()](get_attachment_icon) wp-includes/deprecated.php | Retrieve HTML content of icon attachment image element. |
| [WP\_Image\_Editor\_GD::load()](../classes/wp_image_editor_gd/load) wp-includes/class-wp-image-editor-gd.php | Loads image from $this->file into new GD Resource. |
| [wp\_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’). |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Added support for WebP images. |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
| programming_docs |
wordpress get_term( int|WP_Term|object $term, string $taxonomy = '', string $output = OBJECT, string $filter = 'raw' ): WP_Term|array|WP_Error|null get\_term( int|WP\_Term|object $term, string $taxonomy = '', string $output = OBJECT, string $filter = 'raw' ): WP\_Term|array|WP\_Error|null
=============================================================================================================================================
Gets all term data from database by term ID.
The usage of the get\_term function is to apply filters to a term object. It is possible to get a term object from the database before applying the filters.
$term ID must be part of $taxonomy, to get from the database. Failure, might be able to be captured by the hooks. Failure would be the same value as $[wpdb](../classes/wpdb) returns for the get\_row method.
There are two hooks, one is specifically for each term, named ‘get\_term’, and the second is for the taxonomy name, ‘term\_$taxonomy’. Both hooks gets the term object, and the taxonomy name as parameters. Both hooks are expected to return a term object.
[‘get\_term’](../hooks/get_term) hook – Takes two parameters the term Object and the taxonomy name.
Must return term object. Used in [get\_term()](get_term) as a catch-all filter for every $term.
[‘get\_$taxonomy’](../hooks/get_taxonomy) hook – Takes two parameters the term Object and the taxonomy name. Must return term object. $taxonomy will be the taxonomy name, so for example, if ‘category’, it would be ‘get\_category’ as the filter name. Useful for custom taxonomies or plugging into default taxonomies.
* [sanitize\_term\_field()](sanitize_term_field) : The $context param lists the available values for [get\_term\_by()](get_term_by) $filter param.
`$term` int|[WP\_Term](../classes/wp_term)|object Required If integer, term data will be fetched from the database, or from the cache if available.
If stdClass object (as in the results of a database query), will apply filters and return a `WP_Term` object with the `$term` data.
If `WP_Term`, will return `$term`. `$taxonomy` string Optional Taxonomy name that `$term` is part of. Default: `''`
`$output` string Optional The required return type. One of OBJECT, ARRAY\_A, or ARRAY\_N, which correspond to a [WP\_Term](../classes/wp_term) object, an associative array, or a numeric array, respectively. Default: `OBJECT`
`$filter` string Optional How to sanitize term fields. Default `'raw'`. Default: `'raw'`
[WP\_Term](../classes/wp_term)|array|[WP\_Error](../classes/wp_error)|null [WP\_Term](../classes/wp_term) instance (or array) on success, depending on the `$output` value.
[WP\_Error](../classes/wp_error) if `$taxonomy` does not exist. Null for miscellaneous failure.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function get_term( $term, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) {
if ( empty( $term ) ) {
return new WP_Error( 'invalid_term', __( 'Empty Term.' ) );
}
if ( $taxonomy && ! taxonomy_exists( $taxonomy ) ) {
return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
}
if ( $term instanceof WP_Term ) {
$_term = $term;
} elseif ( is_object( $term ) ) {
if ( empty( $term->filter ) || 'raw' === $term->filter ) {
$_term = sanitize_term( $term, $taxonomy, 'raw' );
$_term = new WP_Term( $_term );
} else {
$_term = WP_Term::get_instance( $term->term_id );
}
} else {
$_term = WP_Term::get_instance( $term, $taxonomy );
}
if ( is_wp_error( $_term ) ) {
return $_term;
} elseif ( ! $_term ) {
return null;
}
// Ensure for filters that this is not empty.
$taxonomy = $_term->taxonomy;
/**
* Filters a taxonomy term object.
*
* The {@see 'get_$taxonomy'} hook is also available for targeting a specific
* taxonomy.
*
* @since 2.3.0
* @since 4.4.0 `$_term` is now a `WP_Term` object.
*
* @param WP_Term $_term Term object.
* @param string $taxonomy The taxonomy slug.
*/
$_term = apply_filters( 'get_term', $_term, $taxonomy );
/**
* Filters a taxonomy term object.
*
* The dynamic portion of the hook name, `$taxonomy`, refers
* to the slug of the term's taxonomy.
*
* Possible hook names include:
*
* - `get_category`
* - `get_post_tag`
*
* @since 2.3.0
* @since 4.4.0 `$_term` is now a `WP_Term` object.
*
* @param WP_Term $_term Term object.
* @param string $taxonomy The taxonomy slug.
*/
$_term = apply_filters( "get_{$taxonomy}", $_term, $taxonomy );
// Bail if a filter callback has changed the type of the `$_term` object.
if ( ! ( $_term instanceof WP_Term ) ) {
return $_term;
}
// Sanitize term, according to the specified filter.
$_term->filter( $filter );
if ( ARRAY_A === $output ) {
return $_term->to_array();
} elseif ( ARRAY_N === $output ) {
return array_values( $_term->to_array() );
}
return $_term;
}
```
[apply\_filters( 'get\_term', WP\_Term $\_term, string $taxonomy )](../hooks/get_term)
Filters a taxonomy term object.
[apply\_filters( "get\_{$taxonomy}", WP\_Term $\_term, string $taxonomy )](../hooks/get_taxonomy)
Filters a taxonomy term object.
| Uses | Description |
| --- | --- |
| [WP\_Term::\_\_construct()](../classes/wp_term/__construct) wp-includes/class-wp-term.php | Constructor. |
| [WP\_Term::get\_instance()](../classes/wp_term/get_instance) wp-includes/class-wp-term.php | Retrieve [WP\_Term](../classes/wp_term) instance. |
| [sanitize\_term()](sanitize_term) wp-includes/taxonomy.php | Sanitizes all term fields. |
| [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. |
| [\_\_()](__) 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 |
| --- | --- |
| [is\_term\_publicly\_viewable()](is_term_publicly_viewable) wp-includes/taxonomy.php | Determines whether a term is publicly viewable. |
| [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\_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\_Term\_Search\_Handler::prepare\_item()](../classes/wp_rest_term_search_handler/prepare_item) wp-includes/rest-api/search/class-wp-rest-term-search-handler.php | Prepares the search result for a given ID. |
| [WP\_REST\_Term\_Search\_Handler::prepare\_item\_links()](../classes/wp_rest_term_search_handler/prepare_item_links) wp-includes/rest-api/search/class-wp-rest-term-search-handler.php | Prepares links for the search result of a given ID. |
| [rest\_get\_route\_for\_term()](rest_get_route_for_term) wp-includes/rest-api.php | Gets the REST API route for a term. |
| [get\_object\_subtype()](get_object_subtype) wp-includes/meta.php | Returns the object subtype for a given object ID of a specific type. |
| [WP\_Term\_Query::populate\_terms()](../classes/wp_term_query/populate_terms) wp-includes/class-wp-term-query.php | Creates an array of term objects from an array of term IDs. |
| [get\_term\_parents\_list()](get_term_parents_list) wp-includes/category-template.php | Retrieves term parents with separator. |
| [WP\_REST\_Terms\_Controller::get\_term()](../classes/wp_rest_terms_controller/get_term) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Get the term, if the ID is valid. |
| [WP\_REST\_Terms\_Controller::prepare\_links()](../classes/wp_rest_terms_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Prepares links for the request. |
| [WP\_REST\_Terms\_Controller::prepare\_item\_for\_database()](../classes/wp_rest_terms_controller/prepare_item_for_database) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Prepares a single term for create or update. |
| [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()](../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\_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\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. |
| [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. |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [get\_category\_to\_edit()](get_category_to_edit) wp-admin/includes/taxonomy.php | Gets category object for given ID and ‘edit’ filter context. |
| [wp\_update\_category()](wp_update_category) wp-admin/includes/taxonomy.php | Aliases [wp\_insert\_category()](wp_insert_category) with minimal args. |
| [wp\_terms\_checklist()](wp_terms_checklist) wp-admin/includes/template.php | Outputs an unordered list of checkbox input elements labelled with term names. |
| [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\_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\_add\_tag()](wp_ajax_add_tag) wp-admin/includes/ajax-actions.php | Ajax handler to add a tag. |
| [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::\_rows()](../classes/wp_terms_list_table/_rows) wp-admin/includes/class-wp-terms-list-table.php | |
| [Walker\_Nav\_Menu\_Edit::start\_el()](../classes/walker_nav_menu_edit/start_el) wp-admin/includes/class-walker-nav-menu-edit.php | Start the element output. |
| [\_wp\_ajax\_menu\_quick\_search()](_wp_ajax_menu_quick_search) wp-admin/includes/nav-menu.php | Prints the appropriate response to a menu quick search. |
| [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. |
| [Walker\_Category::start\_el()](../classes/walker_category/start_el) wp-includes/class-walker-category.php | Starts the element output. |
| [get\_the\_category\_by\_ID()](get_the_category_by_id) wp-includes/category-template.php | Retrieves category name based on category ID. |
| [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. |
| [get\_tag()](get_tag) wp-includes/category.php | Retrieves a post tag by tag ID or tag object. |
| [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\_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. |
| [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\_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\_is\_ancestor\_of()](term_is_ancestor_of) wp-includes/taxonomy.php | Checks if a term is an ancestor of another term. |
| [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. |
| [edit\_term\_link()](edit_term_link) wp-includes/link-template.php | Displays or retrieves the edit term link with formatting. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post 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. |
| [wp\_get\_nav\_menu\_object()](wp_get_nav_menu_object) wp-includes/nav-menu.php | Returns a navigation menu object. |
| [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. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Converted to return a [WP\_Term](../classes/wp_term) object if `$output` is `OBJECT`. The `$taxonomy` parameter was made optional. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress add_user_to_blog( int $blog_id, int $user_id, string $role ): true|WP_Error add\_user\_to\_blog( int $blog\_id, int $user\_id, string $role ): true|WP\_Error
=================================================================================
Adds a user to a blog, along with specifying the user’s role.
Use the [‘add\_user\_to\_blog’](../hooks/add_user_to_blog) action to fire an event when users are added to a blog.
`$blog_id` int Required ID of the blog the user is being added to. `$user_id` int Required ID of the user being added. `$role` string Required The role you want the user to have. true|[WP\_Error](../classes/wp_error) True on success or a [WP\_Error](../classes/wp_error) object if the user doesn't exist or could not be added.
* It does not check if the user is already a member of the blog before setting their role. If you don’t want to overwrite the role of a user if they are already a member of the blog, use [is\_user\_member\_of\_blog()](is_user_member_of_blog) to check that first.
* You *do not* need to call [switch\_to\_blog()](switch_to_blog) to switch to the blog you want to add the user to before calling this function. The function will switch to the blog itself, and restore the current blog before returning as well.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function add_user_to_blog( $blog_id, $user_id, $role ) {
switch_to_blog( $blog_id );
$user = get_userdata( $user_id );
if ( ! $user ) {
restore_current_blog();
return new WP_Error( 'user_does_not_exist', __( 'The requested user does not exist.' ) );
}
/**
* Filters whether a user should be added to a site.
*
* @since 4.9.0
*
* @param true|WP_Error $retval True if the user should be added to the site, error
* object otherwise.
* @param int $user_id User ID.
* @param string $role User role.
* @param int $blog_id Site ID.
*/
$can_add_user = apply_filters( 'can_add_user_to_blog', true, $user_id, $role, $blog_id );
if ( true !== $can_add_user ) {
restore_current_blog();
if ( is_wp_error( $can_add_user ) ) {
return $can_add_user;
}
return new WP_Error( 'user_cannot_be_added', __( 'User cannot be added to this site.' ) );
}
if ( ! get_user_meta( $user_id, 'primary_blog', true ) ) {
update_user_meta( $user_id, 'primary_blog', $blog_id );
$site = get_site( $blog_id );
update_user_meta( $user_id, 'source_domain', $site->domain );
}
$user->set_role( $role );
/**
* Fires immediately after a user is added to a site.
*
* @since MU (3.0.0)
*
* @param int $user_id User ID.
* @param string $role User role.
* @param int $blog_id Blog ID.
*/
do_action( 'add_user_to_blog', $user_id, $role, $blog_id );
clean_user_cache( $user_id );
wp_cache_delete( $blog_id . '_user_count', 'blog-details' );
restore_current_blog();
return true;
}
```
[do\_action( 'add\_user\_to\_blog', int $user\_id, string $role, int $blog\_id )](../hooks/add_user_to_blog)
Fires immediately after a user is added to a site.
[apply\_filters( 'can\_add\_user\_to\_blog', true|WP\_Error $retval, int $user\_id, string $role, int $blog\_id )](../hooks/can_add_user_to_blog)
Filters whether a user should be added to a site.
| Uses | Description |
| --- | --- |
| [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [clean\_user\_cache()](clean_user_cache) wp-includes/user.php | Cleans all user caches. |
| [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. |
| [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) . |
| [\_\_()](__) 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. |
| [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\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. |
| [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. |
| [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) . |
| [add\_new\_user\_to\_blog()](add_new_user_to_blog) wp-includes/ms-functions.php | Adds a newly created user to the appropriate blog |
| [get\_active\_blog\_for\_user()](get_active_blog_for_user) wp-includes/ms-functions.php | Gets one of a user’s active blogs. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
| programming_docs |
wordpress is_feed( string|string[] $feeds = '' ): bool is\_feed( string|string[] $feeds = '' ): bool
=============================================
Determines whether the query is for a feed.
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.
`$feeds` string|string[] Optional Feed type or array of feed types to check against. Default: `''`
bool Whether the query is for a feed.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_feed( $feeds = '' ) {
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_feed( $feeds );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_feed()](../classes/wp_query/is_feed) wp-includes/class-wp-query.php | Is the query for a feed? |
| [\_\_()](__) 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\_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::handle\_404()](../classes/wp/handle_404) wp-includes/class-wp.php | Set the Headers for 404, if nothing is found for requested URL. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [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. |
| [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_update_theme( $theme, $feedback = '' ) wp\_update\_theme( $theme, $feedback = '' )
===========================================
This function has been deprecated. Use [Theme\_Upgrader](../classes/theme_upgrader)() instead.
This was once used to kick-off the Theme Updater.
Deprecated in favor of instantiating a [Theme\_Upgrader](../classes/theme_upgrader) instance directly, and calling the ‘upgrade’ method.
Unused since 2.8.0.
* [Theme\_Upgrader](../classes/theme_upgrader)
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function wp_update_theme($theme, $feedback = '') {
_deprecated_function( __FUNCTION__, '3.7.0', 'new Theme_Upgrader();' );
if ( !empty($feedback) )
add_filter('update_feedback', $feedback);
require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$upgrader = new Theme_Upgrader();
return $upgrader->upgrade($theme);
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| Version | Description |
| --- | --- |
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Use [Theme\_Upgrader](../classes/theme_upgrader) |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress remove_custom_image_header(): null|bool remove\_custom\_image\_header(): null|bool
==========================================
This function has been deprecated. Use [remove\_theme\_support()](remove_theme_support) instead.
Remove image header support.
* [remove\_theme\_support()](remove_theme_support)
null|bool Whether support was removed.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function remove_custom_image_header() {
_deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-header\' )' );
return remove_theme_support( 'custom-header' );
}
```
| Uses | Description |
| --- | --- |
| [remove\_theme\_support()](remove_theme_support) wp-includes/theme.php | Allows a theme to de-register its support of a certain feature |
| [\_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/) | Use [remove\_theme\_support()](remove_theme_support) |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress iframe_footer() iframe\_footer()
================
Generic Iframe footer for use with Thickbox.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function iframe_footer() {
/*
* We're going to hide any footer output on iFrame pages,
* but run the hooks anyway since they output JavaScript
* or other needed content.
*/
/**
* @global string $hook_suffix
*/
global $hook_suffix;
?>
<div class="hidden">
<?php
/** This action is documented in wp-admin/admin-footer.php */
do_action( 'admin_footer', $hook_suffix );
/** This action is documented in wp-admin/admin-footer.php */
do_action( "admin_print_footer_scripts-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/admin-footer.php */
do_action( 'admin_print_footer_scripts' );
?>
</div>
<script type="text/javascript">if(typeof wpOnload==='function')wpOnload();</script>
</body>
</html>
<?php
}
```
[do\_action( 'admin\_footer', string $data )](../hooks/admin_footer)
Prints scripts or data before the default footer scripts.
[do\_action( 'admin\_print\_footer\_scripts' )](../hooks/admin_print_footer_scripts)
Prints any scripts and data queued for the footer.
[do\_action( "admin\_print\_footer\_scripts-{$hook\_suffix}" )](../hooks/admin_print_footer_scripts-hook_suffix)
Prints scripts and data queued for the footer.
| 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 |
| --- | --- |
| [install\_theme\_information()](install_theme_information) wp-admin/includes/theme-install.php | Displays theme information in dialog box form. |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress get_search_form( array $args = array() ): void|string get\_search\_form( array $args = array() ): void|string
=======================================================
Displays search form.
Will first attempt to locate the searchform.php file in either the child or the parent, then load it. If it doesn’t exist, then the default search form will be displayed. The default search form is HTML, which will be displayed.
There is a filter applied to the search form HTML in order to edit or replace it. The filter is [‘get\_search\_form’](../hooks/get_search_form).
This function is primarily used by themes which want to hardcode the search form into the sidebar and also by the search widget in WordPress.
There is also an action that is called whenever the function is run called, [‘pre\_get\_search\_form’](../hooks/pre_get_search_form). This can be useful for outputting JavaScript that the search relies on or various formatting that applies to the beginning of the search. To give a few examples of what it can be used for.
`$args` array Optional Array of display arguments.
* `echo`boolWhether to echo or return the form. Default true.
* `aria_label`stringARIA label for the search form. Useful to distinguish multiple search forms on the same page and improve accessibility.
Default: `array()`
void|string Void if `'echo'` argument is true, search form HTML if `'echo'` is false.
```
get_search_form( $echo );
```
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function get_search_form( $args = array() ) {
/**
* Fires before the search form is retrieved, at the start of get_search_form().
*
* @since 2.7.0 as 'get_search_form' action.
* @since 3.6.0
* @since 5.5.0 The `$args` parameter was added.
*
* @link https://core.trac.wordpress.org/ticket/19321
*
* @param array $args The array of arguments for building the search form.
* See get_search_form() for information on accepted arguments.
*/
do_action( 'pre_get_search_form', $args );
$echo = true;
if ( ! is_array( $args ) ) {
/*
* Back compat: to ensure previous uses of get_search_form() continue to
* function as expected, we handle a value for the boolean $echo param removed
* in 5.2.0. Then we deal with the $args array and cast its defaults.
*/
$echo = (bool) $args;
// Set an empty array and allow default arguments to take over.
$args = array();
}
// Defaults are to echo and to output no custom label on the form.
$defaults = array(
'echo' => $echo,
'aria_label' => '',
);
$args = wp_parse_args( $args, $defaults );
/**
* Filters the array of arguments used when generating the search form.
*
* @since 5.2.0
*
* @param array $args The array of arguments for building the search form.
* See get_search_form() for information on accepted arguments.
*/
$args = apply_filters( 'search_form_args', $args );
// Ensure that the filtered arguments contain all required default values.
$args = array_merge( $defaults, $args );
$format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml';
/**
* Filters the HTML format of the search form.
*
* @since 3.6.0
* @since 5.5.0 The `$args` parameter was added.
*
* @param string $format The type of markup to use in the search form.
* Accepts 'html5', 'xhtml'.
* @param array $args The array of arguments for building the search form.
* See get_search_form() for information on accepted arguments.
*/
$format = apply_filters( 'search_form_format', $format, $args );
$search_form_template = locate_template( 'searchform.php' );
if ( '' !== $search_form_template ) {
ob_start();
require $search_form_template;
$form = ob_get_clean();
} else {
// Build a string containing an aria-label to use for the search form.
if ( $args['aria_label'] ) {
$aria_label = 'aria-label="' . esc_attr( $args['aria_label'] ) . '" ';
} else {
/*
* If there's no custom aria-label, we can set a default here. At the
* moment it's empty as there's uncertainty about what the default should be.
*/
$aria_label = '';
}
if ( 'html5' === $format ) {
$form = '<form role="search" ' . $aria_label . 'method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '">
<label>
<span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span>
<input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search …', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" />
</label>
<input type="submit" class="search-submit" value="' . esc_attr_x( 'Search', 'submit button' ) . '" />
</form>';
} else {
$form = '<form role="search" ' . $aria_label . 'method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/' ) ) . '">
<div>
<label class="screen-reader-text" for="s">' . _x( 'Search for:', 'label' ) . '</label>
<input type="text" value="' . get_search_query() . '" name="s" id="s" />
<input type="submit" id="searchsubmit" value="' . esc_attr_x( 'Search', 'submit button' ) . '" />
</div>
</form>';
}
}
/**
* Filters the HTML output of the search form.
*
* @since 2.7.0
* @since 5.5.0 The `$args` parameter was added.
*
* @param string $form The search form HTML output.
* @param array $args The array of arguments for building the search form.
* See get_search_form() for information on accepted arguments.
*/
$result = apply_filters( 'get_search_form', $form, $args );
if ( null === $result ) {
$result = $form;
}
if ( $args['echo'] ) {
echo $result;
} else {
return $result;
}
}
```
[apply\_filters( 'get\_search\_form', string $form, array $args )](../hooks/get_search_form)
Filters the HTML output of the search form.
[do\_action( 'pre\_get\_search\_form', array $args )](../hooks/pre_get_search_form)
Fires before the search form is retrieved, at the start of [get\_search\_form()](get_search_form) .
[apply\_filters( 'search\_form\_args', array $args )](../hooks/search_form_args)
Filters the array of arguments used when generating the search form.
[apply\_filters( 'search\_form\_format', string $format, array $args )](../hooks/search_form_format)
Filters the HTML format of the search form.
| Uses | Description |
| --- | --- |
| [esc\_attr\_x()](esc_attr_x) wp-includes/l10n.php | Translates string with gettext context, and escapes it for safe use in an attribute. |
| [get\_search\_query()](get_search_query) wp-includes/general-template.php | Retrieves the contents of the search WordPress query variable. |
| [locate\_template()](locate_template) wp-includes/template.php | Retrieves the name of the highest priority template file that exists. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [\_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\_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. |
| [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\_Widget\_Search::widget()](../classes/wp_widget_search/widget) wp-includes/widgets/class-wp-widget-search.php | Outputs the content for the current Search widget instance. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | The `$args` array parameter was added in place of an `$echo` boolean flag. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_media_attach_action( int $parent_id, string $action = 'attach' ) wp\_media\_attach\_action( int $parent\_id, string $action = 'attach' )
=======================================================================
Encapsulates the logic for Attach/Detach actions.
`$parent_id` int Required Attachment parent ID. `$action` string Optional Attach/detach action. Accepts `'attach'` or `'detach'`.
Default `'attach'`. Default: `'attach'`
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function wp_media_attach_action( $parent_id, $action = 'attach' ) {
global $wpdb;
if ( ! $parent_id ) {
return;
}
if ( ! current_user_can( 'edit_post', $parent_id ) ) {
wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );
}
$ids = array();
foreach ( (array) $_REQUEST['media'] as $attachment_id ) {
$attachment_id = (int) $attachment_id;
if ( ! current_user_can( 'edit_post', $attachment_id ) ) {
continue;
}
$ids[] = $attachment_id;
}
if ( ! empty( $ids ) ) {
$ids_string = implode( ',', $ids );
if ( 'attach' === $action ) {
$result = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $ids_string )", $parent_id ) );
} else {
$result = $wpdb->query( "UPDATE $wpdb->posts SET post_parent = 0 WHERE post_type = 'attachment' AND ID IN ( $ids_string )" );
}
}
if ( isset( $result ) ) {
foreach ( $ids as $attachment_id ) {
/**
* Fires when media is attached or detached from a post.
*
* @since 5.5.0
*
* @param string $action Attach/detach action. Accepts 'attach' or 'detach'.
* @param int $attachment_id The attachment ID.
* @param int $parent_id Attachment parent ID.
*/
do_action( 'wp_media_attach_action', $action, $attachment_id, $parent_id );
clean_attachment_cache( $attachment_id );
}
$location = 'upload.php';
$referer = wp_get_referer();
if ( $referer ) {
if ( false !== strpos( $referer, 'upload.php' ) ) {
$location = remove_query_arg( array( 'attached', 'detach' ), $referer );
}
}
$key = 'attach' === $action ? 'attached' : 'detach';
$location = add_query_arg( array( $key => $result ), $location );
wp_redirect( $location );
exit;
}
}
```
[do\_action( 'wp\_media\_attach\_action', string $action, int $attachment\_id, int $parent\_id )](../hooks/wp_media_attach_action)
Fires when media is attached or detached from a post.
| Uses | Description |
| --- | --- |
| [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. |
| [wp\_get\_referer()](wp_get_referer) wp-includes/functions.php | Retrieves referer from ‘\_wp\_http\_referer’ or HTTP referer. |
| [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. |
| [clean\_attachment\_cache()](clean_attachment_cache) wp-includes/post.php | Will clean the attachment in the cache. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [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\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [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. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress _update_posts_count_on_delete( int $post_id ) \_update\_posts\_count\_on\_delete( int $post\_id )
===================================================
Handler for updating the current site’s posts count when a post is deleted.
`$post_id` int Required Post ID. 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_delete( $post_id ) {
$post = get_post( $post_id );
if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) {
return;
}
update_posts_count();
}
```
| Uses | Description |
| --- | --- |
| [update\_posts\_count()](update_posts_count) wp-includes/ms-functions.php | Updates a blog’s post count. |
| [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. |
| programming_docs |
wordpress get_stylesheet_directory(): string get\_stylesheet\_directory(): string
====================================
Retrieves stylesheet directory path for the active theme.
string Path to active theme's stylesheet directory.
* The returning path does not contain a trailing slash.
* An example output of [get\_stylesheet\_directory()](get_stylesheet_directory) is
/home/user/public\_html/wp-content/themes/my\_theme
* In the event a child theme is being used, that is the directory that will be returned, not the parent theme directory (use [get\_template\_directory()](get_template_directory) instead if you want the parent directory).
* To retrieve the URI of the stylesheet directory use [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri)
* To retrieve the path of a parent theme, use [get\_template\_directory()](get_template_directory)
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_stylesheet_directory() {
$stylesheet = get_stylesheet();
$theme_root = get_theme_root( $stylesheet );
$stylesheet_dir = "$theme_root/$stylesheet";
/**
* Filters the stylesheet directory path for the active theme.
*
* @since 1.5.0
*
* @param string $stylesheet_dir Absolute path to the active theme.
* @param string $stylesheet Directory name of the active theme.
* @param string $theme_root Absolute path to themes directory.
*/
return apply_filters( 'stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root );
}
```
[apply\_filters( 'stylesheet\_directory', string $stylesheet\_dir, string $stylesheet, string $theme\_root )](../hooks/stylesheet_directory)
Filters the stylesheet directory path for the active theme.
| Uses | Description |
| --- | --- |
| [get\_theme\_root()](get_theme_root) wp-includes/theme.php | Retrieves path to themes directory. |
| [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Theme\_JSON\_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\_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. |
| [\_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\_theme\_file\_path()](get_theme_file_path) wp-includes/link-template.php | Retrieves the path of a file in the theme. |
| [get\_theme\_file\_uri()](get_theme_file_uri) wp-includes/link-template.php | Retrieves the URL 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. |
| [get\_locale\_stylesheet\_uri()](get_locale_stylesheet_uri) wp-includes/theme.php | Retrieves the localized stylesheet URI. |
| [load\_child\_theme\_textdomain()](load_child_theme_textdomain) wp-includes/l10n.php | Loads the child themes translated strings. |
| [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_slash_strings_only( mixed $value ): mixed wp\_slash\_strings\_only( mixed $value ): mixed
===============================================
This function has been deprecated. Use [wp\_slash()](wp_slash) instead.
Adds slashes to only string values in an array of values.
This should be used when preparing data for core APIs that expect slashed data.
This should not be used to escape data going directly into an SQL query.
* [wp\_slash()](wp_slash)
`$value` mixed Required Scalar or array of scalars. mixed Slashes $value
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_slash_strings_only( $value ) {
return map_deep( $value, 'addslashes_strings_only' );
}
```
| Uses | Description |
| --- | --- |
| [map\_deep()](map_deep) wp-includes/formatting.php | Maps a function to all non-iterable elements of an array or an object. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Use [wp\_slash()](wp_slash) |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress add_query_arg( $args ): string add\_query\_arg( $args ): string
================================
Retrieves a modified URL query string.
You can rebuild the URL and append query variables to the URL query by using this function.
There are two ways to use this function; either a single key and value, or an associative array.
Using a single key and value:
```
add_query_arg( 'key', 'value', 'http://example.com' );
```
Using an associative array:
```
add_query_arg( array(
'key1' => 'value1',
'key2' => 'value2',
), 'http://example.com' );
```
Omitting the URL from either use results in the current URL being used (the value of `$_SERVER['REQUEST_URI']`).
Values are expected to be encoded appropriately with urlencode() or rawurlencode().
Setting any query variable’s value to boolean false removes the key (see [remove\_query\_arg()](remove_query_arg) ).
Important: The return value of [add\_query\_arg()](add_query_arg) is not escaped by default. Output should be late-escaped with [esc\_url()](esc_url) or similar to help prevent vulnerability to cross-site scripting (XSS) attacks.
`$key` string|array Required Either a query variable key, or an associative array of query variables. `$value` string Optional Either a query variable value, or a URL to act upon. `$url` string Optional A URL to act upon. string New URL query string (unescaped).
```
// Parameters as separate arguments
add_query_arg( $param1, $param2, $old_query_or_uri );
// Parameters as array of key => value pairs
add_query_arg(
array(
'key1' => 'value1',
'key2' => 'value2',
...
),
$old_query_or_uri
);
```
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function add_query_arg( ...$args ) {
if ( is_array( $args[0] ) ) {
if ( count( $args ) < 2 || false === $args[1] ) {
$uri = $_SERVER['REQUEST_URI'];
} else {
$uri = $args[1];
}
} else {
if ( count( $args ) < 3 || false === $args[2] ) {
$uri = $_SERVER['REQUEST_URI'];
} else {
$uri = $args[2];
}
}
$frag = strstr( $uri, '#' );
if ( $frag ) {
$uri = substr( $uri, 0, -strlen( $frag ) );
} else {
$frag = '';
}
if ( 0 === stripos( $uri, 'http://' ) ) {
$protocol = 'http://';
$uri = substr( $uri, 7 );
} elseif ( 0 === stripos( $uri, 'https://' ) ) {
$protocol = 'https://';
$uri = substr( $uri, 8 );
} else {
$protocol = '';
}
if ( strpos( $uri, '?' ) !== false ) {
list( $base, $query ) = explode( '?', $uri, 2 );
$base .= '?';
} elseif ( $protocol || strpos( $uri, '=' ) === false ) {
$base = $uri . '?';
$query = '';
} else {
$base = '';
$query = $uri;
}
wp_parse_str( $query, $qs );
$qs = urlencode_deep( $qs ); // This re-URL-encodes things that were already in the query string.
if ( is_array( $args[0] ) ) {
foreach ( $args[0] as $k => $v ) {
$qs[ $k ] = $v;
}
} else {
$qs[ $args[0] ] = $args[1];
}
foreach ( $qs as $k => $v ) {
if ( false === $v ) {
unset( $qs[ $k ] );
}
}
$ret = build_query( $qs );
$ret = trim( $ret, '?' );
$ret = preg_replace( '#=(&|$)#', '$1', $ret );
$ret = $protocol . $base . $ret . $frag;
$ret = rtrim( $ret, '?' );
$ret = str_replace( '?#', '#', $ret );
return $ret;
}
```
| Uses | Description |
| --- | --- |
| [stripos()](stripos) wp-includes/class-pop3.php | |
| [wp\_parse\_str()](wp_parse_str) wp-includes/formatting.php | Parses a string into variables to be stored in an array. |
| [urlencode\_deep()](urlencode_deep) wp-includes/formatting.php | Navigates through an array, object, or scalar, and encodes the values to be used in a URL. |
| [build\_query()](build_query) wp-includes/functions.php | Builds URL query based on an associative and, or indexed array. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Sidebars\_Controller::prepare\_links()](../classes/wp_rest_sidebars_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Prepares links for the sidebar. |
| [core\_auto\_updates\_settings()](core_auto_updates_settings) wp-admin/update-core.php | Display WordPress auto-updates settings. |
| [WP\_REST\_Block\_Directory\_Controller::prepare\_links()](../classes/wp_rest_block_directory_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php | Generates a list of links to include in the response for the plugin. |
| [WP\_REST\_Block\_Types\_Controller::prepare\_links()](../classes/wp_rest_block_types_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Prepares links for the request. |
| [Plugin\_Installer\_Skin::do\_overwrite()](../classes/plugin_installer_skin/do_overwrite) wp-admin/includes/class-plugin-installer-skin.php | Check if the plugin can be overwritten and output the HTML for overwriting a plugin on upload. |
| [Theme\_Installer\_Skin::do\_overwrite()](../classes/theme_installer_skin/do_overwrite) wp-admin/includes/class-theme-installer-skin.php | Check if the theme can be overwritten and output the HTML for overwriting a theme on upload. |
| [WP\_MS\_Themes\_List\_Table::column\_autoupdates()](../classes/wp_ms_themes_list_table/column_autoupdates) wp-admin/includes/class-wp-ms-themes-list-table.php | Handles the auto-updates column output. |
| [WP\_Privacy\_Data\_Removal\_Requests\_List\_Table::column\_email()](../classes/wp_privacy_data_removal_requests_list_table/column_email) wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Actions column. |
| [WP\_Privacy\_Data\_Removal\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_removal_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Next steps column. |
| [WP\_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\_Data\_Export\_Requests\_List\_Table::column\_email()](../classes/wp_privacy_data_export_requests_list_table/column_email) wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php | Actions column. |
| [WP\_Privacy\_Data\_Export\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_export_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php | Displays the next steps column. |
| [WP\_Recovery\_Mode\_Link\_Service::handle\_begin\_link()](../classes/wp_recovery_mode_link_service/handle_begin_link) wp-includes/class-wp-recovery-mode-link-service.php | Enters recovery mode when the user hits wp-login.php with a valid recovery mode link. |
| [WP\_Recovery\_Mode\_Link\_Service::get\_recovery\_mode\_begin\_url()](../classes/wp_recovery_mode_link_service/get_recovery_mode_begin_url) wp-includes/class-wp-recovery-mode-link-service.php | Gets a URL to begin recovery mode. |
| [wp\_admin\_bar\_recovery\_mode\_menu()](wp_admin_bar_recovery_mode_menu) wp-includes/admin-bar.php | Adds a link to exit recovery mode when Recovery Mode is active. |
| [resume\_theme()](resume_theme) wp-admin/includes/theme.php | Tries to resume a single theme. |
| [wp\_recovery\_mode\_nag()](wp_recovery_mode_nag) wp-admin/includes/update.php | Displays a notice when the user is in recovery mode. |
| [WP\_Site\_Health::get\_test\_rest\_availability()](../classes/wp_site_health/get_test_rest_availability) wp-admin/includes/class-wp-site-health.php | Tests if the REST API is accessible. |
| [WP\_Site\_Health::get\_test\_https\_status()](../classes/wp_site_health/get_test_https_status) wp-admin/includes/class-wp-site-health.php | Tests if the site is serving content over HTTPS. |
| [resume\_plugin()](resume_plugin) wp-admin/includes/plugin.php | Tries to resume a single plugin. |
| [wp\_check\_php\_version()](wp_check_php_version) wp-admin/includes/misc.php | Checks if the user needs to update PHP. |
| [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\_get\_script\_polyfill()](wp_get_script_polyfill) wp-includes/script-loader.php | Returns contents of an inline script used in appending polyfill scripts for browsers which fail the provided tests. The provided array is a mapping from a condition to verify feature support to its polyfill script handle. |
| [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\_send\_user\_request()](wp_send_user_request) wp-includes/user.php | Send a confirmation request email to confirm an action. |
| [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\_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\_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\_Customize\_Manager::add\_state\_query\_params()](../classes/wp_customize_manager/add_state_query_params) wp-includes/class-wp-customize-manager.php | Adds customize state query params to a given URL if preview is allowed. |
| [WP\_REST\_Users\_Controller::get\_items()](../classes/wp_rest_users_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves all users. |
| [WP\_REST\_Revisions\_Controller::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\_Post\_Statuses\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_post_statuses_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Prepares a post status object for serialization. |
| [WP\_REST\_Terms\_Controller::prepare\_links()](../classes/wp_rest_terms_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Prepares links for the request. |
| [WP\_REST\_Terms\_Controller::get\_items()](../classes/wp_rest_terms_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Retrieves terms associated with a taxonomy. |
| [WP\_REST\_Posts\_Controller::prepare\_links()](../classes/wp_rest_posts_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares links for the request. |
| [WP\_REST\_Posts\_Controller::get\_items()](../classes/wp_rest_posts_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves a collection of posts. |
| [WP\_REST\_Comments\_Controller::prepare\_links()](../classes/wp_rest_comments_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Prepares links for the request. |
| [WP\_REST\_Comments\_Controller::get\_items()](../classes/wp_rest_comments_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Retrieves a list of comment items. |
| [wp\_get\_canonical\_url()](wp_get_canonical_url) wp-includes/link-template.php | Returns the canonical URL for a post. |
| [network\_edit\_site\_nav()](network_edit_site_nav) wp-admin/includes/ms.php | Outputs the HTML for a network’s “Edit Site” tabular interface. |
| [wp\_ajax\_search\_install\_plugins()](wp_ajax_search_install_plugins) wp-admin/includes/ajax-actions.php | Ajax handler for searching plugins to install. |
| [wp\_ajax\_search\_plugins()](wp_ajax_search_plugins) wp-admin/includes/ajax-actions.php | Ajax handler for searching plugins. |
| [wp\_ajax\_install\_theme()](wp_ajax_install_theme) wp-admin/includes/ajax-actions.php | Ajax handler for installing a theme. |
| [wp\_ajax\_install\_plugin()](wp_ajax_install_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for installing a plugin. |
| [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. |
| [get\_oembed\_endpoint\_url()](get_oembed_endpoint_url) wp-includes/embed.php | Retrieves the oEmbed endpoint URL for a given permalink. |
| [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. |
| [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::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\_admin\_bar\_customize\_menu()](wp_admin_bar_customize_menu) wp-includes/admin-bar.php | Adds the “Customize” link to the Toolbar. |
| [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\_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\_author()](../classes/wp_media_list_table/column_author) wp-admin/includes/class-wp-media-list-table.php | Handles the author 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\_default()](../classes/wp_media_list_table/column_default) wp-admin/includes/class-wp-media-list-table.php | Handles output for the default column. |
| [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. |
| [wp\_media\_attach\_action()](wp_media_attach_action) wp-admin/includes/media.php | Encapsulates the logic for Attach/Detach actions. |
| [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. |
| [themes\_api()](themes_api) wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. |
| [WP\_Plugins\_List\_Table::get\_views()](../classes/wp_plugins_list_table/get_views) 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. |
| [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. |
| [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. |
| [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::comments\_bubble()](../classes/wp_list_table/comments_bubble) wp-admin/includes/class-wp-list-table.php | Displays a comment count bubble. |
| [WP\_List\_Table::pagination()](../classes/wp_list_table/pagination) wp-admin/includes/class-wp-list-table.php | Displays the pagination. |
| [WP\_List\_Table::print\_column\_headers()](../classes/wp_list_table/print_column_headers) wp-admin/includes/class-wp-list-table.php | Prints column headers, accounting for hidden and sortable columns. |
| [WP\_List\_Table::set\_pagination\_args()](../classes/wp_list_table/set_pagination_args) wp-admin/includes/class-wp-list-table.php | An internal method that sets all the necessary pagination arguments |
| [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 | |
| [set\_screen\_options()](set_screen_options) wp-admin/includes/misc.php | Saves option for number of rows when listing posts, pages, comments, etc. |
| [WP\_Theme\_Install\_List\_Table::install\_theme\_info()](../classes/wp_theme_install_list_table/install_theme_info) wp-admin/includes/class-wp-theme-install-list-table.php | Prints the info for a theme (to be used in the theme installer modal). |
| [WP\_Theme\_Install\_List\_Table::single\_row()](../classes/wp_theme_install_list_table/single_row) wp-admin/includes/class-wp-theme-install-list-table.php | Prints a theme from the WordPress.org API. |
| [wp\_plugin\_update\_row()](wp_plugin_update_row) wp-admin/includes/update.php | Displays update information for a plugin. |
| [wp\_theme\_update\_row()](wp_theme_update_row) wp-admin/includes/update.php | Displays update information for a theme. |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| [plugins\_api()](plugins_api) wp-admin/includes/plugin-install.php | Retrieves plugin installer pages from the WordPress.org Plugins API. |
| [wp\_dashboard\_browser\_nag()](wp_dashboard_browser_nag) wp-admin/includes/dashboard.php | Displays the browser update nag. |
| [wp\_add\_dashboard\_widget()](wp_add_dashboard_widget) wp-admin/includes/dashboard.php | Adds a new dashboard widget. |
| [menu\_page\_url()](menu_page_url) wp-admin/includes/plugin.php | Gets the URL to access a particular menu page based on the slug it was registered with. |
| [activate\_plugins()](activate_plugins) wp-admin/includes/plugin.php | Activates multiple 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::display\_rows()](../classes/wp_plugin_install_list_table/display_rows) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [WP\_Users\_List\_Table::single\_row()](../classes/wp_users_list_table/single_row) wp-admin/includes/class-wp-users-list-table.php | Generate HTML for a single row on the users.php admin panel. |
| [WP\_Users\_List\_Table::get\_views()](../classes/wp_users_list_table/get_views) wp-admin/includes/class-wp-users-list-table.php | Return an associative array listing all the views that can be used with this table. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| [the\_media\_upload\_tabs()](the_media_upload_tabs) wp-admin/includes/media.php | Outputs the legacy media upload tabs UI. |
| [get\_upload\_iframe\_src()](get_upload_iframe_src) wp-admin/includes/media.php | Retrieves the upload iframe source URL. |
| [\_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\_query\_themes()](wp_ajax_query_themes) wp-admin/includes/ajax-actions.php | Ajax handler for getting themes from [themes\_api()](themes_api) . |
| [wp\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
| [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| [WP\_Comments\_List\_Table::column\_author()](../classes/wp_comments_list_table/column_author) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::get\_views()](../classes/wp_comments_list_table/get_views) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Terms\_List\_Table::column\_name()](../classes/wp_terms_list_table/column_name) wp-admin/includes/class-wp-terms-list-table.php | |
| [WP\_Terms\_List\_Table::column\_posts()](../classes/wp_terms_list_table/column_posts) wp-admin/includes/class-wp-terms-list-table.php | |
| [Walker\_Nav\_Menu\_Edit::start\_el()](../classes/walker_nav_menu_edit/start_el) wp-admin/includes/class-walker-nav-menu-edit.php | Start the element output. |
| [wp\_nav\_menu\_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\_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\_views()](../classes/wp_posts_list_table/get_views) wp-admin/includes/class-wp-posts-list-table.php | |
| [wp\_get\_popular\_importers()](wp_get_popular_importers) wp-admin/includes/import.php | Returns a list from WordPress.org of popular importer plugins. |
| [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. |
| [redirect\_post()](redirect_post) wp-admin/includes/post.php | Redirects to previous page. |
| [\_wp\_menu\_output()](_wp_menu_output) wp-admin/menu-header.php | Display menu. |
| [WP\_Styles::\_css\_href()](../classes/wp_styles/_css_href) wp-includes/class-wp-styles.php | Generates an enqueued style’s fully-qualified URL. |
| [spawn\_cron()](spawn_cron) wp-includes/cron.php | Sends a request to run cron through HTTP request that doesn’t halt page loading. |
| [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. |
| [wp\_admin\_css\_uri()](wp_admin_css_uri) wp-includes/general-template.php | Displays the URL of a WordPress admin CSS file. |
| [wp\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. |
| [wp\_logout\_url()](wp_logout_url) wp-includes/general-template.php | Retrieves the logout URL. |
| [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. |
| [wp\_lostpassword\_url()](wp_lostpassword_url) wp-includes/general-template.php | Returns the URL that allows the user to reset the lost password. |
| [dropdown\_cats()](dropdown_cats) wp-includes/deprecated.php | Deprecated method for generating a drop-down of categories. |
| [wp\_get\_links()](wp_get_links) wp-includes/deprecated.php | Gets the links associated with category. |
| [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\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. |
| [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\_edit\_user\_link()](get_edit_user_link) wp-includes/link-template.php | Retrieves the edit user link. |
| [get\_search\_comments\_feed\_link()](get_search_comments_feed_link) wp-includes/link-template.php | Retrieves the permalink for the search results comments feed. |
| [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\_delete\_post\_link()](get_delete_post_link) wp-includes/link-template.php | Retrieves the delete posts link for post. |
| [get\_edit\_term\_link()](get_edit_term_link) wp-includes/link-template.php | Retrieves the URL for editing a given 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\_post\_permalink()](get_post_permalink) wp-includes/link-template.php | Retrieves the permalink for a post of a custom post type. |
| [WP\_oEmbed::fetch()](../classes/wp_oembed/fetch) wp-includes/class-wp-oembed.php | Connects to a oEmbed provider and returns the result. |
| [WP\_oEmbed::\_fetch\_with\_format()](../classes/wp_oembed/_fetch_with_format) wp-includes/class-wp-oembed.php | Fetches result from an oEmbed provider for a specific format and complete provider URL |
| [\_wp\_link\_page()](_wp_link_page) wp-includes/post-template.php | Helper function for [wp\_link\_pages()](wp_link_pages) . |
| [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\_audio\_shortcode()](wp_audio_shortcode) wp-includes/media.php | Builds the Audio shortcode output. |
| [WP\_Rewrite::add\_rule()](../classes/wp_rewrite/add_rule) wp-includes/class-wp-rewrite.php | Adds a rewrite rule that transforms a URL structure to a set of query vars. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| [\_post\_format\_link()](_post_format_link) wp-includes/post-formats.php | Filters the post format term link to remove the format prefix. |
| [WP\_Scripts::do\_item()](../classes/wp_scripts/do_item) wp-includes/class-wp-scripts.php | Processes a script dependency. |
| [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. |
| [wp\_style\_loader\_src()](wp_style_loader_src) wp-includes/script-loader.php | Administration Screen CSS for changing the styles. |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Formalized the existing and already documented parameters by adding `...$args` to the function signature. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress post_class( string|string[] $class = '', int|WP_Post $post = null ) post\_class( string|string[] $class = '', int|WP\_Post $post = null )
=====================================================================
Displays the classes for the post container element.
`$class` string|string[] Optional One or more classes to add to the class list. Default: `''`
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Defaults to the global `$post`. Default: `null`
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function post_class( $class = '', $post = null ) {
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . esc_attr( implode( ' ', get_post_class( $class, $post ) ) ) . '"';
}
```
| Uses | Description |
| --- | --- |
| [get\_post\_class()](get_post_class) wp-includes/post-template.php | Retrieves an array of the class names for the post container element. |
| [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 media_upload_form( array $errors = null ) media\_upload\_form( array $errors = null )
===========================================
Outputs the legacy media upload form.
`$errors` array 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_form( $errors = null ) {
global $type, $tab, $is_IE, $is_opera;
if ( ! _device_can_upload() ) {
echo '<p>' . sprintf(
/* 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>';
return;
}
$upload_action_url = admin_url( 'async-upload.php' );
$post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
$_type = isset( $type ) ? $type : '';
$_tab = isset( $tab ) ? $tab : '';
$max_upload_size = wp_max_upload_size();
if ( ! $max_upload_size ) {
$max_upload_size = 0;
}
?>
<div id="media-upload-notice">
<?php
if ( isset( $errors['upload_notice'] ) ) {
echo $errors['upload_notice'];
}
?>
</div>
<div id="media-upload-error">
<?php
if ( isset( $errors['upload_error'] ) && is_wp_error( $errors['upload_error'] ) ) {
echo $errors['upload_error']->get_error_message();
}
?>
</div>
<?php
if ( is_multisite() && ! is_upload_space_available() ) {
/**
* Fires when an upload will exceed the defined upload space quota for a network site.
*
* @since 3.5.0
*/
do_action( 'upload_ui_over_quota' );
return;
}
/**
* Fires just before the legacy (pre-3.5.0) upload interface is loaded.
*
* @since 2.6.0
*/
do_action( 'pre-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
$post_params = array(
'post_id' => $post_id,
'_wpnonce' => wp_create_nonce( 'media-form' ),
'type' => $_type,
'tab' => $_tab,
'short' => '1',
);
/**
* Filters the media upload post parameters.
*
* @since 3.1.0 As 'swfupload_post_params'
* @since 3.3.0
*
* @param array $post_params An array of media upload parameters used by Plupload.
*/
$post_params = apply_filters( 'upload_post_params', $post_params );
/*
* Since 4.9 the `runtimes` setting is hardcoded in our version of Plupload to `html5,html4`,
* and the `flash_swf_url` and `silverlight_xap_url` are not used.
*/
$plupload_init = array(
'browse_button' => 'plupload-browse-button',
'container' => 'plupload-upload-ui',
'drop_element' => 'drag-drop-area',
'file_data_name' => 'async-upload',
'url' => $upload_action_url,
'filters' => array( 'max_file_size' => $max_upload_size . 'b' ),
'multipart_params' => $post_params,
);
/*
* Currently only iOS Safari supports multiple files uploading,
* but iOS 7.x has a bug that prevents uploading of videos when enabled.
* See #29602.
*/
if (
wp_is_mobile() &&
strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false &&
strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false
) {
$plupload_init['multi_selection'] = false;
}
// Check if WebP images can be edited.
if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) {
$plupload_init['webp_upload_error'] = true;
}
/**
* Filters the default Plupload settings.
*
* @since 3.3.0
*
* @param array $plupload_init An array of default settings used by Plupload.
*/
$plupload_init = apply_filters( 'plupload_init', $plupload_init );
?>
<script type="text/javascript">
<?php
// Verify size is an int. If not return default value.
$large_size_h = absint( get_option( 'large_size_h' ) );
if ( ! $large_size_h ) {
$large_size_h = 1024;
}
$large_size_w = absint( get_option( 'large_size_w' ) );
if ( ! $large_size_w ) {
$large_size_w = 1024;
}
?>
var resize_height = <?php echo $large_size_h; ?>, resize_width = <?php echo $large_size_w; ?>,
wpUploaderInit = <?php echo wp_json_encode( $plupload_init ); ?>;
</script>
<div id="plupload-upload-ui" class="hide-if-no-js">
<?php
/**
* Fires before the upload interface loads.
*
* @since 2.6.0 As 'pre-flash-upload-ui'
* @since 3.3.0
*/
do_action( 'pre-plupload-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
?>
<div id="drag-drop-area">
<div class="drag-drop-inside">
<p class="drag-drop-info"><?php _e( 'Drop files to upload' ); ?></p>
<p><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p>
<p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php esc_attr_e( 'Select Files' ); ?>" class="button" /></p>
</div>
</div>
<?php
/**
* Fires after the upload interface loads.
*
* @since 2.6.0 As 'post-flash-upload-ui'
* @since 3.3.0
*/
do_action( 'post-plupload-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
?>
</div>
<div id="html-upload-ui" class="hide-if-js">
<?php
/**
* Fires before the upload button in the media upload interface.
*
* @since 2.6.0
*/
do_action( 'pre-html-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
?>
<p id="async-upload-wrap">
<label class="screen-reader-text" for="async-upload"><?php _e( 'Upload' ); ?></label>
<input type="file" name="async-upload" id="async-upload" />
<?php submit_button( __( 'Upload' ), 'primary', 'html-upload', false ); ?>
<a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e( 'Cancel' ); ?></a>
</p>
<div class="clear"></div>
<?php
/**
* Fires after the upload button in the media upload interface.
*
* @since 2.6.0
*/
do_action( 'post-html-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
?>
</div>
<p class="max-upload-size">
<?php
/* translators: %s: Maximum allowed file size. */
printf( __( 'Maximum upload file size: %s.' ), esc_html( size_format( $max_upload_size ) ) );
?>
</p>
<?php
/**
* Fires on the post upload UI screen.
*
* Legacy (pre-3.5.0) media workflow hook.
*
* @since 2.6.0
*/
do_action( 'post-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
```
[apply\_filters( 'plupload\_init', array $plupload\_init )](../hooks/plupload_init)
Filters the default Plupload settings.
[do\_action( 'post-html-upload-ui' )](../hooks/post-html-upload-ui)
Fires after the upload button in the media upload interface.
[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-html-upload-ui' )](../hooks/pre-html-upload-ui)
Fires before the upload button in the media upload interface.
[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.
[apply\_filters( 'upload\_post\_params', array $post\_params )](../hooks/upload_post_params)
Filters the media upload post parameters.
[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 |
| --- | --- |
| [\_device\_can\_upload()](_device_can_upload) wp-includes/functions.php | Tests if the current device has the capability to upload files. |
| [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. |
| [wp\_image\_editor\_supports()](wp_image_editor_supports) wp-includes/media.php | Tests whether there is an editor that supports a given mime type or methods. |
| [\_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\_max\_upload\_size()](wp_max_upload_size) wp-includes/media.php | Determines the maximum upload size allowed in php.ini. |
| [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\_is\_mobile()](wp_is_mobile) wp-includes/vars.php | Test if the current browser runs on a mobile device (smart phone, tablet, etc.) |
| [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). |
| [size\_format()](size_format) wp-includes/functions.php | Converts a number of bytes to the largest unit the bytes will fit into. |
| [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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [media\_upload\_type\_form()](media_upload_type_form) wp-admin/includes/media.php | Outputs the legacy media upload form for a given media type. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress get_front_page_template(): string get\_front\_page\_template(): string
====================================
Retrieves path of front 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 ‘frontpage’.
* [get\_query\_template()](get_query_template)
string Full path to front page template file.
File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
```
function get_front_page_template() {
$templates = array( 'front-page.php' );
return get_query_template( 'frontpage', $templates );
}
```
| Uses | Description |
| --- | --- |
| [get\_query\_template()](get_query_template) wp-includes/template.php | Retrieves path to a template. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_delete_object_term_relationships( int $object_id, string|array $taxonomies ) wp\_delete\_object\_term\_relationships( int $object\_id, string|array $taxonomies )
====================================================================================
Unlinks the object from the taxonomy or taxonomies.
Will remove all relationships between the object and any terms in a particular taxonomy or taxonomies. Does not remove the term or taxonomy itself.
`$object_id` int Required The term object ID that refers to the term. `$taxonomies` string|array Required List of taxonomy names or single taxonomy name. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
$object_id = (int) $object_id;
if ( ! is_array( $taxonomies ) ) {
$taxonomies = array( $taxonomies );
}
foreach ( (array) $taxonomies as $taxonomy ) {
$term_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'ids' ) );
$term_ids = array_map( 'intval', $term_ids );
wp_remove_object_terms( $object_id, $term_ids, $taxonomy );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [wp\_remove\_object\_terms()](wp_remove_object_terms) wp-includes/taxonomy.php | Removes term(s) associated with a given object. |
| Used By | Description |
| --- | --- |
| [wp\_delete\_link()](wp_delete_link) wp-admin/includes/bookmark.php | Deletes a specified link from the database. |
| [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress the_author_firstname() the\_author\_firstname()
========================
This function has been deprecated. Use [the\_author\_meta()](the_author_meta) instead.
Display the first name of the author of the current post.
* [the\_author\_meta()](the_author_meta)
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function the_author_firstname() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'first_name\')' );
the_author_meta('first_name');
}
```
| 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 get_uploaded_header_images(): array get\_uploaded\_header\_images(): array
======================================
Gets the header images uploaded for the active theme.
array
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_uploaded_header_images() {
$header_images = array();
// @todo Caching.
$headers = get_posts(
array(
'post_type' => 'attachment',
'meta_key' => '_wp_attachment_is_custom_header',
'meta_value' => get_option( 'stylesheet' ),
'orderby' => 'none',
'nopaging' => true,
)
);
if ( empty( $headers ) ) {
return array();
}
foreach ( (array) $headers as $header ) {
$url = sanitize_url( wp_get_attachment_url( $header->ID ) );
$header_data = wp_get_attachment_metadata( $header->ID );
$header_index = $header->ID;
$header_images[ $header_index ] = array();
$header_images[ $header_index ]['attachment_id'] = $header->ID;
$header_images[ $header_index ]['url'] = $url;
$header_images[ $header_index ]['thumbnail_url'] = $url;
$header_images[ $header_index ]['alt_text'] = get_post_meta( $header->ID, '_wp_attachment_image_alt', true );
if ( isset( $header_data['attachment_parent'] ) ) {
$header_images[ $header_index ]['attachment_parent'] = $header_data['attachment_parent'];
} else {
$header_images[ $header_index ]['attachment_parent'] = '';
}
if ( isset( $header_data['width'] ) ) {
$header_images[ $header_index ]['width'] = $header_data['width'];
}
if ( isset( $header_data['height'] ) ) {
$header_images[ $header_index ]['height'] = $header_data['height'];
}
}
return $header_images;
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [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\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. |
| [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 |
| --- | --- |
| [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| [Custom\_Image\_Header::get\_uploaded\_header\_images()](../classes/custom_image_header/get_uploaded_header_images) wp-admin/includes/class-custom-image-header.php | Gets the previously uploaded header images. |
| [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::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\_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. |
| [\_get\_random\_header\_data()](_get_random_header_data) wp-includes/theme.php | Gets random header image data from registered images in theme. |
| Version | Description |
| --- | --- |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
| programming_docs |
wordpress wp_send_json_error( mixed $data = null, int $status_code = null, int $options ) wp\_send\_json\_error( mixed $data = null, int $status\_code = null, int $options )
===================================================================================
Sends a JSON response back to an Ajax request, indicating failure.
If the `$data` parameter is a [WP\_Error](../classes/wp_error) object, the errors within the object are processed and output as an array of error codes and corresponding messages. All other types are output without further processing.
`$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 `false`. If anything is passed to the function in the `$data` parameter, it will be encoded as the value for a `data` key.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_send_json_error( $data = null, $status_code = null, $options = 0 ) {
$response = array( 'success' => false );
if ( isset( $data ) ) {
if ( is_wp_error( $data ) ) {
$result = array();
foreach ( $data->errors as $code => $messages ) {
foreach ( $messages as $message ) {
$result[] = array(
'code' => $code,
'message' => $message,
);
}
}
$response['data'] = $result;
} else {
$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. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| 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\_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\_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\_process\_personal\_data\_erasure\_page()](wp_privacy_process_personal_data_erasure_page) wp-admin/includes/privacy-tools.php | Mark erasure requests as completed after processing is finished. |
| [wp\_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\_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\_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\_press\_this\_add\_category()](wp_ajax_press_this_add_category) wp-includes/deprecated.php | Ajax handler for creating new category from Press This. |
| [wp\_ajax\_update\_plugin()](wp_ajax_update_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for updating a plugin. |
| [wp\_ajax\_press\_this\_save\_post()](wp_ajax_press_this_save_post) wp-includes/deprecated.php | Ajax handler for saving a post from Press This. |
| [wp\_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\_heartbeat()](wp_ajax_heartbeat) wp-admin/includes/ajax-actions.php | Ajax handler for the Heartbeat API. |
| [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\_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\_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. |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | The `$data` parameter is now processed if a [WP\_Error](../classes/wp_error) object is passed in. |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress edit_link( int $link_id ): int|WP_Error edit\_link( int $link\_id ): int|WP\_Error
==========================================
Updates or inserts a link using values provided in $\_POST.
`$link_id` int Optional ID of the link to edit. Default 0. 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 edit_link( $link_id = 0 ) {
if ( ! current_user_can( 'manage_links' ) ) {
wp_die(
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to edit the links for this site.' ) . '</p>',
403
);
}
$_POST['link_url'] = esc_html( $_POST['link_url'] );
$_POST['link_url'] = esc_url( $_POST['link_url'] );
$_POST['link_name'] = esc_html( $_POST['link_name'] );
$_POST['link_image'] = esc_html( $_POST['link_image'] );
$_POST['link_rss'] = esc_url( $_POST['link_rss'] );
if ( ! isset( $_POST['link_visible'] ) || 'N' !== $_POST['link_visible'] ) {
$_POST['link_visible'] = 'Y';
}
if ( ! empty( $link_id ) ) {
$_POST['link_id'] = $link_id;
return wp_update_link( $_POST );
} else {
return wp_insert_link( $_POST );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_update\_link()](wp_update_link) wp-admin/includes/bookmark.php | Updates a link in the database. |
| [wp\_insert\_link()](wp_insert_link) wp-admin/includes/bookmark.php | Inserts a link into the database, or updates an existing 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\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Used By | Description |
| --- | --- |
| [add\_link()](add_link) wp-admin/includes/bookmark.php | Add a link to using values provided in $\_POST. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress remove_user_from_blog( int $user_id, int $blog_id, int $reassign ): true|WP_Error remove\_user\_from\_blog( int $user\_id, int $blog\_id, int $reassign ): true|WP\_Error
=======================================================================================
Removes a user from a blog.
Use the [‘remove\_user\_from\_blog’](../hooks/remove_user_from_blog) action to fire an event when users are removed from a blog.
Accepts an optional `$reassign` parameter, if you want to reassign the user’s blog posts to another user upon removal.
`$user_id` int Required ID of the user being removed. `$blog_id` int Optional ID of the blog the user is being removed from. Default 0. `$reassign` int Optional ID of the user to whom to reassign posts. Default 0. true|[WP\_Error](../classes/wp_error) True on success or a [WP\_Error](../classes/wp_error) object if the user doesn't exist.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function remove_user_from_blog( $user_id, $blog_id = 0, $reassign = 0 ) {
global $wpdb;
switch_to_blog( $blog_id );
$user_id = (int) $user_id;
/**
* Fires before a user is removed from a site.
*
* @since MU (3.0.0)
* @since 5.4.0 Added the `$reassign` parameter.
*
* @param int $user_id ID of the user being removed.
* @param int $blog_id ID of the blog the user is being removed from.
* @param int $reassign ID of the user to whom to reassign posts.
*/
do_action( 'remove_user_from_blog', $user_id, $blog_id, $reassign );
// If being removed from the primary blog, set a new primary
// if the user is assigned to multiple blogs.
$primary_blog = get_user_meta( $user_id, 'primary_blog', true );
if ( $primary_blog == $blog_id ) {
$new_id = '';
$new_domain = '';
$blogs = get_blogs_of_user( $user_id );
foreach ( (array) $blogs as $blog ) {
if ( $blog->userblog_id == $blog_id ) {
continue;
}
$new_id = $blog->userblog_id;
$new_domain = $blog->domain;
break;
}
update_user_meta( $user_id, 'primary_blog', $new_id );
update_user_meta( $user_id, 'source_domain', $new_domain );
}
$user = get_userdata( $user_id );
if ( ! $user ) {
restore_current_blog();
return new WP_Error( 'user_does_not_exist', __( 'That user does not exist.' ) );
}
$user->remove_all_caps();
$blogs = get_blogs_of_user( $user_id );
if ( count( $blogs ) == 0 ) {
update_user_meta( $user_id, 'primary_blog', '' );
update_user_meta( $user_id, 'source_domain', '' );
}
if ( $reassign ) {
$reassign = (int) $reassign;
$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $user_id ) );
$link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $user_id ) );
if ( ! empty( $post_ids ) ) {
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id ) );
array_walk( $post_ids, 'clean_post_cache' );
}
if ( ! empty( $link_ids ) ) {
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id ) );
array_walk( $link_ids, 'clean_bookmark_cache' );
}
}
restore_current_blog();
return true;
}
```
[do\_action( 'remove\_user\_from\_blog', int $user\_id, int $blog\_id, int $reassign )](../hooks/remove_user_from_blog)
Fires before a user is removed from a site.
| Uses | Description |
| --- | --- |
| [get\_user\_meta()](get_user_meta) wp-includes/user.php | Retrieves user meta field for a user. |
| [get\_blogs\_of\_user()](get_blogs_of_user) wp-includes/user.php | Gets the sites a user belongs to. |
| [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. |
| [switch\_to\_blog()](switch_to_blog) wp-includes/ms-blogs.php | Switch the current blog. |
| [restore\_current\_blog()](restore_current_blog) wp-includes/ms-blogs.php | Restore the current blog, after calling [switch\_to\_blog()](switch_to_blog) . |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [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 |
| --- | --- |
| [wp\_uninitialize\_site()](wp_uninitialize_site) wp-includes/ms-site.php | Runs the uninitialization routine for a given site. |
| [wpmu\_delete\_user()](wpmu_delete_user) wp-admin/includes/ms.php | Delete a user from the network and remove from all sites. |
| [wpmu\_delete\_blog()](wpmu_delete_blog) wp-admin/includes/ms.php | Delete a site. |
| [wp\_delete\_user()](wp_delete_user) wp-admin/includes/user.php | Remove user and optionally reassign posts and links to another user. |
| [add\_new\_user\_to\_blog()](add_new_user_to_blog) wp-includes/ms-functions.php | Adds a newly created user to the appropriate blog |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
| programming_docs |
wordpress get_post_field( string $field, int|WP_Post $post = null, string $context = 'display' ): string get\_post\_field( string $field, int|WP\_Post $post = null, string $context = 'display' ): string
=================================================================================================
Retrieves data from a post field based on Post ID.
Examples of the post field will be, ‘post\_type’, ‘post\_status’, ‘post\_content’, etc and based off of the post object property or key names.
The context values are based off of the taxonomy filter functions and supported values are found within those functions.
* [sanitize\_post\_field()](sanitize_post_field)
`$field` string Required Post field name. `$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Defaults to global $post. Default: `null`
`$context` string Optional How to filter the field. Accepts `'raw'`, `'edit'`, `'db'`, or `'display'`. Default `'display'`. Default: `'display'`
string The value of the post field on success, empty string on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_post_field( $field, $post = null, $context = 'display' ) {
$post = get_post( $post );
if ( ! $post ) {
return '';
}
if ( ! isset( $post->$field ) ) {
return '';
}
return sanitize_post_field( $field, $post->$field, $post->ID, $context );
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_post\_field()](sanitize_post_field) wp-includes/post.php | Sanitizes a post field based on context. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [\_wp\_translate\_postdata()](_wp_translate_postdata) wp-admin/includes/post.php | Renames `$_POST` data from form names to DB post columns. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | The `$post` parameter was made optional. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress get_feed_link( string $feed = '' ): string get\_feed\_link( string $feed = '' ): string
============================================
Retrieves the permalink for the feed type.
`$feed` string Optional Feed type. Possible values include `'rss2'`, `'atom'`.
Default is the value of [get\_default\_feed()](get_default_feed) . Default: `''`
string The feed permalink.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_feed_link( $feed = '' ) {
global $wp_rewrite;
$permalink = $wp_rewrite->get_feed_permastruct();
if ( $permalink ) {
if ( false !== strpos( $feed, 'comments_' ) ) {
$feed = str_replace( 'comments_', '', $feed );
$permalink = $wp_rewrite->get_comment_feed_permastruct();
}
if ( get_default_feed() == $feed ) {
$feed = '';
}
$permalink = str_replace( '%feed%', $feed, $permalink );
$permalink = preg_replace( '#/+#', '/', "/$permalink" );
$output = home_url( user_trailingslashit( $permalink, 'feed' ) );
} else {
if ( empty( $feed ) ) {
$feed = get_default_feed();
}
if ( false !== strpos( $feed, 'comments_' ) ) {
$feed = str_replace( 'comments_', 'comments-', $feed );
}
$output = home_url( "?feed={$feed}" );
}
/**
* Filters the feed type permalink.
*
* @since 1.5.0
*
* @param string $output The feed permalink.
* @param string $feed The feed type. Possible values include 'rss2', 'atom',
* or an empty string for the default feed type.
*/
return apply_filters( 'feed_link', $output, $feed );
}
```
[apply\_filters( 'feed\_link', string $output, string $feed )](../hooks/feed_link)
Filters the feed type permalink.
| Uses | Description |
| --- | --- |
| [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. |
| [WP\_Rewrite::get\_feed\_permastruct()](../classes/wp_rewrite/get_feed_permastruct) wp-includes/class-wp-rewrite.php | Retrieves the feed permalink structure. |
| [WP\_Rewrite::get\_comment\_feed\_permastruct()](../classes/wp_rewrite/get_comment_feed_permastruct) wp-includes/class-wp-rewrite.php | Retrieves the comment feed permalink structure. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [feed\_links()](feed_links) wp-includes/general-template.php | Displays the links to the general feeds. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [the\_feed\_link()](the_feed_link) wp-includes/link-template.php | Displays the permalink for the feed type. |
| [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 taxonomy_meta_box_sanitize_cb_input( string $taxonomy, array|string $terms ): array taxonomy\_meta\_box\_sanitize\_cb\_input( string $taxonomy, array|string $terms ): array
========================================================================================
Sanitizes POST values from an input taxonomy metabox.
`$taxonomy` string Required The taxonomy name. `$terms` array|string Required Raw term data from the `'tax_input'` field. array
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function taxonomy_meta_box_sanitize_cb_input( $taxonomy, $terms ) {
/*
* Assume that a 'tax_input' string is a comma-separated list of term names.
* Some languages may use a character other than a comma as a delimiter, so we standardize on
* commas before parsing the list.
*/
if ( ! is_array( $terms ) ) {
$comma = _x( ',', 'tag delimiter' );
if ( ',' !== $comma ) {
$terms = str_replace( $comma, ',', $terms );
}
$terms = explode( ',', trim( $terms, " \n\t\r\0\x0B," ) );
}
$clean_terms = array();
foreach ( $terms as $term ) {
// Empty terms are invalid input.
if ( empty( $term ) ) {
continue;
}
$_term = get_terms(
array(
'taxonomy' => $taxonomy,
'name' => $term,
'fields' => 'ids',
'hide_empty' => false,
)
);
if ( ! empty( $_term ) ) {
$clean_terms[] = (int) $_term[0];
} else {
// No existing term was found, so pass the string. A new term will be created.
$clean_terms[] = $term;
}
}
return $clean_terms;
}
```
| Uses | Description |
| --- | --- |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress rest_filter_response_fields( WP_REST_Response $response, WP_REST_Server $server, WP_REST_Request $request ): WP_REST_Response rest\_filter\_response\_fields( WP\_REST\_Response $response, WP\_REST\_Server $server, WP\_REST\_Request $request ): WP\_REST\_Response
========================================================================================================================================
Filters the REST API response to include only a white-listed set of response object fields.
`$response` [WP\_REST\_Response](../classes/wp_rest_response) Required Current response being served. `$server` [WP\_REST\_Server](../classes/wp_rest_server) Required ResponseHandler instance (usually [WP\_REST\_Server](../classes/wp_rest_server)). `$request` [WP\_REST\_Request](../classes/wp_rest_request) Required The request that was used to make current response. [WP\_REST\_Response](../classes/wp_rest_response) Response to be served, trimmed down to contain a subset of fields.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_filter_response_fields( $response, $server, $request ) {
if ( ! isset( $request['_fields'] ) || $response->is_error() ) {
return $response;
}
$data = $response->get_data();
$fields = wp_parse_list( $request['_fields'] );
if ( 0 === count( $fields ) ) {
return $response;
}
// Trim off outside whitespace from the comma delimited list.
$fields = array_map( 'trim', $fields );
// Create nested array of accepted field hierarchy.
$fields_as_keyed = array();
foreach ( $fields as $field ) {
$parts = explode( '.', $field );
$ref = &$fields_as_keyed;
while ( count( $parts ) > 1 ) {
$next = array_shift( $parts );
if ( isset( $ref[ $next ] ) && true === $ref[ $next ] ) {
// Skip any sub-properties if their parent prop is already marked for inclusion.
break 2;
}
$ref[ $next ] = isset( $ref[ $next ] ) ? $ref[ $next ] : array();
$ref = &$ref[ $next ];
}
$last = array_shift( $parts );
$ref[ $last ] = true;
}
if ( wp_is_numeric_array( $data ) ) {
$new_data = array();
foreach ( $data as $item ) {
$new_data[] = _rest_array_intersect_key_recursive( $item, $fields_as_keyed );
}
} else {
$new_data = _rest_array_intersect_key_recursive( $data, $fields_as_keyed );
}
$response->set_data( $new_data );
return $response;
}
```
| Uses | Description |
| --- | --- |
| [\_rest\_array\_intersect\_key\_recursive()](_rest_array_intersect_key_recursive) wp-includes/rest-api.php | Recursively computes the intersection of arrays using keys for comparison. |
| [wp\_parse\_list()](wp_parse_list) wp-includes/functions.php | Converts a comma- or space-separated list of scalar values to an array. |
| [wp\_is\_numeric\_array()](wp_is_numeric_array) wp-includes/functions.php | Determines if the variable is a numeric-indexed array. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Introduced. |
wordpress get_query_var( string $var, mixed $default = '' ): mixed get\_query\_var( string $var, mixed $default = '' ): mixed
==========================================================
Retrieves the value of a query variable in the [WP\_Query](../classes/wp_query) class.
`$var` string Required The variable key to retrieve. `$default` mixed Optional Value to return if the query variable is not set. Default: `''`
mixed Contents of the query variable.
[get\_query\_var()](get_query_var) only retrieves **public query variables** that are recognized by [WP\_Query](../classes/wp_query). This means that if you create your own custom URLs with their own query variables, [get\_query\_var()](get_query_var) **will not retrieve them** without some further work (see below).
In order to be able to add and work with your own custom query vars that you append to URLs (eg: “http://mysite.com/some\_page/?my\_var=foo” – for example using [add\_query\_arg()](add_query_arg) ) you need to add them to the **public query variables** available to [WP\_Query](../classes/wp_query). These are built up when [WP\_Query](../classes/wp_query) instantiates, but fortunately are passed through a filter ‘[query\_vars](../hooks/query_vars)‘ before they are actually used to populate the $query\_vars property of [WP\_Query](../classes/wp_query).
So, to expose your new, custom query variable to [WP\_Query](../classes/wp_query) hook into the ‘[query\_vars](../hooks/query_vars)‘ filter, add your query variable to the $vars array that is passed by the filter, and remember to return the array as the output of your filter function. See below:
```
function themeslug_query_vars( $qvars ) {
$qvars[] = 'custom_query_var';
return $qvars;
}
add_filter( 'query_vars', 'themeslug_query_vars' );
```
Getting current page pagination number
```
$paged = get_query_var( 'paged', 1 );
echo 'Currently Browsing Page ', $paged;
```
To get the current pagination number on a [static front page](https://wordpress.org/support/article/creating-a-static-front-page/) (Page template) you have to use the ‘page’ query variable:
```
$paged = get_query_var( 'page', 1 );
echo 'Currently Browsing Page ', $paged, ' on a static front page';
```
Note: The query variable ‘page’ holds the pagenumber for a single paginated Post or Page that includes the Quicktag in the post content.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function get_query_var( $var, $default = '' ) {
global $wp_query;
return $wp_query->get( $var, $default );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::get()](../classes/wp_query/get) wp-includes/class-wp-query.php | Retrieves the value of a query variable. |
| Used By | Description |
| --- | --- |
| [build\_comment\_query\_vars\_from\_block()](build_comment_query_vars_from_block) wp-includes/blocks.php | Helper function that constructs a comment query vars array from the passed block properties. |
| [WP\_Sitemaps::render\_sitemaps()](../classes/wp_sitemaps/render_sitemaps) wp-includes/sitemaps/class-wp-sitemaps.php | Renders sitemap templates based on rewrite rules. |
| [\_find\_post\_by\_old\_slug()](_find_post_by_old_slug) wp-includes/query.php | Find the post ID for redirecting an old slug. |
| [\_find\_post\_by\_old\_date()](_find_post_by_old_date) wp-includes/query.php | Find the post ID for redirecting an old date. |
| [get\_the\_post\_type\_description()](get_the_post_type_description) wp-includes/general-template.php | Retrieves the description for a post type archive. |
| [wp\_get\_canonical\_url()](wp_get_canonical_url) wp-includes/link-template.php | Returns the canonical URL for a post. |
| [wp\_dropdown\_categories()](wp_dropdown_categories) wp-includes/category-template.php | Displays or retrieves the HTML dropdown list of categories. |
| [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. |
| [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. |
| [single\_month\_title()](single_month_title) wp-includes/general-template.php | Displays or retrieves page title for post archive based on date. |
| [wp\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. |
| [post\_type\_archive\_title()](post_type_archive_title) wp-includes/general-template.php | Displays or retrieves title for a post type archive. |
| [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. |
| [do\_feed()](do_feed) wp-includes/functions.php | Loads the feed template from the use of an action hook. |
| [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. |
| [wp\_dropdown\_users()](wp_dropdown_users) wp-includes/user.php | Creates dropdown HTML content of users. |
| [get\_archive\_template()](get_archive_template) wp-includes/template.php | Retrieves path of archive template in current or parent template. |
| [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. |
| [get\_page\_template()](get_page_template) wp-includes/template.php | Retrieves path of page template in current or parent template. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| [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. |
| [wp\_list\_comments()](wp_list_comments) wp-includes/comment-template.php | Displays a list of comments. |
| [comments\_template()](comments_template) wp-includes/comment-template.php | Loads the comment template specified in $file. |
| [get\_comment\_link()](get_comment_link) wp-includes/comment-template.php | Retrieves the link to a given comment. |
| [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. |
| Version | Description |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | The `$default` argument was introduced. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_get_attachment_id3_keys( WP_Post $attachment, string $context = 'display' ): string[] wp\_get\_attachment\_id3\_keys( WP\_Post $attachment, string $context = 'display' ): string[]
=============================================================================================
Returns useful keys to use to lookup data from an attachment’s stored metadata.
`$attachment` [WP\_Post](../classes/wp_post) Required The current attachment, provided for context. `$context` string Optional The context. Accepts `'edit'`, `'display'`. Default `'display'`. Default: `'display'`
string[] Key/value pairs of field keys to labels.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_get_attachment_id3_keys( $attachment, $context = 'display' ) {
$fields = array(
'artist' => __( 'Artist' ),
'album' => __( 'Album' ),
);
if ( 'display' === $context ) {
$fields['genre'] = __( 'Genre' );
$fields['year'] = __( 'Year' );
$fields['length_formatted'] = _x( 'Length', 'video or audio' );
} elseif ( 'js' === $context ) {
$fields['bitrate'] = __( 'Bitrate' );
$fields['bitrate_mode'] = __( 'Bitrate Mode' );
}
/**
* Filters the editable list of keys to look up data from an attachment's metadata.
*
* @since 3.9.0
*
* @param array $fields Key/value pairs of field keys to labels.
* @param WP_Post $attachment Attachment object.
* @param string $context The context. Accepts 'edit', 'display'. Default 'display'.
*/
return apply_filters( 'wp_get_attachment_id3_keys', $fields, $attachment, $context );
}
```
[apply\_filters( 'wp\_get\_attachment\_id3\_keys', array $fields, WP\_Post $attachment, string $context )](../hooks/wp_get_attachment_id3_keys)
Filters the editable list of keys to look up data from an attachment’s metadata.
| Uses | Description |
| --- | --- |
| [\_\_()](__) 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. |
| Used By | Description |
| --- | --- |
| [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. |
| [wp\_prepare\_attachment\_for\_js()](wp_prepare_attachment_for_js) wp-includes/media.php | Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model. |
| [wp\_playlist\_shortcode()](wp_playlist_shortcode) wp-includes/media.php | Builds the Playlist shortcode output. |
| Version | Description |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
| programming_docs |
wordpress is_rtl(): bool is\_rtl(): bool
===============
Determines whether the current locale is right-to-left (RTL).
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 locale is RTL.
Deprecate get\_bloginfo(‘text\_direction’) in favor of [is\_rtl()](is_rtl) in [Version 3.0](https://wordpress.org/support/wordpress-version/version-3-0/).
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function is_rtl() {
global $wp_locale;
if ( ! ( $wp_locale instanceof WP_Locale ) ) {
return false;
}
return $wp_locale->is_rtl();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Locale::is\_rtl()](../classes/wp_locale/is_rtl) wp-includes/class-wp-locale.php | Checks if current locale is RTL. |
| Used By | Description |
| --- | --- |
| [wp\_enqueue\_block\_style()](wp_enqueue_block_style) wp-includes/script-loader.php | Enqueues a stylesheet for a specific block. |
| [get\_default\_block\_editor\_settings()](get_default_block_editor_settings) wp-includes/block-editor.php | Returns the default block editor settings. |
| [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. |
| [WP\_Sitemaps\_Stylesheet::get\_stylesheet\_css()](../classes/wp_sitemaps_stylesheet/get_stylesheet_css) wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php | Gets the CSS to be included in sitemap XSL stylesheets. |
| [\_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\_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\_Editors::print\_default\_editor\_scripts()](../classes/_wp_editors/print_default_editor_scripts) wp-includes/class-wp-editor.php | Print (output) all editor scripts and default settings. |
| [WP\_Customize\_Site\_Icon\_Control::content\_template()](../classes/wp_customize_site_icon_control/content_template) wp-includes/customize/class-wp-customize-site-icon-control.php | Renders a JS template for the content of the site icon control. |
| [get\_language\_attributes()](get_language_attributes) wp-includes/general-template.php | Gets the language attributes for the ‘html’ tag. |
| [login\_header()](login_header) wp-login.php | Output the login page header. |
| [display\_header()](display_header) wp-admin/install.php | Display installation 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. |
| [add\_editor\_style()](add_editor_style) wp-includes/theme.php | Adds callback for custom TinyMCE editor stylesheets. |
| [register\_admin\_color\_schemes()](register_admin_color_schemes) wp-includes/general-template.php | Registers the default admin color schemes. |
| [wp\_admin\_css()](wp_admin_css) wp-includes/general-template.php | Enqueues or directly prints a stylesheet link to the specified CSS file. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [\_mce\_set\_direction()](_mce_set_direction) wp-includes/functions.php | Sets the localized direction for MCE plugin. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| [gallery\_shortcode()](gallery_shortcode) wp-includes/media.php | Builds the Gallery shortcode output. |
| [wp\_default\_styles()](wp_default_styles) wp-includes/script-loader.php | Assigns default styles to $styles object. |
| [\_WP\_Editors::wp\_mce\_translation()](../classes/_wp_editors/wp_mce_translation) wp-includes/class-wp-editor.php | Translates the default TinyMCE strings and returns them as JSON encoded object ready to be loaded with tinymce.addI18n(), or as JS snippet that should run after tinymce.js is loaded. |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress has_block( string $block_name, int|string|WP_Post|null $post = null ): bool has\_block( string $block\_name, int|string|WP\_Post|null $post = null ): bool
==============================================================================
Determines whether a $post or a string contains a specific block type.
This test optimizes for performance rather than strict accuracy, detecting whether the block type exists but not validating its structure and not checking reusable blocks. For strict accuracy, you should use the block parser on post content.
* [parse\_blocks()](parse_blocks)
`$block_name` string Required Full block type to look for. `$post` int|string|[WP\_Post](../classes/wp_post)|null Optional Post content, post ID, or post object.
Defaults to global $post. Default: `null`
bool Whether the post content contains the specified block.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function has_block( $block_name, $post = null ) {
if ( ! has_blocks( $post ) ) {
return false;
}
if ( ! is_string( $post ) ) {
$wp_post = get_post( $post );
if ( $wp_post instanceof WP_Post ) {
$post = $wp_post->post_content;
}
}
/*
* Normalize block name to include namespace, if provided as non-namespaced.
* This matches behavior for WordPress 5.0.0 - 5.3.0 in matching blocks by
* their serialized names.
*/
if ( false === strpos( $block_name, '/' ) ) {
$block_name = 'core/' . $block_name;
}
// Test for existence of block by its fully qualified name.
$has_block = false !== strpos( $post, '<!-- wp:' . $block_name . ' ' );
if ( ! $has_block ) {
/*
* If the given block name would serialize to a different name, test for
* existence by the serialized form.
*/
$serialized_block_name = strip_core_block_namespace( $block_name );
if ( $serialized_block_name !== $block_name ) {
$has_block = false !== strpos( $post, '<!-- wp:' . $serialized_block_name . ' ' );
}
}
return $has_block;
}
```
| Uses | Description |
| --- | --- |
| [strip\_core\_block\_namespace()](strip_core_block_namespace) wp-includes/blocks.php | Returns the block name to use for serialization. This will remove the default “core/” namespace from a block name. |
| [has\_blocks()](has_blocks) wp-includes/blocks.php | Determines whether a post or content string has blocks. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [get\_the\_content()](get_the_content) wp-includes/post-template.php | Retrieves the post content. |
| [get\_post\_galleries()](get_post_galleries) wp-includes/media.php | Retrieves galleries from the passed post’s content. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress wp_get_plugin_file_editable_extensions( string $plugin ): string[] wp\_get\_plugin\_file\_editable\_extensions( string $plugin ): string[]
=======================================================================
Gets the list of file extensions that are editable in plugins.
`$plugin` string Required Path to the plugin file relative to the plugins directory. string[] Array of editable file extensions.
File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/)
```
function wp_get_plugin_file_editable_extensions( $plugin ) {
$default_types = array(
'bash',
'conf',
'css',
'diff',
'htm',
'html',
'http',
'inc',
'include',
'js',
'json',
'jsx',
'less',
'md',
'patch',
'php',
'php3',
'php4',
'php5',
'php7',
'phps',
'phtml',
'sass',
'scss',
'sh',
'sql',
'svg',
'text',
'txt',
'xml',
'yaml',
'yml',
);
/**
* Filters the list of file types allowed for editing in the plugin file editor.
*
* @since 2.8.0
* @since 4.9.0 Added the `$plugin` parameter.
*
* @param string[] $default_types An array of editable plugin file extensions.
* @param string $plugin Path to the plugin file relative to the plugins directory.
*/
$file_types = (array) apply_filters( 'editable_extensions', $default_types, $plugin );
return $file_types;
}
```
[apply\_filters( 'editable\_extensions', string[] $default\_types, string $plugin )](../hooks/editable_extensions)
Filters the list of file types allowed for editing in the plugin file editor.
| 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\_edit\_theme\_plugin\_file()](wp_edit_theme_plugin_file) wp-admin/includes/file.php | Attempts to edit a file for a theme or plugin. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
wordpress wp_get_nav_menu_to_edit( int $menu_id ): string|WP_Error wp\_get\_nav\_menu\_to\_edit( int $menu\_id ): string|WP\_Error
===============================================================
Returns the menu formatted to edit.
`$menu_id` int Optional The ID of the menu to format. Default 0. string|[WP\_Error](../classes/wp_error) The menu formatted to edit or error object on failure.
File: `wp-admin/includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/nav-menu.php/)
```
function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
$menu = wp_get_nav_menu_object( $menu_id );
// If the menu exists, get its items.
if ( is_nav_menu( $menu ) ) {
$menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'post_status' => 'any' ) );
$result = '<div id="menu-instructions" class="post-body-plain';
$result .= ( ! empty( $menu_items ) ) ? ' menu-instructions-inactive">' : '">';
$result .= '<p>' . __( 'Add menu items from the column on the left.' ) . '</p>';
$result .= '</div>';
if ( empty( $menu_items ) ) {
return $result . ' <ul class="menu" id="menu-to-edit"> </ul>';
}
/**
* Filters the Walker class used when adding nav menu items.
*
* @since 3.0.0
*
* @param string $class The walker class to use. Default 'Walker_Nav_Menu_Edit'.
* @param int $menu_id ID of the menu being rendered.
*/
$walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id );
if ( class_exists( $walker_class_name ) ) {
$walker = new $walker_class_name;
} else {
return new WP_Error(
'menu_walker_not_exist',
sprintf(
/* translators: %s: Walker class name. */
__( 'The Walker class named %s does not exist.' ),
'<strong>' . $walker_class_name . '</strong>'
)
);
}
$some_pending_menu_items = false;
$some_invalid_menu_items = false;
foreach ( (array) $menu_items as $menu_item ) {
if ( isset( $menu_item->post_status ) && 'draft' === $menu_item->post_status ) {
$some_pending_menu_items = true;
}
if ( ! empty( $menu_item->_invalid ) ) {
$some_invalid_menu_items = true;
}
}
if ( $some_pending_menu_items ) {
$result .= '<div class="notice notice-info notice-alt inline"><p>' . __( 'Click Save Menu to make pending menu items public.' ) . '</p></div>';
}
if ( $some_invalid_menu_items ) {
$result .= '<div class="notice notice-error notice-alt inline"><p>' . __( 'There are some invalid menu items. Please check or delete them.' ) . '</p></div>';
}
$result .= '<ul class="menu" id="menu-to-edit"> ';
$result .= walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $menu_items ), 0, (object) array( 'walker' => $walker ) );
$result .= ' </ul> ';
return $result;
} elseif ( is_wp_error( $menu ) ) {
return $menu;
}
}
```
[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 |
| --- | --- |
| [walk\_nav\_menu\_tree()](walk_nav_menu_tree) wp-includes/nav-menu-template.php | Retrieves the HTML list content for nav menu items. |
| [wp\_get\_nav\_menu\_items()](wp_get_nav_menu_items) wp-includes/nav-menu.php | Retrieves all menu items of a navigation menu. |
| [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. |
| [\_\_()](__) 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 |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_password_reset_key( WP_User $user ): string|WP_Error get\_password\_reset\_key( WP\_User $user ): string|WP\_Error
=============================================================
Creates, stores, then returns a password reset key for user.
`$user` [WP\_User](../classes/wp_user) Required User to retrieve password reset key for. string|[WP\_Error](../classes/wp_error) Password reset key on success. [WP\_Error](../classes/wp_error) on error.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function get_password_reset_key( $user ) {
global $wp_hasher;
if ( ! ( $user instanceof WP_User ) ) {
return new WP_Error( 'invalidcombo', __( '<strong>Error:</strong> There is no account with that username or email address.' ) );
}
/**
* Fires before a new password is retrieved.
*
* Use the {@see 'retrieve_password'} hook instead.
*
* @since 1.5.0
* @deprecated 1.5.1 Misspelled. Use {@see 'retrieve_password'} hook instead.
*
* @param string $user_login The user login name.
*/
do_action_deprecated( 'retreive_password', array( $user->user_login ), '1.5.1', 'retrieve_password' );
/**
* Fires before a new password is retrieved.
*
* @since 1.5.1
*
* @param string $user_login The user login name.
*/
do_action( 'retrieve_password', $user->user_login );
$allow = true;
if ( is_multisite() && is_user_spammy( $user ) ) {
$allow = false;
}
/**
* Filters whether to allow a password to be reset.
*
* @since 2.7.0
*
* @param bool $allow Whether to allow the password to be reset. Default true.
* @param int $user_id The ID of the user attempting to reset a password.
*/
$allow = apply_filters( 'allow_password_reset', $allow, $user->ID );
if ( ! $allow ) {
return new WP_Error( 'no_password_reset', __( 'Password reset is not allowed for this user' ) );
} elseif ( is_wp_error( $allow ) ) {
return $allow;
}
// Generate something random for a password reset key.
$key = wp_generate_password( 20, false );
/**
* Fires when a password reset key is generated.
*
* @since 2.5.0
*
* @param string $user_login The username for the user.
* @param string $key The generated password reset key.
*/
do_action( 'retrieve_password_key', $user->user_login, $key );
// Now insert the key, hashed, into the DB.
if ( empty( $wp_hasher ) ) {
require_once ABSPATH . WPINC . '/class-phpass.php';
$wp_hasher = new PasswordHash( 8, true );
}
$hashed = time() . ':' . $wp_hasher->HashPassword( $key );
$key_saved = wp_update_user(
array(
'ID' => $user->ID,
'user_activation_key' => $hashed,
)
);
if ( is_wp_error( $key_saved ) ) {
return $key_saved;
}
return $key;
}
```
[apply\_filters( 'allow\_password\_reset', bool $allow, int $user\_id )](../hooks/allow_password_reset)
Filters whether to allow a password to be reset.
[do\_action\_deprecated( 'retreive\_password', string $user\_login )](../hooks/retreive_password)
Fires before a new password is retrieved.
[do\_action( 'retrieve\_password', string $user\_login )](../hooks/retrieve_password)
Fires before a new password is retrieved.
[do\_action( 'retrieve\_password\_key', string $user\_login, string $key )](../hooks/retrieve_password_key)
Fires when a password reset key is generated.
| Uses | Description |
| --- | --- |
| [do\_action\_deprecated()](do_action_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated action hook. |
| [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [is\_user\_spammy()](is_user_spammy) wp-includes/ms-functions.php | Determines whether a user is marked as a spammer, based on user login. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [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. |
| [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 |
| --- | --- |
| [retrieve\_password()](retrieve_password) wp-includes/user.php | Handles sending a password retrieval email to a user. |
| [wp\_new\_user\_notification()](wp_new_user_notification) wp-includes/pluggable.php | Emails login credentials to a newly-registered user. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress option_update_filter( array $options ): array option\_update\_filter( array $options ): array
===============================================
Refreshes the value of the allowed options list available via the ‘allowed\_options’ hook.
See the [‘allowed\_options’](../hooks/allowed_options) filter.
`$options` array Required array
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function option_update_filter( $options ) {
global $new_allowed_options;
if ( is_array( $new_allowed_options ) ) {
$options = add_allowed_options( $new_allowed_options, $options );
}
return $options;
}
```
| Uses | Description |
| --- | --- |
| [add\_allowed\_options()](add_allowed_options) wp-admin/includes/plugin.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/) | `$new_whitelist_options` was renamed to `$new_allowed_options`. Please consider writing more inclusive code. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
| programming_docs |
wordpress wp_image_matches_ratio( int $source_width, int $source_height, int $target_width, int $target_height ): bool wp\_image\_matches\_ratio( int $source\_width, int $source\_height, int $target\_width, int $target\_height ): bool
===================================================================================================================
Helper function to test if aspect ratios for two images match.
`$source_width` int Required Width of the first image in pixels. `$source_height` int Required Height of the first image in pixels. `$target_width` int Required Width of the second image in pixels. `$target_height` int Required Height of the second image in pixels. bool True if aspect ratios match within 1px. False if not.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_image_matches_ratio( $source_width, $source_height, $target_width, $target_height ) {
/*
* To test for varying crops, we constrain the dimensions of the larger image
* to the dimensions of the smaller image and see if they match.
*/
if ( $source_width > $target_width ) {
$constrained_size = wp_constrain_dimensions( $source_width, $source_height, $target_width );
$expected_size = array( $target_width, $target_height );
} else {
$constrained_size = wp_constrain_dimensions( $target_width, $target_height, $source_width );
$expected_size = array( $source_width, $source_height );
}
// If the image dimensions are within 1px of the expected size, we consider it a match.
$matched = ( wp_fuzzy_number_match( $constrained_size[0], $expected_size[0] ) && wp_fuzzy_number_match( $constrained_size[1], $expected_size[1] ) );
return $matched;
}
```
| 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. |
| Used By | Description |
| --- | --- |
| [wp\_calculate\_image\_srcset()](wp_calculate_image_srcset) wp-includes/media.php | A helper function to calculate the image sources to include in a ‘srcset’ attribute. |
| [image\_get\_intermediate\_size()](image_get_intermediate_size) wp-includes/media.php | Retrieves the image’s intermediate size (resized) path, width, and height. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress get_post_type( int|WP_Post|null $post = null ): string|false get\_post\_type( int|WP\_Post|null $post = null ): string|false
===============================================================
Retrieves the post type of the current post or of a given post.
`$post` int|[WP\_Post](../classes/wp_post)|null Optional Post ID or post object. Default is global $post. Default: `null`
string|false Post type on success, false on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_post_type( $post = null ) {
$post = get_post( $post );
if ( $post ) {
return $post->post_type;
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Menu\_Items\_Controller::prepare\_links()](../classes/wp_rest_menu_items_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares links for the request. |
| [WP\_REST\_Menu\_Items\_Controller::prepare\_item\_for\_database()](../classes/wp_rest_menu_items_controller/prepare_item_for_database) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares a single post for create or update. |
| [\_disable\_content\_editor\_for\_navigation\_post\_type()](_disable_content_editor_for_navigation_post_type) wp-admin/includes/post.php | This callback disables the content editor for wp\_navigation type posts. |
| [\_enable\_content\_editor\_for\_navigation\_post\_type()](_enable_content_editor_for_navigation_post_type) wp-admin/includes/post.php | This callback enables content editor for wp\_navigation type posts. |
| [wp\_force\_plain\_post\_permalink()](wp_force_plain_post_permalink) wp-includes/link-template.php | Determine whether post should always use a plain permalink structure. |
| [is\_post\_publicly\_viewable()](is_post_publicly_viewable) wp-includes/post.php | Determines whether a post is publicly viewable. |
| [WP\_Customize\_Manager::preserve\_insert\_changeset\_post\_content()](../classes/wp_customize_manager/preserve_insert_changeset_post_content) wp-includes/class-wp-customize-manager.php | Preserves the initial JSON post\_content passed to save into the post. |
| [get\_object\_subtype()](get_object_subtype) wp-includes/meta.php | Returns the object subtype for a given object ID of a specific type. |
| [wp\_check\_for\_changed\_dates()](wp_check_for_changed_dates) wp-includes/post.php | Checks for changed dates for published post objects and save the old date. |
| [WP\_Customize\_Manager::grant\_edit\_post\_capability\_for\_changeset()](../classes/wp_customize_manager/grant_edit_post_capability_for_changeset) wp-includes/class-wp-customize-manager.php | Re-maps ‘edit\_post’ meta cap for a customize\_changeset post to be the same as ‘customize’ maps. |
| [WP\_Embed::find\_oembed\_post\_id()](../classes/wp_embed/find_oembed_post_id) wp-includes/class-wp-embed.php | Finds the oEmbed cache post ID for a given cache key. |
| [WP\_Widget\_Media\_Gallery::has\_content()](../classes/wp_widget_media_gallery/has_content) wp-includes/widgets/class-wp-widget-media-gallery.php | Whether the widget has content to show. |
| [WP\_Widget\_Media::has\_content()](../classes/wp_widget_media/has_content) wp-includes/widgets/class-wp-widget-media.php | Whether the widget has content to show. |
| [WP\_Customize\_Manager::has\_published\_pages()](../classes/wp_customize_manager/has_published_pages) wp-includes/class-wp-customize-manager.php | Returns whether there are published pages. |
| [WP\_Customize\_Manager::find\_changeset\_post\_id()](../classes/wp_customize_manager/find_changeset_post_id) wp-includes/class-wp-customize-manager.php | Finds the changeset post ID for a given changeset UUID. |
| [WP\_Customize\_Manager::get\_changeset\_post\_data()](../classes/wp_customize_manager/get_changeset_post_data) wp-includes/class-wp-customize-manager.php | Gets the data stored in a changeset post. |
| [WP\_REST\_Attachments\_Controller::create\_item()](../classes/wp_rest_attachments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Creates a single attachment. |
| [WP\_REST\_Attachments\_Controller::update\_item()](../classes/wp_rest_attachments_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Updates a single attachment. |
| [WP\_REST\_Posts\_Controller::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\_Customize\_Nav\_Menus::save\_nav\_menus\_created\_posts()](../classes/wp_customize_nav_menus/save_nav_menus_created_posts) wp-includes/class-wp-customize-nav-menus.php | Publishes the auto-draft posts that were created for nav menu items. |
| [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. |
| [\_update\_posts\_count\_on\_transition\_post\_status()](_update_posts_count_on_transition_post_status) wp-includes/ms-blogs.php | Handler for updating the current site’s posts count when a post status changes. |
| [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. |
| [\_wp\_ajax\_menu\_quick\_search()](_wp_ajax_menu_quick_search) wp-admin/includes/nav-menu.php | Prints the appropriate response to a menu quick search. |
| [get\_the\_category\_list()](get_the_category_list) wp-includes/category-template.php | Retrieves category list for a post in either HTML list or custom format. |
| [WP\_Theme::get\_page\_templates()](../classes/wp_theme/get_page_templates) wp-includes/class-wp-theme.php | Returns the theme’s post templates for a given post type. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [wp\_check\_for\_changed\_slugs()](wp_check_for_changed_slugs) wp-includes/post.php | Checks for changed slugs for published post objects and save the old slug. |
| [wp\_set\_post\_categories()](wp_set_post_categories) wp-includes/post.php | Sets categories for a post. |
| [is\_nav\_menu\_item()](is_nav_menu_item) wp-includes/nav-menu.php | Determines whether the given ID is a nav menu item. |
| [wp\_xmlrpc\_server::\_insert\_post()](../classes/wp_xmlrpc_server/_insert_post) wp-includes/class-wp-xmlrpc-server.php | Helper method for wp\_newPost() and wp\_editPost(), containing shared logic. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress get_alloptions_110(): stdClass get\_alloptions\_110(): stdClass
================================
Retrieve all options as it was for 1.2.
stdClass List of options.
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function get_alloptions_110() {
global $wpdb;
$all_options = new stdClass;
$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
if ( $options ) {
foreach ( $options as $option ) {
if ( 'siteurl' === $option->option_name || 'home' === $option->option_name || 'category_base' === $option->option_name ) {
$option->option_value = untrailingslashit( $option->option_value );
}
$all_options->{$option->option_name} = stripslashes( $option->option_value );
}
}
return $all_options;
}
```
| Uses | Description |
| --- | --- |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress get_upload_space_available(): int get\_upload\_space\_available(): int
====================================
Determines if there is any upload space left in the current blog’s quota.
int of upload space available in bytes
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function get_upload_space_available() {
$allowed = get_space_allowed();
if ( $allowed < 0 ) {
$allowed = 0;
}
$space_allowed = $allowed * MB_IN_BYTES;
if ( get_site_option( 'upload_space_check_disabled' ) ) {
return $space_allowed;
}
$space_used = get_space_used() * MB_IN_BYTES;
if ( ( $space_allowed - $space_used ) <= 0 ) {
return 0;
}
return $space_allowed - $space_used;
}
```
| Uses | Description |
| --- | --- |
| [get\_space\_used()](get_space_used) wp-includes/ms-functions.php | Returns the space used by the current site. |
| [get\_space\_allowed()](get_space_allowed) wp-includes/ms-functions.php | Returns the upload quota for the current blog. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Attachments\_Controller::check\_upload\_size()](../classes/wp_rest_attachments_controller/check_upload_size) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Determine if uploaded file exceeds space quota on multisite. |
| [fix\_import\_form\_size()](fix_import_form_size) wp-admin/includes/ms.php | Get the remaining upload space for this site. |
| [check\_upload\_size()](check_upload_size) wp-admin/includes/ms.php | Determine if uploaded file exceeds space quota. |
| [is\_upload\_space\_available()](is_upload_space_available) wp-includes/ms-functions.php | Determines if there is any upload space left in the current blog’s quota. |
| [upload\_size\_limit\_filter()](upload_size_limit_filter) wp-includes/ms-functions.php | Filters the maximum upload file size allowed, in bytes. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_create_thumbnail( mixed $file, int $max_side, mixed $deprecated = '' ): string wp\_create\_thumbnail( mixed $file, int $max\_side, mixed $deprecated = '' ): string
====================================================================================
This function has been deprecated. Use [image\_resize()](image_resize) instead.
This was once used to create a thumbnail from an Image given a maximum side size.
* [image\_resize()](image_resize)
`$file` mixed Required Filename of the original image, Or attachment ID. `$max_side` int Required Maximum length of a single side for the thumbnail. `$deprecated` mixed Optional Never used. Default: `''`
string Thumbnail path on success, Error string on failure.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
_deprecated_function( __FUNCTION__, '3.5.0', 'image_resize()' );
return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [\_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 |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Use [image\_resize()](image_resize) |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress wp_create_nav_menu( string $menu_name ): int|WP_Error wp\_create\_nav\_menu( string $menu\_name ): int|WP\_Error
==========================================================
Creates a navigation menu.
Note that `$menu_name` is expected to be pre-slashed.
`$menu_name` string Required Menu name. int|[WP\_Error](../classes/wp_error) Menu ID on success, [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_create_nav_menu( $menu_name ) {
// expected_slashed ($menu_name)
return wp_update_nav_menu_object( 0, array( 'menu-name' => $menu_name ) );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_maybe_update_network_user_counts( int|null $network_id = null ) wp\_maybe\_update\_network\_user\_counts( int|null $network\_id = null )
========================================================================
Updates the network-wide users count.
If enabled through the [‘enable\_live\_network\_counts’](../hooks/enable_live_network_counts) filter, update the users count on a network when a user is created or its status is updated.
`$network_id` int|null Optional ID of the network. Default is the current network. Default: `null`
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function wp_maybe_update_network_user_counts( $network_id = null ) {
$is_small_network = ! wp_is_large_network( 'users', $network_id );
/** This filter is documented in wp-includes/ms-functions.php */
if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) ) {
return;
}
wp_update_network_user_counts( $network_id );
}
```
[apply\_filters( 'enable\_live\_network\_counts', bool $small\_network, string $context )](../hooks/enable_live_network_counts)
Filters whether to update network site or user counts when a new site is created.
| Uses | Description |
| --- | --- |
| [wp\_update\_network\_user\_counts()](wp_update_network_user_counts) wp-includes/ms-functions.php | Updates the network-wide user count. |
| [wp\_is\_large\_network()](wp_is_large_network) wp-includes/ms-functions.php | Determines whether or not we have a large network. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| 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 check_upload_size( array $file ): array check\_upload\_size( array $file ): array
=========================================
Determine if uploaded file exceeds space quota.
`$file` array Required An element from the `$_FILES` array for a given file. array The `$_FILES` array element with `'error'` key set if file exceeds quota. `'error'` is empty otherwise.
File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function check_upload_size( $file ) {
if ( get_site_option( 'upload_space_check_disabled' ) ) {
return $file;
}
if ( $file['error'] > 0 ) { // There's already an error.
return $file;
}
if ( defined( 'WP_IMPORTING' ) ) {
return $file;
}
$space_left = get_upload_space_available();
$file_size = filesize( $file['tmp_name'] );
if ( $space_left < $file_size ) {
/* translators: %s: Required disk space in kilobytes. */
$file['error'] = sprintf( __( 'Not enough space to upload. %s KB needed.' ), number_format( ( $file_size - $space_left ) / KB_IN_BYTES ) );
}
if ( $file_size > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
/* translators: %s: Maximum allowed file size in kilobytes. */
$file['error'] = sprintf( __( 'This file is too big. Files must be less than %s KB in size.' ), get_site_option( 'fileupload_maxk', 1500 ) );
}
if ( upload_is_user_over_quota( false ) ) {
$file['error'] = __( 'You have used your space quota. Please delete files before uploading.' );
}
if ( $file['error'] > 0 && ! isset( $_POST['html-upload'] ) && ! wp_doing_ajax() ) {
wp_die( $file['error'] . ' <a href="javascript:history.go(-1)">' . __( 'Back' ) . '</a>' );
}
return $file;
}
```
| Uses | Description |
| --- | --- |
| [wp\_doing\_ajax()](wp_doing_ajax) wp-includes/load.php | Determines whether the current request is a WordPress Ajax request. |
| [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. |
| [\_\_()](__) 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. |
| [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. |
| programming_docs |
wordpress antispambot( string $email_address, int $hex_encoding ): string antispambot( string $email\_address, int $hex\_encoding ): string
=================================================================
Converts email addresses characters to HTML entities to block spam bots.
`$email_address` string Required Email address. `$hex_encoding` int Optional Set to 1 to enable hex encoding. string Converted email address.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function antispambot( $email_address, $hex_encoding = 0 ) {
$email_no_spam_address = '';
for ( $i = 0, $len = strlen( $email_address ); $i < $len; $i++ ) {
$j = rand( 0, 1 + $hex_encoding );
if ( 0 == $j ) {
$email_no_spam_address .= '&#' . ord( $email_address[ $i ] ) . ';';
} elseif ( 1 == $j ) {
$email_no_spam_address .= $email_address[ $i ];
} elseif ( 2 == $j ) {
$email_no_spam_address .= '%' . zeroise( dechex( ord( $email_address[ $i ] ) ), 2 );
}
}
return str_replace( '@', '@', $email_no_spam_address );
}
```
| Uses | Description |
| --- | --- |
| [zeroise()](zeroise) wp-includes/formatting.php | Add leading zeros when necessary. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress mu_dropdown_languages( string[] $lang_files = array(), string $current = '' ) mu\_dropdown\_languages( string[] $lang\_files = array(), string $current = '' )
================================================================================
Generates and displays a drop-down of available languages.
`$lang_files` string[] Optional An array of the language files. Default: `array()`
`$current` string Optional The current language code. Default: `''`
File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
$flag = false;
$output = array();
foreach ( (array) $lang_files as $val ) {
$code_lang = basename( $val, '.mo' );
if ( 'en_US' === $code_lang ) { // American English.
$flag = true;
$ae = __( 'American English' );
$output[ $ae ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $ae . '</option>';
} elseif ( 'en_GB' === $code_lang ) { // British English.
$flag = true;
$be = __( 'British English' );
$output[ $be ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $be . '</option>';
} else {
$translated = format_code_lang( $code_lang );
$output[ $translated ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . esc_html( $translated ) . '</option>';
}
}
if ( false === $flag ) { // WordPress English.
$output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . '</option>';
}
// Order by name.
uksort( $output, 'strnatcasecmp' );
/**
* Filters the languages available in the dropdown.
*
* @since MU (3.0.0)
*
* @param string[] $output Array of HTML output for the dropdown.
* @param string[] $lang_files Array of available language files.
* @param string $current The current language code.
*/
$output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );
echo implode( "\n\t", $output );
}
```
[apply\_filters( 'mu\_dropdown\_languages', string[] $output, string[] $lang\_files, string $current )](../hooks/mu_dropdown_languages)
Filters the languages available in the dropdown.
| Uses | Description |
| --- | --- |
| [format\_code\_lang()](format_code_lang) wp-admin/includes/ms.php | Returns the language for a language code. |
| [selected()](selected) wp-includes/general-template.php | Outputs the HTML selected attribute. |
| [\_\_()](__) 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. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress init() init()
======
Set up constants with default values, unless user overrides.
File: `wp-includes/rss.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rss.php/)
```
function init () {
if ( defined('MAGPIE_INITALIZED') ) {
return;
}
else {
define('MAGPIE_INITALIZED', 1);
}
if ( !defined('MAGPIE_CACHE_ON') ) {
define('MAGPIE_CACHE_ON', 1);
}
if ( !defined('MAGPIE_CACHE_DIR') ) {
define('MAGPIE_CACHE_DIR', './cache');
}
if ( !defined('MAGPIE_CACHE_AGE') ) {
define('MAGPIE_CACHE_AGE', 60*60); // one hour
}
if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) {
define('MAGPIE_CACHE_FRESH_ONLY', 0);
}
if ( !defined('MAGPIE_DEBUG') ) {
define('MAGPIE_DEBUG', 0);
}
if ( !defined('MAGPIE_USER_AGENT') ) {
$ua = 'WordPress/' . $GLOBALS['wp_version'];
if ( MAGPIE_CACHE_ON ) {
$ua = $ua . ')';
}
else {
$ua = $ua . '; No cache)';
}
define('MAGPIE_USER_AGENT', $ua);
}
if ( !defined('MAGPIE_FETCH_TIME_OUT') ) {
define('MAGPIE_FETCH_TIME_OUT', 2); // 2 second timeout
}
// use gzip encoding to fetch rss files if supported?
if ( !defined('MAGPIE_USE_GZIP') ) {
define('MAGPIE_USE_GZIP', true);
}
}
```
| Used By | Description |
| --- | --- |
| [fetch\_rss()](fetch_rss) wp-includes/rss.php | Build Magpie object based on RSS from URL. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress edit_bookmark_link( string $link = '', string $before = '', string $after = '', int $bookmark = null ) edit\_bookmark\_link( string $link = '', string $before = '', string $after = '', int $bookmark = null )
========================================================================================================
Displays the edit bookmark link anchor content.
`$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: `''`
`$bookmark` int Optional Bookmark ID. Default is the current bookmark. Default: `null`
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark = null ) {
$bookmark = get_bookmark( $bookmark );
if ( ! current_user_can( 'manage_links' ) ) {
return;
}
if ( empty( $link ) ) {
$link = __( 'Edit This' );
}
$link = '<a href="' . esc_url( get_edit_bookmark_link( $bookmark ) ) . '">' . $link . '</a>';
/**
* Filters the bookmark edit link anchor tag.
*
* @since 2.7.0
*
* @param string $link Anchor tag for the edit link.
* @param int $link_id Bookmark ID.
*/
echo $before . apply_filters( 'edit_bookmark_link', $link, $bookmark->link_id ) . $after;
}
```
[apply\_filters( 'edit\_bookmark\_link', string $link, int $link\_id )](../hooks/edit_bookmark_link)
Filters the bookmark edit link anchor tag.
| Uses | Description |
| --- | --- |
| [get\_edit\_bookmark\_link()](get_edit_bookmark_link) wp-includes/link-template.php | Displays the edit bookmark link. |
| [get\_bookmark()](get_bookmark) wp-includes/bookmark.php | Retrieves bookmark data. |
| [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. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress user_pass_ok( string $user_login, string $user_pass ): bool user\_pass\_ok( string $user\_login, string $user\_pass ): bool
===============================================================
This function has been deprecated. Use [wp\_authenticate()](wp_authenticate) instead.
Check that the user login name and password is correct.
* [wp\_authenticate()](wp_authenticate)
`$user_login` string Required User name. `$user_pass` string Required User password. bool False if does not authenticate, true if username and password authenticates.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function user_pass_ok($user_login, $user_pass) {
_deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' );
$user = wp_authenticate( $user_login, $user_pass );
if ( is_wp_error( $user ) )
return false;
return true;
}
```
| Uses | Description |
| --- | --- |
| [wp\_authenticate()](wp_authenticate) wp-includes/pluggable.php | Authenticates a user, confirming the login credentials are valid. |
| [\_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.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Use [wp\_authenticate()](wp_authenticate) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_maybe_clean_new_site_cache_on_update( WP_Site $new_site, WP_Site $old_site ) wp\_maybe\_clean\_new\_site\_cache\_on\_update( WP\_Site $new\_site, WP\_Site $old\_site )
==========================================================================================
Cleans the necessary caches after specific site data has been updated.
`$new_site` [WP\_Site](../classes/wp_site) Required The site object after the update. `$old_site` [WP\_Site](../classes/wp_site) Required The site object prior to the update. File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function wp_maybe_clean_new_site_cache_on_update( $new_site, $old_site ) {
if ( $old_site->domain !== $new_site->domain || $old_site->path !== $new_site->path ) {
clean_blog_cache( $new_site );
}
}
```
| Uses | Description |
| --- | --- |
| [clean\_blog\_cache()](clean_blog_cache) wp-includes/ms-site.php | Clean the blog cache |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress get_post_stati( array|string $args = array(), string $output = 'names', string $operator = 'and' ): string[]|stdClass[] get\_post\_stati( array|string $args = array(), string $output = 'names', string $operator = 'and' ): string[]|stdClass[]
=========================================================================================================================
Gets a list of post statuses.
* [register\_post\_status()](register_post_status)
`$args` array|string Optional Array or string of post status arguments to compare against properties of the global `$wp_post_statuses objects`. Default: `array()`
`$output` string Optional The type of output to return, either `'names'` or `'objects'`. Default `'names'`. Default: `'names'`
`$operator` string Optional The logical operation to perform. `'or'` means only one element from the array needs to match; `'and'` means all elements must match.
Default `'and'`. Default: `'and'`
string[]|stdClass[] A list of post status names or objects.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_post_stati( $args = array(), $output = 'names', $operator = 'and' ) {
global $wp_post_statuses;
$field = ( 'names' === $output ) ? 'name' : false;
return wp_filter_object_list( $wp_post_statuses, $args, $operator, $field );
}
```
| Uses | Description |
| --- | --- |
| [wp\_filter\_object\_list()](wp_filter_object_list) wp-includes/functions.php | Filters a list of objects, based on a set of key => value arguments. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Menu\_Items\_Controller::get\_item\_schema()](../classes/wp_rest_menu_items_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Retrieves the term’s schema, conforming to JSON Schema. |
| [WP\_REST\_Templates\_Controller::get\_item\_schema()](../classes/wp_rest_templates_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Retrieves the block type’ schema, conforming to JSON Schema. |
| [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\_Requests\_Table::get\_request\_counts()](../classes/wp_privacy_requests_table/get_request_counts) wp-admin/includes/class-wp-privacy-requests-table.php | Count number of requests for each status. |
| [WP\_Customize\_Manager::establish\_loaded\_changeset()](../classes/wp_customize_manager/establish_loaded_changeset) wp-includes/class-wp-customize-manager.php | Establishes the loaded changeset. |
| [WP\_Customize\_Manager::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::find\_changeset\_post\_id()](../classes/wp_customize_manager/find_changeset_post_id) wp-includes/class-wp-customize-manager.php | Finds the changeset post ID for a given changeset UUID. |
| [wp\_get\_custom\_css\_post()](wp_get_custom_css_post) wp-includes/theme.php | Fetches the `custom_css` post for a given theme. |
| [WP\_REST\_Post\_Statuses\_Controller::get\_items()](../classes/wp_rest_post_statuses_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Retrieves all post statuses, depending on user context. |
| [WP\_REST\_Posts\_Controller::get\_item\_schema()](../classes/wp_rest_posts_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves the post’s schema, conforming to JSON Schema. |
| [WP\_REST\_Posts\_Controller::get\_collection\_params()](../classes/wp_rest_posts_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves the query params for the posts collection. |
| [wp\_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. |
| [WP\_Posts\_List\_Table::get\_views()](../classes/wp_posts_list_table/get_views) 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::prepare\_items()](../classes/wp_posts_list_table/prepare_items) 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. |
| [get\_adjacent\_post()](get_adjacent_post) wp-includes/link-template.php | Retrieves the adjacent post. |
| [get\_page\_by\_title()](get_page_by_title) wp-includes/post.php | Retrieves a page given its title. |
| [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [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\_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. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress adjacent_image_link( bool $prev = true, string|int[] $size = 'thumbnail', bool $text = false ) adjacent\_image\_link( bool $prev = true, string|int[] $size = 'thumbnail', bool $text = false )
================================================================================================
Displays next or previous image link that has the same post parent.
Retrieves the current attachment object from the $post global.
`$prev` bool Optional Whether to display the next (false) or previous (true) link. Default: `true`
`$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` bool Optional Link text. Default: `false`
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) {
echo get_adjacent_image_link( $prev, $size, $text );
}
```
| Uses | Description |
| --- | --- |
| [get\_adjacent\_image\_link()](get_adjacent_image_link) wp-includes/media.php | Gets the next or previous image link that has the same post parent. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_ajax_save_attachment() wp\_ajax\_save\_attachment()
============================
Ajax handler for updating attachment attributes.
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_attachment() {
if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['changes'] ) ) {
wp_send_json_error();
}
$id = absint( $_REQUEST['id'] );
if ( ! $id ) {
wp_send_json_error();
}
check_ajax_referer( 'update-post_' . $id, 'nonce' );
if ( ! current_user_can( 'edit_post', $id ) ) {
wp_send_json_error();
}
$changes = $_REQUEST['changes'];
$post = get_post( $id, ARRAY_A );
if ( 'attachment' !== $post['post_type'] ) {
wp_send_json_error();
}
if ( isset( $changes['parent'] ) ) {
$post['post_parent'] = $changes['parent'];
}
if ( isset( $changes['title'] ) ) {
$post['post_title'] = $changes['title'];
}
if ( isset( $changes['caption'] ) ) {
$post['post_excerpt'] = $changes['caption'];
}
if ( isset( $changes['description'] ) ) {
$post['post_content'] = $changes['description'];
}
if ( MEDIA_TRASH && isset( $changes['status'] ) ) {
$post['post_status'] = $changes['status'];
}
if ( isset( $changes['alt'] ) ) {
$alt = wp_unslash( $changes['alt'] );
if ( get_post_meta( $id, '_wp_attachment_image_alt', true ) !== $alt ) {
$alt = wp_strip_all_tags( $alt, true );
update_post_meta( $id, '_wp_attachment_image_alt', wp_slash( $alt ) );
}
}
if ( wp_attachment_is( 'audio', $post['ID'] ) ) {
$changed = false;
$id3data = wp_get_attachment_metadata( $post['ID'] );
if ( ! is_array( $id3data ) ) {
$changed = true;
$id3data = array();
}
foreach ( wp_get_attachment_id3_keys( (object) $post, 'edit' ) as $key => $label ) {
if ( isset( $changes[ $key ] ) ) {
$changed = true;
$id3data[ $key ] = sanitize_text_field( wp_unslash( $changes[ $key ] ) );
}
}
if ( $changed ) {
wp_update_attachment_metadata( $id, $id3data );
}
}
if ( MEDIA_TRASH && isset( $changes['status'] ) && 'trash' === $changes['status'] ) {
wp_delete_post( $id );
} else {
wp_update_post( $post );
}
wp_send_json_success();
}
```
| Uses | Description |
| --- | --- |
| [wp\_attachment\_is()](wp_attachment_is) wp-includes/post.php | Verifies an attachment is of a given type. |
| [wp\_get\_attachment\_id3\_keys()](wp_get_attachment_id3_keys) wp-includes/media.php | Returns useful keys to use to lookup data from an attachment’s stored metadata. |
| [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. |
| [wp\_strip\_all\_tags()](wp_strip_all_tags) wp-includes/formatting.php | Properly strips all HTML tags including script and style |
| [sanitize\_text\_field()](sanitize_text_field) wp-includes/formatting.php | Sanitizes a string from user input or from the database. |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [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. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [wp\_send\_json\_success()](wp_send_json_success) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating success. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| [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 |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
| programming_docs |
wordpress validate_file_to_edit( string $file, string[] $allowed_files = array() ): string|void validate\_file\_to\_edit( string $file, string[] $allowed\_files = array() ): string|void
=========================================================================================
Makes sure that the file that was requested to be edited is allowed to be edited.
Function will die if you are not allowed to edit the file.
`$file` string Required File the user is attempting to edit. `$allowed_files` string[] Optional Array of allowed files to edit.
`$file` must match an entry exactly. Default: `array()`
string|void Returns the file name on success, dies on failure.
File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/)
```
function validate_file_to_edit( $file, $allowed_files = array() ) {
$code = validate_file( $file, $allowed_files );
if ( ! $code ) {
return $file;
}
switch ( $code ) {
case 1:
wp_die( __( 'Sorry, that file cannot be edited.' ) );
// case 2 :
// wp_die( __('Sorry, cannot call files with their real path.' ));
case 3:
wp_die( __( 'Sorry, that file cannot be edited.' ) );
}
}
```
| Uses | Description |
| --- | --- |
| [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\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress register_admin_color_schemes() register\_admin\_color\_schemes()
=================================
Registers the default admin color schemes.
Registers the initial set of eight color schemes in the Profile section of the dashboard which allows for styling the admin menu and toolbar.
* [wp\_admin\_css\_color()](wp_admin_css_color)
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function register_admin_color_schemes() {
$suffix = is_rtl() ? '-rtl' : '';
$suffix .= SCRIPT_DEBUG ? '' : '.min';
wp_admin_css_color(
'fresh',
_x( 'Default', 'admin color scheme' ),
false,
array( '#1d2327', '#2c3338', '#2271b1', '#72aee6' ),
array(
'base' => '#a7aaad',
'focus' => '#72aee6',
'current' => '#fff',
)
);
wp_admin_css_color(
'light',
_x( 'Light', 'admin color scheme' ),
admin_url( "css/colors/light/colors$suffix.css" ),
array( '#e5e5e5', '#999', '#d64e07', '#04a4cc' ),
array(
'base' => '#999',
'focus' => '#ccc',
'current' => '#ccc',
)
);
wp_admin_css_color(
'modern',
_x( 'Modern', 'admin color scheme' ),
admin_url( "css/colors/modern/colors$suffix.css" ),
array( '#1e1e1e', '#3858e9', '#33f078' ),
array(
'base' => '#f3f1f1',
'focus' => '#fff',
'current' => '#fff',
)
);
wp_admin_css_color(
'blue',
_x( 'Blue', 'admin color scheme' ),
admin_url( "css/colors/blue/colors$suffix.css" ),
array( '#096484', '#4796b3', '#52accc', '#74B6CE' ),
array(
'base' => '#e5f8ff',
'focus' => '#fff',
'current' => '#fff',
)
);
wp_admin_css_color(
'midnight',
_x( 'Midnight', 'admin color scheme' ),
admin_url( "css/colors/midnight/colors$suffix.css" ),
array( '#25282b', '#363b3f', '#69a8bb', '#e14d43' ),
array(
'base' => '#f1f2f3',
'focus' => '#fff',
'current' => '#fff',
)
);
wp_admin_css_color(
'sunrise',
_x( 'Sunrise', 'admin color scheme' ),
admin_url( "css/colors/sunrise/colors$suffix.css" ),
array( '#b43c38', '#cf4944', '#dd823b', '#ccaf0b' ),
array(
'base' => '#f3f1f1',
'focus' => '#fff',
'current' => '#fff',
)
);
wp_admin_css_color(
'ectoplasm',
_x( 'Ectoplasm', 'admin color scheme' ),
admin_url( "css/colors/ectoplasm/colors$suffix.css" ),
array( '#413256', '#523f6d', '#a3b745', '#d46f15' ),
array(
'base' => '#ece6f6',
'focus' => '#fff',
'current' => '#fff',
)
);
wp_admin_css_color(
'ocean',
_x( 'Ocean', 'admin color scheme' ),
admin_url( "css/colors/ocean/colors$suffix.css" ),
array( '#627c83', '#738e96', '#9ebaa0', '#aa9d88' ),
array(
'base' => '#f2fcff',
'focus' => '#fff',
'current' => '#fff',
)
);
wp_admin_css_color(
'coffee',
_x( 'Coffee', 'admin color scheme' ),
admin_url( "css/colors/coffee/colors$suffix.css" ),
array( '#46403c', '#59524c', '#c7a589', '#9ea476' ),
array(
'base' => '#f3f2f1',
'focus' => '#fff',
'current' => '#fff',
)
);
}
```
| Uses | Description |
| --- | --- |
| [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| [wp\_admin\_css\_color()](wp_admin_css_color) wp-includes/general-template.php | Registers an admin color scheme css file. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress _wp_customize_loader_settings() \_wp\_customize\_loader\_settings()
===================================
Adds settings for the customize-loader script.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function _wp_customize_loader_settings() {
$admin_origin = parse_url( admin_url() );
$home_origin = parse_url( home_url() );
$cross_domain = ( strtolower( $admin_origin['host'] ) != strtolower( $home_origin['host'] ) );
$browser = array(
'mobile' => wp_is_mobile(),
'ios' => wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] ),
);
$settings = array(
'url' => esc_url( admin_url( 'customize.php' ) ),
'isCrossDomain' => $cross_domain,
'browser' => $browser,
'l10n' => array(
'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
'mainIframeTitle' => __( 'Customizer' ),
),
);
$script = 'var _wpCustomizeLoaderSettings = ' . wp_json_encode( $settings ) . ';';
$wp_scripts = wp_scripts();
$data = $wp_scripts->get_data( 'customize-loader', 'data' );
if ( $data ) {
$script = "$data\n$script";
}
$wp_scripts->add_data( 'customize-loader', 'data', $script );
}
```
| Uses | Description |
| --- | --- |
| [wp\_scripts()](wp_scripts) wp-includes/functions.wp-scripts.php | Initialize $wp\_scripts if it has not been set. |
| [wp\_is\_mobile()](wp_is_mobile) wp-includes/vars.php | Test if the current browser runs on a mobile device (smart phone, tablet, etc.) |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [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. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress absint() absint()
========
**Function:** Converts a value to non-negative integer.
Source: wp-includes/functions.php:5329
Used by [127 functions](absint#used-by) | Uses [0 functions](absint#uses)
wordpress remove_option_update_handler( string $option_group, string $option_name, callable $sanitize_callback = '' ) remove\_option\_update\_handler( string $option\_group, string $option\_name, callable $sanitize\_callback = '' )
=================================================================================================================
This function has been deprecated. Use [unregister\_setting()](unregister_setting) instead.
Unregister a setting
* [unregister\_setting()](unregister_setting)
`$option_group` string Required The settings group name used during registration. `$option_name` string Required The name of the option to unregister. `$sanitize_callback` callable Optional Deprecated. Default: `''`
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'unregister_setting()' );
unregister_setting( $option_group, $option_name, $sanitize_callback );
}
```
| Uses | Description |
| --- | --- |
| [unregister\_setting()](unregister_setting) wp-includes/option.php | Unregisters a setting. |
| [\_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 [unregister\_setting()](unregister_setting) |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress generic_ping( int $post_id ): int generic\_ping( int $post\_id ): int
===================================
Sends pings to all of the ping site services.
`$post_id` int Required Post ID. int Same post ID as provided.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function generic_ping( $post_id = 0 ) {
$services = get_option( 'ping_sites' );
$services = explode( "\n", $services );
foreach ( (array) $services as $service ) {
$service = trim( $service );
if ( '' !== $service ) {
weblog_ping( $service );
}
}
return $post_id;
}
```
| Uses | Description |
| --- | --- |
| [weblog\_ping()](weblog_ping) wp-includes/comment.php | Sends a pingback. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress update_meta_cache( string $meta_type, string|int[] $object_ids ): array|false update\_meta\_cache( string $meta\_type, string|int[] $object\_ids ): array|false
=================================================================================
Updates the metadata cache for the specified objects.
`$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_ids` string|int[] Required Array or comma delimited list of object IDs to update cache for. array|false Metadata cache for the specified objects, or false on failure.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function update_meta_cache( $meta_type, $object_ids ) {
global $wpdb;
if ( ! $meta_type || ! $object_ids ) {
return false;
}
$table = _get_meta_table( $meta_type );
if ( ! $table ) {
return false;
}
$column = sanitize_key( $meta_type . '_id' );
if ( ! is_array( $object_ids ) ) {
$object_ids = preg_replace( '|[^0-9,]|', '', $object_ids );
$object_ids = explode( ',', $object_ids );
}
$object_ids = array_map( 'intval', $object_ids );
/**
* Short-circuits updating the metadata cache 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_cache`
* - `update_comment_metadata_cache`
* - `update_term_metadata_cache`
* - `update_user_metadata_cache`
*
* @since 5.0.0
*
* @param mixed $check Whether to allow updating the meta cache of the given type.
* @param int[] $object_ids Array of object IDs to update the meta cache for.
*/
$check = apply_filters( "update_{$meta_type}_metadata_cache", null, $object_ids );
if ( null !== $check ) {
return (bool) $check;
}
$cache_key = $meta_type . '_meta';
$non_cached_ids = array();
$cache = array();
$cache_values = wp_cache_get_multiple( $object_ids, $cache_key );
foreach ( $cache_values as $id => $cached_object ) {
if ( false === $cached_object ) {
$non_cached_ids[] = $id;
} else {
$cache[ $id ] = $cached_object;
}
}
if ( empty( $non_cached_ids ) ) {
return $cache;
}
// Get meta info.
$id_list = implode( ',', $non_cached_ids );
$id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id';
$meta_list = $wpdb->get_results( "SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list) ORDER BY $id_column ASC", ARRAY_A );
if ( ! empty( $meta_list ) ) {
foreach ( $meta_list as $metarow ) {
$mpid = (int) $metarow[ $column ];
$mkey = $metarow['meta_key'];
$mval = $metarow['meta_value'];
// Force subkeys to be array type.
if ( ! isset( $cache[ $mpid ] ) || ! is_array( $cache[ $mpid ] ) ) {
$cache[ $mpid ] = array();
}
if ( ! isset( $cache[ $mpid ][ $mkey ] ) || ! is_array( $cache[ $mpid ][ $mkey ] ) ) {
$cache[ $mpid ][ $mkey ] = array();
}
// Add a value to the current pid/key.
$cache[ $mpid ][ $mkey ][] = $mval;
}
}
$data = array();
foreach ( $non_cached_ids as $id ) {
if ( ! isset( $cache[ $id ] ) ) {
$cache[ $id ] = array();
}
$data[ $id ] = $cache[ $id ];
}
wp_cache_add_multiple( $data, $cache_key );
return $cache;
}
```
[apply\_filters( "update\_{$meta\_type}\_metadata\_cache", mixed $check, int[] $object\_ids )](../hooks/update_meta_type_metadata_cache)
Short-circuits updating the metadata cache of a specific type.
| 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. |
| [\_get\_meta\_table()](_get_meta_table) wp-includes/meta.php | Retrieves the name of the metadata table for the specified object type. |
| [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. |
| [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 |
| --- | --- |
| [get\_metadata\_raw()](get_metadata_raw) wp-includes/meta.php | Retrieves raw metadata value for the specified object. |
| [update\_sitemeta\_cache()](update_sitemeta_cache) wp-includes/ms-site.php | Updates metadata cache for list of site IDs. |
| [WP\_Metadata\_Lazyloader::lazyload\_comment\_meta()](../classes/wp_metadata_lazyloader/lazyload_comment_meta) wp-includes/class-wp-metadata-lazyloader.php | Lazy-loads comment meta for queued comments. |
| [update\_termmeta\_cache()](update_termmeta_cache) wp-includes/taxonomy.php | Updates metadata cache for list of term IDs. |
| [cache\_users()](cache_users) wp-includes/pluggable.php | Retrieves info for user lists to prevent multiple queries by [get\_userdata()](get_userdata) . |
| [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 |
| [update\_postmeta\_cache()](update_postmeta_cache) wp-includes/post.php | Updates metadata cache for a list of post IDs. |
| [update\_comment\_cache()](update_comment_cache) wp-includes/comment.php | Updates the comment cache of given comments. |
| [metadata\_exists()](metadata_exists) wp-includes/meta.php | Determines if a meta field with the given key exists for the given object ID. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress _device_can_upload(): bool \_device\_can\_upload(): 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.
Tests if the current device has the capability to upload files.
bool Whether the device is able to upload files.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _device_can_upload() {
if ( ! wp_is_mobile() ) {
return true;
}
$ua = $_SERVER['HTTP_USER_AGENT'];
if ( strpos( $ua, 'iPhone' ) !== false
|| strpos( $ua, 'iPad' ) !== false
|| strpos( $ua, 'iPod' ) !== false ) {
return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_mobile()](wp_is_mobile) wp-includes/vars.php | Test if the current browser runs on a mobile device (smart phone, tablet, etc.) |
| Used By | Description |
| --- | --- |
| [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. |
| [wp\_plupload\_default\_settings()](wp_plupload_default_settings) wp-includes/media.php | Prints default Plupload arguments. |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress is_term_publicly_viewable( int|WP_Term $term ): bool is\_term\_publicly\_viewable( int|WP\_Term $term ): bool
========================================================
Determines whether a term is publicly viewable.
A term is considered publicly viewable if its taxonomy is viewable.
`$term` int|[WP\_Term](../classes/wp_term) Required Term ID or term object. bool Whether the term is publicly viewable.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function is_term_publicly_viewable( $term ) {
$term = get_term( $term );
if ( ! $term ) {
return false;
}
return is_taxonomy_viewable( $term->taxonomy );
}
```
| Uses | Description |
| --- | --- |
| [is\_taxonomy\_viewable()](is_taxonomy_viewable) wp-includes/taxonomy.php | Determines whether a taxonomy is considered “viewable”. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| Used By | Description |
| --- | --- |
| [WP\_Terms\_List\_Table::handle\_row\_actions()](../classes/wp_terms_list_table/handle_row_actions) wp-admin/includes/class-wp-terms-list-table.php | Generates and displays row action links. |
| [wp\_admin\_bar\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress restore_previous_locale(): string|false restore\_previous\_locale(): string|false
=========================================
Restores the translations according to the previous locale.
string|false Locale on success, false on error.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function restore_previous_locale() {
/* @var WP_Locale_Switcher $wp_locale_switcher */
global $wp_locale_switcher;
return $wp_locale_switcher->restore_previous_locale();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Locale\_Switcher::restore\_previous\_locale()](../classes/wp_locale_switcher/restore_previous_locale) wp-includes/class-wp-locale-switcher.php | Restores the translations according to the previous locale. |
| Used By | Description |
| --- | --- |
| [wpmu\_new\_site\_admin\_notification()](wpmu_new_site_admin_notification) wp-includes/ms-functions.php | Notifies the Multisite network administrator that a new site was created. |
| [WP\_Recovery\_Mode\_Email\_Service::send\_recovery\_mode\_email()](../classes/wp_recovery_mode_email_service/send_recovery_mode_email) wp-includes/class-wp-recovery-mode-email-service.php | Sends the Recovery Mode email to the site admin email address. |
| [\_wp\_privacy\_send\_erasure\_fulfillment\_notification()](_wp_privacy_send_erasure_fulfillment_notification) wp-includes/user.php | Notifies the user when their erasure request is fulfilled. |
| [wp\_send\_user\_request()](wp_send_user_request) wp-includes/user.php | Send a confirmation request email to confirm an action. |
| [wp\_privacy\_send\_personal\_data\_export\_email()](wp_privacy_send_personal_data_export_email) wp-admin/includes/privacy-tools.php | Send an email to the user with a link to the personal data export file |
| [update\_network\_option\_new\_admin\_email()](update_network_option_new_admin_email) wp-includes/ms-functions.php | Sends a confirmation request email when a change of network admin email address is attempted. |
| [WP\_Customize\_Selective\_Refresh::export\_preview\_data()](../classes/wp_customize_selective_refresh/export_preview_data) wp-includes/customize/class-wp-customize-selective-refresh.php | Exports data in preview after it has finished rendering so that partials can be added at runtime. |
| [retrieve\_password()](retrieve_password) wp-includes/user.php | Handles sending a password retrieval email to a user. |
| [update\_option\_new\_admin\_email()](update_option_new_admin_email) wp-admin/includes/misc.php | Sends a confirmation request email when a change of site admin email address is attempted. |
| [insert\_with\_markers()](insert_with_markers) wp-admin/includes/misc.php | Inserts an array of strings into a file (.htaccess), placing it between BEGIN and END markers. |
| [WP\_Customize\_Manager::customize\_preview\_settings()](../classes/wp_customize_manager/customize_preview_settings) wp-includes/class-wp-customize-manager.php | Prints JavaScript settings for preview frame. |
| [wp\_new\_user\_notification()](wp_new_user_notification) wp-includes/pluggable.php | Emails login credentials to a newly-registered user. |
| [wp\_notify\_postauthor()](wp_notify_postauthor) wp-includes/pluggable.php | Notifies an author (and/or others) of a comment/trackback/pingback on a post. |
| [wp\_notify\_moderator()](wp_notify_moderator) wp-includes/pluggable.php | Notifies the moderator of the site about a new comment that is awaiting approval. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [wpmu\_welcome\_user\_notification()](wpmu_welcome_user_notification) wp-includes/ms-functions.php | Notifies a user that their account activation has been successful. |
| [wpmu\_welcome\_notification()](wpmu_welcome_notification) wp-includes/ms-functions.php | Notifies the site administrator that their site activation was successful. |
| [wpmu\_signup\_blog\_notification()](wpmu_signup_blog_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
| [wpmu\_signup\_user\_notification()](wpmu_signup_user_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked. |
| [WP\_Customize\_Widgets::export\_preview\_data()](../classes/wp_customize_widgets/export_preview_data) wp-includes/class-wp-customize-widgets.php | Communicates the sidebars that appeared on the page at the very end of the page, and at the very end of the wp\_footer, |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
| programming_docs |
wordpress the_author_lastname() the\_author\_lastname()
=======================
This function has been deprecated. Use [the\_author\_meta()](the_author_meta) instead.
Display the last name of the author of the current post.
* [the\_author\_meta()](the_author_meta)
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function the_author_lastname() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'last_name\')' );
the_author_meta('last_name');
}
```
| 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_get_post_revisions_url( int|WP_Post $post ): string|null wp\_get\_post\_revisions\_url( int|WP\_Post $post ): string|null
================================================================
Returns the url for viewing and potentially restoring revisions of a given post.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global `$post`. string|null The URL for editing revisions on the given post, otherwise null.
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function wp_get_post_revisions_url( $post = 0 ) {
$post = get_post( $post );
if ( ! $post instanceof WP_Post ) {
return null;
}
// If the post is a revision, return early.
if ( 'revision' === $post->post_type ) {
return get_edit_post_link( $post );
}
if ( ! wp_revisions_enabled( $post ) ) {
return null;
}
$revisions = wp_get_latest_revision_id_and_total_count( $post->ID );
if ( is_wp_error( $revisions ) || 0 === $revisions['count'] ) {
return null;
}
return get_edit_post_link( $revisions['latest_id'] );
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_latest\_revision\_id\_and\_total\_count()](wp_get_latest_revision_id_and_total_count) wp-includes/revision.php | Returns the latest revision ID and count of revisions for a post. |
| [get\_edit\_post\_link()](get_edit_post_link) wp-includes/link-template.php | Retrieves the edit post link for post. |
| [wp\_revisions\_enabled()](wp_revisions_enabled) wp-includes/revision.php | Determines whether revisions are enabled for a given post. |
| [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 |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress _x( string $text, string $context, string $domain = 'default' ): string \_x( string $text, string $context, string $domain = 'default' ): string
========================================================================
Retrieves translated string with gettext context.
Quite a few times, there will be collisions with similar translatable text found in more than two places, but with different translated context.
By including the context in the pot file, translators can translate the two strings differently.
`$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 context string without pipe.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function _x( $text, $context, $domain = 'default' ) {
return 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. |
| Used By | Description |
| --- | --- |
| [WP\_Widget\_Media::get\_l10n\_defaults()](../classes/wp_widget_media/get_l10n_defaults) wp-includes/widgets/class-wp-widget-media.php | Returns the default localized strings used by the widget. |
| [WP\_Taxonomy::get\_default\_labels()](../classes/wp_taxonomy/get_default_labels) wp-includes/class-wp-taxonomy.php | Returns the default labels for taxonomies. |
| [WP\_Post\_Type::get\_default\_labels()](../classes/wp_post_type/get_default_labels) wp-includes/class-wp-post-type.php | Returns the default labels for post types. |
| [wp\_list\_users()](wp_list_users) wp-includes/user.php | Lists all the users of the site, with several options available. |
| [get\_default\_block\_template\_types()](get_default_block_template_types) wp-includes/block-template-utils.php | Returns a filtered list of default template types, containing their localized titles and descriptions. |
| [get\_default\_block\_categories()](get_default_block_categories) wp-includes/block-editor.php | Returns the list of default categories for block types. |
| [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. |
| [\_register\_core\_block\_patterns\_and\_categories()](_register_core_block_patterns_and_categories) wp-includes/block-patterns.php | Registers the core block patterns and categories. |
| [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. |
| [wp\_credits\_section\_title()](wp_credits_section_title) wp-admin/includes/credits.php | Displays the title for a given group of contributors. |
| [get\_post\_states()](get_post_states) wp-admin/includes/template.php | Retrieves an array of post states from a post. |
| [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. |
| [validate\_plugin\_requirements()](validate_plugin_requirements) wp-admin/includes/plugin.php | Validates the plugin requirements for WordPress version and PHP version. |
| [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. |
| [taxonomy\_meta\_box\_sanitize\_cb\_input()](taxonomy_meta_box_sanitize_cb_input) wp-admin/includes/post.php | Sanitizes POST values from an input taxonomy metabox. |
| [wp\_default\_packages\_scripts()](wp_default_packages_scripts) wp-includes/script-loader.php | Registers all the WordPress packages scripts that are in the standardized `js/dist/` location. |
| [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\_statuses()](_wp_privacy_statuses) wp-includes/post.php | Returns statuses for privacy requests. |
| [wp\_privacy\_generate\_personal\_data\_export\_file()](wp_privacy_generate_personal_data_export_file) wp-admin/includes/privacy-tools.php | Generate the personal data export file. |
| [WP\_Widget\_Media\_Gallery::\_\_construct()](../classes/wp_widget_media_gallery/__construct) wp-includes/widgets/class-wp-widget-media-gallery.php | Constructor. |
| [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\_Widget\_Media\_Audio::\_\_construct()](../classes/wp_widget_media_audio/__construct) wp-includes/widgets/class-wp-widget-media-audio.php | Constructor. |
| [WP\_Widget\_Media\_Video::\_\_construct()](../classes/wp_widget_media_video/__construct) wp-includes/widgets/class-wp-widget-media-video.php | Constructor. |
| [WP\_Widget\_Media\_Image::\_\_construct()](../classes/wp_widget_media_image/__construct) wp-includes/widgets/class-wp-widget-media-image.php | Constructor. |
| [wp\_dashboard\_events\_news()](wp_dashboard_events_news) wp-admin/includes/dashboard.php | Renders the Events and News dashboard widget. |
| [WP\_Community\_Events::format\_event\_data\_time()](../classes/wp_community_events/format_event_data_time) wp-admin/includes/class-wp-community-events.php | Adds formatted date and time items for each event in an API response. |
| [get\_theme\_starter\_content()](get_theme_starter_content) wp-includes/theme.php | Expands a theme’s starter content configuration using core-provided data. |
| [\_WP\_Editors::get\_translation()](../classes/_wp_editors/get_translation) wp-includes/class-wp-editor.php | |
| [wp\_print\_update\_row\_templates()](wp_print_update_row_templates) wp-admin/includes/update.php | Prints the JavaScript templates for update and deletion rows in list tables. |
| [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\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. |
| [wp\_maybe\_decline\_date()](wp_maybe_decline_date) wp-includes/functions.php | Determines if the date should be declined. |
| [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\_Users\_List\_Table::get\_role\_list()](../classes/wp_users_list_table/get_role_list) wp-admin/includes/class-wp-users-list-table.php | Returns an array of translated user role names for a given user object. |
| [WP\_Customize\_Nav\_Menu\_Setting::sanitize()](../classes/wp_customize_nav_menu_setting/sanitize) wp-includes/customize/class-wp-customize-nav-menu-setting.php | Sanitize an input. |
| [WP\_Customize\_Nav\_Menus::search\_available\_items\_query()](../classes/wp_customize_nav_menus/search_available_items_query) wp-includes/class-wp-customize-nav-menus.php | Performs post queries for available-item searching. |
| [WP\_Customize\_Nav\_Menus::enqueue\_scripts()](../classes/wp_customize_nav_menus/enqueue_scripts) wp-includes/class-wp-customize-nav-menus.php | Enqueues scripts and styles for Customizer pane. |
| [WP\_Customize\_Nav\_Menus::customize\_register()](../classes/wp_customize_nav_menus/customize_register) wp-includes/class-wp-customize-nav-menus.php | Adds the customizer settings and controls. |
| [WP\_Customize\_Nav\_Menus::load\_available\_items\_query()](../classes/wp_customize_nav_menus/load_available_items_query) wp-includes/class-wp-customize-nav-menus.php | Performs the post\_type and taxonomy queries for loading available menu items. |
| [WP\_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\_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\_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\_MS\_Sites\_List\_Table::handle\_row\_actions()](../classes/wp_ms_sites_list_table/handle_row_actions) wp-admin/includes/class-wp-ms-sites-list-table.php | Generates and displays row action links. |
| [WP\_MS\_Users\_List\_Table::column\_name()](../classes/wp_ms_users_list_table/column_name) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the name column output. |
| [WP\_Customize\_Theme\_Control::content\_template()](../classes/wp_customize_theme_control/content_template) wp-includes/customize/class-wp-customize-theme-control.php | Render a JS template for theme display. |
| [the\_meta()](the_meta) wp-includes/post-template.php | Displays a list of post custom fields. |
| [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\_install\_maybe\_enable\_pretty\_permalinks()](wp_install_maybe_enable_pretty_permalinks) wp-admin/includes/upgrade.php | Maybe enable pretty permalinks on installation. |
| [get\_the\_archive\_title()](get_the_archive_title) wp-includes/general-template.php | Retrieves the archive title based on the queried object. |
| [get\_the\_posts\_pagination()](get_the_posts_pagination) wp-includes/link-template.php | Retrieves a paginated navigation to next/previous set of posts, when applicable. |
| [wp\_dropdown\_languages()](wp_dropdown_languages) wp-includes/l10n.php | Displays or returns a Language selector. |
| [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. |
| [login\_footer()](login_footer) wp-login.php | Outputs the footer for the login page. |
| [network\_step1()](network_step1) wp-admin/includes/network.php | Prints step 1 for Network installation process. |
| [WP\_MS\_Users\_List\_Table::get\_bulk\_actions()](../classes/wp_ms_users_list_table/get_bulk_actions) wp-admin/includes/class-wp-ms-users-list-table.php | |
| [WP\_MS\_Users\_List\_Table::get\_columns()](../classes/wp_ms_users_list_table/get_columns) wp-admin/includes/class-wp-ms-users-list-table.php | |
| [get\_theme\_update\_available()](get_theme_update_available) wp-admin/includes/theme.php | Retrieves the update link if there is a theme update available. |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Links\_List\_Table::get\_columns()](../classes/wp_links_list_table/get_columns) 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. |
| [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. |
| [WP\_List\_Table::pagination()](../classes/wp_list_table/pagination) wp-admin/includes/class-wp-list-table.php | Displays the pagination. |
| [WP\_Theme\_Install\_List\_Table::install\_theme\_info()](../classes/wp_theme_install_list_table/install_theme_info) wp-admin/includes/class-wp-theme-install-list-table.php | Prints the info for a theme (to be used in the theme installer modal). |
| [populate\_options()](populate_options) wp-admin/includes/schema.php | Create WordPress options and set the default values. |
| [WP\_Theme\_Install\_List\_Table::prepare\_items()](../classes/wp_theme_install_list_table/prepare_items) wp-admin/includes/class-wp-theme-install-list-table.php | |
| [WP\_Theme\_Install\_List\_Table::single\_row()](../classes/wp_theme_install_list_table/single_row) wp-admin/includes/class-wp-theme-install-list-table.php | Prints a theme from the WordPress.org API. |
| [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\_dashboard\_recent\_posts()](wp_dashboard_recent_posts) wp-admin/includes/dashboard.php | Generates Publishing Soon and Recently Published sections. |
| [wp\_dashboard\_plugins\_output()](wp_dashboard_plugins_output) wp-admin/includes/deprecated.php | Display plugins text for the WordPress news widget. |
| [wp\_dashboard\_recent\_drafts()](wp_dashboard_recent_drafts) wp-admin/includes/dashboard.php | Show recent drafts of the user on the dashboard. |
| [\_wp\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. |
| [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. |
| [WP\_Plugin\_Install\_List\_Table::display\_rows()](../classes/wp_plugin_install_list_table/display_rows) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [WP\_Plugin\_Install\_List\_Table::prepare\_items()](../classes/wp_plugin_install_list_table/prepare_items) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [list\_meta()](list_meta) wp-admin/includes/template.php | Outputs a post’s public meta data in the Custom Fields meta box. |
| [WP\_Themes\_List\_Table::display\_rows()](../classes/wp_themes_list_table/display_rows) wp-admin/includes/class-wp-themes-list-table.php | |
| [WP\_MS\_Sites\_List\_Table::\_\_construct()](../classes/wp_ms_sites_list_table/__construct) wp-admin/includes/class-wp-ms-sites-list-table.php | Constructor. |
| [WP\_MS\_Sites\_List\_Table::get\_bulk\_actions()](../classes/wp_ms_sites_list_table/get_bulk_actions) wp-admin/includes/class-wp-ms-sites-list-table.php | |
| [WP\_MS\_Sites\_List\_Table::get\_columns()](../classes/wp_ms_sites_list_table/get_columns) wp-admin/includes/class-wp-ms-sites-list-table.php | |
| [WP\_Users\_List\_Table::single\_row()](../classes/wp_users_list_table/single_row) wp-admin/includes/class-wp-users-list-table.php | Generate HTML for a single row on the users.php admin panel. |
| [WP\_Users\_List\_Table::get\_columns()](../classes/wp_users_list_table/get_columns) wp-admin/includes/class-wp-users-list-table.php | Get a list of columns for the list table. |
| [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. |
| [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\_autocomplete\_user()](wp_ajax_autocomplete_user) wp-admin/includes/ajax-actions.php | Ajax handler for user autocomplete. |
| [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. |
| [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\_columns()](../classes/wp_media_list_table/get_columns) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Media\_List\_Table::\_get\_row\_actions()](../classes/wp_media_list_table/_get_row_actions) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Post\_Comments\_List\_Table::get\_column\_info()](../classes/wp_post_comments_list_table/get_column_info) wp-admin/includes/class-wp-post-comments-list-table.php | |
| [WP\_Comments\_List\_Table::get\_bulk\_actions()](../classes/wp_comments_list_table/get_bulk_actions) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::get\_columns()](../classes/wp_comments_list_table/get_columns) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Terms\_List\_Table::get\_columns()](../classes/wp_terms_list_table/get_columns) wp-admin/includes/class-wp-terms-list-table.php | |
| [wp\_nav\_menu\_item\_post\_type\_meta\_box()](wp_nav_menu_item_post_type_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for a post type menu item. |
| [WP\_Posts\_List\_Table::get\_columns()](../classes/wp_posts_list_table/get_columns) wp-admin/includes/class-wp-posts-list-table.php | |
| [Custom\_Image\_Header::step\_1()](../classes/custom_image_header/step_1) wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. |
| [WP\_Customize\_Manager::register\_controls()](../classes/wp_customize_manager/register_controls) wp-includes/class-wp-customize-manager.php | Registers some default controls. |
| [\_ex()](_ex) wp-includes/l10n.php | Displays translated string with gettext context. |
| [capital\_P\_dangit()](capital_p_dangit) wp-includes/formatting.php | Forever eliminate “Wordpress” from the planet (or at least the little bit we can influence). |
| [wp\_trim\_excerpt()](wp_trim_excerpt) wp-includes/formatting.php | Generates an excerpt from the content, if needed. |
| [wp\_trim\_words()](wp_trim_words) wp-includes/formatting.php | Trims text to a certain number of words. |
| [wptexturize()](wptexturize) wp-includes/formatting.php | Replaces common plain text characters with formatted entities. |
| [register\_admin\_color\_schemes()](register_admin_color_schemes) wp-includes/general-template.php | Registers the default admin color schemes. |
| [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\_calendar()](get_calendar) wp-includes/general-template.php | Displays calendar with days that have posts as links. |
| [get\_search\_form()](get_search_form) wp-includes/general-template.php | Displays search form. |
| [WP\_Theme::translate\_header()](../classes/wp_theme/translate_header) wp-includes/class-wp-theme.php | Translates a theme header. |
| [WP\_Query::get\_search\_stopwords()](../classes/wp_query/get_search_stopwords) wp-includes/class-wp-query.php | Retrieve stopwords used when parsing search terms. |
| [size\_format()](size_format) wp-includes/functions.php | Converts a number of bytes to the largest unit the bytes will fit into. |
| [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\_Search::\_\_construct()](../classes/wp_widget_search/__construct) wp-includes/widgets/class-wp-widget-search.php | Sets up a new Search widget instance. |
| [WP\_Locale::init()](../classes/wp_locale/init) wp-includes/class-wp-locale.php | Sets up the translated strings and object properties. |
| [create\_initial\_taxonomies()](create_initial_taxonomies) wp-includes/taxonomy.php | Creates the initial taxonomies. |
| [wp\_admin\_bar\_new\_content\_menu()](wp_admin_bar_new_content_menu) wp-includes/admin-bar.php | Adds “Add New” menu. |
| [wp\_insert\_user()](wp_insert_user) wp-includes/user.php | Inserts a user into the database. |
| [wp\_dropdown\_users()](wp_dropdown_users) wp-includes/user.php | Creates dropdown HTML content of users. |
| [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\_enqueue\_media()](wp_enqueue_media) wp-includes/media.php | Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. |
| [wp\_underscore\_playlist\_templates()](wp_underscore_playlist_templates) wp-includes/media.php | Outputs the templates used by playlists. |
| [wp\_get\_attachment\_id3\_keys()](wp_get_attachment_id3_keys) wp-includes/media.php | Returns useful keys to use to lookup data from an attachment’s stored metadata. |
| [wp\_set\_post\_terms()](wp_set_post_terms) wp-includes/post.php | Sets the terms for a post. |
| [get\_post\_mime\_types()](get_post_mime_types) wp-includes/post.php | Gets default post mime types. |
| [create\_initial\_post\_types()](create_initial_post_types) wp-includes/post.php | Creates the initial post types when ‘init’ action is fired. |
| [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\_post\_format\_strings()](get_post_format_strings) wp-includes/post-formats.php | Returns an array of post format slugs to their translated and pretty display versions |
| [wp\_list\_authors()](wp_list_authors) wp-includes/author-template.php | Lists all the authors of the site, with several options available. |
| [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. |
| [comment\_type()](comment_type) wp-includes/comment-template.php | Displays the comment type of the current comment. |
| [get\_comment\_excerpt()](get_comment_excerpt) wp-includes/comment-template.php | Retrieves the excerpt of the given comment. |
| [WP\_Customize\_Widgets::enqueue\_scripts()](../classes/wp_customize_widgets/enqueue_scripts) wp-includes/class-wp-customize-widgets.php | Enqueues scripts and styles for Customizer panel and export data to JavaScript. |
| [wp\_default\_styles()](wp_default_styles) wp-includes/script-loader.php | Assigns default styles to $styles object. |
| [wp\_just\_in\_time\_script\_localization()](wp_just_in_time_script_localization) wp-includes/script-loader.php | Loads localized data on print rather than initialization. |
| [wp\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. |
| [get\_comment\_statuses()](get_comment_statuses) wp-includes/comment.php | Retrieves all of the WordPress supported comment statuses. |
| [\_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.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
| programming_docs |
wordpress switch_theme( string $stylesheet ) switch\_theme( string $stylesheet )
===================================
Switches the theme.
Accepts one argument: $stylesheet of the theme. It also accepts an additional function signature of two arguments: $template then $stylesheet. This is for backward compatibility.
`$stylesheet` string Required Stylesheet name. File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function switch_theme( $stylesheet ) {
global $wp_theme_directories, $wp_customize, $sidebars_widgets;
$requirements = validate_theme_requirements( $stylesheet );
if ( is_wp_error( $requirements ) ) {
wp_die( $requirements );
}
$_sidebars_widgets = null;
if ( 'wp_ajax_customize_save' === current_action() ) {
$old_sidebars_widgets_data_setting = $wp_customize->get_setting( 'old_sidebars_widgets_data' );
if ( $old_sidebars_widgets_data_setting ) {
$_sidebars_widgets = $wp_customize->post_value( $old_sidebars_widgets_data_setting );
}
} elseif ( is_array( $sidebars_widgets ) ) {
$_sidebars_widgets = $sidebars_widgets;
}
if ( is_array( $_sidebars_widgets ) ) {
set_theme_mod(
'sidebars_widgets',
array(
'time' => time(),
'data' => $_sidebars_widgets,
)
);
}
$nav_menu_locations = get_theme_mod( 'nav_menu_locations' );
update_option( 'theme_switch_menu_locations', $nav_menu_locations );
if ( func_num_args() > 1 ) {
$stylesheet = func_get_arg( 1 );
}
$old_theme = wp_get_theme();
$new_theme = wp_get_theme( $stylesheet );
$template = $new_theme->get_template();
if ( wp_is_recovery_mode() ) {
$paused_themes = wp_paused_themes();
$paused_themes->delete( $old_theme->get_stylesheet() );
$paused_themes->delete( $old_theme->get_template() );
}
update_option( 'template', $template );
update_option( 'stylesheet', $stylesheet );
if ( count( $wp_theme_directories ) > 1 ) {
update_option( 'template_root', get_raw_theme_root( $template, true ) );
update_option( 'stylesheet_root', get_raw_theme_root( $stylesheet, true ) );
} else {
delete_option( 'template_root' );
delete_option( 'stylesheet_root' );
}
$new_name = $new_theme->get( 'Name' );
update_option( 'current_theme', $new_name );
// Migrate from the old mods_{name} option to theme_mods_{slug}.
if ( is_admin() && false === get_option( 'theme_mods_' . $stylesheet ) ) {
$default_theme_mods = (array) get_option( 'mods_' . $new_name );
if ( ! empty( $nav_menu_locations ) && empty( $default_theme_mods['nav_menu_locations'] ) ) {
$default_theme_mods['nav_menu_locations'] = $nav_menu_locations;
}
add_option( "theme_mods_$stylesheet", $default_theme_mods );
} else {
/*
* Since retrieve_widgets() is called when initializing a theme in the Customizer,
* we need to remove the theme mods to avoid overwriting changes made via
* the Customizer when accessing wp-admin/widgets.php.
*/
if ( 'wp_ajax_customize_save' === current_action() ) {
remove_theme_mod( 'sidebars_widgets' );
}
}
update_option( 'theme_switched', $old_theme->get_stylesheet() );
/**
* Fires after the theme is switched.
*
* @since 1.5.0
* @since 4.5.0 Introduced the `$old_theme` parameter.
*
* @param string $new_name Name of the new theme.
* @param WP_Theme $new_theme WP_Theme instance of the new theme.
* @param WP_Theme $old_theme WP_Theme instance of the old theme.
*/
do_action( 'switch_theme', $new_name, $new_theme, $old_theme );
}
```
[do\_action( 'switch\_theme', string $new\_name, WP\_Theme $new\_theme, WP\_Theme $old\_theme )](../hooks/switch_theme)
Fires after the theme is switched.
| Uses | Description |
| --- | --- |
| [validate\_theme\_requirements()](validate_theme_requirements) wp-includes/theme.php | Validates the theme requirements for WordPress version and PHP version. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [wp\_paused\_themes()](wp_paused_themes) wp-includes/error-protection.php | Get the instance for storing paused extensions. |
| [set\_theme\_mod()](set_theme_mod) wp-includes/theme.php | Updates theme modification value for the active theme. |
| [remove\_theme\_mod()](remove_theme_mod) wp-includes/theme.php | Removes theme modification name from active theme list. |
| [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. |
| [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. |
| [wp\_is\_recovery\_mode()](wp_is_recovery_mode) wp-includes/load.php | Is WordPress in Recovery Mode. |
| [add\_option()](add_option) wp-includes/option.php | Adds a new option. |
| [current\_action()](current_action) wp-includes/plugin.php | Retrieves the name of the current action hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [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. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. |
| [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. |
| [validate\_current\_theme()](validate_current_theme) wp-includes/theme.php | Checks that the active theme has the required files. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_cron(): bool|int|void wp\_cron(): bool|int|void
=========================
Register [\_wp\_cron()](_wp_cron) to run on the {@see ‘wp\_loaded’} action.
If the [‘wp\_loaded’](../hooks/wp_loaded) action has already fired, this function calls [\_wp\_cron()](_wp_cron) directly.
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.
bool|int|void On success an integer indicating number of events spawned (0 indicates no events needed to be spawned), false if spawning fails for one or more events or void if the function registered [\_wp\_cron()](_wp_cron) to run on the action.
File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/)
```
function wp_cron() {
if ( did_action( 'wp_loaded' ) ) {
return _wp_cron();
}
add_action( 'wp_loaded', '_wp_cron', 20 );
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_cron()](_wp_cron) wp-includes/cron.php | Run scheduled callbacks or spawn cron for all scheduled events. |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Functionality moved to [\_wp\_cron()](_wp_cron) to which this becomes a wrapper. |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Return value added to indicate success or failure. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress set_post_type( int $post_id, string $post_type = 'post' ): int|false set\_post\_type( int $post\_id, string $post\_type = 'post' ): int|false
========================================================================
Updates the post type for the post ID.
The page or post cache will be cleaned for the post ID.
`$post_id` int Optional Post ID to change post type. Default 0. `$post_type` string Optional Post type. Accepts `'post'` or `'page'` to name a few. Default `'post'`. Default: `'post'`
int|false Amount of rows changed. Should be 1 for success and 0 for failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function set_post_type( $post_id = 0, $post_type = 'post' ) {
global $wpdb;
$post_type = sanitize_post_field( 'post_type', $post_type, $post_id, 'db' );
$return = $wpdb->update( $wpdb->posts, array( 'post_type' => $post_type ), array( 'ID' => $post_id ) );
clean_post_cache( $post_id );
return $return;
}
```
| Uses | Description |
| --- | --- |
| [clean\_post\_cache()](clean_post_cache) wp-includes/post.php | Will clean the post in the cache. |
| [sanitize\_post\_field()](sanitize_post_field) wp-includes/post.php | Sanitizes a post field based on context. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_update_user_counts( int|null $network_id = null ): bool wp\_update\_user\_counts( int|null $network\_id = null ): bool
==============================================================
Updates the total count of users on the site.
`$network_id` int|null Optional ID of the network. Defaults to the current network. Default: `null`
bool Whether the update was successful.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_update_user_counts( $network_id = null ) {
global $wpdb;
if ( ! is_multisite() && null !== $network_id ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: %s: $network_id */
__( 'Unable to pass %s if not using multisite.' ),
'<code>$network_id</code>'
),
'6.0.0'
);
}
$query = "SELECT COUNT(ID) as c FROM $wpdb->users";
if ( is_multisite() ) {
$query .= " WHERE spam = '0' AND deleted = '0'";
}
$count = $wpdb->get_var( $query );
return update_network_option( $network_id, 'user_count', $count );
}
```
| Uses | Description |
| --- | --- |
| [update\_network\_option()](update_network_option) wp-includes/option.php | Updates the value of a network option that was already added. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| Used By | Description |
| --- | --- |
| [wp\_maybe\_update\_user\_counts()](wp_maybe_update_user_counts) wp-includes/user.php | Updates the total count of users on the site if live user counting is enabled. |
| [wp\_update\_network\_user\_counts()](wp_update_network_user_counts) wp-includes/ms-functions.php | Updates the network-wide user count. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress wp_get_mime_types(): string[] wp\_get\_mime\_types(): string[]
================================
Retrieves the list of mime types and file extensions.
string[] Array of mime types keyed by the file extension regex corresponding to those types.
##### Usage:
```
$mime_types = wp_get_mime_types();
```
##### Notes:
Applies the filter `mime_types` to return value, passing the array of mime types. This filter should be used to add types, not remove them. To remove types, use the `upload_mimes` filter.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_get_mime_types() {
/**
* Filters the list of mime types and file extensions.
*
* This filter should be used to add, not remove, mime types. To remove
* mime types, use the {@see 'upload_mimes'} filter.
*
* @since 3.5.0
*
* @param string[] $wp_get_mime_types Mime types keyed by the file extension regex
* corresponding to those types.
*/
return apply_filters(
'mime_types',
array(
// Image formats.
'jpg|jpeg|jpe' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
'bmp' => 'image/bmp',
'tiff|tif' => 'image/tiff',
'webp' => 'image/webp',
'ico' => 'image/x-icon',
'heic' => 'image/heic',
// Video formats.
'asf|asx' => 'video/x-ms-asf',
'wmv' => 'video/x-ms-wmv',
'wmx' => 'video/x-ms-wmx',
'wm' => 'video/x-ms-wm',
'avi' => 'video/avi',
'divx' => 'video/divx',
'flv' => 'video/x-flv',
'mov|qt' => 'video/quicktime',
'mpeg|mpg|mpe' => 'video/mpeg',
'mp4|m4v' => 'video/mp4',
'ogv' => 'video/ogg',
'webm' => 'video/webm',
'mkv' => 'video/x-matroska',
'3gp|3gpp' => 'video/3gpp', // Can also be audio.
'3g2|3gp2' => 'video/3gpp2', // Can also be audio.
// Text formats.
'txt|asc|c|cc|h|srt' => 'text/plain',
'csv' => 'text/csv',
'tsv' => 'text/tab-separated-values',
'ics' => 'text/calendar',
'rtx' => 'text/richtext',
'css' => 'text/css',
'htm|html' => 'text/html',
'vtt' => 'text/vtt',
'dfxp' => 'application/ttaf+xml',
// Audio formats.
'mp3|m4a|m4b' => 'audio/mpeg',
'aac' => 'audio/aac',
'ra|ram' => 'audio/x-realaudio',
'wav' => 'audio/wav',
'ogg|oga' => 'audio/ogg',
'flac' => 'audio/flac',
'mid|midi' => 'audio/midi',
'wma' => 'audio/x-ms-wma',
'wax' => 'audio/x-ms-wax',
'mka' => 'audio/x-matroska',
// Misc application formats.
'rtf' => 'application/rtf',
'js' => 'application/javascript',
'pdf' => 'application/pdf',
'swf' => 'application/x-shockwave-flash',
'class' => 'application/java',
'tar' => 'application/x-tar',
'zip' => 'application/zip',
'gz|gzip' => 'application/x-gzip',
'rar' => 'application/rar',
'7z' => 'application/x-7z-compressed',
'exe' => 'application/x-msdownload',
'psd' => 'application/octet-stream',
'xcf' => 'application/octet-stream',
// MS Office formats.
'doc' => 'application/msword',
'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
'wri' => 'application/vnd.ms-write',
'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
'mdb' => 'application/vnd.ms-access',
'mpp' => 'application/vnd.ms-project',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'docm' => 'application/vnd.ms-word.document.macroEnabled.12',
'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'dotm' => 'application/vnd.ms-word.template.macroEnabled.12',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12',
'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12',
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12',
'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12',
'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
'sldm' => 'application/vnd.ms-powerpoint.slide.macroEnabled.12',
'onetoc|onetoc2|onetmp|onepkg' => 'application/onenote',
'oxps' => 'application/oxps',
'xps' => 'application/vnd.ms-xpsdocument',
// OpenOffice formats.
'odt' => 'application/vnd.oasis.opendocument.text',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'odg' => 'application/vnd.oasis.opendocument.graphics',
'odc' => 'application/vnd.oasis.opendocument.chart',
'odb' => 'application/vnd.oasis.opendocument.database',
'odf' => 'application/vnd.oasis.opendocument.formula',
// WordPerfect formats.
'wp|wpd' => 'application/wordperfect',
// iWork formats.
'key' => 'application/vnd.apple.keynote',
'numbers' => 'application/vnd.apple.numbers',
'pages' => 'application/vnd.apple.pages',
)
);
}
```
[apply\_filters( 'mime\_types', string[] $wp\_get\_mime\_types )](../hooks/mime_types)
Filters the list of mime types and file extensions.
| 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\_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\_get\_code\_editor\_settings()](wp_get_code_editor_settings) wp-includes/general-template.php | Generates and returns code editor settings. |
| [get\_header\_video\_settings()](get_header_video_settings) wp-includes/theme.php | Retrieves header video settings. |
| [sanitize\_file\_name()](sanitize_file_name) wp-includes/formatting.php | Sanitizes a filename, replacing whitespace with dashes. |
| [get\_allowed\_mime\_types()](get_allowed_mime_types) wp-includes/functions.php | Retrieves the list of allowed mime types and file extensions. |
| [do\_enclose()](do_enclose) wp-includes/functions.php | Checks content for video and audio links to add as enclosures. |
| [WP\_Image\_Editor::get\_mime\_type()](../classes/wp_image_editor/get_mime_type) wp-includes/class-wp-image-editor.php | Returns first matched mime-type from extension, as mapped from [wp\_get\_mime\_types()](wp_get_mime_types) |
| [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\_post\_mime\_types()](get_post_mime_types) wp-includes/post.php | Gets default post mime types. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Support was added for AAC (.aac) files. |
| [4.9.2](https://developer.wordpress.org/reference/since/4.9.2/) | Support was added for Flac (.flac) files. |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Support was added for GIMP (.xcf) files. |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
| programming_docs |
wordpress get_the_comments_pagination( array $args = array() ): string get\_the\_comments\_pagination( array $args = array() ): string
===============================================================
Retrieves a paginated navigation to next/previous set of comments, when applicable.
* [paginate\_comments\_links()](paginate_comments_links)
`$args` array Optional Default pagination arguments.
* `screen_reader_text`stringScreen reader text for the nav element. Default 'Comments navigation'.
* `aria_label`stringARIA label text for the nav element. Default `'Comments'`.
* `class`stringCustom class for the nav element. Default `'comments-pagination'`.
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_comments_pagination( $args = array() ) {
$navigation = '';
// 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(
'screen_reader_text' => __( 'Comments navigation' ),
'aria_label' => __( 'Comments' ),
'class' => 'comments-pagination',
)
);
$args['echo'] = false;
// Make sure we get a string back. Plain is the next best thing.
if ( isset( $args['type'] ) && 'array' === $args['type'] ) {
$args['type'] = 'plain';
}
$links = paginate_comments_links( $args );
if ( $links ) {
$navigation = _navigation_markup( $links, $args['class'], $args['screen_reader_text'], $args['aria_label'] );
}
return $navigation;
}
```
| Uses | Description |
| --- | --- |
| [\_navigation\_markup()](_navigation_markup) wp-includes/link-template.php | Wraps passed links in navigational markup. |
| [paginate\_comments\_links()](paginate_comments_links) wp-includes/link-template.php | Displays or retrieves pagination links for the comments on the current post. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Used By | Description |
| --- | --- |
| [the\_comments\_pagination()](the_comments_pagination) wp-includes/link-template.php | Displays a paginated navigation to next/previous set of comments, 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.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_render_widget_control( string $id ): string|null wp\_render\_widget\_control( string $id ): string|null
======================================================
Calls the control callback of a widget and returns the output.
`$id` string Required Widget ID. string|null
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function wp_render_widget_control( $id ) {
global $wp_registered_widget_controls;
if ( ! isset( $wp_registered_widget_controls[ $id ]['callback'] ) ) {
return null;
}
$callback = $wp_registered_widget_controls[ $id ]['callback'];
$params = $wp_registered_widget_controls[ $id ]['params'];
ob_start();
if ( is_callable( $callback ) ) {
call_user_func_array( $callback, $params );
}
return ob_get_clean();
}
```
| 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. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress use_codepress() use\_codepress()
================
This function has been deprecated.
Determine whether to use CodePress.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function use_codepress() {
_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 wp_registration_url(): string wp\_registration\_url(): string
===============================
Returns the URL that allows the user to register on the site.
string User registration URL.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_registration_url() {
/**
* Filters the user registration URL.
*
* @since 3.6.0
*
* @param string $register The user registration URL.
*/
return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) );
}
```
[apply\_filters( 'register\_url', string $register )](../hooks/register_url)
Filters the user registration URL.
| Uses | Description |
| --- | --- |
| [site\_url()](site_url) wp-includes/link-template.php | Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_register()](wp_register) wp-includes/general-template.php | Displays the Registration or Admin link. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress wp_validate_site_data( WP_Error $errors, array $data, WP_Site|null $old_site = null ) wp\_validate\_site\_data( WP\_Error $errors, array $data, WP\_Site|null $old\_site = null )
===========================================================================================
Validates data for a site prior to inserting or updating in the database.
`$errors` [WP\_Error](../classes/wp_error) Required Error object, passed by reference. Will contain validation errors if any occurred. `$data` array Required Associative array of complete site data. See [wp\_insert\_site()](wp_insert_site) for the included data. More Arguments from wp\_insert\_site( ... $data ) Data for the new site that should be inserted.
* `domain`stringSite domain. Default empty string.
* `path`stringSite path. Default `'/'`.
* `network_id`intThe site's network ID. Default is the current network ID.
* `registered`stringWhen the site was registered, in SQL datetime format. Default is the current time.
* `last_updated`stringWhen the site was last updated, in SQL datetime format. Default is the value of $registered.
* `public`intWhether the site is public. Default 1.
* `archived`intWhether the site is archived. Default 0.
* `mature`intWhether the site is mature. Default 0.
* `spam`intWhether the site is spam. Default 0.
* `deleted`intWhether the site is deleted. Default 0.
* `lang_id`intThe site's language ID. Currently unused. Default 0.
* `user_id`intUser ID for the site administrator. Passed to the `wp_initialize_site` hook.
* `title`stringSite title. Default is 'Site %d' where %d is the site ID. Passed to the `wp_initialize_site` hook.
* `options`arrayCustom option $key => $value pairs to use. Default empty array. Passed to the `wp_initialize_site` hook.
* `meta`arrayCustom site metadata $key => $value pairs to use. Default empty array.
Passed to the `wp_initialize_site` hook.
`$old_site` [WP\_Site](../classes/wp_site)|null Optional The old site object if the data belongs to a site being updated, or null if it is a new site being inserted. Default: `null`
File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function wp_validate_site_data( $errors, $data, $old_site = null ) {
// A domain must always be present.
if ( empty( $data['domain'] ) ) {
$errors->add( 'site_empty_domain', __( 'Site domain must not be empty.' ) );
}
// A path must always be present.
if ( empty( $data['path'] ) ) {
$errors->add( 'site_empty_path', __( 'Site path must not be empty.' ) );
}
// A network ID must always be present.
if ( empty( $data['network_id'] ) ) {
$errors->add( 'site_empty_network_id', __( 'Site network ID must be provided.' ) );
}
// Both registration and last updated dates must always be present and valid.
$date_fields = array( 'registered', 'last_updated' );
foreach ( $date_fields as $date_field ) {
if ( empty( $data[ $date_field ] ) ) {
$errors->add( 'site_empty_' . $date_field, __( 'Both registration and last updated dates must be provided.' ) );
break;
}
// Allow '0000-00-00 00:00:00', although it be stripped out at this point.
if ( '0000-00-00 00:00:00' !== $data[ $date_field ] ) {
$month = substr( $data[ $date_field ], 5, 2 );
$day = substr( $data[ $date_field ], 8, 2 );
$year = substr( $data[ $date_field ], 0, 4 );
$valid_date = wp_checkdate( $month, $day, $year, $data[ $date_field ] );
if ( ! $valid_date ) {
$errors->add( 'site_invalid_' . $date_field, __( 'Both registration and last updated dates must be valid dates.' ) );
break;
}
}
}
if ( ! empty( $errors->errors ) ) {
return;
}
// If a new site, or domain/path/network ID have changed, ensure uniqueness.
if ( ! $old_site
|| $data['domain'] !== $old_site->domain
|| $data['path'] !== $old_site->path
|| $data['network_id'] !== $old_site->network_id
) {
if ( domain_exists( $data['domain'], $data['path'], $data['network_id'] ) ) {
$errors->add( 'site_taken', __( 'Sorry, that site already exists!' ) );
}
}
}
```
| Uses | Description |
| --- | --- |
| [domain\_exists()](domain_exists) wp-includes/ms-functions.php | Checks whether a site name is already taken. |
| [wp\_checkdate()](wp_checkdate) wp-includes/functions.php | Tests if the supplied date is valid for the Gregorian calendar. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress post_custom( string $key = '' ): array|string|false post\_custom( string $key = '' ): array|string|false
====================================================
Retrieves post custom meta data field.
`$key` string Optional Meta data key name. Default: `''`
array|string|false Array of values, or single value if only one element exists.
False if the key does not exist.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function post_custom( $key = '' ) {
$custom = get_post_custom();
if ( ! isset( $custom[ $key ] ) ) {
return false;
} elseif ( 1 === count( $custom[ $key ] ) ) {
return $custom[ $key ][0];
} else {
return $custom[ $key ];
}
}
```
| Uses | Description |
| --- | --- |
| [get\_post\_custom()](get_post_custom) wp-includes/post.php | Retrieves post meta fields, based on post ID. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress stream_preview_image( int $post_id ): bool stream\_preview\_image( int $post\_id ): bool
=============================================
Streams image in post to browser, along with enqueued changes in `$_REQUEST['history']`.
`$post_id` int Required Attachment post ID. bool True on success, false on failure.
File: `wp-admin/includes/image-edit.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image-edit.php/)
```
function stream_preview_image( $post_id ) {
$post = get_post( $post_id );
wp_raise_memory_limit( 'admin' );
$img = wp_get_image_editor( _load_image_to_edit_path( $post_id ) );
if ( is_wp_error( $img ) ) {
return false;
}
$changes = ! empty( $_REQUEST['history'] ) ? json_decode( wp_unslash( $_REQUEST['history'] ) ) : null;
if ( $changes ) {
$img = image_edit_apply_changes( $img, $changes );
}
// Scale the image.
$size = $img->get_size();
$w = $size['width'];
$h = $size['height'];
$ratio = _image_get_preview_ratio( $w, $h );
$w2 = max( 1, $w * $ratio );
$h2 = max( 1, $h * $ratio );
if ( is_wp_error( $img->resize( $w2, $h2 ) ) ) {
return false;
}
return wp_stream_image( $img, $post->post_mime_type, $post_id );
}
```
| Uses | Description |
| --- | --- |
| [wp\_raise\_memory\_limit()](wp_raise_memory_limit) wp-includes/functions.php | Attempts to raise the PHP memory limit for memory intensive processes. |
| [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. |
| [\_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\_get\_image\_editor()](wp_get_image_editor) wp-includes/media.php | Returns a [WP\_Image\_Editor](../classes/wp_image_editor) instance and loads file into it. |
| [wp\_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. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_imgedit\_preview()](wp_ajax_imgedit_preview) wp-admin/includes/ajax-actions.php | Ajax handler for image editor previews. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress get_previous_image_link( string|int[] $size = 'thumbnail', string|false $text = false ): string get\_previous\_image\_link( string|int[] $size = 'thumbnail', string|false $text = false ): string
==================================================================================================
Gets the previous image link that has the same post parent.
* [get\_adjacent\_image\_link()](get_adjacent_image_link)
`$size` string|int[] Optional Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default `'thumbnail'`. Default: `'thumbnail'`
`$text` string|false Optional Link text. Default: `false`
string Markup for previous image link.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function get_previous_image_link( $size = 'thumbnail', $text = false ) {
return get_adjacent_image_link( true, $size, $text );
}
```
| Uses | Description |
| --- | --- |
| [get\_adjacent\_image\_link()](get_adjacent_image_link) wp-includes/media.php | Gets the next or previous image link that has the same post parent. |
| Used By | Description |
| --- | --- |
| [previous\_image\_link()](previous_image_link) wp-includes/media.php | Displays previous image link that has the same post parent. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress wp_schedule_https_detection() wp\_schedule\_https\_detection()
================================
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.
Schedules the Cron hook for detecting HTTPS support.
File: `wp-includes/https-detection.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/https-detection.php/)
```
function wp_schedule_https_detection() {
if ( wp_installing() ) {
return;
}
if ( ! wp_next_scheduled( 'wp_https_detection' ) ) {
wp_schedule_event( time(), 'twicedaily', 'wp_https_detection' );
}
}
```
| 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 |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress wp_defer_comment_counting( bool $defer = null ): bool wp\_defer\_comment\_counting( bool $defer = null ): bool
========================================================
Determines whether to defer comment counting.
When setting $defer to true, all post comment counts will not be updated until $defer is set to false. When $defer is set to false, then all previously deferred updated post comment counts will then be automatically updated without having to call [wp\_update\_comment\_count()](wp_update_comment_count) after.
`$defer` bool Optional Default: `null`
bool
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_defer_comment_counting( $defer = null ) {
static $_defer = false;
if ( is_bool( $defer ) ) {
$_defer = $defer;
// Flush any deferred counts.
if ( ! $defer ) {
wp_update_comment_count( null, true );
}
}
return $_defer;
}
```
| Uses | Description |
| --- | --- |
| [wp\_update\_comment\_count()](wp_update_comment_count) wp-includes/comment.php | Updates the comment count for post(s). |
| Used By | Description |
| --- | --- |
| [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [wp\_update\_comment\_count()](wp_update_comment_count) wp-includes/comment.php | Updates the comment count for post(s). |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress get_post_custom_keys( int $post_id ): array|void get\_post\_custom\_keys( int $post\_id ): array|void
====================================================
Retrieves meta field names for a post.
If there are no meta fields, then nothing (null) will be returned.
`$post_id` int Optional Post ID. Default is the ID of the global `$post`. array|void Array of the keys, if retrieved.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_post_custom_keys( $post_id = 0 ) {
$custom = get_post_custom( $post_id );
if ( ! is_array( $custom ) ) {
return;
}
$keys = array_keys( $custom );
if ( $keys ) {
return $keys;
}
}
```
| Uses | Description |
| --- | --- |
| [get\_post\_custom()](get_post_custom) wp-includes/post.php | Retrieves post meta fields, based on post ID. |
| Used By | Description |
| --- | --- |
| [the\_meta()](the_meta) wp-includes/post-template.php | Displays a list of post custom fields. |
| [WP\_Embed::delete\_oembed\_caches()](../classes/wp_embed/delete_oembed_caches) wp-includes/class-wp-embed.php | Deletes all oEmbed caches. Unused by core as of 4.0.0. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
| programming_docs |
wordpress has_excerpt( int|WP_Post $post ): bool has\_excerpt( int|WP\_Post $post ): bool
========================================
Determines whether the post has a custom excerpt.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global $post. bool True if the post has a custom excerpt, false otherwise.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function has_excerpt( $post = 0 ) {
$post = get_post( $post );
return ( ! empty( $post->post_excerpt ) );
}
```
| Uses | Description |
| --- | --- |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [WP\_Media\_List\_Table::column\_desc()](../classes/wp_media_list_table/column_desc) wp-admin/includes/class-wp-media-list-table.php | Handles the description column output. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress _update_blog_date_on_post_delete( int $post_id ) \_update\_blog\_date\_on\_post\_delete( int $post\_id )
=======================================================
Handler for updating the current site’s last updated date when a published post is deleted.
`$post_id` int Required Post ID File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function _update_blog_date_on_post_delete( $post_id ) {
$post = get_post( $post_id );
$post_type_obj = get_post_type_object( $post->post_type );
if ( ! $post_type_obj || ! $post_type_obj->public ) {
return;
}
if ( 'publish' !== $post->post_status ) {
return;
}
wpmu_update_blogs_date();
}
```
| Uses | Description |
| --- | --- |
| [wpmu\_update\_blogs\_date()](wpmu_update_blogs_date) wp-includes/ms-blogs.php | Update the last\_updated field for the current site. |
| [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. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress get_catname( int $cat_ID ): string get\_catname( int $cat\_ID ): string
====================================
This function has been deprecated. Use [get\_cat\_name()](get_cat_name) instead.
Retrieve the category name by the category ID.
* [get\_cat\_name()](get_cat_name)
`$cat_ID` int Required Category ID string category name
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_catname( $cat_ID ) {
_deprecated_function( __FUNCTION__, '2.8.0', 'get_cat_name()' );
return get_cat_name( $cat_ID );
}
```
| Uses | Description |
| --- | --- |
| [get\_cat\_name()](get_cat_name) wp-includes/category.php | Retrieves the name of a category from its ID. |
| [\_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\_cat\_name()](get_cat_name) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress get_metadata_by_mid( string $meta_type, int $meta_id ): stdClass|false get\_metadata\_by\_mid( string $meta\_type, int $meta\_id ): stdClass|false
===========================================================================
Retrieves metadata by meta ID.
`$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. `$meta_id` int Required ID for a specific meta row. stdClass|false Metadata object, or boolean `false` if the metadata doesn't exist.
* `meta_key`stringThe meta key.
* `meta_value`mixedThe unserialized meta value.
* `meta_id`stringOptional. The meta ID when the meta type is any value except `'user'`.
* `umeta_id`stringOptional. The meta ID when the meta type is `'user'`.
* `post_id`stringOptional. The object ID when the meta type is `'post'`.
* `comment_id`stringOptional. The object ID when the meta type is `'comment'`.
* `term_id`stringOptional. The object ID when the meta type is `'term'`.
* `user_id`stringOptional. The object ID when the meta type is `'user'`.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function get_metadata_by_mid( $meta_type, $meta_id ) {
global $wpdb;
if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) {
return false;
}
$meta_id = (int) $meta_id;
if ( $meta_id <= 0 ) {
return false;
}
$table = _get_meta_table( $meta_type );
if ( ! $table ) {
return false;
}
/**
* Short-circuits the return value when fetching a meta field by meta ID.
*
* 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:
*
* - `get_post_metadata_by_mid`
* - `get_comment_metadata_by_mid`
* - `get_term_metadata_by_mid`
* - `get_user_metadata_by_mid`
*
* @since 5.0.0
*
* @param stdClass|null $value The value to return.
* @param int $meta_id Meta ID.
*/
$check = apply_filters( "get_{$meta_type}_metadata_by_mid", null, $meta_id );
if ( null !== $check ) {
return $check;
}
$id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id';
$meta = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table WHERE $id_column = %d", $meta_id ) );
if ( empty( $meta ) ) {
return false;
}
if ( isset( $meta->meta_value ) ) {
$meta->meta_value = maybe_unserialize( $meta->meta_value );
}
return $meta;
}
```
[apply\_filters( "get\_{$meta\_type}\_metadata\_by\_mid", stdClass|null $value, int $meta\_id )](../hooks/get_meta_type_metadata_by_mid)
Short-circuits the return value when fetching a meta field by meta ID.
| Uses | Description |
| --- | --- |
| [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. |
| [\_get\_meta\_table()](_get_meta_table) wp-includes/meta.php | Retrieves the name of the metadata table for the specified object type. |
| [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\_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. |
| [get\_post\_meta\_by\_id()](get_post_meta_by_id) wp-admin/includes/post.php | Returns post meta data by meta ID. |
| [wp\_ajax\_add\_meta()](wp_ajax_add_meta) wp-admin/includes/ajax-actions.php | Ajax handler for adding meta. |
| [wp\_ajax\_delete\_meta()](wp_ajax_delete_meta) wp-admin/includes/ajax-actions.php | Ajax handler for deleting meta. |
| [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. |
| [update\_metadata\_by\_mid()](update_metadata_by_mid) wp-includes/meta.php | Updates metadata by meta ID. |
| [delete\_metadata\_by\_mid()](delete_metadata_by_mid) wp-includes/meta.php | Deletes metadata by meta ID. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress set_query_var( string $var, mixed $value ) set\_query\_var( string $var, mixed $value )
============================================
Sets the value of a query variable in the [WP\_Query](../classes/wp_query) class.
`$var` string Required Query variable key. `$value` mixed Required Query variable value. File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function set_query_var( $var, $value ) {
global $wp_query;
$wp_query->set( $var, $value );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::set()](../classes/wp_query/set) wp-includes/class-wp-query.php | Sets the value of a query variable. |
| Used By | Description |
| --- | --- |
| [build\_comment\_query\_vars\_from\_block()](build_comment_query_vars_from_block) wp-includes/blocks.php | Helper function that constructs a comment query vars array from the passed block properties. |
| [wp\_list\_comments()](wp_list_comments) wp-includes/comment-template.php | Displays a list of comments. |
| [comments\_template()](comments_template) wp-includes/comment-template.php | Loads the comment template specified in $file. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress get_plugin_data( string $plugin_file, bool $markup = true, bool $translate = true ): array get\_plugin\_data( string $plugin\_file, bool $markup = true, bool $translate = true ): array
=============================================================================================
Parses the plugin contents to retrieve plugin’s metadata.
All plugin headers must be on their own line. Plugin description must not have any newlines, otherwise only parts of the description will be displayed.
The below is formatted for printing.
```
/*
Plugin Name: Name of the plugin.
Plugin URI: The home page of the plugin.
Description: Plugin description.
Author: Plugin author's name.
Author URI: Link to the author's website.
Version: Plugin version.
Text Domain: Optional. Unique identifier, should be same as the one used in
load_plugin_textdomain().
Domain Path: Optional. Only useful if the translations are located in a
folder above the plugin's base path. For example, if .mo files are
located in the locale folder then Domain Path will be "/locale/" and
must have the first slash. Defaults to the base folder the plugin is
located in.
Network: Optional. Specify "Network: true" to require that a plugin is activated
across all sites in an installation. This will prevent a plugin from being
activated on a single site when Multisite is enabled.
Requires at least: Optional. Specify the minimum required WordPress version.
Requires PHP: Optional. Specify the minimum required PHP version.
* / # Remove the space to close comment.
```
The first 8 KB of the file will be pulled in and if the plugin data is not within that first 8 KB, then the plugin author should correct their plugin and move the plugin data headers to the top.
The plugin file is assumed to have permissions to allow for scripts to read the file. This is not checked however and the file is only opened for reading.
`$plugin_file` string Required Absolute path to the main plugin file. `$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.
* `Name`stringName of the plugin. Should be unique.
* `PluginURI`stringPlugin URI.
* `Version`stringPlugin version.
* `Description`stringPlugin description.
* `Author`stringPlugin author's name.
* `AuthorURI`stringPlugin author's website address (if set).
* `TextDomain`stringPlugin textdomain.
* `DomainPath`stringPlugin's relative directory path to .mo files.
* `Network`boolWhether the plugin can only be activated network-wide.
* `RequiresWP`stringMinimum required version of WordPress.
* `RequiresPHP`stringMinimum required version of PHP.
* `UpdateURI`stringID of the plugin for update purposes, should be a URI.
* `Title`stringTitle of the plugin and link to the plugin's site (if set).
* `AuthorName`stringPlugin author's name.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
$default_headers = array(
'Name' => 'Plugin Name',
'PluginURI' => 'Plugin URI',
'Version' => 'Version',
'Description' => 'Description',
'Author' => 'Author',
'AuthorURI' => 'Author URI',
'TextDomain' => 'Text Domain',
'DomainPath' => 'Domain Path',
'Network' => 'Network',
'RequiresWP' => 'Requires at least',
'RequiresPHP' => 'Requires PHP',
'UpdateURI' => 'Update URI',
// Site Wide Only is deprecated in favor of Network.
'_sitewide' => 'Site Wide Only',
);
$plugin_data = get_file_data( $plugin_file, $default_headers, 'plugin' );
// Site Wide Only is the old header for Network.
if ( ! $plugin_data['Network'] && $plugin_data['_sitewide'] ) {
/* translators: 1: Site Wide Only: true, 2: Network: true */
_deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The %1$s plugin header is deprecated. Use %2$s instead.' ), '<code>Site Wide Only: true</code>', '<code>Network: true</code>' ) );
$plugin_data['Network'] = $plugin_data['_sitewide'];
}
$plugin_data['Network'] = ( 'true' === strtolower( $plugin_data['Network'] ) );
unset( $plugin_data['_sitewide'] );
// If no text domain is defined fall back to the plugin slug.
if ( ! $plugin_data['TextDomain'] ) {
$plugin_slug = dirname( plugin_basename( $plugin_file ) );
if ( '.' !== $plugin_slug && false === strpos( $plugin_slug, '/' ) ) {
$plugin_data['TextDomain'] = $plugin_slug;
}
}
if ( $markup || $translate ) {
$plugin_data = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup, $translate );
} else {
$plugin_data['Title'] = $plugin_data['Name'];
$plugin_data['AuthorName'] = $plugin_data['Author'];
}
return $plugin_data;
}
```
| Uses | Description |
| --- | --- |
| [\_get\_plugin\_data\_markup\_translate()](_get_plugin_data_markup_translate) wp-admin/includes/plugin.php | Sanitizes plugin data, optionally adds markup, optionally translates. |
| [get\_file\_data()](get_file_data) wp-includes/functions.php | Retrieves metadata from a file. |
| [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. |
| [\_\_()](__) 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. |
| Used By | Description |
| --- | --- |
| [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. |
| [validate\_plugin\_requirements()](validate_plugin_requirements) wp-admin/includes/plugin.php | Validates the plugin requirements for WordPress version and PHP version. |
| [wp\_ajax\_delete\_plugin()](wp_ajax_delete_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a plugin. |
| [wp\_ajax\_update\_plugin()](wp_ajax_update_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for updating a plugin. |
| [WP\_Automatic\_Updater::update()](../classes/wp_automatic_updater/update) wp-admin/includes/class-wp-automatic-updater.php | Updates an item, if appropriate. |
| [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. |
| [get\_dropins()](get_dropins) wp-admin/includes/plugin.php | Checks the wp-content directory and retrieve all drop-ins with any plugin data. |
| [is\_network\_only\_plugin()](is_network_only_plugin) wp-admin/includes/plugin.php | Checks for “Network: true” in the plugin header to see if this should be activated only as a network wide plugin. The plugin would also work when Multisite is not enabled. |
| [get\_plugins()](get_plugins) wp-admin/includes/plugin.php | Checks the plugins directory and retrieve all plugin files with plugin data. |
| [get\_mu\_plugins()](get_mu_plugins) wp-admin/includes/plugin.php | Checks the mu-plugins directory and retrieve all mu-plugin files with any plugin data. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Added support for `Update URI` header. |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added support for `Requires at least` and `Requires PHP` headers. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_untrash_post( int $post_id ): WP_Post|false|null wp\_untrash\_post( int $post\_id ): WP\_Post|false|null
=======================================================
Restores a post from the Trash.
`$post_id` int Optional Post ID. Default is the ID of the global `$post`. [WP\_Post](../classes/wp_post)|false|null Post data on success, false or null on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_untrash_post( $post_id = 0 ) {
$post = get_post( $post_id );
if ( ! $post ) {
return $post;
}
$post_id = $post->ID;
if ( 'trash' !== $post->post_status ) {
return false;
}
$previous_status = get_post_meta( $post_id, '_wp_trash_meta_status', true );
/**
* Filters whether a post untrashing should take place.
*
* @since 4.9.0
* @since 5.6.0 The `$previous_status` parameter was added.
*
* @param bool|null $untrash Whether to go forward with untrashing.
* @param WP_Post $post Post object.
* @param string $previous_status The status of the post at the point where it was trashed.
*/
$check = apply_filters( 'pre_untrash_post', null, $post, $previous_status );
if ( null !== $check ) {
return $check;
}
/**
* Fires before a post is restored from the Trash.
*
* @since 2.9.0
* @since 5.6.0 The `$previous_status` parameter was added.
*
* @param int $post_id Post ID.
* @param string $previous_status The status of the post at the point where it was trashed.
*/
do_action( 'untrash_post', $post_id, $previous_status );
$new_status = ( 'attachment' === $post->post_type ) ? 'inherit' : 'draft';
/**
* Filters the status that a post gets assigned when it is restored from the trash (untrashed).
*
* By default posts that are restored will be assigned a status of 'draft'. Return the value of `$previous_status`
* in order to assign the status that the post had before it was trashed. The `wp_untrash_post_set_previous_status()`
* function is available for this.
*
* Prior to WordPress 5.6.0, restored posts were always assigned their original status.
*
* @since 5.6.0
*
* @param string $new_status The new status of the post being restored.
* @param int $post_id The ID of the post being restored.
* @param string $previous_status The status of the post at the point where it was trashed.
*/
$post_status = apply_filters( 'wp_untrash_post_status', $new_status, $post_id, $previous_status );
delete_post_meta( $post_id, '_wp_trash_meta_status' );
delete_post_meta( $post_id, '_wp_trash_meta_time' );
$post_updated = wp_update_post(
array(
'ID' => $post_id,
'post_status' => $post_status,
)
);
if ( ! $post_updated ) {
return false;
}
wp_untrash_post_comments( $post_id );
/**
* Fires after a post is restored from the Trash.
*
* @since 2.9.0
* @since 5.6.0 The `$previous_status` parameter was added.
*
* @param int $post_id Post ID.
* @param string $previous_status The status of the post at the point where it was trashed.
*/
do_action( 'untrashed_post', $post_id, $previous_status );
return $post;
}
```
[apply\_filters( 'pre\_untrash\_post', bool|null $untrash, WP\_Post $post, string $previous\_status )](../hooks/pre_untrash_post)
Filters whether a post untrashing should take place.
[do\_action( 'untrashed\_post', int $post\_id, string $previous\_status )](../hooks/untrashed_post)
Fires after a post is restored from the Trash.
[do\_action( 'untrash\_post', int $post\_id, string $previous\_status )](../hooks/untrash_post)
Fires before a post is restored from the Trash.
[apply\_filters( 'wp\_untrash\_post\_status', string $new\_status, int $post\_id, string $previous\_status )](../hooks/wp_untrash_post_status)
Filters the status that a post gets assigned when it is restored from the trash (untrashed).
| Uses | Description |
| --- | --- |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [wp\_untrash\_post\_comments()](wp_untrash_post_comments) wp-includes/post.php | Restores comments for a post from the Trash. |
| [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. |
| [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\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_trash\_post()](wp_ajax_trash_post) wp-admin/includes/ajax-actions.php | Ajax handler for sending a post to the Trash. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | An untrashed post is now returned to `'draft'` status by default, except for attachments which are returned to their original `'inherit'` status. |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
| programming_docs |
wordpress _add_block_template_part_area_info( array $template_info ): array \_add\_block\_template\_part\_area\_info( array $template\_info ): 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 the template part’s area information to the input template.
`$template_info` array Required Template to add information to (requires `'type'` and `'slug'` fields). array Template info.
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_part_area_info( $template_info ) {
if ( WP_Theme_JSON_Resolver::theme_has_support() ) {
$theme_data = WP_Theme_JSON_Resolver::get_theme_data()->get_template_parts();
}
if ( isset( $theme_data[ $template_info['slug'] ]['area'] ) ) {
$template_info['title'] = $theme_data[ $template_info['slug'] ]['title'];
$template_info['area'] = _filter_block_template_part_area( $theme_data[ $template_info['slug'] ]['area'] );
} else {
$template_info['area'] = WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
}
return $template_info;
}
```
| Uses | Description |
| --- | --- |
| [\_filter\_block\_template\_part\_area()](_filter_block_template_part_area) wp-includes/block-template-utils.php | Checks whether the input ‘area’ is a supported value. |
| [WP\_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 wp_common_block_scripts_and_styles() wp\_common\_block\_scripts\_and\_styles()
=========================================
Handles the enqueueing of block scripts and styles that are common to both the editor and the front-end.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_common_block_scripts_and_styles() {
if ( is_admin() && ! wp_should_load_block_editor_scripts_and_styles() ) {
return;
}
wp_enqueue_style( 'wp-block-library' );
if ( current_theme_supports( 'wp-block-styles' ) ) {
if ( wp_should_load_separate_core_block_assets() ) {
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? 'css' : 'min.css';
$files = glob( __DIR__ . "/blocks/**/theme.$suffix" );
foreach ( $files as $path ) {
$block_name = basename( dirname( $path ) );
if ( is_rtl() && file_exists( __DIR__ . "/blocks/$block_name/theme-rtl.$suffix" ) ) {
$path = __DIR__ . "/blocks/$block_name/theme-rtl.$suffix";
}
wp_add_inline_style( "wp-block-{$block_name}", file_get_contents( $path ) );
}
} else {
wp_enqueue_style( 'wp-block-library-theme' );
}
}
/**
* Fires after enqueuing block assets for both editor and front-end.
*
* Call `add_action` on any hook before 'wp_enqueue_scripts'.
*
* In the function call you supply, simply use `wp_enqueue_script` and
* `wp_enqueue_style` to add your functionality to the Gutenberg editor.
*
* @since 5.0.0
*/
do_action( 'enqueue_block_assets' );
}
```
[do\_action( 'enqueue\_block\_assets' )](../hooks/enqueue_block_assets)
Fires after enqueuing block assets for both editor and front-end.
| 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. |
| [wp\_should\_load\_block\_editor\_scripts\_and\_styles()](wp_should_load_block_editor_scripts_and_styles) wp-includes/script-loader.php | Checks if the editor scripts and styles for all registered block types should be enqueued on the current screen. |
| [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| [wp\_add\_inline\_style()](wp_add_inline_style) wp-includes/functions.wp-styles.php | Add extra CSS styles to a registered stylesheet. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress unregister_block_style( string $block_name, string $block_style_name ): bool unregister\_block\_style( string $block\_name, string $block\_style\_name ): bool
=================================================================================
Unregisters a block style.
`$block_name` string Required Block type name including namespace. `$block_style_name` string Required Block style name. bool True if the block style was unregistered with success and false otherwise.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function unregister_block_style( $block_name, $block_style_name ) {
return WP_Block_Styles_Registry::get_instance()->unregister( $block_name, $block_style_name );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress is_multi_author(): bool is\_multi\_author(): bool
=========================
Determines whether this site has more than one author.
Checks to see if more than one author has published posts.
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 or not we have more than one author
File: `wp-includes/author-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/author-template.php/)
```
function is_multi_author() {
global $wpdb;
$is_multi_author = get_transient( 'is_multi_author' );
if ( false === $is_multi_author ) {
$rows = (array) $wpdb->get_col( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 2" );
$is_multi_author = 1 < count( $rows ) ? 1 : 0;
set_transient( 'is_multi_author', $is_multi_author );
}
/**
* Filters whether the site has more than one author with published posts.
*
* @since 3.2.0
*
* @param bool $is_multi_author Whether $is_multi_author should evaluate as true.
*/
return apply_filters( 'is_multi_author', (bool) $is_multi_author );
}
```
[apply\_filters( 'is\_multi\_author', bool $is\_multi\_author )](../hooks/is_multi_author)
Filters whether the site has more than one author with published posts.
| Uses | Description |
| --- | --- |
| [set\_transient()](set_transient) wp-includes/option.php | Sets/updates the value of a transient. |
| [get\_transient()](get_transient) wp-includes/option.php | Retrieves the value of a transient. |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
wordpress get_page_children( int $page_id, WP_Post[] $pages ): WP_Post[] get\_page\_children( int $page\_id, WP\_Post[] $pages ): WP\_Post[]
===================================================================
Identifies descendants of a given page ID in a list of page objects.
Descendants are identified from the `$pages` array passed to the function. No database queries are performed.
`$page_id` int Required Page ID. `$pages` [WP\_Post](../classes/wp_post)[] Required List of page objects from which descendants should be identified. [WP\_Post](../classes/wp_post)[] List of page children.
This function calls itself recursively.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_page_children( $page_id, $pages ) {
// Build a hash of ID -> children.
$children = array();
foreach ( (array) $pages as $page ) {
$children[ (int) $page->post_parent ][] = $page;
}
$page_list = array();
// Start the search by looking at immediate children.
if ( isset( $children[ $page_id ] ) ) {
// Always start at the end of the stack in order to preserve original `$pages` order.
$to_look = array_reverse( $children[ $page_id ] );
while ( $to_look ) {
$p = array_pop( $to_look );
$page_list[] = $p;
if ( isset( $children[ $p->ID ] ) ) {
foreach ( array_reverse( $children[ $p->ID ] ) as $child ) {
// Append to the `$to_look` stack to descend the tree.
$to_look[] = $child;
}
}
}
}
return $page_list;
}
```
| Used By | Description |
| --- | --- |
| [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 the_attachment_links( int|bool $id = false ) the\_attachment\_links( int|bool $id = false )
==============================================
This function has been deprecated.
This was once used to display attachment links. Now it is deprecated and stubbed.
`$id` int|bool Optional Default: `false`
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function the_attachment_links( $id = false ) {
_deprecated_function( __FUNCTION__, '3.7.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.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | This function has been deprecated. |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress shutdown_action_hook() shutdown\_action\_hook()
========================
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 just before PHP shuts down execution.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function shutdown_action_hook() {
/**
* Fires just before PHP shuts down execution.
*
* @since 1.2.0
*/
do_action( 'shutdown' );
wp_cache_close();
}
```
[do\_action( 'shutdown' )](../hooks/shutdown)
Fires just before PHP shuts down execution.
| Uses | Description |
| --- | --- |
| [wp\_cache\_close()](wp_cache_close) wp-includes/cache.php | Closes the cache. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress get_oembed_response_data( WP_Post|int $post, int $width ): array|false get\_oembed\_response\_data( WP\_Post|int $post, int $width ): array|false
==========================================================================
Retrieves the oEmbed response data for a given post.
`$post` [WP\_Post](../classes/wp_post)|int Required Post ID or post object. `$width` int Required The requested width. array|false Response data on success, false if post doesn't exist or is not publicly viewable.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function get_oembed_response_data( $post, $width ) {
$post = get_post( $post );
$width = absint( $width );
if ( ! $post ) {
return false;
}
if ( ! is_post_publicly_viewable( $post ) ) {
return false;
}
/**
* Filters the allowed minimum and maximum widths for the oEmbed response.
*
* @since 4.4.0
*
* @param array $min_max_width {
* Minimum and maximum widths for the oEmbed response.
*
* @type int $min Minimum width. Default 200.
* @type int $max Maximum width. Default 600.
* }
*/
$min_max_width = apply_filters(
'oembed_min_max_width',
array(
'min' => 200,
'max' => 600,
)
);
$width = min( max( $min_max_width['min'], $width ), $min_max_width['max'] );
$height = max( ceil( $width / 16 * 9 ), 200 );
$data = array(
'version' => '1.0',
'provider_name' => get_bloginfo( 'name' ),
'provider_url' => get_home_url(),
'author_name' => get_bloginfo( 'name' ),
'author_url' => get_home_url(),
'title' => get_the_title( $post ),
'type' => 'link',
);
$author = get_userdata( $post->post_author );
if ( $author ) {
$data['author_name'] = $author->display_name;
$data['author_url'] = get_author_posts_url( $author->ID );
}
/**
* Filters the oEmbed response data.
*
* @since 4.4.0
*
* @param array $data The response data.
* @param WP_Post $post The post object.
* @param int $width The requested width.
* @param int $height The calculated height.
*/
return apply_filters( 'oembed_response_data', $data, $post, $width, $height );
}
```
[apply\_filters( 'oembed\_min\_max\_width', array $min\_max\_width )](../hooks/oembed_min_max_width)
Filters the allowed minimum and maximum widths for the oEmbed response.
[apply\_filters( 'oembed\_response\_data', array $data, WP\_Post $post, int $width, int $height )](../hooks/oembed_response_data)
Filters the oEmbed response data.
| Uses | Description |
| --- | --- |
| [is\_post\_publicly\_viewable()](is_post_publicly_viewable) wp-includes/post.php | Determines whether a post is publicly viewable. |
| [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\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. |
| [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. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [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\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [get\_oembed\_response\_data\_for\_url()](get_oembed_response_data_for_url) wp-includes/embed.php | Retrieves the oEmbed response data for a given URL. |
| [WP\_oEmbed\_Controller::get\_item()](../classes/wp_oembed_controller/get_item) wp-includes/class-wp-oembed-controller.php | Callback for the embed API endpoint. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress post_trackback_meta_box( WP_Post $post ) post\_trackback\_meta\_box( WP\_Post $post )
============================================
Displays trackback links 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_trackback_meta_box( $post ) {
$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' .
esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />';
if ( '' !== $post->pinged ) {
$pings = '<p>' . __( 'Already pinged:' ) . '</p><ul>';
$already_pinged = explode( "\n", trim( $post->pinged ) );
foreach ( $already_pinged as $pinged_url ) {
$pings .= "\n\t<li>" . esc_html( $pinged_url ) . '</li>';
}
$pings .= '</ul>';
}
?>
<p>
<label for="trackback_url"><?php _e( 'Send trackbacks to:' ); ?></label>
<?php echo $form_trackback; ?>
</p>
<p id="trackback-url-desc" class="howto"><?php _e( 'Separate multiple URLs with spaces' ); ?></p>
<p>
<?php
printf(
/* translators: %s: Documentation URL. */
__( 'Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress sites, they’ll be notified automatically using <a href="%s">pingbacks</a>, no other action necessary.' ),
__( 'https://wordpress.org/support/article/introduction-to-blogging/#comments' )
);
?>
</p>
<?php
if ( ! empty( $pings ) ) {
echo $pings;
}
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress rest_convert_error_to_response( WP_Error $error ): WP_REST_Response rest\_convert\_error\_to\_response( WP\_Error $error ): WP\_REST\_Response
==========================================================================
Converts an error to a response object.
This iterates over all error codes and messages to change it into a flat array. This enables simpler client behaviour, as it is represented as a list in JSON rather than an object/map.
`$error` [WP\_Error](../classes/wp_error) Required [WP\_Error](../classes/wp_error) instance. [WP\_REST\_Response](../classes/wp_rest_response) List of associative arrays with code and message keys.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_convert_error_to_response( $error ) {
$status = array_reduce(
$error->get_all_error_data(),
static function ( $status, $error_data ) {
return is_array( $error_data ) && isset( $error_data['status'] ) ? $error_data['status'] : $status;
},
500
);
$errors = array();
foreach ( (array) $error->errors as $code => $messages ) {
$all_data = $error->get_all_error_data( $code );
$last_data = array_pop( $all_data );
foreach ( (array) $messages as $message ) {
$formatted = array(
'code' => $code,
'message' => $message,
'data' => $last_data,
);
if ( $all_data ) {
$formatted['additional_data'] = $all_data;
}
$errors[] = $formatted;
}
}
$data = $errors[0];
if ( count( $errors ) > 1 ) {
// Remove the primary error.
array_shift( $errors );
$data['additional_errors'] = $errors;
}
return new WP_REST_Response( $data, $status );
}
```
| Used By | Description |
| --- | --- |
| [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::error\_to\_response()](../classes/wp_rest_server/error_to_response) wp-includes/rest-api/class-wp-rest-server.php | Converts an error to a response object. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
| programming_docs |
wordpress wp_ajax_set_attachment_thumbnail() wp\_ajax\_set\_attachment\_thumbnail()
======================================
Ajax handler for setting the featured image for an attachment.
* [set\_post\_thumbnail()](set_post_thumbnail)
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_attachment_thumbnail() {
if ( empty( $_POST['urls'] ) || ! is_array( $_POST['urls'] ) ) {
wp_send_json_error();
}
$thumbnail_id = (int) $_POST['thumbnail_id'];
if ( empty( $thumbnail_id ) ) {
wp_send_json_error();
}
$post_ids = array();
// For each URL, try to find its corresponding post ID.
foreach ( $_POST['urls'] as $url ) {
$post_id = attachment_url_to_postid( $url );
if ( ! empty( $post_id ) ) {
$post_ids[] = $post_id;
}
}
if ( empty( $post_ids ) ) {
wp_send_json_error();
}
$success = 0;
// For each found attachment, set its thumbnail.
foreach ( $post_ids as $post_id ) {
if ( ! current_user_can( 'edit_post', $post_id ) ) {
continue;
}
if ( set_post_thumbnail( $post_id, $thumbnail_id ) ) {
$success++;
}
}
if ( 0 === $success ) {
wp_send_json_error();
} else {
wp_send_json_success();
}
wp_send_json_error();
}
```
| Uses | Description |
| --- | --- |
| [attachment\_url\_to\_postid()](attachment_url_to_postid) wp-includes/media.php | Tries to convert an attachment URL into a post ID. |
| [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. |
| [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 |
| --- | --- |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
wordpress wp_style_engine_get_styles( array $block_styles, array $options = array() ): array wp\_style\_engine\_get\_styles( array $block\_styles, array $options = array() ): array
=======================================================================================
Global public interface method to generate styles from a single style object, e.g., the value of a block’s attributes.style object or the top level styles in theme.json.
See: <https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-living/#styles> and <https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/>
Example usage:
$styles = wp\_style\_engine\_get\_styles( array( ‘color’ => array( ‘text’ => ‘#cccccc’ ) ) ); // Returns `array( 'css' => 'color: #cccccc', 'declarations' => array( 'color' => '#cccccc' ), 'classnames' => 'has-color' )`.
`$block_styles` array Required The style object. `$options` array Optional An array of options.
* `context`string|nullAn identifier describing the origin of the style object, e.g., `'block-supports'` or `'global-styles'`. Default is `null`.
When set, the style engine will attempt to store the CSS rules, where a selector is also passed.
* `convert_vars_to_classnames`boolWhether to skip converting incoming CSS var patterns, e.g., `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`, to var( --wp--preset--\* ) values. Default `false`.
* `selector`stringOptional. When a selector is passed, the value of `$css` in the return value will comprise a full CSS rule `$selector { ...$css_declarations }`, otherwise, the value will be a concatenated string of CSS declarations.
Default: `array()`
array
* `css`stringA CSS ruleset or declarations block formatted to be placed in an HTML `style` attribute or tag.
* `declarations`string[]An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).
* `classnames`stringClassnames separated by a space.
File: `wp-includes/style-engine.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/style-engine.php/)
```
function wp_style_engine_get_styles( $block_styles, $options = array() ) {
$options = wp_parse_args(
$options,
array(
'selector' => null,
'context' => null,
'convert_vars_to_classnames' => false,
)
);
$parsed_styles = WP_Style_Engine::parse_block_styles( $block_styles, $options );
// Output.
$styles_output = array();
if ( ! empty( $parsed_styles['declarations'] ) ) {
$styles_output['css'] = WP_Style_Engine::compile_css( $parsed_styles['declarations'], $options['selector'] );
$styles_output['declarations'] = $parsed_styles['declarations'];
if ( ! empty( $options['context'] ) ) {
WP_Style_Engine::store_css_rule( $options['context'], $options['selector'], $parsed_styles['declarations'] );
}
}
if ( ! empty( $parsed_styles['classnames'] ) ) {
$styles_output['classnames'] = implode( ' ', array_unique( $parsed_styles['classnames'] ) );
}
return array_filter( $styles_output );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Style\_Engine::parse\_block\_styles()](../classes/wp_style_engine/parse_block_styles) wp-includes/style-engine/class-wp-style-engine.php | Returns classnames and CSS based on the values in a styles object. |
| [WP\_Style\_Engine::compile\_css()](../classes/wp_style_engine/compile_css) wp-includes/style-engine/class-wp-style-engine.php | Returns compiled CSS from css\_declarations. |
| [WP\_Style\_Engine::store\_css\_rule()](../classes/wp_style_engine/store_css_rule) wp-includes/style-engine/class-wp-style-engine.php | Stores a CSS rule using the provided CSS selector and CSS declarations. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress dashboard_browser_nag_class( string[] $classes ): string[] dashboard\_browser\_nag\_class( string[] $classes ): string[]
=============================================================
Adds an additional class to the browser nag if the current version is insecure.
`$classes` string[] Required Array of meta box classes. string[] Modified array of meta box classes.
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function dashboard_browser_nag_class( $classes ) {
$response = wp_check_browser_version();
if ( $response && $response['insecure'] ) {
$classes[] = 'browser-insecure';
}
return $classes;
}
```
| Uses | Description |
| --- | --- |
| [wp\_check\_browser\_version()](wp_check_browser_version) wp-admin/includes/dashboard.php | Checks if the user needs a browser update. |
| Version | Description |
| --- | --- |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
wordpress post_slug_meta_box( WP_Post $post ) post\_slug\_meta\_box( WP\_Post $post )
=======================================
Displays slug 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_slug_meta_box( $post ) {
/** This filter is documented in wp-admin/edit-tag-form.php */
$editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );
?>
<label class="screen-reader-text" for="post_name"><?php _e( 'Slug' ); ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $editable_slug ); ?>" />
<?php
}
```
[apply\_filters( 'editable\_slug', string $slug, WP\_Term|WP\_Post $tag )](../hooks/editable_slug)
Filters the editable slug for a post or term.
| Uses | Description |
| --- | --- |
| [\_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. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress _disable_content_editor_for_navigation_post_type( WP_Post $post ) \_disable\_content\_editor\_for\_navigation\_post\_type( WP\_Post $post )
=========================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
This callback disables the content editor for wp\_navigation type posts.
Content editor cannot handle wp\_navigation type posts correctly.
We cannot disable the "editor" feature in the wp\_navigation’s CPT definition because it disables the ability to save navigation blocks via REST API.
`$post` [WP\_Post](../classes/wp_post) Required An instance of [WP\_Post](../classes/wp_post) class. File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function _disable_content_editor_for_navigation_post_type( $post ) {
$post_type = get_post_type( $post );
if ( 'wp_navigation' !== $post_type ) {
return;
}
remove_post_type_support( $post_type, 'editor' );
}
```
| Uses | Description |
| --- | --- |
| [remove\_post\_type\_support()](remove_post_type_support) wp-includes/post.php | Removes support for a feature from a post type. |
| [get\_post\_type()](get_post_type) wp-includes/post.php | Retrieves the post type of the current post or of a given post. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress wp_load_alloptions( bool $force_cache = false ): array wp\_load\_alloptions( bool $force\_cache = false ): array
=========================================================
Loads and caches all autoloaded options, if available or all options.
`$force_cache` bool Optional Whether to force an update of the local cache from the persistent cache. Default: `false`
array List of all options.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function wp_load_alloptions( $force_cache = false ) {
global $wpdb;
if ( ! wp_installing() || ! is_multisite() ) {
$alloptions = wp_cache_get( 'alloptions', 'options', $force_cache );
} else {
$alloptions = false;
}
if ( ! $alloptions ) {
$suppress = $wpdb->suppress_errors();
$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" );
if ( ! $alloptions_db ) {
$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
}
$wpdb->suppress_errors( $suppress );
$alloptions = array();
foreach ( (array) $alloptions_db as $o ) {
$alloptions[ $o->option_name ] = $o->option_value;
}
if ( ! wp_installing() || ! is_multisite() ) {
/**
* Filters all options before caching them.
*
* @since 4.9.0
*
* @param array $alloptions Array with all options.
*/
$alloptions = apply_filters( 'pre_cache_alloptions', $alloptions );
wp_cache_add( 'alloptions', $alloptions, 'options' );
}
}
/**
* Filters all options after retrieving them.
*
* @since 4.9.0
*
* @param array $alloptions Array with all options.
*/
return apply_filters( 'alloptions', $alloptions );
}
```
[apply\_filters( 'alloptions', array $alloptions )](../hooks/alloptions)
Filters all options after retrieving them.
[apply\_filters( 'pre\_cache\_alloptions', array $alloptions )](../hooks/pre_cache_alloptions)
Filters all options before caching them.
| Uses | Description |
| --- | --- |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [wp\_cache\_add()](wp_cache_add) wp-includes/cache.php | Adds data to the cache, if the cache key doesn’t already exist. |
| [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. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [wpdb::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\_Health::should\_suggest\_persistent\_object\_cache()](../classes/wp_site_health/should_suggest_persistent_object_cache) wp-admin/includes/class-wp-site-health.php | Determines whether to suggest using a persistent object cache. |
| [\_wp\_specialchars()](_wp_specialchars) wp-includes/formatting.php | Converts a number of special characters into their HTML entities. |
| [get\_alloptions()](get_alloptions) wp-includes/deprecated.php | Retrieve all autoload options, or all options if no autoloaded ones exist. |
| [is\_blog\_installed()](is_blog_installed) wp-includes/functions.php | Determines whether WordPress is already installed. |
| [get\_transient()](get_transient) wp-includes/option.php | Retrieves the value of a transient. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [add\_option()](add_option) wp-includes/option.php | Adds a new option. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [5.3.1](https://developer.wordpress.org/reference/since/5.3.1/) | The `$force_cache` parameter was added. |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress wp_get_default_update_https_url(): string wp\_get\_default\_update\_https\_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.
Gets the default URL to learn more about updating the site to use HTTPS.
Do not use this function to retrieve this URL. Instead, use [wp\_get\_update\_https\_url()](wp_get_update_https_url) when relying on the URL.
This function does not allow modifying the returned URL, and is only used to compare the actually used URL with the default one.
string Default URL to learn more about updating to HTTPS.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_get_default_update_https_url() {
/* translators: Documentation explaining HTTPS and why it should be used. */
return __( 'https://wordpress.org/support/article/why-should-i-use-https/' );
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Used By | Description |
| --- | --- |
| [wp\_get\_update\_https\_url()](wp_get_update_https_url) wp-includes/functions.php | Gets the URL to learn more about updating the site to use HTTPS. |
| [WP\_Site\_Health::get\_test\_https\_status()](../classes/wp_site_health/get_test_https_status) wp-admin/includes/class-wp-site-health.php | Tests if the site is serving content over HTTPS. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress get_query_template( string $type, string[] $templates = array() ): string get\_query\_template( string $type, string[] $templates = array() ): string
===========================================================================
Retrieves path to a template.
Used to quickly retrieve the path of a template without including the file extension. It will also check the parent theme, if the file exists, with the use of [locate\_template()](locate_template) . Allows for more generic template location without the use of the other get\_\*\_template() functions.
`$type` string Required Filename without extension. `$templates` string[] Optional An optional list of template candidates. Default: `array()`
string Full path to template file.
File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
```
function get_query_template( $type, $templates = array() ) {
$type = preg_replace( '|[^a-z0-9-]+|', '', $type );
if ( empty( $templates ) ) {
$templates = array( "{$type}.php" );
}
/**
* Filters the list of template filenames that are searched for when retrieving a template to use.
*
* The dynamic portion of the hook name, `$type`, refers to the filename -- minus the file
* extension and any non-alphanumeric characters delimiting words -- of the file to load.
* The last element in the array should always be the fallback template for this query type.
*
* Possible hook names include:
*
* - `404_template_hierarchy`
* - `archive_template_hierarchy`
* - `attachment_template_hierarchy`
* - `author_template_hierarchy`
* - `category_template_hierarchy`
* - `date_template_hierarchy`
* - `embed_template_hierarchy`
* - `frontpage_template_hierarchy`
* - `home_template_hierarchy`
* - `index_template_hierarchy`
* - `page_template_hierarchy`
* - `paged_template_hierarchy`
* - `privacypolicy_template_hierarchy`
* - `search_template_hierarchy`
* - `single_template_hierarchy`
* - `singular_template_hierarchy`
* - `tag_template_hierarchy`
* - `taxonomy_template_hierarchy`
*
* @since 4.7.0
*
* @param string[] $templates A list of template candidates, in descending order of priority.
*/
$templates = apply_filters( "{$type}_template_hierarchy", $templates );
$template = locate_template( $templates );
$template = locate_block_template( $template, $type, $templates );
/**
* Filters the path of the queried template by type.
*
* The dynamic portion of the hook name, `$type`, refers to the filename -- minus the file
* extension and any non-alphanumeric characters delimiting words -- of the file to load.
* This hook also applies to various types of files loaded as part of the Template Hierarchy.
*
* Possible hook names include:
*
* - `404_template`
* - `archive_template`
* - `attachment_template`
* - `author_template`
* - `category_template`
* - `date_template`
* - `embed_template`
* - `frontpage_template`
* - `home_template`
* - `index_template`
* - `page_template`
* - `paged_template`
* - `privacypolicy_template`
* - `search_template`
* - `single_template`
* - `singular_template`
* - `tag_template`
* - `taxonomy_template`
*
* @since 1.5.0
* @since 4.8.0 The `$type` and `$templates` parameters were added.
*
* @param string $template Path to the template. See locate_template().
* @param string $type Sanitized filename without extension.
* @param string[] $templates A list of template candidates, in descending order of priority.
*/
return apply_filters( "{$type}_template", $template, $type, $templates );
}
```
[apply\_filters( "{$type}\_template", string $template, string $type, string[] $templates )](../hooks/type_template)
Filters the path of the queried template by type.
[apply\_filters( "{$type}\_template\_hierarchy", string[] $templates )](../hooks/type_template_hierarchy)
Filters the list of template filenames that are searched for when retrieving a template to use.
| Uses | 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. |
| [locate\_template()](locate_template) wp-includes/template.php | Retrieves the name of the highest priority template file that exists. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [get\_privacy\_policy\_template()](get_privacy_policy_template) wp-includes/template.php | Retrieves path of Privacy Policy page template in current or parent template. |
| [get\_embed\_template()](get_embed_template) wp-includes/template.php | Retrieves an embed template path in the current or parent template. |
| [get\_singular\_template()](get_singular_template) wp-includes/template.php | Retrieves the path of the singular template in current or parent template. |
| [get\_search\_template()](get_search_template) wp-includes/template.php | Retrieves path of search template in current or parent template. |
| [get\_single\_template()](get_single_template) wp-includes/template.php | Retrieves path of single template in current or parent template. Applies to single Posts, single Attachments, and single custom post types. |
| [get\_attachment\_template()](get_attachment_template) wp-includes/template.php | Retrieves path of attachment template in current or parent template. |
| [get\_index\_template()](get_index_template) wp-includes/template.php | Retrieves path of index template in current or parent template. |
| [get\_404\_template()](get_404_template) wp-includes/template.php | Retrieves path of 404 template in current or parent template. |
| [get\_archive\_template()](get_archive_template) wp-includes/template.php | Retrieves path of archive template in current or parent template. |
| [get\_author\_template()](get_author_template) wp-includes/template.php | Retrieves path of author template in current or parent template. |
| [get\_category\_template()](get_category_template) wp-includes/template.php | Retrieves path of category template in current or parent template. |
| [get\_tag\_template()](get_tag_template) wp-includes/template.php | Retrieves path of tag template in current or parent template. |
| [get\_taxonomy\_template()](get_taxonomy_template) wp-includes/template.php | Retrieves path of custom taxonomy term template in current or parent template. |
| [get\_date\_template()](get_date_template) wp-includes/template.php | Retrieves path of date template in current or parent template. |
| [get\_home\_template()](get_home_template) wp-includes/template.php | Retrieves path of home template in current or parent template. |
| [get\_front\_page\_template()](get_front_page_template) wp-includes/template.php | Retrieves path of front page template in current or parent template. |
| [get\_page\_template()](get_page_template) wp-includes/template.php | Retrieves path of page template in current or parent template. |
| [get\_paged\_template()](get_paged_template) wp-includes/deprecated.php | Retrieve path of paged template in current or parent template. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress wp_load_translations_early() wp\_load\_translations\_early()
===============================
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.
Attempt an early load of translations.
Used for errors encountered during the initial loading process, before the locale has been properly detected and loaded.
Designed for unusual load sequences (like setup-config.php) or for when the script will then terminate with an error, otherwise there is a risk that a file can be double-included.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_load_translations_early() {
global $wp_locale;
static $loaded = false;
if ( $loaded ) {
return;
}
$loaded = true;
if ( function_exists( 'did_action' ) && did_action( 'init' ) ) {
return;
}
// We need $wp_local_package.
require ABSPATH . WPINC . '/version.php';
// Translation and localization.
require_once ABSPATH . WPINC . '/pomo/mo.php';
require_once ABSPATH . WPINC . '/l10n.php';
require_once ABSPATH . WPINC . '/class-wp-locale.php';
require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
// General libraries.
require_once ABSPATH . WPINC . '/plugin.php';
$locales = array();
$locations = array();
while ( true ) {
if ( defined( 'WPLANG' ) ) {
if ( '' === WPLANG ) {
break;
}
$locales[] = WPLANG;
}
if ( isset( $wp_local_package ) ) {
$locales[] = $wp_local_package;
}
if ( ! $locales ) {
break;
}
if ( defined( 'WP_LANG_DIR' ) && @is_dir( WP_LANG_DIR ) ) {
$locations[] = WP_LANG_DIR;
}
if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) ) {
$locations[] = WP_CONTENT_DIR . '/languages';
}
if ( @is_dir( ABSPATH . 'wp-content/languages' ) ) {
$locations[] = ABSPATH . 'wp-content/languages';
}
if ( @is_dir( ABSPATH . WPINC . '/languages' ) ) {
$locations[] = ABSPATH . WPINC . '/languages';
}
if ( ! $locations ) {
break;
}
$locations = array_unique( $locations );
foreach ( $locales as $locale ) {
foreach ( $locations as $location ) {
if ( file_exists( $location . '/' . $locale . '.mo' ) ) {
load_textdomain( 'default', $location . '/' . $locale . '.mo' );
if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) ) {
load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
}
break 2;
}
}
}
break;
}
$wp_locale = new WP_Locale();
}
```
| Uses | Description |
| --- | --- |
| [load\_textdomain()](load_textdomain) wp-includes/l10n.php | Loads a .mo file into the text domain $domain. |
| [WP\_Locale::\_\_construct()](../classes/wp_locale/__construct) wp-includes/class-wp-locale.php | Constructor which calls helper methods to set up object variables. |
| [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 |
| --- | --- |
| [WP\_Object\_Cache::is\_valid\_key()](../classes/wp_object_cache/is_valid_key) wp-includes/class-wp-object-cache.php | Serves as a utility function to determine whether a key is valid. |
| [WP\_Fatal\_Error\_Handler::display\_default\_error\_template()](../classes/wp_fatal_error_handler/display_default_error_template) wp-includes/class-wp-fatal-error-handler.php | Displays the default PHP error template. |
| [wpdb::process\_fields()](../classes/wpdb/process_fields) wp-includes/class-wpdb.php | Processes arrays of field/value pairs and field formats. |
| [wp\_check\_php\_mysql\_versions()](wp_check_php_mysql_versions) wp-includes/load.php | Check for the required PHP version, and the MySQL extension or a database drop-in. |
| [wp\_maintenance()](wp_maintenance) wp-includes/load.php | Die with a maintenance message when conditions are met. |
| [wp\_set\_wpdb\_vars()](wp_set_wpdb_vars) wp-includes/load.php | Set the database table prefix and the format specifiers for database table columns. |
| [dead\_db()](dead_db) wp-includes/functions.php | Loads custom DB error or display WordPress DB error. |
| [is\_blog\_installed()](is_blog_installed) wp-includes/functions.php | Determines whether WordPress is already installed. |
| [ms\_not\_installed()](ms_not_installed) wp-includes/ms-load.php | Displays a failure message. |
| [wpdb::check\_connection()](../classes/wpdb/check_connection) wp-includes/class-wpdb.php | Checks that the connection to the database is still up. If not, try to reconnect. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [wpdb::select()](../classes/wpdb/select) wp-includes/class-wpdb.php | Selects a database using the current or provided database connection. |
| [wpdb::\_real\_escape()](../classes/wpdb/_real_escape) wp-includes/class-wpdb.php | Real escape, using mysqli\_real\_escape\_string() or mysql\_real\_escape\_string(). |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| [wpdb::print\_error()](../classes/wpdb/print_error) wp-includes/class-wpdb.php | Prints SQL/DB error. |
| [wpdb::db\_connect()](../classes/wpdb/db_connect) wp-includes/class-wpdb.php | Connects to and selects database. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress remove_custom_background(): null|bool remove\_custom\_background(): null|bool
=======================================
This function has been deprecated. Use [add\_custom\_background()](add_custom_background) instead.
Remove custom background support.
* [add\_custom\_background()](add_custom_background)
null|bool Whether support was removed.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function remove_custom_background() {
_deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-background\' )' );
return remove_theme_support( 'custom-background' );
}
```
| Uses | Description |
| --- | --- |
| [remove\_theme\_support()](remove_theme_support) wp-includes/theme.php | Allows a theme to de-register its support of a certain feature |
| [\_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/) | Use [add\_custom\_background()](add_custom_background) |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_cache_decr( int|string $key, int $offset = 1, string $group = '' ): int|false wp\_cache\_decr( int|string $key, int $offset = 1, string $group = '' ): int|false
==================================================================================
Decrements numeric cache item’s value.
* [WP\_Object\_Cache::decr()](../classes/wp_object_cache/decr)
`$key` int|string Required The cache key to decrement. `$offset` int Optional The amount by which to decrement the item's value.
Default: `1`
`$group` string Optional The group the key is in. Default: `''`
int|false The item's new value on success, false on failure.
File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_decr( $key, $offset = 1, $group = '' ) {
global $wp_object_cache;
return $wp_object_cache->decr( $key, $offset, $group );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::decr()](../classes/wp_object_cache/decr) wp-includes/class-wp-object-cache.php | Decrements numeric cache item’s value. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress display_themes() display\_themes()
=================
Displays theme content based on theme list.
File: `wp-admin/includes/theme-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme-install.php/)
```
function display_themes() {
global $wp_list_table;
if ( ! isset( $wp_list_table ) ) {
$wp_list_table = _get_list_table( 'WP_Theme_Install_List_Table' );
}
$wp_list_table->prepare_items();
$wp_list_table->display();
}
```
| Uses | Description |
| --- | --- |
| [WP\_List\_Table::display()](../classes/wp_list_table/display) wp-admin/includes/class-wp-list-table.php | Displays the table. |
| [WP\_List\_Table::prepare\_items()](../classes/wp_list_table/prepare_items) wp-admin/includes/class-wp-list-table.php | Prepares the list of items for displaying. |
| [\_get\_list\_table()](_get_list_table) wp-admin/includes/list-table.php | Fetches an instance of a [WP\_List\_Table](../classes/wp_list_table) class. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress is_taxonomy_viewable( string|WP_Taxonomy $taxonomy ): bool is\_taxonomy\_viewable( string|WP\_Taxonomy $taxonomy ): bool
=============================================================
Determines whether a taxonomy is considered “viewable”.
`$taxonomy` string|[WP\_Taxonomy](../classes/wp_taxonomy) Required Taxonomy name or object. bool Whether the taxonomy should be considered viewable.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function is_taxonomy_viewable( $taxonomy ) {
if ( is_scalar( $taxonomy ) ) {
$taxonomy = get_taxonomy( $taxonomy );
if ( ! $taxonomy ) {
return false;
}
}
return $taxonomy->publicly_queryable;
}
```
| Uses | Description |
| --- | --- |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| Used By | Description |
| --- | --- |
| [is\_term\_publicly\_viewable()](is_term_publicly_viewable) wp-includes/taxonomy.php | Determines whether a term is publicly viewable. |
| [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. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress load_template( string $_template_file, bool $require_once = true, array $args = array() ) load\_template( string $\_template\_file, bool $require\_once = true, array $args = array() )
=============================================================================================
Requires the template file with WordPress environment.
The globals are set up for the template file to ensure that the WordPress environment is available from within the function. The query variables are also available.
`$_template_file` string Required Path to template file. `$require_once` bool Optional Whether to require\_once or require. Default: `true`
`$args` array Optional Additional arguments passed to the template.
Default: `array()`
Uses global: (object) [$wp\_query](../classes/wp_query "Class Reference/WP Query") to extract [extract()](http://us.php.net/manual/en/function.extract.php) global variables returned by the query\_vars method while protecting the current values in these global variables:
* (unknown type) $posts
* (unknown type) $post
* (boolean) $wp\_did\_header Returns true if the WordPress header was already loaded. See the /wp-blog-header.php file for details.
* (boolean) $wp\_did\_template\_redirect
* (object) $wp\_rewrite
* (object) [$[wpdb](../classes/wpdb)](https://codex.wordpress.org/Class_Reference/wpdb "Class Reference/wpdb")
* (string) $wp\_version holds the installed WordPress version number.
* (string) $wp
* (string) $id
* (string) $comment
* (string) $user\_ID
File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
```
function load_template( $_template_file, $require_once = true, $args = array() ) {
global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
if ( is_array( $wp_query->query_vars ) ) {
/*
* This use of extract() cannot be removed. There are many possible ways that
* templates could depend on variables that it creates existing, and no way to
* detect and deprecate it.
*
* Passing the EXTR_SKIP flag is the safest option, ensuring globals and
* function variables cannot be overwritten.
*/
// phpcs:ignore WordPress.PHP.DontExtract.extract_extract
extract( $wp_query->query_vars, EXTR_SKIP );
}
if ( isset( $s ) ) {
$s = esc_attr( $s );
}
/**
* Fires before a template file is loaded.
*
* @since 6.1.0
*
* @param string $_template_file The full path to the template file.
* @param bool $require_once Whether to require_once or require.
* @param array $args Additional arguments passed to the template.
*/
do_action( 'wp_before_load_template', $_template_file, $require_once, $args );
if ( $require_once ) {
require_once $_template_file;
} else {
require $_template_file;
}
/**
* Fires after a template file is loaded.
*
* @since 6.1.0
*
* @param string $_template_file The full path to the template file.
* @param bool $require_once Whether to require_once or require.
* @param array $args Additional arguments passed to the template.
*/
do_action( 'wp_after_load_template', $_template_file, $require_once, $args );
}
```
[do\_action( 'wp\_after\_load\_template', string $\_template\_file, bool $require\_once, array $args )](../hooks/wp_after_load_template)
Fires after a template file is loaded.
[do\_action( 'wp\_before\_load\_template', string $\_template\_file, bool $require\_once, array $args )](../hooks/wp_before_load_template)
Fires before a template file is loaded.
| Uses | Description |
| --- | --- |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [do\_feed\_rdf()](do_feed_rdf) wp-includes/functions.php | Loads the RDF RSS 0.91 Feed template. |
| [do\_feed\_rss()](do_feed_rss) wp-includes/functions.php | Loads the RSS 1.0 Feed Template. |
| [do\_feed\_rss2()](do_feed_rss2) wp-includes/functions.php | Loads either the RSS2 comment feed or the RSS2 posts feed. |
| [do\_feed\_atom()](do_feed_atom) wp-includes/functions.php | Loads either Atom comment feed or Atom posts feed. |
| [locate\_template()](locate_template) wp-includes/template.php | Retrieves the name of the highest priority template file that exists. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | The `$args` parameter was added. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress validate_current_theme(): bool validate\_current\_theme(): bool
================================
Checks that the active theme has the required files.
Standalone themes need to have a `templates/index.html` or `index.php` template file.
Child themes need to have a `Template` header in the `style.css` stylesheet.
Does not initially check the default theme, which is the fallback and should always exist.
But if it doesn’t exist, it’ll fall back to the latest core default theme that does exist.
Will switch theme to the fallback theme if active theme does not validate.
You can use the [‘validate\_current\_theme’](../hooks/validate_current_theme) filter to return false to disable this functionality.
* [WP\_DEFAULT\_THEME](../classes/wp_default_theme)
bool
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function validate_current_theme() {
/**
* Filters whether to validate the active theme.
*
* @since 2.7.0
*
* @param bool $validate Whether to validate the active theme. Default true.
*/
if ( wp_installing() || ! apply_filters( 'validate_current_theme', true ) ) {
return true;
}
if (
! file_exists( get_template_directory() . '/templates/index.html' )
&& ! file_exists( get_template_directory() . '/block-templates/index.html' ) // Deprecated path support since 5.9.0.
&& ! file_exists( get_template_directory() . '/index.php' )
) {
// Invalid.
} elseif ( ! file_exists( get_template_directory() . '/style.css' ) ) {
// Invalid.
} elseif ( is_child_theme() && ! file_exists( get_stylesheet_directory() . '/style.css' ) ) {
// Invalid.
} else {
// Valid.
return true;
}
$default = wp_get_theme( WP_DEFAULT_THEME );
if ( $default->exists() ) {
switch_theme( WP_DEFAULT_THEME );
return false;
}
/**
* If we're in an invalid state but WP_DEFAULT_THEME doesn't exist,
* switch to the latest core default theme that's installed.
*
* If it turns out that this latest core default theme is our current
* theme, then there's nothing we can do about that, so we have to bail,
* rather than going into an infinite loop. (This is why there are
* checks against WP_DEFAULT_THEME above, also.) We also can't do anything
* if it turns out there is no default theme installed. (That's `false`.)
*/
$default = WP_Theme::get_core_default_theme();
if ( false === $default || get_stylesheet() == $default->get_stylesheet() ) {
return true;
}
switch_theme( $default->get_stylesheet() );
return false;
}
```
[apply\_filters( 'validate\_current\_theme', bool $validate )](../hooks/validate_current_theme)
Filters whether to validate the active theme.
| Uses | Description |
| --- | --- |
| [WP\_Theme::get\_core\_default\_theme()](../classes/wp_theme/get_core_default_theme) wp-includes/class-wp-theme.php | Determines the latest WordPress default theme that is installed. |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [switch\_theme()](switch_theme) wp-includes/theme.php | Switches the theme. |
| [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. |
| [is\_child\_theme()](is_child_theme) wp-includes/theme.php | Whether a child theme is in use. |
| [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. |
| [wp\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Manager::after\_setup\_theme()](../classes/wp_customize_manager/after_setup_theme) wp-includes/class-wp-customize-manager.php | Callback to validate a theme once it is loaded |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Removed the requirement for block themes to have an `index.php` template. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_set_post_terms( int $post_id, string|array $terms = '', string $taxonomy = 'post_tag', bool $append = false ): array|false|WP_Error wp\_set\_post\_terms( int $post\_id, string|array $terms = '', string $taxonomy = 'post\_tag', bool $append = false ): array|false|WP\_Error
============================================================================================================================================
Sets the terms for a post.
* [wp\_set\_object\_terms()](wp_set_object_terms)
`$post_id` int Optional The Post ID. Does not default to the ID of the global $post. `$terms` string|array Optional An array of terms to set for the post, or a string of terms separated by commas. Hierarchical taxonomies must always pass IDs rather than names so that children with the same names but different parents aren't confused. Default: `''`
`$taxonomy` string Optional Taxonomy name. Default `'post_tag'`. Default: `'post_tag'`
`$append` bool Optional If true, don't delete existing terms, just add on. If false, replace the terms with the new terms. Default: `false`
array|false|[WP\_Error](../classes/wp_error) Array of term taxonomy IDs of affected terms. [WP\_Error](../classes/wp_error) or false on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_set_post_terms( $post_id = 0, $terms = '', $taxonomy = 'post_tag', $append = false ) {
$post_id = (int) $post_id;
if ( ! $post_id ) {
return false;
}
if ( empty( $terms ) ) {
$terms = array();
}
if ( ! is_array( $terms ) ) {
$comma = _x( ',', 'tag delimiter' );
if ( ',' !== $comma ) {
$terms = str_replace( $comma, ',', $terms );
}
$terms = explode( ',', trim( $terms, " \n\t\r\0\x0B," ) );
}
/*
* Hierarchical taxonomies must always pass IDs rather than names so that
* children with the same names but different parents aren't confused.
*/
if ( is_taxonomy_hierarchical( $taxonomy ) ) {
$terms = array_unique( array_map( 'intval', $terms ) );
}
return wp_set_object_terms( $post_id, $terms, $taxonomy, $append );
}
```
| Uses | Description |
| --- | --- |
| [is\_taxonomy\_hierarchical()](is_taxonomy_hierarchical) wp-includes/taxonomy.php | Determines whether the taxonomy object is hierarchical. |
| [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| Used By | Description |
| --- | --- |
| [wp\_set\_unique\_slug\_on\_create\_template\_part()](wp_set_unique_slug_on_create_template_part) wp-includes/theme-templates.php | Sets a custom slug when creating auto-draft template parts. |
| [wp\_publish\_post()](wp_publish_post) wp-includes/post.php | Publishes a post by transitioning the post status. |
| [wp\_set\_post\_tags()](wp_set_post_tags) wp-includes/post.php | Sets the tags for a post. |
| [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. |
| [set\_post\_format()](set_post_format) wp-includes/post-formats.php | Assign a format to a post |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
| programming_docs |
wordpress get_the_author_link(): string|null get\_the\_author\_link(): string|null
=====================================
Retrieves either author’s link or author’s name.
If the author has a home page set, return an HTML link, otherwise just return the author’s name.
string|null An HTML link if the author's url exist in user meta, else the result of [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 get_the_author_link() {
if ( get_the_author_meta( 'url' ) ) {
global $authordata;
$author_url = get_the_author_meta( 'url' );
$author_display_name = get_the_author();
$link = sprintf(
'<a href="%1$s" title="%2$s" rel="author external">%3$s</a>',
esc_url( $author_url ),
/* translators: %s: Author's display name. */
esc_attr( sprintf( __( 'Visit %s’s website' ), $author_display_name ) ),
$author_display_name
);
/**
* Filters the author URL link HTML.
*
* @since 6.0.0
*
* @param string $link The default rendered author HTML link.
* @param string $author_url Author's URL.
* @param WP_User $authordata Author user data.
*/
return apply_filters( 'the_author_link', $link, $author_url, $authordata );
} else {
return get_the_author();
}
}
```
[apply\_filters( 'the\_author\_link', string $link, string $author\_url, WP\_User $authordata )](../hooks/the_author_link)
Filters the author URL link HTML.
| 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. |
| [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. |
| [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. |
| Used By | Description |
| --- | --- |
| [the\_author\_link()](the_author_link) wp-includes/author-template.php | Displays either author’s link or author’s name. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress resume_plugin( string $plugin, string $redirect = '' ): bool|WP_Error resume\_plugin( string $plugin, string $redirect = '' ): bool|WP\_Error
=======================================================================
Tries to resume a single plugin.
If a redirect was provided, we first ensure the plugin does not throw fatal errors anymore.
The way it works is by setting the redirection to the error before trying to include the plugin file. If the plugin fails, then the redirection will not be overwritten with the success message and the plugin will not be resumed.
`$plugin` string Required Single plugin to resume. `$redirect` string Optional URL to redirect to. Default: `''`
bool|[WP\_Error](../classes/wp_error) True on success, false if `$plugin` was not paused, `WP_Error` on failure.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function resume_plugin( $plugin, $redirect = '' ) {
/*
* We'll override this later if the plugin could be resumed without
* creating a fatal error.
*/
if ( ! empty( $redirect ) ) {
wp_redirect(
add_query_arg(
'_error_nonce',
wp_create_nonce( 'plugin-resume-error_' . $plugin ),
$redirect
)
);
// Load the plugin to test whether it throws a fatal error.
ob_start();
plugin_sandbox_scrape( $plugin );
ob_clean();
}
list( $extension ) = explode( '/', $plugin );
$result = wp_paused_plugins()->delete( $extension );
if ( ! $result ) {
return new WP_Error(
'could_not_resume_plugin',
__( 'Could not resume the plugin.' )
);
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [wp\_paused\_plugins()](wp_paused_plugins) wp-includes/error-protection.php | Get the instance for storing paused plugins. |
| [plugin\_sandbox\_scrape()](plugin_sandbox_scrape) wp-admin/includes/plugin.php | Loads a given plugin attempt to generate errors. |
| [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 get_nav_menu_locations(): int[] get\_nav\_menu\_locations(): int[]
==================================
Retrieves all registered navigation menu locations and the menus assigned to them.
int[] Associative array of registered navigation menu IDs keyed by their location name. If none are registered, an empty array.
File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function get_nav_menu_locations() {
$locations = get_theme_mod( 'nav_menu_locations' );
return ( is_array( $locations ) ) ? $locations : array();
}
```
| Uses | Description |
| --- | --- |
| [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Menus\_Controller::get\_menu\_locations()](../classes/wp_rest_menus_controller/get_menu_locations) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Returns the names of the locations assigned to the menu. |
| [WP\_REST\_Menus\_Controller::handle\_locations()](../classes/wp_rest_menus_controller/handle_locations) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Updates the menu’s locations from a REST request. |
| [WP\_REST\_Menu\_Locations\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_menu_locations_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Prepares a menu location object for serialization. |
| [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\_menus\_changed()](_wp_menus_changed) wp-includes/nav-menu.php | Handles menu config after theme change. |
| [wp\_get\_nav\_menu\_name()](wp_get_nav_menu_name) wp-includes/nav-menu.php | Returns the name of a navigation menu. |
| [WP\_Customize\_Nav\_Menus::\_\_construct()](../classes/wp_customize_nav_menus/__construct) wp-includes/class-wp-customize-nav-menus.php | Constructor. |
| [wp\_nav\_menu()](wp_nav_menu) wp-includes/nav-menu-template.php | Displays a navigation menu. |
| [has\_nav\_menu()](has_nav_menu) wp-includes/nav-menu.php | Determines whether a registered nav menu location has a menu assigned to it. |
| [wp\_delete\_nav\_menu()](wp_delete_nav_menu) wp-includes/nav-menu.php | Deletes a navigation menu. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress media_upload_flash_bypass() media\_upload\_flash\_bypass()
==============================
Displays the multi-file uploader message.
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function media_upload_flash_bypass() {
$browser_uploader = admin_url( 'media-new.php?browser-uploader' );
$post = get_post();
if ( $post ) {
$browser_uploader .= '&post_id=' . (int) $post->ID;
} elseif ( ! empty( $GLOBALS['post_ID'] ) ) {
$browser_uploader .= '&post_id=' . (int) $GLOBALS['post_ID'];
}
?>
<p class="upload-flash-bypass">
<?php
printf(
/* translators: 1: URL to browser uploader, 2: Additional link attributes. */
__( 'You are using the multi-file uploader. Problems? Try the <a href="%1$s" %2$s>browser uploader</a> instead.' ),
$browser_uploader,
'target="_blank"'
);
?>
</p>
<?php
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress is_nav_menu_item( int $menu_item_id ): bool is\_nav\_menu\_item( int $menu\_item\_id ): bool
================================================
Determines whether the given ID is a nav menu item.
`$menu_item_id` int Required The ID of the potential nav menu item. bool Whether the given ID is that of a nav menu item.
File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function is_nav_menu_item( $menu_item_id = 0 ) {
return ( ! is_wp_error( $menu_item_id ) && ( 'nav_menu_item' === get_post_type( $menu_item_id ) ) );
}
```
| 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. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| 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\_get\_associated\_nav\_menu\_items()](wp_get_associated_nav_menu_items) wp-includes/nav-menu.php | Returns the menu items associated with a particular object. |
| [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. |
wordpress register_nav_menu( string $location, string $description ) register\_nav\_menu( string $location, string $description )
============================================================
Registers a navigation menu location for a theme.
`$location` string Required Menu location identifier, like a slug. `$description` string Required Menu location descriptive text. * See [register\_nav\_menus()](register_nav_menus) for creating multiple menus at once.
* This function automatically registers custom menu support for the theme therefore you do **not** need to call `add_theme_support( 'menus' );`
* This function actually works by simply calling [register\_nav\_menus()](register_nav_menus) in the following way:
```
register_nav_menus( array( $location => $description ) );
```
* You may use [wp\_nav\_menu()](wp_nav_menu) to display your custom menu.
File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function register_nav_menu( $location, $description ) {
register_nav_menus( array( $location => $description ) );
}
```
| Uses | Description |
| --- | --- |
| [register\_nav\_menus()](register_nav_menus) wp-includes/nav-menu.php | Registers navigation menu locations for a theme. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_post_custom_values( string $key = '', int $post_id ): array|null get\_post\_custom\_values( string $key = '', int $post\_id ): array|null
========================================================================
Retrieves values for a custom post field.
The parameters must not be considered optional. All of the post meta fields will be retrieved and only the meta field key values returned.
`$key` string Optional Meta field key. Default: `''`
`$post_id` int Optional Post ID. Default is the ID of the global `$post`. array|null Meta field values.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_post_custom_values( $key = '', $post_id = 0 ) {
if ( ! $key ) {
return null;
}
$custom = get_post_custom( $post_id );
return isset( $custom[ $key ] ) ? $custom[ $key ] : null;
}
```
| Uses | Description |
| --- | --- |
| [get\_post\_custom()](get_post_custom) wp-includes/post.php | Retrieves post meta fields, based on post ID. |
| Used By | Description |
| --- | --- |
| [the\_meta()](the_meta) wp-includes/post-template.php | Displays a list of post custom fields. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress wpmu_signup_blog_notification( string $domain, string $path, string $title, string $user_login, string $user_email, string $key, array $meta = array() ): bool wpmu\_signup\_blog\_notification( string $domain, string $path, string $title, 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 site. The new site will not become active until the confirmation link is clicked.
This is the notification function used when site registration is enabled.
Filter [‘wpmu\_signup\_blog\_notification’](../hooks/wpmu_signup_blog_notification) to bypass this function or replace it with your own notification behavior.
Filter [‘wpmu\_signup\_blog\_notification\_email’](../hooks/wpmu_signup_blog_notification_email) and [‘wpmu\_signup\_blog\_notification\_subject’](../hooks/wpmu_signup_blog_notification_subject) to change the content and subject line of the email sent to newly registered users.
`$domain` string Required The new blog domain. `$path` string Required The new blog path. `$title` string Required The site title. `$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\_blog()](wpmu_signup_blog) `$meta` array Optional Signup meta data. By default, contains the requested privacy setting and lang\_id. 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_blog_notification( $domain, $path, $title, $user_login, $user_email, $key, $meta = array() ) {
/**
* Filters whether to bypass the new site email notification.
*
* @since MU (3.0.0)
*
* @param string|false $domain Site domain, or false to prevent the email from sending.
* @param string $path Site path.
* @param string $title Site title.
* @param string $user_login User login name.
* @param string $user_email User email address.
* @param string $key Activation key created in wpmu_signup_blog().
* @param array $meta Signup meta data. By default, contains the requested privacy setting and lang_id.
*/
if ( ! apply_filters( 'wpmu_signup_blog_notification', $domain, $path, $title, $user_login, $user_email, $key, $meta ) ) {
return false;
}
// Send email with activation link.
if ( ! is_subdomain_install() || get_current_network_id() != 1 ) {
$activate_url = network_site_url( "wp-activate.php?key=$key" );
} else {
$activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo Use *_url() API.
}
$activate_url = esc_url( $activate_url );
$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";
$user = get_user_by( 'login', $user_login );
$switched_locale = switch_to_locale( get_user_locale( $user ) );
$message = sprintf(
/**
* Filters the message content of the new blog notification email.
*
* Content should be formatted for transmission via wp_mail().
*
* @since MU (3.0.0)
*
* @param string $content Content of the notification email.
* @param string $domain Site domain.
* @param string $path Site path.
* @param string $title Site title.
* @param string $user_login User login name.
* @param string $user_email User email address.
* @param string $key Activation key created in wpmu_signup_blog().
* @param array $meta Signup meta data. By default, contains the requested privacy setting and lang_id.
*/
apply_filters(
'wpmu_signup_blog_notification_email',
/* translators: New site notification email. 1: Activation URL, 2: New site URL. */
__( "To activate your site, please click the following link:\n\n%1\$s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your site here:\n\n%2\$s" ),
$domain,
$path,
$title,
$user_login,
$user_email,
$key,
$meta
),
$activate_url,
esc_url( "http://{$domain}{$path}" ),
$key
);
$subject = sprintf(
/**
* Filters the subject of the new blog notification email.
*
* @since MU (3.0.0)
*
* @param string $subject Subject of the notification email.
* @param string $domain Site domain.
* @param string $path Site path.
* @param string $title Site title.
* @param string $user_login User login name.
* @param string $user_email User email address.
* @param string $key Activation key created in wpmu_signup_blog().
* @param array $meta Signup meta data. By default, contains the requested privacy setting and lang_id.
*/
apply_filters(
'wpmu_signup_blog_notification_subject',
/* translators: New site notification email subject. 1: Network title, 2: New site URL. */
_x( '[%1$s] Activate %2$s', 'New site notification email subject' ),
$domain,
$path,
$title,
$user_login,
$user_email,
$key,
$meta
),
$from_name,
esc_url( 'http://' . $domain . $path )
);
wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
if ( $switched_locale ) {
restore_previous_locale();
}
return true;
}
```
[apply\_filters( 'wpmu\_signup\_blog\_notification', string|false $domain, string $path, string $title, string $user\_login, string $user\_email, string $key, array $meta )](../hooks/wpmu_signup_blog_notification)
Filters whether to bypass the new site email notification.
[apply\_filters( 'wpmu\_signup\_blog\_notification\_email', string $content, string $domain, string $path, string $title, string $user\_login, string $user\_email, string $key, array $meta )](../hooks/wpmu_signup_blog_notification_email)
Filters the message content of the new blog notification email.
[apply\_filters( 'wpmu\_signup\_blog\_notification\_subject', string $subject, string $domain, string $path, string $title, string $user\_login, string $user\_email, string $key, array $meta )](../hooks/wpmu_signup_blog_notification_subject)
Filters the subject of the new blog notification email.
| 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. |
| [network\_home\_url()](network_home_url) wp-includes/link-template.php | Retrieves the home URL for the current network. |
| [network\_site\_url()](network_site_url) wp-includes/link-template.php | Retrieves the site URL for the current network. |
| [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [wp\_specialchars\_decode()](wp_specialchars_decode) wp-includes/formatting.php | Converts a number of HTML entities into their special characters. |
| [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. |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. |
| [is\_subdomain\_install()](is_subdomain_install) wp-includes/ms-load.php | Whether a subdomain configuration is enabled. |
| [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. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [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. |
| programming_docs |
wordpress wp_ajax_meta_box_order() wp\_ajax\_meta\_box\_order()
============================
Ajax handler for saving the meta box order.
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_meta_box_order() {
check_ajax_referer( 'meta-box-order' );
$order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false;
$page_columns = isset( $_POST['page_columns'] ) ? $_POST['page_columns'] : 'auto';
if ( 'auto' !== $page_columns ) {
$page_columns = (int) $page_columns;
}
$page = isset( $_POST['page'] ) ? $_POST['page'] : '';
if ( sanitize_key( $page ) != $page ) {
wp_die( 0 );
}
$user = wp_get_current_user();
if ( ! $user ) {
wp_die( -1 );
}
if ( $order ) {
update_user_meta( $user->ID, "meta-box-order_$page", $order );
}
if ( $page_columns ) {
update_user_meta( $user->ID, "screen_layout_$page", $page_columns );
}
wp_send_json_success();
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. |
| [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\_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 wp_ajax_get_revision_diffs() wp\_ajax\_get\_revision\_diffs()
================================
Ajax handler for getting revision diffs.
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_get_revision_diffs() {
require ABSPATH . 'wp-admin/includes/revision.php';
$post = get_post( (int) $_REQUEST['post_id'] );
if ( ! $post ) {
wp_send_json_error();
}
if ( ! current_user_can( 'edit_post', $post->ID ) ) {
wp_send_json_error();
}
// Really just pre-loading the cache here.
$revisions = wp_get_post_revisions( $post->ID, array( 'check_enabled' => false ) );
if ( ! $revisions ) {
wp_send_json_error();
}
$return = array();
set_time_limit( 0 );
foreach ( $_REQUEST['compare'] as $compare_key ) {
list( $compare_from, $compare_to ) = explode( ':', $compare_key ); // from:to
$return[] = array(
'id' => $compare_key,
'fields' => wp_get_revision_ui_diff( $post, $compare_from, $compare_to ),
);
}
wp_send_json_success( $return );
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_revision\_ui\_diff()](wp_get_revision_ui_diff) wp-admin/includes/revision.php | Get the revision UI diff. |
| [wp\_get\_post\_revisions()](wp_get_post_revisions) wp-includes/revision.php | Returns all revisions of specified post. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [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 |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress wp_admin_headers() wp\_admin\_headers()
====================
Sends a referrer policy header so referrers are not sent externally from administration screens.
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function wp_admin_headers() {
$policy = 'strict-origin-when-cross-origin';
/**
* Filters the admin referrer policy header value.
*
* @since 4.9.0
* @since 4.9.5 The default value was changed to 'strict-origin-when-cross-origin'.
*
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
*
* @param string $policy The admin referrer policy header value. Default 'strict-origin-when-cross-origin'.
*/
$policy = apply_filters( 'admin_referrer_policy', $policy );
header( sprintf( 'Referrer-Policy: %s', $policy ) );
}
```
[apply\_filters( 'admin\_referrer\_policy', string $policy )](../hooks/admin_referrer_policy)
Filters the admin referrer policy header value.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
wordpress print_footer_scripts(): array print\_footer\_scripts(): array
===============================
Prints the scripts that were queued for the footer or too late for the HTML head.
array
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function print_footer_scripts() {
global $wp_scripts, $concatenate_scripts;
if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
return array(); // No need to run if not instantiated.
}
script_concat_settings();
$wp_scripts->do_concat = $concatenate_scripts;
$wp_scripts->do_footer_items();
/**
* Filters whether to print the footer scripts.
*
* @since 2.8.0
*
* @param bool $print Whether to print the footer scripts. Default true.
*/
if ( apply_filters( 'print_footer_scripts', true ) ) {
_print_scripts();
}
$wp_scripts->reset();
return $wp_scripts->done;
}
```
[apply\_filters( 'print\_footer\_scripts', bool $print )](../hooks/print_footer_scripts)
Filters whether to print the footer scripts.
| Uses | Description |
| --- | --- |
| [WP\_Scripts::reset()](../classes/wp_scripts/reset) wp-includes/class-wp-scripts.php | Resets class properties. |
| [WP\_Scripts::do\_footer\_items()](../classes/wp_scripts/do_footer_items) wp-includes/class-wp-scripts.php | Processes items and dependencies for the footer group. |
| [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 |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress get_index_rel_link(): string get\_index\_rel\_link(): string
===============================
This function has been deprecated.
Get site index relational link.
string
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_index_rel_link() {
_deprecated_function( __FUNCTION__, '3.3.0' );
$link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n";
return apply_filters( "index_rel_link", $link );
}
```
| Uses | Description |
| --- | --- |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [\_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. |
| Used By | Description |
| --- | --- |
| [index\_rel\_link()](index_rel_link) wp-includes/deprecated.php | Display relational link for the site index. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | This function has been deprecated. |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress unregister_setting( string $option_group, string $option_name, callable $deprecated = '' ) unregister\_setting( string $option\_group, string $option\_name, callable $deprecated = '' )
=============================================================================================
Unregisters a setting.
`$option_group` string Required The settings group name used during registration. `$option_name` string Required The name of the option to unregister. `$deprecated` callable Optional Deprecated. Default: `''`
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function unregister_setting( $option_group, $option_name, $deprecated = '' ) {
global $new_allowed_options, $wp_registered_settings;
/*
* In 5.5.0, the `$new_whitelist_options` global variable was renamed to `$new_allowed_options`.
* Please consider writing more inclusive code.
*/
$GLOBALS['new_whitelist_options'] = &$new_allowed_options;
if ( 'misc' === $option_group ) {
_deprecated_argument(
__FUNCTION__,
'3.0.0',
sprintf(
/* translators: %s: misc */
__( 'The "%s" options group has been removed. Use another settings group.' ),
'misc'
)
);
$option_group = 'general';
}
if ( 'privacy' === $option_group ) {
_deprecated_argument(
__FUNCTION__,
'3.5.0',
sprintf(
/* translators: %s: privacy */
__( 'The "%s" options group has been removed. Use another settings group.' ),
'privacy'
)
);
$option_group = 'reading';
}
$pos = array_search( $option_name, (array) $new_allowed_options[ $option_group ], true );
if ( false !== $pos ) {
unset( $new_allowed_options[ $option_group ][ $pos ] );
}
if ( '' !== $deprecated ) {
_deprecated_argument(
__FUNCTION__,
'4.7.0',
sprintf(
/* translators: 1: $sanitize_callback, 2: register_setting() */
__( '%1$s is deprecated. The callback from %2$s is used instead.' ),
'<code>$sanitize_callback</code>',
'<code>register_setting()</code>'
)
);
remove_filter( "sanitize_option_{$option_name}", $deprecated );
}
if ( isset( $wp_registered_settings[ $option_name ] ) ) {
// Remove the sanitize callback if one was set during registration.
if ( ! empty( $wp_registered_settings[ $option_name ]['sanitize_callback'] ) ) {
remove_filter( "sanitize_option_{$option_name}", $wp_registered_settings[ $option_name ]['sanitize_callback'] );
}
// Remove the default filter if a default was provided during registration.
if ( array_key_exists( 'default', $wp_registered_settings[ $option_name ] ) ) {
remove_filter( "default_option_{$option_name}", 'filter_default_option', 10 );
}
/**
* Fires immediately before the setting is unregistered and after its filters have been removed.
*
* @since 5.5.0
*
* @param string $option_group Setting group.
* @param string $option_name Setting name.
*/
do_action( 'unregister_setting', $option_group, $option_name );
unset( $wp_registered_settings[ $option_name ] );
}
}
```
[do\_action( 'unregister\_setting', string $option\_group, string $option\_name )](../hooks/unregister_setting)
Fires immediately before the setting is unregistered and after its filters have been removed.
| Uses | Description |
| --- | --- |
| [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [remove\_option\_update\_handler()](remove_option_update_handler) wp-admin/includes/deprecated.php | Unregister a setting |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | `$new_whitelist_options` was renamed to `$new_allowed_options`. Please consider writing more inclusive code. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | `$sanitize_callback` was deprecated. The callback from `register_setting()` is now used instead. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress _preview_theme_stylesheet_filter(): string \_preview\_theme\_stylesheet\_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 stylesheet 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_stylesheet_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 kses_init_filters() kses\_init\_filters()
=====================
Adds all KSES input form content filters.
All hooks have default priority. The `wp_filter_kses()` function is added to the ‘pre\_comment\_content’ and ‘title\_save\_pre’ hooks.
The `wp_filter_post_kses()` function is added to the ‘content\_save\_pre’, ‘excerpt\_save\_pre’, and ‘content\_filtered\_save\_pre’ hooks.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function kses_init_filters() {
// Normal filtering.
add_filter( 'title_save_pre', 'wp_filter_kses' );
// Comment filtering.
if ( current_user_can( 'unfiltered_html' ) ) {
add_filter( 'pre_comment_content', 'wp_filter_post_kses' );
} else {
add_filter( 'pre_comment_content', 'wp_filter_kses' );
}
// Global Styles filtering: Global Styles filters should be executed before normal post_kses HTML filters.
add_filter( 'content_save_pre', 'wp_filter_global_styles_post', 9 );
add_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post', 9 );
// Post filtering.
add_filter( 'content_save_pre', 'wp_filter_post_kses' );
add_filter( 'excerpt_save_pre', 'wp_filter_post_kses' );
add_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' );
}
```
| Uses | Description |
| --- | --- |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_handle\_comment\_submission()](wp_handle_comment_submission) wp-includes/comment.php | Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
| [wp\_ajax\_replyto\_comment()](wp_ajax_replyto_comment) wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. |
| [kses\_init()](kses_init) wp-includes/kses.php | Sets up most of the KSES filters for input form content. |
| [WP\_Embed::shortcode()](../classes/wp_embed/shortcode) wp-includes/class-wp-embed.php | The [do\_shortcode()](do_shortcode) callback function. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress do_blocks( string $content ): string do\_blocks( string $content ): string
=====================================
Parses dynamic blocks out of `post_content` and re-renders them.
`$content` string Required Post content. string Updated post content.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function do_blocks( $content ) {
$blocks = parse_blocks( $content );
$output = '';
foreach ( $blocks as $block ) {
$output .= render_block( $block );
}
// If there are blocks in this content, we shouldn't run wpautop() on it later.
$priority = has_filter( 'the_content', 'wpautop' );
if ( false !== $priority && doing_filter( 'the_content' ) && has_blocks( $content ) ) {
remove_filter( 'the_content', 'wpautop', $priority );
add_filter( 'the_content', '_restore_wpautop_hook', $priority + 1 );
}
return $output;
}
```
| Uses | Description |
| --- | --- |
| [parse\_blocks()](parse_blocks) wp-includes/blocks.php | Parses blocks out of a content string. |
| [render\_block()](render_block) wp-includes/blocks.php | Renders a single block into a HTML string. |
| [has\_blocks()](has_blocks) wp-includes/blocks.php | Determines whether a post or content string has blocks. |
| [has\_filter()](has_filter) wp-includes/plugin.php | Checks if any filter has been registered for a hook. |
| [doing\_filter()](doing_filter) wp-includes/plugin.php | Returns whether or not a filter hook is currently being processed. |
| [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. |
| Used By | Description |
| --- | --- |
| [block\_template\_part()](block_template_part) wp-includes/block-template-utils.php | Prints a block template part. |
| [get\_the\_block\_template\_html()](get_the_block_template_html) wp-includes/block-template.php | Returns the markup for the current template. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress wp_finalize_scraping_edited_file_errors( string $scrape_key ) wp\_finalize\_scraping\_edited\_file\_errors( string $scrape\_key )
===================================================================
Finalize scraping for edited file errors.
`$scrape_key` string Required Scrape key. File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_finalize_scraping_edited_file_errors( $scrape_key ) {
$error = error_get_last();
echo "\n###### wp_scraping_result_start:$scrape_key ######\n";
if ( ! empty( $error ) && in_array( $error['type'], array( E_CORE_ERROR, E_COMPILE_ERROR, E_ERROR, E_PARSE, E_USER_ERROR, E_RECOVERABLE_ERROR ), true ) ) {
$error = str_replace( ABSPATH, '', $error );
echo wp_json_encode( $error );
} else {
echo wp_json_encode( true );
}
echo "\n###### wp_scraping_result_end:$scrape_key ######\n";
}
```
| Uses | Description |
| --- | --- |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
| programming_docs |
wordpress wp_skip_border_serialization( WP_Block_Type $block_type ): bool wp\_skip\_border\_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 border 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 serialization of the current block's border properties should occur.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_skip_border_serialization( $block_type ) {
_deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
$border_support = _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), false );
return is_array( $border_support ) &&
array_key_exists( '__experimentalSkipSerialization', $border_support ) &&
$border_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.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress get_enclosed( int $post_id ): string[] get\_enclosed( int $post\_id ): string[]
========================================
Retrieves enclosures already enclosed for a post.
`$post_id` int Required Post ID. string[] Array of enclosures for the given post.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_enclosed( $post_id ) {
$custom_fields = get_post_custom( $post_id );
$pung = array();
if ( ! is_array( $custom_fields ) ) {
return $pung;
}
foreach ( $custom_fields as $key => $val ) {
if ( 'enclosure' !== $key || ! is_array( $val ) ) {
continue;
}
foreach ( $val as $enc ) {
$enclosure = explode( "\n", $enc );
$pung[] = trim( $enclosure[0] );
}
}
/**
* Filters the list of enclosures already enclosed for the given post.
*
* @since 2.0.0
*
* @param string[] $pung Array of enclosures for the given post.
* @param int $post_id Post ID.
*/
return apply_filters( 'get_enclosed', $pung, $post_id );
}
```
[apply\_filters( 'get\_enclosed', string[] $pung, int $post\_id )](../hooks/get_enclosed)
Filters the list of enclosures already enclosed for the given post.
| Uses | Description |
| --- | --- |
| [get\_post\_custom()](get_post_custom) wp-includes/post.php | Retrieves post meta fields, based on 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 |
| --- | --- |
| [do\_enclose()](do_enclose) wp-includes/functions.php | Checks content for video and audio links to add as enclosures. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_timezone_string(): string wp\_timezone\_string(): string
==============================
Retrieves the timezone of the site as a string.
Uses the `timezone_string` option to get a proper timezone name if available, otherwise falls back to a manual UTC ± offset.
Example return values:
* ‘Europe/Rome’
* ‘America/North\_Dakota/New\_Salem’
* ‘UTC’
* ‘-06:30’
* ‘+00:00’
* ‘+08:45’
string PHP timezone name or a ±HH:MM offset.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_timezone_string() {
$timezone_string = get_option( 'timezone_string' );
if ( $timezone_string ) {
return $timezone_string;
}
$offset = (float) get_option( 'gmt_offset' );
$hours = (int) $offset;
$minutes = ( $offset - $hours );
$sign = ( $offset < 0 ) ? '-' : '+';
$abs_hour = abs( $hours );
$abs_mins = abs( $minutes * 60 );
$tz_offset = sprintf( '%s%02d:%02d', $sign, $abs_hour, $abs_mins );
return $tz_offset;
}
```
| Uses | Description |
| --- | --- |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [wp\_timezone()](wp_timezone) wp-includes/functions.php | Retrieves the timezone of the site as a `DateTimeZone` object. |
| [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. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress remove_accents( string $string, string $locale = '' ): string remove\_accents( string $string, string $locale = '' ): string
==============================================================
Converts all accent characters to ASCII characters.
If there are no accent characters, then the string given is just returned.
**Accent characters converted:**
Currency signs:
| Code | Glyph | Replacement | Description |
| --- | --- | --- | --- |
| U+00A3 | £ | (empty) | British Pound sign |
| U+20AC | € | E | Euro sign |
Decompositions for Latin-1 Supplement:
| Code | Glyph | Replacement | Description |
| --- | --- | --- | --- |
| U+00AA | ª | a | Feminine ordinal indicator |
| U+00BA | º | o | Masculine ordinal indicator |
| U+00C0 | À | A | Latin capital letter A with grave |
| U+00C1 | Á | A | Latin capital letter A with acute |
| U+00C2 | Â | A | Latin capital letter A with circumflex |
| U+00C3 | Ã | A | Latin capital letter A with tilde |
| U+00C4 | Ä | A | Latin capital letter A with diaeresis |
| U+00C5 | Å | A | Latin capital letter A with ring above |
| U+00C6 | Æ | AE | Latin capital letter AE |
| U+00C7 | Ç | C | Latin capital letter C with cedilla |
| U+00C8 | È | E | Latin capital letter E with grave |
| U+00C9 | É | E | Latin capital letter E with acute |
| U+00CA | Ê | E | Latin capital letter E with circumflex |
| U+00CB | Ë | E | Latin capital letter E with diaeresis |
| U+00CC | Ì | I | Latin capital letter I with grave |
| U+00CD | Í | I | Latin capital letter I with acute |
| U+00CE | Î | I | Latin capital letter I with circumflex |
| U+00CF | Ï | I | Latin capital letter I with diaeresis |
| U+00D0 | Ð | D | Latin capital letter Eth |
| U+00D1 | Ñ | N | Latin capital letter N with tilde |
| U+00D2 | Ò | O | Latin capital letter O with grave |
| U+00D3 | Ó | O | Latin capital letter O with acute |
| U+00D4 | Ô | O | Latin capital letter O with circumflex |
| U+00D5 | Õ | O | Latin capital letter O with tilde |
| U+00D6 | Ö | O | Latin capital letter O with diaeresis |
| U+00D8 | Ø | O | Latin capital letter O with stroke |
| U+00D9 | Ù | U | Latin capital letter U with grave |
| U+00DA | Ú | U | Latin capital letter U with acute |
| U+00DB | Û | U | Latin capital letter U with circumflex |
| U+00DC | Ü | U | Latin capital letter U with diaeresis |
| U+00DD | Ý | Y | Latin capital letter Y with acute |
| U+00DE | Þ | TH | Latin capital letter Thorn |
| U+00DF | ß | s | Latin small letter sharp s |
| U+00E0 | à | a | Latin small letter a with grave |
| U+00E1 | á | a | Latin small letter a with acute |
| U+00E2 | â | a | Latin small letter a with circumflex |
| U+00E3 | ã | a | Latin small letter a with tilde |
| U+00E4 | ä | a | Latin small letter a with diaeresis |
| U+00E5 | å | a | Latin small letter a with ring above |
| U+00E6 | æ | ae | Latin small letter ae |
| U+00E7 | ç | c | Latin small letter c with cedilla |
| U+00E8 | è | e | Latin small letter e with grave |
| U+00E9 | é | e | Latin small letter e with acute |
| U+00EA | ê | e | Latin small letter e with circumflex |
| U+00EB | ë | e | Latin small letter e with diaeresis |
| U+00EC | ì | i | Latin small letter i with grave |
| U+00ED | í | i | Latin small letter i with acute |
| U+00EE | î | i | Latin small letter i with circumflex |
| U+00EF | ï | i | Latin small letter i with diaeresis |
| U+00F0 | ð | d | Latin small letter Eth |
| U+00F1 | ñ | n | Latin small letter n with tilde |
| U+00F2 | ò | o | Latin small letter o with grave |
| U+00F3 | ó | o | Latin small letter o with acute |
| U+00F4 | ô | o | Latin small letter o with circumflex |
| U+00F5 | õ | o | Latin small letter o with tilde |
| U+00F6 | ö | o | Latin small letter o with diaeresis |
| U+00F8 | ø | o | Latin small letter o with stroke |
| U+00F9 | ù | u | Latin small letter u with grave |
| U+00FA | ú | u | Latin small letter u with acute |
| U+00FB | û | u | Latin small letter u with circumflex |
| U+00FC | ü | u | Latin small letter u with diaeresis |
| U+00FD | ý | y | Latin small letter y with acute |
| U+00FE | þ | th | Latin small letter Thorn |
| U+00FF | ÿ | y | Latin small letter y with diaeresis |
Decompositions for Latin Extended-A:
| Code | Glyph | Replacement | Description |
| --- | --- | --- | --- |
| U+0100 | Ā | A | Latin capital letter A with macron |
| U+0101 | ā | a | Latin small letter a with macron |
| U+0102 | Ă | A | Latin capital letter A with breve |
| U+0103 | ă | a | Latin small letter a with breve |
| U+0104 | Ą | A | Latin capital letter A with ogonek |
| U+0105 | ą | a | Latin small letter a with ogonek |
| U+01006 | Ć | C | Latin capital letter C with acute |
| U+0107 | ć | c | Latin small letter c with acute |
| U+0108 | Ĉ | C | Latin capital letter C with circumflex |
| U+0109 | ĉ | c | Latin small letter c with circumflex |
| U+010A | Ċ | C | Latin capital letter C with dot above |
| U+010B | ċ | c | Latin small letter c with dot above |
| U+010C | Č | C | Latin capital letter C with caron |
| U+010D | č | c | Latin small letter c with caron |
| U+010E | Ď | D | Latin capital letter D with caron |
| U+010F | ď | d | Latin small letter d with caron |
| U+0110 | Đ | D | Latin capital letter D with stroke |
| U+0111 | đ | d | Latin small letter d with stroke |
| U+0112 | Ē | E | Latin capital letter E with macron |
| U+0113 | ē | e | Latin small letter e with macron |
| U+0114 | Ĕ | E | Latin capital letter E with breve |
| U+0115 | ĕ | e | Latin small letter e with breve |
| U+0116 | Ė | E | Latin capital letter E with dot above |
| U+0117 | ė | e | Latin small letter e with dot above |
| U+0118 | Ę | E | Latin capital letter E with ogonek |
| U+0119 | ę | e | Latin small letter e with ogonek |
| U+011A | Ě | E | Latin capital letter E with caron |
| U+011B | ě | e | Latin small letter e with caron |
| U+011C | Ĝ | G | Latin capital letter G with circumflex |
| U+011D | ĝ | g | Latin small letter g with circumflex |
| U+011E | Ğ | G | Latin capital letter G with breve |
| U+011F | ğ | g | Latin small letter g with breve |
| U+0120 | Ġ | G | Latin capital letter G with dot above |
| U+0121 | ġ | g | Latin small letter g with dot above |
| U+0122 | Ģ | G | Latin capital letter G with cedilla |
| U+0123 | ģ | g | Latin small letter g with cedilla |
| U+0124 | Ĥ | H | Latin capital letter H with circumflex |
| U+0125 | ĥ | h | Latin small letter h with circumflex |
| U+0126 | Ħ | H | Latin capital letter H with stroke |
| U+0127 | ħ | h | Latin small letter h with stroke |
| U+0128 | Ĩ | I | Latin capital letter I with tilde |
| U+0129 | ĩ | i | Latin small letter i with tilde |
| U+012A | Ī | I | Latin capital letter I with macron |
| U+012B | ī | i | Latin small letter i with macron |
| U+012C | Ĭ | I | Latin capital letter I with breve |
| U+012D | ĭ | i | Latin small letter i with breve |
| U+012E | Į | I | Latin capital letter I with ogonek |
| U+012F | į | i | Latin small letter i with ogonek |
| U+0130 | İ | I | Latin capital letter I with dot above |
| U+0131 | ı | i | Latin small letter dotless i |
| U+0132 | IJ | IJ | Latin capital ligature IJ |
| U+0133 | ij | ij | Latin small ligature ij |
| U+0134 | Ĵ | J | Latin capital letter J with circumflex |
| U+0135 | ĵ | j | Latin small letter j with circumflex |
| U+0136 | Ķ | K | Latin capital letter K with cedilla |
| U+0137 | ķ | k | Latin small letter k with cedilla |
| U+0138 | ĸ | k | Latin small letter Kra |
| U+0139 | Ĺ | L | Latin capital letter L with acute |
| U+013A | ĺ | l | Latin small letter l with acute |
| U+013B | Ļ | L | Latin capital letter L with cedilla |
| U+013C | ļ | l | Latin small letter l with cedilla |
| U+013D | Ľ | L | Latin capital letter L with caron |
| U+013E | ľ | l | Latin small letter l with caron |
| U+013F | Ŀ | L | Latin capital letter L with middle dot |
| U+0140 | ŀ | l | Latin small letter l with middle dot |
| U+0141 | Ł | L | Latin capital letter L with stroke |
| U+0142 | ł | l | Latin small letter l with stroke |
| U+0143 | Ń | N | Latin capital letter N with acute |
| U+0144 | ń | n | Latin small letter N with acute |
| U+0145 | Ņ | N | Latin capital letter N with cedilla |
| U+0146 | ņ | n | Latin small letter n with cedilla |
| U+0147 | Ň | N | Latin capital letter N with caron |
| U+0148 | ň | n | Latin small letter n with caron |
| U+0149 | ʼn | n | Latin small letter n preceded by apostrophe |
| U+014A | Ŋ | N | Latin capital letter Eng |
| U+014B | ŋ | n | Latin small letter Eng |
| U+014C | Ō | O | Latin capital letter O with macron |
| U+014D | ō | o | Latin small letter o with macron |
| U+014E | Ŏ | O | Latin capital letter O with breve |
| U+014F | ŏ | o | Latin small letter o with breve |
| U+0150 | Ő | O | Latin capital letter O with double acute |
| U+0151 | ő | o | Latin small letter o with double acute |
| U+0152 | Œ | OE | Latin capital ligature OE |
| U+0153 | œ | oe | Latin small ligature oe |
| U+0154 | Ŕ | R | Latin capital letter R with acute |
| U+0155 | ŕ | r | Latin small letter r with acute |
| U+0156 | Ŗ | R | Latin capital letter R with cedilla |
| U+0157 | ŗ | r | Latin small letter r with cedilla |
| U+0158 | Ř | R | Latin capital letter R with caron |
| U+0159 | ř | r | Latin small letter r with caron |
| U+015A | Ś | S | Latin capital letter S with acute |
| U+015B | ś | s | Latin small letter s with acute |
| U+015C | Ŝ | S | Latin capital letter S with circumflex |
| U+015D | ŝ | s | Latin small letter s with circumflex |
| U+015E | Ş | S | Latin capital letter S with cedilla |
| U+015F | ş | s | Latin small letter s with cedilla |
| U+0160 | Š | S | Latin capital letter S with caron |
| U+0161 | š | s | Latin small letter s with caron |
| U+0162 | Ţ | T | Latin capital letter T with cedilla |
| U+0163 | ţ | t | Latin small letter t with cedilla |
| U+0164 | Ť | T | Latin capital letter T with caron |
| U+0165 | ť | t | Latin small letter t with caron |
| U+0166 | Ŧ | T | Latin capital letter T with stroke |
| U+0167 | ŧ | t | Latin small letter t with stroke |
| U+0168 | Ũ | U | Latin capital letter U with tilde |
| U+0169 | ũ | u | Latin small letter u with tilde |
| U+016A | Ū | U | Latin capital letter U with macron |
| U+016B | ū | u | Latin small letter u with macron |
| U+016C | Ŭ | U | Latin capital letter U with breve |
| U+016D | ŭ | u | Latin small letter u with breve |
| U+016E | Ů | U | Latin capital letter U with ring above |
| U+016F | ů | u | Latin small letter u with ring above |
| U+0170 | Ű | U | Latin capital letter U with double acute |
| U+0171 | ű | u | Latin small letter u with double acute |
| U+0172 | Ų | U | Latin capital letter U with ogonek |
| U+0173 | ų | u | Latin small letter u with ogonek |
| U+0174 | Ŵ | W | Latin capital letter W with circumflex |
| U+0175 | ŵ | w | Latin small letter w with circumflex |
| U+0176 | Ŷ | Y | Latin capital letter Y with circumflex |
| U+0177 | ŷ | y | Latin small letter y with circumflex |
| U+0178 | Ÿ | Y | Latin capital letter Y with diaeresis |
| U+0179 | Ź | Z | Latin capital letter Z with acute |
| U+017A | ź | z | Latin small letter z with acute |
| U+017B | Ż | Z | Latin capital letter Z with dot above |
| U+017C | ż | z | Latin small letter z with dot above |
| U+017D | Ž | Z | Latin capital letter Z with caron |
| U+017E | ž | z | Latin small letter z with caron |
| U+017F | ſ | s | Latin small letter long s |
| U+01A0 | Ơ | O | Latin capital letter O with horn |
| U+01A1 | ơ | o | Latin small letter o with horn |
| U+01AF | Ư | U | Latin capital letter U with horn |
| U+01B0 | ư | u | Latin small letter u with horn |
| U+01CD | Ǎ | A | Latin capital letter A with caron |
| U+01CE | ǎ | a | Latin small letter a with caron |
| U+01CF | Ǐ | I | Latin capital letter I with caron |
| U+01D0 | ǐ | i | Latin small letter i with caron |
| U+01D1 | Ǒ | O | Latin capital letter O with caron |
| U+01D2 | ǒ | o | Latin small letter o with caron |
| U+01D3 | Ǔ | U | Latin capital letter U with caron |
| U+01D4 | ǔ | u | Latin small letter u with caron |
| U+01D5 | Ǖ | U | Latin capital letter U with diaeresis and macron |
| U+01D6 | ǖ | u | Latin small letter u with diaeresis and macron |
| U+01D7 | Ǘ | U | Latin capital letter U with diaeresis and acute |
| U+01D8 | ǘ | u | Latin small letter u with diaeresis and acute |
| U+01D9 | Ǚ | U | Latin capital letter U with diaeresis and caron |
| U+01DA | ǚ | u | Latin small letter u with diaeresis and caron |
| U+01DB | Ǜ | U | Latin capital letter U with diaeresis and grave |
| U+01DC | ǜ | u | Latin small letter u with diaeresis and grave |
Decompositions for Latin Extended-B:
| Code | Glyph | Replacement | Description |
| --- | --- | --- | --- |
| U+0218 | Ș | S | Latin capital letter S with comma below |
| U+0219 | ș | s | Latin small letter s with comma below |
| U+021A | Ț | T | Latin capital letter T with comma below |
| U+021B | ț | t | Latin small letter t with comma below |
Vowels with diacritic (Chinese, Hanyu Pinyin):
| Code | Glyph | Replacement | Description |
| --- | --- | --- | --- |
| U+0251 | ɑ | a | Latin small letter alpha |
| U+1EA0 | Ạ | A | Latin capital letter A with dot below |
| U+1EA1 | ạ | a | Latin small letter a with dot below |
| U+1EA2 | Ả | A | Latin capital letter A with hook above |
| U+1EA3 | ả | a | Latin small letter a with hook above |
| U+1EA4 | Ấ | A | Latin capital letter A with circumflex and acute |
| U+1EA5 | ấ | a | Latin small letter a with circumflex and acute |
| U+1EA6 | Ầ | A | Latin capital letter A with circumflex and grave |
| U+1EA7 | ầ | a | Latin small letter a with circumflex and grave |
| U+1EA8 | Ẩ | A | Latin capital letter A with circumflex and hook above |
| U+1EA9 | ẩ | a | Latin small letter a with circumflex and hook above |
| U+1EAA | Ẫ | A | Latin capital letter A with circumflex and tilde |
| U+1EAB | ẫ | a | Latin small letter a with circumflex and tilde |
| U+1EA6 | Ậ | A | Latin capital letter A with circumflex and dot below |
| U+1EAD | ậ | a | Latin small letter a with circumflex and dot below |
| U+1EAE | Ắ | A | Latin capital letter A with breve and acute |
| U+1EAF | ắ | a | Latin small letter a with breve and acute |
| U+1EB0 | Ằ | A | Latin capital letter A with breve and grave |
| U+1EB1 | ằ | a | Latin small letter a with breve and grave |
| U+1EB2 | Ẳ | A | Latin capital letter A with breve and hook above |
| U+1EB3 | ẳ | a | Latin small letter a with breve and hook above |
| U+1EB4 | Ẵ | A | Latin capital letter A with breve and tilde |
| U+1EB5 | ẵ | a | Latin small letter a with breve and tilde |
| U+1EB6 | Ặ | A | Latin capital letter A with breve and dot below |
| U+1EB7 | ặ | a | Latin small letter a with breve and dot below |
| U+1EB8 | Ẹ | E | Latin capital letter E with dot below |
| U+1EB9 | ẹ | e | Latin small letter e with dot below |
| U+1EBA | Ẻ | E | Latin capital letter E with hook above |
| U+1EBB | ẻ | e | Latin small letter e with hook above |
| U+1EBC | Ẽ | E | Latin capital letter E with tilde |
| U+1EBD | ẽ | e | Latin small letter e with tilde |
| U+1EBE | Ế | E | Latin capital letter E with circumflex and acute |
| U+1EBF | ế | e | Latin small letter e with circumflex and acute |
| U+1EC0 | Ề | E | Latin capital letter E with circumflex and grave |
| U+1EC1 | ề | e | Latin small letter e with circumflex and grave |
| U+1EC2 | Ể | E | Latin capital letter E with circumflex and hook above |
| U+1EC3 | ể | e | Latin small letter e with circumflex and hook above |
| U+1EC4 | Ễ | E | Latin capital letter E with circumflex and tilde |
| U+1EC5 | ễ | e | Latin small letter e with circumflex and tilde |
| U+1EC6 | Ệ | E | Latin capital letter E with circumflex and dot below |
| U+1EC7 | ệ | e | Latin small letter e with circumflex and dot below |
| U+1EC8 | Ỉ | I | Latin capital letter I with hook above |
| U+1EC9 | ỉ | i | Latin small letter i with hook above |
| U+1ECA | Ị | I | Latin capital letter I with dot below |
| U+1ECB | ị | i | Latin small letter i with dot below |
| U+1ECC | Ọ | O | Latin capital letter O with dot below |
| U+1ECD | ọ | o | Latin small letter o with dot below |
| U+1ECE | Ỏ | O | Latin capital letter O with hook above |
| U+1ECF | ỏ | o | Latin small letter o with hook above |
| U+1ED0 | Ố | O | Latin capital letter O with circumflex and acute |
| U+1ED1 | ố | o | Latin small letter o with circumflex and acute |
| U+1ED2 | Ồ | O | Latin capital letter O with circumflex and grave |
| U+1ED3 | ồ | o | Latin small letter o with circumflex and grave |
| U+1ED4 | Ổ | O | Latin capital letter O with circumflex and hook above |
| U+1ED5 | ổ | o | Latin small letter o with circumflex and hook above |
| U+1ED6 | Ỗ | O | Latin capital letter O with circumflex and tilde |
| U+1ED7 | ỗ | o | Latin small letter o with circumflex and tilde |
| U+1ED8 | Ộ | O | Latin capital letter O with circumflex and dot below |
| U+1ED9 | ộ | o | Latin small letter o with circumflex and dot below |
| U+1EDA | Ớ | O | Latin capital letter O with horn and acute |
| U+1EDB | ớ | o | Latin small letter o with horn and acute |
| U+1EDC | Ờ | O | Latin capital letter O with horn and grave |
| U+1EDD | ờ | o | Latin small letter o with horn and grave |
| U+1EDE | Ở | O | Latin capital letter O with horn and hook above |
| U+1EDF | ở | o | Latin small letter o with horn and hook above |
| U+1EE0 | Ỡ | O | Latin capital letter O with horn and tilde |
| U+1EE1 | ỡ | o | Latin small letter o with horn and tilde |
| U+1EE2 | Ợ | O | Latin capital letter O with horn and dot below |
| U+1EE3 | ợ | o | Latin small letter o with horn and dot below |
| U+1EE4 | Ụ | U | Latin capital letter U with dot below |
| U+1EE5 | ụ | u | Latin small letter u with dot below |
| U+1EE6 | Ủ | U | Latin capital letter U with hook above |
| U+1EE7 | ủ | u | Latin small letter u with hook above |
| U+1EE8 | Ứ | U | Latin capital letter U with horn and acute |
| U+1EE9 | ứ | u | Latin small letter u with horn and acute |
| U+1EEA | Ừ | U | Latin capital letter U with horn and grave |
| U+1EEB | ừ | u | Latin small letter u with horn and grave |
| U+1EEC | Ử | U | Latin capital letter U with horn and hook above |
| U+1EED | ử | u | Latin small letter u with horn and hook above |
| U+1EEE | Ữ | U | Latin capital letter U with horn and tilde |
| U+1EEF | ữ | u | Latin small letter u with horn and tilde |
| U+1EF0 | Ự | U | Latin capital letter U with horn and dot below |
| U+1EF1 | ự | u | Latin small letter u with horn and dot below |
| U+1EF2 | Ỳ | Y | Latin capital letter Y with grave |
| U+1EF3 | ỳ | y | Latin small letter y with grave |
| U+1EF4 | Ỵ | Y | Latin capital letter Y with dot below |
| U+1EF5 | ỵ | y | Latin small letter y with dot below |
| U+1EF6 | Ỷ | Y | Latin capital letter Y with hook above |
| U+1EF7 | ỷ | y | Latin small letter y with hook above |
| U+1EF8 | Ỹ | Y | Latin capital letter Y with tilde |
| U+1EF9 | ỹ | y | Latin small letter y with tilde |
German (`de_DE`), German formal (`de_DE_formal`), German (Switzerland) formal (`de_CH`), German (Switzerland) informal (`de_CH_informal`), and German (Austria) (`de_AT`) locales:
| Code | Glyph | Replacement | Description |
| --- | --- | --- | --- |
| U+00C4 | Ä | Ae | Latin capital letter A with diaeresis |
| U+00E4 | ä | ae | Latin small letter a with diaeresis |
| U+00D6 | Ö | Oe | Latin capital letter O with diaeresis |
| U+00F6 | ö | oe | Latin small letter o with diaeresis |
| U+00DC | Ü | Ue | Latin capital letter U with diaeresis |
| U+00FC | ü | ue | Latin small letter u with diaeresis |
| U+00DF | ß | ss | Latin small letter sharp s |
Danish (`da_DK`) locale:
| Code | Glyph | Replacement | Description |
| --- | --- | --- | --- |
| U+00C6 | Æ | Ae | Latin capital letter AE |
| U+00E6 | æ | ae | Latin small letter ae |
| U+00D8 | Ø | Oe | Latin capital letter O with stroke |
| U+00F8 | ø | oe | Latin small letter o with stroke |
| U+00C5 | Å | Aa | Latin capital letter A with ring above |
| U+00E5 | å | aa | Latin small letter a with ring above |
Catalan (`ca`) locale:
| Code | Glyph | Replacement | Description |
| --- | --- | --- | --- |
| U+00B7 | l·l | ll | Flown dot (between two Ls) |
Serbian (`sr_RS`) and Bosnian (`bs_BA`) locales:
| Code | Glyph | Replacement | Description |
| --- | --- | --- | --- |
| U+0110 | Đ | DJ | Latin capital letter D with stroke |
| U+0111 | đ | dj | Latin small letter d with stroke |
`$string` string Required Text that might have accent characters. `$locale` string Optional The locale to use for accent removal. Some character replacements depend on the locale being used (e.g. `'de_DE'`).
Defaults to the current locale. Default: `''`
string Filtered string with replaced "nice" characters.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function remove_accents( $string, $locale = '' ) {
if ( ! preg_match( '/[\x80-\xff]/', $string ) ) {
return $string;
}
if ( seems_utf8( $string ) ) {
// Unicode sequence normalization from NFD (Normalization Form Decomposed)
// to NFC (Normalization Form [Pre]Composed), the encoding used in this function.
if ( function_exists( 'normalizer_normalize' ) ) {
if ( ! normalizer_is_normalized( $string, Normalizer::FORM_C ) ) {
$string = normalizer_normalize( $string, Normalizer::FORM_C );
}
}
$chars = array(
// Decompositions for Latin-1 Supplement.
'ª' => 'a',
'º' => 'o',
'À' => 'A',
'Á' => 'A',
'Â' => 'A',
'Ã' => 'A',
'Ä' => 'A',
'Å' => 'A',
'Æ' => 'AE',
'Ç' => 'C',
'È' => 'E',
'É' => 'E',
'Ê' => 'E',
'Ë' => 'E',
'Ì' => 'I',
'Í' => 'I',
'Î' => 'I',
'Ï' => 'I',
'Ð' => 'D',
'Ñ' => 'N',
'Ò' => 'O',
'Ó' => 'O',
'Ô' => 'O',
'Õ' => 'O',
'Ö' => 'O',
'Ù' => 'U',
'Ú' => 'U',
'Û' => 'U',
'Ü' => 'U',
'Ý' => 'Y',
'Þ' => 'TH',
'ß' => 's',
'à' => 'a',
'á' => 'a',
'â' => 'a',
'ã' => 'a',
'ä' => 'a',
'å' => 'a',
'æ' => 'ae',
'ç' => 'c',
'è' => 'e',
'é' => 'e',
'ê' => 'e',
'ë' => 'e',
'ì' => 'i',
'í' => 'i',
'î' => 'i',
'ï' => 'i',
'ð' => 'd',
'ñ' => 'n',
'ò' => 'o',
'ó' => 'o',
'ô' => 'o',
'õ' => 'o',
'ö' => 'o',
'ø' => 'o',
'ù' => 'u',
'ú' => 'u',
'û' => 'u',
'ü' => 'u',
'ý' => 'y',
'þ' => 'th',
'ÿ' => 'y',
'Ø' => 'O',
// Decompositions for Latin Extended-A.
'Ā' => 'A',
'ā' => 'a',
'Ă' => 'A',
'ă' => 'a',
'Ą' => 'A',
'ą' => 'a',
'Ć' => 'C',
'ć' => 'c',
'Ĉ' => 'C',
'ĉ' => 'c',
'Ċ' => 'C',
'ċ' => 'c',
'Č' => 'C',
'č' => 'c',
'Ď' => 'D',
'ď' => 'd',
'Đ' => 'D',
'đ' => 'd',
'Ē' => 'E',
'ē' => 'e',
'Ĕ' => 'E',
'ĕ' => 'e',
'Ė' => 'E',
'ė' => 'e',
'Ę' => 'E',
'ę' => 'e',
'Ě' => 'E',
'ě' => 'e',
'Ĝ' => 'G',
'ĝ' => 'g',
'Ğ' => 'G',
'ğ' => 'g',
'Ġ' => 'G',
'ġ' => 'g',
'Ģ' => 'G',
'ģ' => 'g',
'Ĥ' => 'H',
'ĥ' => 'h',
'Ħ' => 'H',
'ħ' => 'h',
'Ĩ' => 'I',
'ĩ' => 'i',
'Ī' => 'I',
'ī' => 'i',
'Ĭ' => 'I',
'ĭ' => 'i',
'Į' => 'I',
'į' => 'i',
'İ' => 'I',
'ı' => 'i',
'IJ' => 'IJ',
'ij' => 'ij',
'Ĵ' => 'J',
'ĵ' => 'j',
'Ķ' => 'K',
'ķ' => 'k',
'ĸ' => 'k',
'Ĺ' => 'L',
'ĺ' => 'l',
'Ļ' => 'L',
'ļ' => 'l',
'Ľ' => 'L',
'ľ' => 'l',
'Ŀ' => 'L',
'ŀ' => 'l',
'Ł' => 'L',
'ł' => 'l',
'Ń' => 'N',
'ń' => 'n',
'Ņ' => 'N',
'ņ' => 'n',
'Ň' => 'N',
'ň' => 'n',
'ʼn' => 'n',
'Ŋ' => 'N',
'ŋ' => 'n',
'Ō' => 'O',
'ō' => 'o',
'Ŏ' => 'O',
'ŏ' => 'o',
'Ő' => 'O',
'ő' => 'o',
'Œ' => 'OE',
'œ' => 'oe',
'Ŕ' => 'R',
'ŕ' => 'r',
'Ŗ' => 'R',
'ŗ' => 'r',
'Ř' => 'R',
'ř' => 'r',
'Ś' => 'S',
'ś' => 's',
'Ŝ' => 'S',
'ŝ' => 's',
'Ş' => 'S',
'ş' => 's',
'Š' => 'S',
'š' => 's',
'Ţ' => 'T',
'ţ' => 't',
'Ť' => 'T',
'ť' => 't',
'Ŧ' => 'T',
'ŧ' => 't',
'Ũ' => 'U',
'ũ' => 'u',
'Ū' => 'U',
'ū' => 'u',
'Ŭ' => 'U',
'ŭ' => 'u',
'Ů' => 'U',
'ů' => 'u',
'Ű' => 'U',
'ű' => 'u',
'Ų' => 'U',
'ų' => 'u',
'Ŵ' => 'W',
'ŵ' => 'w',
'Ŷ' => 'Y',
'ŷ' => 'y',
'Ÿ' => 'Y',
'Ź' => 'Z',
'ź' => 'z',
'Ż' => 'Z',
'ż' => 'z',
'Ž' => 'Z',
'ž' => 'z',
'ſ' => 's',
// Decompositions for Latin Extended-B.
'Ș' => 'S',
'ș' => 's',
'Ț' => 'T',
'ț' => 't',
// Euro sign.
'€' => 'E',
// GBP (Pound) sign.
'£' => '',
// Vowels with diacritic (Vietnamese).
// Unmarked.
'Ơ' => 'O',
'ơ' => 'o',
'Ư' => 'U',
'ư' => 'u',
// Grave accent.
'Ầ' => 'A',
'ầ' => 'a',
'Ằ' => 'A',
'ằ' => 'a',
'Ề' => 'E',
'ề' => 'e',
'Ồ' => 'O',
'ồ' => 'o',
'Ờ' => 'O',
'ờ' => 'o',
'Ừ' => 'U',
'ừ' => 'u',
'Ỳ' => 'Y',
'ỳ' => 'y',
// Hook.
'Ả' => 'A',
'ả' => 'a',
'Ẩ' => 'A',
'ẩ' => 'a',
'Ẳ' => 'A',
'ẳ' => 'a',
'Ẻ' => 'E',
'ẻ' => 'e',
'Ể' => 'E',
'ể' => 'e',
'Ỉ' => 'I',
'ỉ' => 'i',
'Ỏ' => 'O',
'ỏ' => 'o',
'Ổ' => 'O',
'ổ' => 'o',
'Ở' => 'O',
'ở' => 'o',
'Ủ' => 'U',
'ủ' => 'u',
'Ử' => 'U',
'ử' => 'u',
'Ỷ' => 'Y',
'ỷ' => 'y',
// Tilde.
'Ẫ' => 'A',
'ẫ' => 'a',
'Ẵ' => 'A',
'ẵ' => 'a',
'Ẽ' => 'E',
'ẽ' => 'e',
'Ễ' => 'E',
'ễ' => 'e',
'Ỗ' => 'O',
'ỗ' => 'o',
'Ỡ' => 'O',
'ỡ' => 'o',
'Ữ' => 'U',
'ữ' => 'u',
'Ỹ' => 'Y',
'ỹ' => 'y',
// Acute accent.
'Ấ' => 'A',
'ấ' => 'a',
'Ắ' => 'A',
'ắ' => 'a',
'Ế' => 'E',
'ế' => 'e',
'Ố' => 'O',
'ố' => 'o',
'Ớ' => 'O',
'ớ' => 'o',
'Ứ' => 'U',
'ứ' => 'u',
// Dot below.
'Ạ' => 'A',
'ạ' => 'a',
'Ậ' => 'A',
'ậ' => 'a',
'Ặ' => 'A',
'ặ' => 'a',
'Ẹ' => 'E',
'ẹ' => 'e',
'Ệ' => 'E',
'ệ' => 'e',
'Ị' => 'I',
'ị' => 'i',
'Ọ' => 'O',
'ọ' => 'o',
'Ộ' => 'O',
'ộ' => 'o',
'Ợ' => 'O',
'ợ' => 'o',
'Ụ' => 'U',
'ụ' => 'u',
'Ự' => 'U',
'ự' => 'u',
'Ỵ' => 'Y',
'ỵ' => 'y',
// Vowels with diacritic (Chinese, Hanyu Pinyin).
'ɑ' => 'a',
// Macron.
'Ǖ' => 'U',
'ǖ' => 'u',
// Acute accent.
'Ǘ' => 'U',
'ǘ' => 'u',
// Caron.
'Ǎ' => 'A',
'ǎ' => 'a',
'Ǐ' => 'I',
'ǐ' => 'i',
'Ǒ' => 'O',
'ǒ' => 'o',
'Ǔ' => 'U',
'ǔ' => 'u',
'Ǚ' => 'U',
'ǚ' => 'u',
// Grave accent.
'Ǜ' => 'U',
'ǜ' => 'u',
);
// Used for locale-specific rules.
if ( empty( $locale ) ) {
$locale = get_locale();
}
/*
* German has various locales (de_DE, de_CH, de_AT, ...) with formal and informal variants.
* There is no 3-letter locale like 'def', so checking for 'de' instead of 'de_' is safe,
* since 'de' itself would be a valid locale too.
*/
if ( str_starts_with( $locale, 'de' ) ) {
$chars['Ä'] = 'Ae';
$chars['ä'] = 'ae';
$chars['Ö'] = 'Oe';
$chars['ö'] = 'oe';
$chars['Ü'] = 'Ue';
$chars['ü'] = 'ue';
$chars['ß'] = 'ss';
} elseif ( 'da_DK' === $locale ) {
$chars['Æ'] = 'Ae';
$chars['æ'] = 'ae';
$chars['Ø'] = 'Oe';
$chars['ø'] = 'oe';
$chars['Å'] = 'Aa';
$chars['å'] = 'aa';
} elseif ( 'ca' === $locale ) {
$chars['l·l'] = 'll';
} elseif ( 'sr_RS' === $locale || 'bs_BA' === $locale ) {
$chars['Đ'] = 'DJ';
$chars['đ'] = 'dj';
}
$string = strtr( $string, $chars );
} else {
$chars = array();
// Assume ISO-8859-1 if not UTF-8.
$chars['in'] = "\x80\x83\x8a\x8e\x9a\x9e"
. "\x9f\xa2\xa5\xb5\xc0\xc1\xc2"
. "\xc3\xc4\xc5\xc7\xc8\xc9\xca"
. "\xcb\xcc\xcd\xce\xcf\xd1\xd2"
. "\xd3\xd4\xd5\xd6\xd8\xd9\xda"
. "\xdb\xdc\xdd\xe0\xe1\xe2\xe3"
. "\xe4\xe5\xe7\xe8\xe9\xea\xeb"
. "\xec\xed\xee\xef\xf1\xf2\xf3"
. "\xf4\xf5\xf6\xf8\xf9\xfa\xfb"
. "\xfc\xfd\xff";
$chars['out'] = 'EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy';
$string = strtr( $string, $chars['in'], $chars['out'] );
$double_chars = array();
$double_chars['in'] = array( "\x8c", "\x9c", "\xc6", "\xd0", "\xde", "\xdf", "\xe6", "\xf0", "\xfe" );
$double_chars['out'] = array( 'OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th' );
$string = str_replace( $double_chars['in'], $double_chars['out'], $string );
}
return $string;
}
```
| Uses | Description |
| --- | --- |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [seems\_utf8()](seems_utf8) wp-includes/formatting.php | Checks to see if a string is utf8 encoded. |
| Used By | Description |
| --- | --- |
| [sanitize\_file\_name()](sanitize_file_name) wp-includes/formatting.php | Sanitizes a filename, replacing whitespace with dashes. |
| [sanitize\_user()](sanitize_user) wp-includes/formatting.php | Sanitizes a username, stripping out unsafe characters. |
| [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Added Unicode NFC encoding normalization support. |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Added the `$locale` parameter. |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Added locale support for `de_AT`. |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Added locale support for `bs_BA`. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Added locale support for `sr_RS`. |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Added locale support for `de_CH`, `de_CH_informal`, and `ca`. |
| [1.2.1](https://developer.wordpress.org/reference/since/1.2.1/) | Introduced. |
| programming_docs |
wordpress ms_subdomain_constants() ms\_subdomain\_constants()
==========================
Defines Multisite subdomain constants and handles warnings and notices.
VHOST is deprecated in favor of SUBDOMAIN\_INSTALL, which is a bool.
On first call, the constants are checked and defined. On second call, we will have translations loaded and can trigger warnings easily.
File: `wp-includes/ms-default-constants.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-default-constants.php/)
```
function ms_subdomain_constants() {
static $subdomain_error = null;
static $subdomain_error_warn = null;
if ( false === $subdomain_error ) {
return;
}
if ( $subdomain_error ) {
$vhost_deprecated = sprintf(
/* translators: 1: VHOST, 2: SUBDOMAIN_INSTALL, 3: wp-config.php, 4: is_subdomain_install() */
__( 'The constant %1$s <strong>is deprecated</strong>. Use the boolean constant %2$s in %3$s to enable a subdomain configuration. Use %4$s to check whether a subdomain configuration is enabled.' ),
'<code>VHOST</code>',
'<code>SUBDOMAIN_INSTALL</code>',
'<code>wp-config.php</code>',
'<code>is_subdomain_install()</code>'
);
if ( $subdomain_error_warn ) {
trigger_error(
sprintf(
/* translators: 1: VHOST, 2: SUBDOMAIN_INSTALL */
__( '<strong>Conflicting values for the constants %1$s and %2$s.</strong> The value of %2$s will be assumed to be your subdomain configuration setting.' ),
'<code>VHOST</code>',
'<code>SUBDOMAIN_INSTALL</code>'
) . ' ' . $vhost_deprecated,
E_USER_WARNING
);
} else {
_deprecated_argument( 'define()', '3.0.0', $vhost_deprecated );
}
return;
}
if ( defined( 'SUBDOMAIN_INSTALL' ) && defined( 'VHOST' ) ) {
$subdomain_error = true;
if ( SUBDOMAIN_INSTALL !== ( 'yes' === VHOST ) ) {
$subdomain_error_warn = true;
}
} elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) {
$subdomain_error = false;
define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' );
} elseif ( defined( 'VHOST' ) ) {
$subdomain_error = true;
define( 'SUBDOMAIN_INSTALL', 'yes' === VHOST );
} else {
$subdomain_error = false;
define( 'SUBDOMAIN_INSTALL', false );
define( 'VHOST', 'no' );
}
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) 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 |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress media_upload_image(): null|string media\_upload\_image(): null|string
===================================
This function has been deprecated. Use [wp\_media\_upload\_handler()](wp_media_upload_handler) instead.
Handles uploading an image.
* [wp\_media\_upload\_handler()](wp_media_upload_handler)
null|string
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function media_upload_image() {
_deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
return wp_media_upload_handler();
}
```
| Uses | Description |
| --- | --- |
| [wp\_media\_upload\_handler()](wp_media_upload_handler) wp-admin/includes/media.php | Handles the process of uploading media. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress clean_bookmark_cache( int $bookmark_id ) clean\_bookmark\_cache( int $bookmark\_id )
===========================================
Deletes the bookmark cache.
`$bookmark_id` int Required Bookmark ID. File: `wp-includes/bookmark.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/bookmark.php/)
```
function clean_bookmark_cache( $bookmark_id ) {
wp_cache_delete( $bookmark_id, 'bookmark' );
wp_cache_delete( 'get_bookmarks', 'bookmark' );
clean_object_term_cache( $bookmark_id, 'link' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [clean\_object\_term\_cache()](clean_object_term_cache) wp-includes/taxonomy.php | Removes the taxonomy relationship to terms from the cache. |
| Used By | Description |
| --- | --- |
| [wp\_delete\_user()](wp_delete_user) wp-admin/includes/user.php | Remove user and optionally reassign posts and links to another user. |
| [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\_delete\_link()](wp_delete_link) wp-admin/includes/bookmark.php | Deletes a specified link from the database. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress validate_another_blog_signup(): null|bool validate\_another\_blog\_signup(): null|bool
============================================
Validates a new site sign-up for an existing user.
null|bool True if site signup was validated, false on error.
The function halts all execution if the user is not logged in.
File: `wp-signup.php`. [View all references](https://developer.wordpress.org/reference/files/wp-signup.php/)
```
function validate_another_blog_signup() {
global $blogname, $blog_title, $errors, $domain, $path;
$current_user = wp_get_current_user();
if ( ! is_user_logged_in() ) {
die();
}
$result = validate_blog_form();
// Extracted values set/overwrite globals.
$domain = $result['domain'];
$path = $result['path'];
$blogname = $result['blogname'];
$blog_title = $result['blog_title'];
$errors = $result['errors'];
if ( $errors->has_errors() ) {
signup_another_blog( $blogname, $blog_title, $errors );
return false;
}
$public = (int) $_POST['blog_public'];
$blog_meta_defaults = 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 ) {
$blog_meta_defaults['WPLANG'] = $language;
}
}
}
/**
* Filters the new site meta variables.
*
* Use the {@see 'add_signup_meta'} filter instead.
*
* @since MU (3.0.0)
* @deprecated 3.0.0 Use the {@see 'add_signup_meta'} filter instead.
*
* @param array $blog_meta_defaults An array of default blog meta variables.
*/
$meta_defaults = apply_filters_deprecated( 'signup_create_blog_meta', array( $blog_meta_defaults ), '3.0.0', 'add_signup_meta' );
/**
* Filters the new default site meta variables.
*
* @since 3.0.0
*
* @param array $meta {
* An array of default site meta variables.
*
* @type int $lang_id The language ID.
* @type int $blog_public Whether search engines should be discouraged from indexing the site. 1 for true, 0 for false.
* }
*/
$meta = apply_filters( 'add_signup_meta', $meta_defaults );
$blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, get_current_network_id() );
if ( is_wp_error( $blog_id ) ) {
return false;
}
confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id );
return true;
}
```
[apply\_filters( 'add\_signup\_meta', array $meta )](../hooks/add_signup_meta)
Filters the new default site meta variables.
[apply\_filters\_deprecated( 'signup\_create\_blog\_meta', array $blog\_meta\_defaults )](../hooks/signup_create_blog_meta)
Filters the new site meta variables.
| Uses | Description |
| --- | --- |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [apply\_filters\_deprecated()](apply_filters_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated filter hook. |
| [signup\_get\_available\_languages()](signup_get_available_languages) wp-signup.php | Retrieves languages available during the site/user sign-up process. |
| [signup\_another\_blog()](signup_another_blog) wp-signup.php | Shows a form for returning users to sign up for another site. |
| [confirm\_another\_blog\_signup()](confirm_another_blog_signup) wp-signup.php | Shows a message confirming that the new site has been created. |
| [validate\_blog\_form()](validate_blog_form) wp-signup.php | Validates the new site sign-up. |
| [sanitize\_text\_field()](sanitize_text_field) wp-includes/formatting.php | Sanitizes a string from user input or from the database. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [wpmu\_create\_blog()](wpmu_create_blog) wp-includes/ms-functions.php | Creates a site. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [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. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress delete_transient( string $transient ): bool delete\_transient( string $transient ): bool
============================================
Deletes a transient.
`$transient` string Required Transient name. Expected to not be SQL-escaped. bool True if the transient was deleted, false otherwise.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function delete_transient( $transient ) {
/**
* Fires immediately before a specific transient is deleted.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* @since 3.0.0
*
* @param string $transient Transient name.
*/
do_action( "delete_transient_{$transient}", $transient );
if ( wp_using_ext_object_cache() || wp_installing() ) {
$result = wp_cache_delete( $transient, 'transient' );
} else {
$option_timeout = '_transient_timeout_' . $transient;
$option = '_transient_' . $transient;
$result = delete_option( $option );
if ( $result ) {
delete_option( $option_timeout );
}
}
if ( $result ) {
/**
* Fires after a transient is deleted.
*
* @since 3.0.0
*
* @param string $transient Deleted transient name.
*/
do_action( 'deleted_transient', $transient );
}
return $result;
}
```
[do\_action( 'deleted\_transient', string $transient )](../hooks/deleted_transient)
Fires after a transient is deleted.
[do\_action( "delete\_transient\_{$transient}", string $transient )](../hooks/delete_transient_transient)
Fires immediately before a specific transient is deleted.
| Uses | Description |
| --- | --- |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [wp\_using\_ext\_object\_cache()](wp_using_ext_object_cache) wp-includes/load.php | Toggle `$_wp_using_ext_object_cache` on and off without directly touching global. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [wp\_edit\_theme\_plugin\_file()](wp_edit_theme_plugin_file) wp-admin/includes/file.php | Attempts to edit a file for a theme or plugin. |
| [wp\_dashboard\_rss\_control()](wp_dashboard_rss_control) wp-admin/includes/dashboard.php | The RSS dashboard widget control. |
| [get\_settings\_errors()](get_settings_errors) wp-admin/includes/template.php | Fetches settings errors registered by [add\_settings\_error()](add_settings_error) . |
| [WP\_Feed\_Cache\_Transient::unlink()](../classes/wp_feed_cache_transient/unlink) wp-includes/class-wp-feed-cache-transient.php | Deletes transients. |
| [wp\_maybe\_generate\_attachment\_metadata()](wp_maybe_generate_attachment_metadata) wp-includes/media.php | Maybe attempts to generate attachment metadata, if missing. |
| [\_\_clear\_multi\_author\_cache()](__clear_multi_author_cache) wp-includes/author-template.php | Helper function to clear the cache for number of authors. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress wp_logout() wp\_logout()
============
Logs the current user out.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_logout() {
$user_id = get_current_user_id();
wp_destroy_current_session();
wp_clear_auth_cookie();
wp_set_current_user( 0 );
/**
* Fires after a user is logged out.
*
* @since 1.5.0
* @since 5.5.0 Added the `$user_id` parameter.
*
* @param int $user_id ID of the user that was logged out.
*/
do_action( 'wp_logout', $user_id );
}
```
[do\_action( 'wp\_logout', int $user\_id )](../hooks/wp_logout)
Fires after a user is logged out.
| Uses | Description |
| --- | --- |
| [wp\_destroy\_current\_session()](wp_destroy_current_session) wp-includes/user.php | Removes the current session token from the database. |
| [wp\_clear\_auth\_cookie()](wp_clear_auth_cookie) wp-includes/pluggable.php | Removes all of the cookies associated with authentication. |
| [wp\_set\_current\_user()](wp_set_current_user) wp-includes/pluggable.php | Changes the current user by ID or name. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_cache_add_multiple( array $data, string $group = '', int $expire ): bool[] wp\_cache\_add\_multiple( array $data, string $group = '', int $expire ): bool[]
================================================================================
Adds multiple values to the cache in one call.
* [WP\_Object\_Cache::add\_multiple()](../classes/wp_object_cache/add_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 if cache key and group already exist.
File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_add_multiple( array $data, $group = '', $expire = 0 ) {
global $wp_object_cache;
return $wp_object_cache->add_multiple( $data, $group, $expire );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::add\_multiple()](../classes/wp_object_cache/add_multiple) wp-includes/class-wp-object-cache.php | Adds multiple values to the cache in one call. |
| Used By | Description |
| --- | --- |
| [update\_network\_cache()](update_network_cache) wp-includes/ms-network.php | Updates the network cache of given networks. |
| [update\_site\_cache()](update_site_cache) wp-includes/ms-site.php | Updates sites in cache. |
| [update\_object\_term\_cache()](update_object_term_cache) wp-includes/taxonomy.php | Updates the cache for the given term object ID(s). |
| [update\_term\_cache()](update_term_cache) wp-includes/taxonomy.php | Updates terms in cache. |
| [update\_post\_cache()](update_post_cache) wp-includes/post.php | Updates posts in cache. |
| [update\_comment\_cache()](update_comment_cache) wp-includes/comment.php | Updates the comment cache of given comments. |
| [update\_meta\_cache()](update_meta_cache) wp-includes/meta.php | Updates the metadata cache for the specified objects. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress _wp_delete_customize_changeset_dependent_auto_drafts( int $post_id ) \_wp\_delete\_customize\_changeset\_dependent\_auto\_drafts( 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.
Deletes auto-draft posts associated with the supplied changeset.
`$post_id` int Required Post ID for the customize\_changeset. File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function _wp_delete_customize_changeset_dependent_auto_drafts( $post_id ) {
$post = get_post( $post_id );
if ( ! $post || 'customize_changeset' !== $post->post_type ) {
return;
}
$data = json_decode( $post->post_content, true );
if ( empty( $data['nav_menus_created_posts']['value'] ) ) {
return;
}
remove_action( 'delete_post', '_wp_delete_customize_changeset_dependent_auto_drafts' );
foreach ( $data['nav_menus_created_posts']['value'] as $stub_post_id ) {
if ( empty( $stub_post_id ) ) {
continue;
}
if ( 'auto-draft' === get_post_status( $stub_post_id ) ) {
wp_delete_post( $stub_post_id, true );
} elseif ( 'draft' === get_post_status( $stub_post_id ) ) {
wp_trash_post( $stub_post_id );
delete_post_meta( $stub_post_id, '_customize_changeset_uuid' );
}
}
add_action( 'delete_post', '_wp_delete_customize_changeset_dependent_auto_drafts' );
}
```
| Uses | Description |
| --- | --- |
| [remove\_action()](remove_action) wp-includes/plugin.php | Removes a callback function from an action hook. |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [wp\_trash\_post()](wp_trash_post) wp-includes/post.php | Moves a post or page to the Trash |
| [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. |
| [get\_post\_status()](get_post_status) wp-includes/post.php | Retrieves the post status based on the post ID. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Introduced. |
wordpress wp_update_https_detection_errors() wp\_update\_https\_detection\_errors()
======================================
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 a remote HTTPS request to detect whether HTTPS supported, and stores potential errors.
This internal function is called by a regular Cron hook to ensure HTTPS support is detected and maintained.
File: `wp-includes/https-detection.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/https-detection.php/)
```
function wp_update_https_detection_errors() {
/**
* Short-circuits the process of detecting errors related to HTTPS support.
*
* Returning a `WP_Error` from the filter will effectively short-circuit the default logic of trying a remote
* request to the site over HTTPS, storing the errors array from the returned `WP_Error` instead.
*
* @since 5.7.0
*
* @param null|WP_Error $pre Error object to short-circuit detection,
* or null to continue with the default behavior.
*/
$support_errors = apply_filters( 'pre_wp_update_https_detection_errors', null );
if ( is_wp_error( $support_errors ) ) {
update_option( 'https_detection_errors', $support_errors->errors );
return;
}
$support_errors = new WP_Error();
$response = wp_remote_request(
home_url( '/', 'https' ),
array(
'headers' => array(
'Cache-Control' => 'no-cache',
),
'sslverify' => true,
)
);
if ( is_wp_error( $response ) ) {
$unverified_response = wp_remote_request(
home_url( '/', 'https' ),
array(
'headers' => array(
'Cache-Control' => 'no-cache',
),
'sslverify' => false,
)
);
if ( is_wp_error( $unverified_response ) ) {
$support_errors->add(
'https_request_failed',
__( 'HTTPS request failed.' )
);
} else {
$support_errors->add(
'ssl_verification_failed',
__( 'SSL verification failed.' )
);
}
$response = $unverified_response;
}
if ( ! is_wp_error( $response ) ) {
if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
$support_errors->add( 'bad_response_code', wp_remote_retrieve_response_message( $response ) );
} elseif ( false === wp_is_local_html_output( wp_remote_retrieve_body( $response ) ) ) {
$support_errors->add( 'bad_response_source', __( 'It looks like the response did not come from this site.' ) );
}
}
update_option( 'https_detection_errors', $support_errors->errors );
}
```
[apply\_filters( 'pre\_wp\_update\_https\_detection\_errors', null|WP\_Error $pre )](../hooks/pre_wp_update_https_detection_errors)
Short-circuits the process of detecting errors related to HTTPS support.
| Uses | 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\_remote\_request()](wp_remote_request) wp-includes/http.php | Performs an HTTP request 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\_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-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. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [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\_is\_https\_supported()](wp_is_https_supported) wp-includes/https-detection.php | Checks whether HTTPS is supported for the server and domain. |
| [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. |
| programming_docs |
wordpress wp_cron_conditionally_prevent_sslverify( array $request ): array wp\_cron\_conditionally\_prevent\_sslverify( array $request ): 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.
Disables SSL verification if the ‘cron\_request’ arguments include an HTTPS URL.
This prevents an issue if HTTPS breaks, where there would be a failed attempt to verify HTTPS.
`$request` array Required The cron request arguments. array The filtered cron request arguments.
File: `wp-includes/https-detection.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/https-detection.php/)
```
function wp_cron_conditionally_prevent_sslverify( $request ) {
if ( 'https' === wp_parse_url( $request['url'], PHP_URL_SCHEME ) ) {
$request['args']['sslverify'] = false;
}
return $request;
}
```
| 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. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress wp_get_cookie_login(): bool wp\_get\_cookie\_login(): bool
==============================
This function has been deprecated.
Gets the user cookie login. This function is deprecated.
This function is deprecated and should no longer be extended as it won’t be used anywhere in WordPress. Also, plugins shouldn’t use it either.
bool Always returns false
File: `wp-includes/pluggable-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable-deprecated.php/)
```
function wp_get_cookie_login() {
_deprecated_function( __FUNCTION__, '2.5.0' );
return false;
}
```
| 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.3](https://developer.wordpress.org/reference/since/2.0.3/) | Introduced. |
wordpress wp_authenticate( string $username, string $password ): WP_User|WP_Error wp\_authenticate( string $username, string $password ): WP\_User|WP\_Error
==========================================================================
Authenticates a user, confirming the login credentials are valid.
`$username` string Required User's username or email address. `$password` string Required User's password. [WP\_User](../classes/wp_user)|[WP\_Error](../classes/wp_error) [WP\_User](../classes/wp_user) object if the credentials are valid, otherwise [WP\_Error](../classes/wp_error).
* This is a plugabble function, which means that a plug-in can override this function.
* Not to be confused with the [wp\_authenticate](../hooks/wp_authenticate) action hook.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_authenticate( $username, $password ) {
$username = sanitize_user( $username );
$password = trim( $password );
/**
* Filters whether a set of user login credentials are valid.
*
* A WP_User object is returned if the credentials authenticate a user.
* WP_Error or null otherwise.
*
* @since 2.8.0
* @since 4.5.0 `$username` now accepts an email address.
*
* @param null|WP_User|WP_Error $user WP_User if the user is authenticated.
* WP_Error or null otherwise.
* @param string $username Username or email address.
* @param string $password User password.
*/
$user = apply_filters( 'authenticate', null, $username, $password );
if ( null == $user ) {
// TODO: What should the error message be? (Or would these even happen?)
// Only needed if all authentication handlers fail to return anything.
$user = new WP_Error( 'authentication_failed', __( '<strong>Error:</strong> Invalid username, email address or incorrect password.' ) );
}
$ignore_codes = array( 'empty_username', 'empty_password' );
if ( is_wp_error( $user ) && ! in_array( $user->get_error_code(), $ignore_codes, true ) ) {
$error = $user;
/**
* Fires after a user login has failed.
*
* @since 2.5.0
* @since 4.5.0 The value of `$username` can now be an email address.
* @since 5.4.0 The `$error` parameter was added.
*
* @param string $username Username or email address.
* @param WP_Error $error A WP_Error object with the authentication failure details.
*/
do_action( 'wp_login_failed', $username, $error );
}
return $user;
}
```
[apply\_filters( 'authenticate', null|WP\_User|WP\_Error $user, string $username, string $password )](../hooks/authenticate)
Filters whether a set of user login credentials are valid.
[do\_action( 'wp\_login\_failed', string $username, WP\_Error $error )](../hooks/wp_login_failed)
Fires after a user login has failed.
| Uses | Description |
| --- | --- |
| [sanitize\_user()](sanitize_user) wp-includes/formatting.php | Sanitizes a username, stripping out unsafe characters. |
| [\_\_()](__) 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. |
| [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 |
| --- | --- |
| [user\_pass\_ok()](user_pass_ok) wp-includes/deprecated.php | Check that the user login name and password is correct. |
| [wp\_signon()](wp_signon) wp-includes/user.php | Authenticates and logs a user in with ‘remember’ capability. |
| [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\_xmlrpc\_server::login()](../classes/wp_xmlrpc_server/login) wp-includes/class-wp-xmlrpc-server.php | Log user in. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | `$username` now accepts an email address. |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_page_menu( array|string $args = array() ): void|string wp\_page\_menu( array|string $args = array() ): void|string
===========================================================
Displays or retrieves a list of pages with an optional home link.
The arguments are listed below and part of the arguments are for [wp\_list\_pages()](wp_list_pages) function.
Check that function for more info on those arguments.
`$args` array|string Optional Array or string of arguments to generate a page menu. See [wp\_list\_pages()](wp_list_pages) for additional arguments.
* `sort_column`stringHow to sort the list of pages. Accepts post column names.
Default 'menu\_order, post\_title'.
* `menu_id`stringID for the div containing the page list. Default is empty string.
* `menu_class`stringClass to use for the element containing the page list. Default `'menu'`.
* `container`stringElement to use for the element containing the page list. Default `'div'`.
* `echo`boolWhether to echo the list or return it. Accepts true (echo) or false (return).
Default true.
* `show_home`int|bool|stringWhether to display the link to the home page. Can just enter the text you'd like shown for the home link. `1|true` defaults to `'Home'`.
* `link_before`stringThe HTML or text to prepend to $show\_home text.
* `link_after`stringThe HTML or text to append to $show\_home text.
* `before`stringThe HTML or text to prepend to the menu. Default is ``<ul>``.
* `after`stringThe HTML or text to append to the menu. Default is ``</ul>``.
* `item_spacing`stringWhether to preserve whitespace within the menu's HTML. Accepts `'preserve'` or `'discard'`. Default `'discard'`.
* `walker`[Walker](../classes/walker)
[Walker](../classes/walker) instance to use for listing pages. Default empty which results in a [Walker\_Page](../classes/walker_page) instance being used.
More Arguments from wp\_list\_pages( ... $args ) Array or string of arguments to retrieve pages.
* `child_of`intPage ID to return child and grandchild pages of. Note: The value of `$hierarchical` has no bearing on whether `$child_of` returns hierarchical results. Default 0, or no restriction.
* `sort_order`stringHow to sort retrieved pages. Accepts `'ASC'`, `'DESC'`. Default `'ASC'`.
* `sort_column`stringWhat columns to sort pages by, comma-separated. Accepts `'post_author'`, `'post_date'`, `'post_title'`, `'post_name'`, `'post_modified'`, `'menu_order'`, `'post_modified_gmt'`, `'post_parent'`, `'ID'`, `'rand'`, `'comment*count'`.
`'post*'` can be omitted for any values that start with it.
Default `'post_title'`.
* `hierarchical`boolWhether to return pages hierarchically. If false in conjunction with `$child_of` also being false, both arguments will be disregarded.
Default true.
* `exclude`int[]Array of page IDs to exclude.
* `include`int[]Array of page IDs to include. Cannot be used with `$child_of`, `$parent`, `$exclude`, `$meta_key`, `$meta_value`, or `$hierarchical`.
* `meta_key`stringOnly include pages with this meta key.
* `meta_value`stringOnly include pages with this meta value. Requires `$meta_key`.
* `authors`stringA comma-separated list of author IDs.
* `parent`intPage ID to return direct children of. Default -1, or no restriction.
* `exclude_tree`string|int[]Comma-separated string or array of page IDs to exclude.
* `number`intThe number of pages to return. Default 0, or all pages.
* `offset`intThe number of pages to skip before returning. Requires `$number`.
Default 0.
* `post_type`stringThe post type to query. Default `'page'`.
* `post_status`string|arrayA comma-separated list or array of post statuses to include.
Default `'publish'`.
Default: `array()`
void|string Void if `'echo'` argument is true, HTML menu if `'echo'` is false.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function wp_page_menu( $args = array() ) {
$defaults = array(
'sort_column' => 'menu_order, post_title',
'menu_id' => '',
'menu_class' => 'menu',
'container' => 'div',
'echo' => true,
'link_before' => '',
'link_after' => '',
'before' => '<ul>',
'after' => '</ul>',
'item_spacing' => 'discard',
'walker' => '',
);
$args = wp_parse_args( $args, $defaults );
if ( ! in_array( $args['item_spacing'], array( 'preserve', 'discard' ), true ) ) {
// Invalid value, fall back to default.
$args['item_spacing'] = $defaults['item_spacing'];
}
if ( 'preserve' === $args['item_spacing'] ) {
$t = "\t";
$n = "\n";
} else {
$t = '';
$n = '';
}
/**
* Filters the arguments used to generate a page-based menu.
*
* @since 2.7.0
*
* @see wp_page_menu()
*
* @param array $args An array of page menu arguments. See wp_page_menu()
* for information on accepted arguments.
*/
$args = apply_filters( 'wp_page_menu_args', $args );
$menu = '';
$list_args = $args;
// Show Home in the menu.
if ( ! empty( $args['show_home'] ) ) {
if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) {
$text = __( 'Home' );
} else {
$text = $args['show_home'];
}
$class = '';
if ( is_front_page() && ! is_paged() ) {
$class = 'class="current_page_item"';
}
$menu .= '<li ' . $class . '><a href="' . esc_url( home_url( '/' ) ) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
// If the front page is a page, add it to the exclude list.
if ( 'page' === get_option( 'show_on_front' ) ) {
if ( ! empty( $list_args['exclude'] ) ) {
$list_args['exclude'] .= ',';
} else {
$list_args['exclude'] = '';
}
$list_args['exclude'] .= get_option( 'page_on_front' );
}
}
$list_args['echo'] = false;
$list_args['title_li'] = '';
$menu .= wp_list_pages( $list_args );
$container = sanitize_text_field( $args['container'] );
// Fallback in case `wp_nav_menu()` was called without a container.
if ( empty( $container ) ) {
$container = 'div';
}
if ( $menu ) {
// wp_nav_menu() doesn't set before and after.
if ( isset( $args['fallback_cb'] ) &&
'wp_page_menu' === $args['fallback_cb'] &&
'ul' !== $container ) {
$args['before'] = "<ul>{$n}";
$args['after'] = '</ul>';
}
$menu = $args['before'] . $menu . $args['after'];
}
$attrs = '';
if ( ! empty( $args['menu_id'] ) ) {
$attrs .= ' id="' . esc_attr( $args['menu_id'] ) . '"';
}
if ( ! empty( $args['menu_class'] ) ) {
$attrs .= ' class="' . esc_attr( $args['menu_class'] ) . '"';
}
$menu = "<{$container}{$attrs}>" . $menu . "</{$container}>{$n}";
/**
* Filters the HTML output of a page-based menu.
*
* @since 2.7.0
*
* @see wp_page_menu()
*
* @param string $menu The HTML output.
* @param array $args An array of arguments. See wp_page_menu()
* for information on accepted arguments.
*/
$menu = apply_filters( 'wp_page_menu', $menu, $args );
if ( $args['echo'] ) {
echo $menu;
} else {
return $menu;
}
}
```
[apply\_filters( 'wp\_page\_menu', string $menu, array $args )](../hooks/wp_page_menu)
Filters the HTML output of a page-based menu.
[apply\_filters( 'wp\_page\_menu\_args', array $args )](../hooks/wp_page_menu_args)
Filters the arguments used to generate a page-based menu.
| Uses | Description |
| --- | --- |
| [sanitize\_text\_field()](sanitize_text_field) wp-includes/formatting.php | Sanitizes a string from user input or from the database. |
| [is\_front\_page()](is_front_page) wp-includes/query.php | Determines whether the query is for the front page of the site. |
| [is\_paged()](is_paged) wp-includes/query.php | Determines whether the query is for a paged result and not for the first page. |
| [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-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. |
| [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. |
| [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 |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Added the `item_spacing` argument. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added `menu_id`, `container`, `before`, `after`, and `walker` arguments. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_slash( string|array $value ): string|array wp\_slash( string|array $value ): string|array
==============================================
Adds slashes to a string or recursively adds slashes to strings within an array.
This should be used when preparing data for core API that expects slashed data.
This should not be used to escape data going directly into an SQL query.
`$value` string|array Required String or array of data to slash. string|array Slashed `$value`, in the same type as supplied.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_slash( $value ) {
if ( is_array( $value ) ) {
$value = array_map( 'wp_slash', $value );
}
if ( is_string( $value ) ) {
return addslashes( $value );
}
return $value;
}
```
| Used By | Description |
| --- | --- |
| [WP\_REST\_Menu\_Items\_Controller::create\_item()](../classes/wp_rest_menu_items_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Creates a single post. |
| [WP\_REST\_Menu\_Items\_Controller::update\_item()](../classes/wp_rest_menu_items_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Updates a single nav menu item. |
| [WP\_REST\_Global\_Styles\_Controller::update\_item()](../classes/wp_rest_global_styles_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Updates a single global style config. |
| [WP\_REST\_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\_filter\_global\_styles\_post()](wp_filter_global_styles_post) wp-includes/kses.php | Sanitizes global styles user content removing unsafe rules. |
| [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\_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\_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()](../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\_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\_rel\_ugc()](wp_rel_ugc) wp-includes/formatting.php | Adds `rel="nofollow ugc"` string to all HTML A elements in content. |
| [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\_REST\_Autosaves\_Controller::create\_item()](../classes/wp_rest_autosaves_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Creates, updates or deletes an autosave revision. |
| [WP\_REST\_Autosaves\_Controller::create\_post\_autosave()](../classes/wp_rest_autosaves_controller/create_post_autosave) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Creates autosave for the specified post. |
| [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. |
| [wp\_update\_custom\_css\_post()](wp_update_custom_css_post) wp-includes/theme.php | Updates the `custom_css` post for a given theme. |
| [WP\_REST\_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::create\_item()](../classes/wp_rest_users_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Creates a single user. |
| [WP\_REST\_Users\_Controller::update\_item()](../classes/wp_rest_users_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Updates a single user. |
| [WP\_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()](../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\_Posts\_Controller::create\_item()](../classes/wp_rest_posts_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Creates a single post. |
| [WP\_REST\_Posts\_Controller::update\_item()](../classes/wp_rest_posts_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Updates a single post. |
| [WP\_REST\_Comments\_Controller::update\_item()](../classes/wp_rest_comments_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Updates a comment. |
| [WP\_REST\_Comments\_Controller::create\_item()](../classes/wp_rest_comments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Creates a comment. |
| [WP\_Customize\_Nav\_Menus::save\_nav\_menus\_created\_posts()](../classes/wp_customize_nav_menus/save_nav_menus_created_posts) wp-includes/class-wp-customize-nav-menus.php | Publishes the auto-draft posts that were created for nav menu items. |
| [WP\_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\_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::sanitize()](../classes/wp_customize_nav_menu_item_setting/sanitize) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Sanitize an input. |
| [WP\_Customize\_Nav\_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\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [wp\_update\_category()](wp_update_category) wp-admin/includes/taxonomy.php | Aliases [wp\_insert\_category()](wp_insert_category) with minimal args. |
| [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST |
| [media\_upload\_form\_handler()](media_upload_form_handler) wp-admin/includes/media.php | Handles form submissions for the legacy media uploader. |
| [wp\_autosave()](wp_autosave) wp-admin/includes/post.php | Saves a post submitted with XHR. |
| [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\_save\_attachment()](wp_ajax_save_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for updating attachment attributes. |
| [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\_replyto\_comment()](wp_ajax_replyto_comment) wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. |
| [wp\_update\_link()](wp_update_link) wp-admin/includes/bookmark.php | Updates a link in the database. |
| [addslashes\_gpc()](addslashes_gpc) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| [wp\_rel\_nofollow()](wp_rel_nofollow) wp-includes/formatting.php | Adds `rel="nofollow"` string to all HTML A elements in content. |
| [WP\_Embed::shortcode()](../classes/wp_embed/shortcode) wp-includes/class-wp-embed.php | The [do\_shortcode()](do_shortcode) callback function. |
| [wp\_update\_term()](wp_update_term) wp-includes/taxonomy.php | Updates term based on arguments provided. |
| [wp\_create\_user()](wp_create_user) wp-includes/user.php | Provides a simpler way of inserting a user into the database. |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [\_wp\_put\_post\_revision()](_wp_put_post_revision) wp-includes/revision.php | Inserts post data into the posts table as a post revision. |
| [wp\_restore\_post\_revision()](wp_restore_post_revision) wp-includes/revision.php | Restores a post to the specified revision. |
| [wp\_xmlrpc\_server::escape()](../classes/wp_xmlrpc_server/escape) wp-includes/class-wp-xmlrpc-server.php | Escape string or array of strings for database. |
| [WP\_Customize\_Widgets::call\_widget\_update()](../classes/wp_customize_widgets/call_widget_update) wp-includes/class-wp-customize-widgets.php | Finds and invokes the widget update and control callbacks. |
| [wp\_update\_comment()](wp_update_comment) wp-includes/comment.php | Updates an existing comment in the database. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Non-string values are left untouched. |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
| programming_docs |
wordpress wp_plupload_default_settings() wp\_plupload\_default\_settings()
=================================
Prints default Plupload arguments.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_plupload_default_settings() {
$wp_scripts = wp_scripts();
$data = $wp_scripts->get_data( 'wp-plupload', 'data' );
if ( $data && false !== strpos( $data, '_wpPluploadSettings' ) ) {
return;
}
$max_upload_size = wp_max_upload_size();
$allowed_extensions = array_keys( get_allowed_mime_types() );
$extensions = array();
foreach ( $allowed_extensions as $extension ) {
$extensions = array_merge( $extensions, explode( '|', $extension ) );
}
/*
* Since 4.9 the `runtimes` setting is hardcoded in our version of Plupload to `html5,html4`,
* and the `flash_swf_url` and `silverlight_xap_url` are not used.
*/
$defaults = array(
'file_data_name' => 'async-upload', // Key passed to $_FILE.
'url' => admin_url( 'async-upload.php', 'relative' ),
'filters' => array(
'max_file_size' => $max_upload_size . 'b',
'mime_types' => array( array( 'extensions' => implode( ',', $extensions ) ) ),
),
);
/*
* Currently only iOS Safari supports multiple files uploading,
* but iOS 7.x has a bug that prevents uploading of videos when enabled.
* See #29602.
*/
if ( wp_is_mobile() && strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false &&
strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false ) {
$defaults['multi_selection'] = false;
}
// Check if WebP images can be edited.
if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) {
$defaults['webp_upload_error'] = true;
}
/**
* Filters the Plupload default settings.
*
* @since 3.4.0
*
* @param array $defaults Default Plupload settings array.
*/
$defaults = apply_filters( 'plupload_default_settings', $defaults );
$params = array(
'action' => 'upload-attachment',
);
/**
* Filters the Plupload default parameters.
*
* @since 3.4.0
*
* @param array $params Default Plupload parameters array.
*/
$params = apply_filters( 'plupload_default_params', $params );
$params['_wpnonce'] = wp_create_nonce( 'media-form' );
$defaults['multipart_params'] = $params;
$settings = array(
'defaults' => $defaults,
'browser' => array(
'mobile' => wp_is_mobile(),
'supported' => _device_can_upload(),
),
'limitExceeded' => is_multisite() && ! is_upload_space_available(),
);
$script = 'var _wpPluploadSettings = ' . wp_json_encode( $settings ) . ';';
if ( $data ) {
$script = "$data\n$script";
}
$wp_scripts->add_data( 'wp-plupload', 'data', $script );
}
```
[apply\_filters( 'plupload\_default\_params', array $params )](../hooks/plupload_default_params)
Filters the Plupload default parameters.
[apply\_filters( 'plupload\_default\_settings', array $defaults )](../hooks/plupload_default_settings)
Filters the Plupload default settings.
| Uses | Description |
| --- | --- |
| [wp\_scripts()](wp_scripts) wp-includes/functions.wp-scripts.php | Initialize $wp\_scripts if it has not been set. |
| [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\_is\_mobile()](wp_is_mobile) wp-includes/vars.php | Test if the current browser runs on a mobile device (smart phone, tablet, etc.) |
| [\_device\_can\_upload()](_device_can_upload) wp-includes/functions.php | Tests if the current device has the capability to upload files. |
| [get\_allowed\_mime\_types()](get_allowed_mime_types) wp-includes/functions.php | Retrieves the list of allowed mime types and file extensions. |
| [wp\_max\_upload\_size()](wp_max_upload_size) wp-includes/media.php | Determines the maximum upload size allowed in php.ini. |
| [wp\_image\_editor\_supports()](wp_image_editor_supports) wp-includes/media.php | Tests whether there is an editor that supports a given mime type or methods. |
| [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. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [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\_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 |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress get_queried_object_id(): int get\_queried\_object\_id(): int
===============================
Retrieves the ID of the currently queried object.
Wrapper for [WP\_Query::get\_queried\_object\_id()](../classes/wp_query/get_queried_object_id).
int ID of the queried object.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function get_queried_object_id() {
global $wp_query;
return $wp_query->get_queried_object_id();
}
```
| Uses | Description |
| --- | --- |
| [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. |
| 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\_Query::generate\_postdata()](../classes/wp_query/generate_postdata) wp-includes/class-wp-query.php | Generate post data. |
| [wp\_get\_canonical\_url()](wp_get_canonical_url) wp-includes/link-template.php | Returns the canonical URL for a post. |
| [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| [WP::register\_globals()](../classes/wp/register_globals) wp-includes/class-wp.php | Set up the WordPress Globals. |
| [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. |
| [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\_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. |
| [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. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress link_categories_meta_box( object $link ) link\_categories\_meta\_box( object $link )
===========================================
Displays link categories 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_categories_meta_box( $link ) {
?>
<div id="taxonomy-linkcategory" class="categorydiv">
<ul id="category-tabs" class="category-tabs">
<li class="tabs"><a href="#categories-all"><?php _e( 'All categories' ); ?></a></li>
<li class="hide-if-no-js"><a href="#categories-pop"><?php _ex( 'Most Used', 'categories' ); ?></a></li>
</ul>
<div id="categories-all" class="tabs-panel">
<ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear">
<?php
if ( isset( $link->link_id ) ) {
wp_link_category_checklist( $link->link_id );
} else {
wp_link_category_checklist();
}
?>
</ul>
</div>
<div id="categories-pop" class="tabs-panel" style="display: none;">
<ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
<?php wp_popular_terms_checklist( 'link_category' ); ?>
</ul>
</div>
<div id="category-adder" class="wp-hidden-children">
<a id="category-add-toggle" href="#category-add" class="taxonomy-add-new"><?php _e( '+ Add New Category' ); ?></a>
<p id="link-category-add" class="wp-hidden-child">
<label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
<input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" />
<input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e( 'Add' ); ?>" />
<?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
<span id="category-ajax-response"></span>
</p>
</div>
</div>
<?php
}
```
| Uses | Description |
| --- | --- |
| [wp\_link\_category\_checklist()](wp_link_category_checklist) wp-admin/includes/template.php | Outputs a link category checklist element. |
| [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. |
| [\_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\_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. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress wp_mkdir_p( string $target ): bool wp\_mkdir\_p( string $target ): bool
====================================
Recursive directory creation based on full path.
Will attempt to set permissions on folders.
`$target` string Required Full path to attempt to create. bool Whether the path was created. True if path already exists.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_mkdir_p( $target ) {
$wrapper = null;
// Strip the protocol.
if ( wp_is_stream( $target ) ) {
list( $wrapper, $target ) = explode( '://', $target, 2 );
}
// From php.net/mkdir user contributed notes.
$target = str_replace( '//', '/', $target );
// Put the wrapper back on the target.
if ( null !== $wrapper ) {
$target = $wrapper . '://' . $target;
}
/*
* Safe mode fails with a trailing slash under certain PHP versions.
* Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
*/
$target = rtrim( $target, '/' );
if ( empty( $target ) ) {
$target = '/';
}
if ( file_exists( $target ) ) {
return @is_dir( $target );
}
// Do not allow path traversals.
if ( false !== strpos( $target, '../' ) || false !== strpos( $target, '..' . DIRECTORY_SEPARATOR ) ) {
return false;
}
// We need to find the permissions of the parent folder that exists and inherit that.
$target_parent = dirname( $target );
while ( '.' !== $target_parent && ! is_dir( $target_parent ) && dirname( $target_parent ) !== $target_parent ) {
$target_parent = dirname( $target_parent );
}
// Get the permission bits.
$stat = @stat( $target_parent );
if ( $stat ) {
$dir_perms = $stat['mode'] & 0007777;
} else {
$dir_perms = 0777;
}
if ( @mkdir( $target, $dir_perms, true ) ) {
/*
* If a umask is set that modifies $dir_perms, we'll have to re-set
* the $dir_perms correctly with chmod()
*/
if ( ( $dir_perms & ~umask() ) != $dir_perms ) {
$folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) {
chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms );
}
}
return true;
}
return false;
}
```
| 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\_Image\_Editor\_Imagick::write\_image()](../classes/wp_image_editor_imagick/write_image) wp-includes/class-wp-image-editor-imagick.php | Writes an image to a file or stream. |
| [wp\_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. |
| [\_copy\_image\_file()](_copy_image_file) wp-admin/includes/image.php | Copies an existing image file. |
| [wp\_crop\_image()](wp_crop_image) wp-admin/includes/image.php | Crops an image to a given size. |
| [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::make\_image()](../classes/wp_image_editor/make_image) wp-includes/class-wp-image-editor.php | Either calls editor’s save function or handles file as a stream. |
| Version | Description |
| --- | --- |
| [2.0.1](https://developer.wordpress.org/reference/since/2.0.1/) | Introduced. |
wordpress xfn_check( string $xfn_relationship, string $xfn_value = '', mixed $deprecated = '' ) xfn\_check( string $xfn\_relationship, string $xfn\_value = '', mixed $deprecated = '' )
========================================================================================
Displays ‘checked’ checkboxes attribute for XFN microformat options.
`$xfn_relationship` string Required XFN relationship category. Possible values are: `'friendship'`, `'physical'`, `'professional'`, `'geographical'`, `'family'`, `'romantic'`, `'identity'`. `$xfn_value` string Optional The XFN value to mark as checked if it matches the current link's relationship.
Default: `''`
`$deprecated` mixed Optional Deprecated. Not used. Default: `''`
File: `wp-admin/includes/meta-boxes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/meta-boxes.php/)
```
function xfn_check( $xfn_relationship, $xfn_value = '', $deprecated = '' ) {
global $link;
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented.
}
$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
$link_rels = preg_split( '/\s+/', $link_rel );
// Mark the specified value as checked if it matches the current link's relationship.
if ( '' !== $xfn_value && in_array( $xfn_value, $link_rels, true ) ) {
echo ' checked="checked"';
}
if ( '' === $xfn_value ) {
// Mark the 'none' value as checked if the current link does not match the specified relationship.
if ( 'family' === $xfn_relationship
&& ! array_intersect( $link_rels, array( 'child', 'parent', 'sibling', 'spouse', 'kin' ) )
) {
echo ' checked="checked"';
}
if ( 'friendship' === $xfn_relationship
&& ! array_intersect( $link_rels, array( 'friend', 'acquaintance', 'contact' ) )
) {
echo ' checked="checked"';
}
if ( 'geographical' === $xfn_relationship
&& ! array_intersect( $link_rels, array( 'co-resident', 'neighbor' ) )
) {
echo ' checked="checked"';
}
// Mark the 'me' value as checked if it matches the current link's relationship.
if ( 'identity' === $xfn_relationship
&& in_array( 'me', $link_rels, true )
) {
echo ' checked="checked"';
}
}
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| Used By | Description |
| --- | --- |
| [link\_xfn\_meta\_box()](link_xfn_meta_box) wp-admin/includes/meta-boxes.php | Displays XFN form fields. |
| Version | Description |
| --- | --- |
| [1.0.1](https://developer.wordpress.org/reference/since/1.0.1/) | Introduced. |
wordpress wp_cache_switch_to_blog( int $blog_id ) wp\_cache\_switch\_to\_blog( int $blog\_id )
============================================
Switches the internal blog ID.
This changes the blog id used to create keys in blog specific groups.
* [WP\_Object\_Cache::switch\_to\_blog()](../classes/wp_object_cache/switch_to_blog)
`$blog_id` int Required Site ID. File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_switch_to_blog( $blog_id ) {
global $wp_object_cache;
$wp_object_cache->switch_to_blog( $blog_id );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::switch\_to\_blog()](../classes/wp_object_cache/switch_to_blog) wp-includes/class-wp-object-cache.php | Switches the internal blog ID. |
| 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 |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress wp_get_direct_php_update_url(): string wp\_get\_direct\_php\_update\_url(): string
===========================================
Gets the URL for directly updating the PHP version the site is running on.
A URL will only be returned if the `WP_DIRECT_UPDATE_PHP_URL` environment variable is specified or by using the [‘wp\_direct\_php\_update\_url’](../hooks/wp_direct_php_update_url) filter. This allows hosts to send users directly to the page where they can update PHP to a newer version.
string URL for directly updating PHP or empty string.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_get_direct_php_update_url() {
$direct_update_url = '';
if ( false !== getenv( 'WP_DIRECT_UPDATE_PHP_URL' ) ) {
$direct_update_url = getenv( 'WP_DIRECT_UPDATE_PHP_URL' );
}
/**
* Filters the URL for directly updating the PHP version the site is running on from the host.
*
* @since 5.1.1
*
* @param string $direct_update_url URL for directly updating PHP.
*/
$direct_update_url = apply_filters( 'wp_direct_php_update_url', $direct_update_url );
return $direct_update_url;
}
```
[apply\_filters( 'wp\_direct\_php\_update\_url', string $direct\_update\_url )](../hooks/wp_direct_php_update_url)
Filters the URL for directly updating the PHP version the site is running on from the host.
| 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\_direct\_php\_update\_button()](wp_direct_php_update_button) wp-includes/functions.php | Displays a button directly linking to a PHP update process. |
| Version | Description |
| --- | --- |
| [5.1.1](https://developer.wordpress.org/reference/since/5.1.1/) | Introduced. |
| programming_docs |
wordpress wp_spam_comment( int|WP_Comment $comment_id ): bool wp\_spam\_comment( int|WP\_Comment $comment\_id ): bool
=======================================================
Marks a comment as Spam.
`$comment_id` int|[WP\_Comment](../classes/wp_comment) Required Comment ID or [WP\_Comment](../classes/wp_comment) object. 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_spam_comment( $comment_id ) {
$comment = get_comment( $comment_id );
if ( ! $comment ) {
return false;
}
/**
* Fires immediately before a comment is marked as Spam.
*
* @since 2.9.0
* @since 4.9.0 Added the `$comment` parameter.
*
* @param int $comment_id The comment ID.
* @param WP_Comment $comment The comment to be marked as spam.
*/
do_action( 'spam_comment', $comment->comment_ID, $comment );
if ( wp_set_comment_status( $comment, 'spam' ) ) {
delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' );
delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' );
add_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', $comment->comment_approved );
add_comment_meta( $comment->comment_ID, '_wp_trash_meta_time', time() );
/**
* Fires immediately after a comment is marked as Spam.
*
* @since 2.9.0
* @since 4.9.0 Added the `$comment` parameter.
*
* @param int $comment_id The comment ID.
* @param WP_Comment $comment The comment marked as spam.
*/
do_action( 'spammed_comment', $comment->comment_ID, $comment );
return true;
}
return false;
}
```
[do\_action( 'spammed\_comment', int $comment\_id, WP\_Comment $comment )](../hooks/spammed_comment)
Fires immediately after a comment is marked as Spam.
[do\_action( 'spam\_comment', int $comment\_id, WP\_Comment $comment )](../hooks/spam_comment)
Fires immediately before a comment is marked as Spam.
| Uses | Description |
| --- | --- |
| [delete\_comment\_meta()](delete_comment_meta) wp-includes/comment.php | Removes metadata matching criteria from a comment. |
| [wp\_set\_comment\_status()](wp_set_comment_status) wp-includes/comment.php | Sets the status of a comment. |
| [add\_comment\_meta()](add_comment_meta) wp-includes/comment.php | Adds meta data field to a comment. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [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\_ajax\_delete\_comment()](wp_ajax_delete_comment) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a comment. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress wpautop( string $text, bool $br = true ): string wpautop( string $text, bool $br = true ): string
================================================
Replaces double line breaks with paragraph elements.
A group of regex replaces used to identify text formatted with newlines and replace double line breaks with HTML paragraph tags. The remaining line breaks after conversion become `<br />` tags, unless `$br` is set to ‘0’ or ‘false’.
`$text` string Required The text which has to be formatted. `$br` bool Optional If set, this will convert all remaining line breaks after paragraphing. Line breaks within `<script>`, `<style>`, and `<svg>` tags are not affected. Default: `true`
string Text which has been converted into correct paragraph tags.
**Disabling the filter**
Some people choose to disable the wpautop filter from within their theme’s `functions.php`:
`remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );`
There’s also a [plugin](https://wordpress.org/plugins/wpautop-control/) available to enable/disable the filter on a post-by-post basis.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wpautop( $text, $br = true ) {
$pre_tags = array();
if ( trim( $text ) === '' ) {
return '';
}
// Just to make things a little easier, pad the end.
$text = $text . "\n";
/*
* Pre tags shouldn't be touched by autop.
* Replace pre tags with placeholders and bring them back after autop.
*/
if ( strpos( $text, '<pre' ) !== false ) {
$text_parts = explode( '</pre>', $text );
$last_part = array_pop( $text_parts );
$text = '';
$i = 0;
foreach ( $text_parts as $text_part ) {
$start = strpos( $text_part, '<pre' );
// Malformed HTML?
if ( false === $start ) {
$text .= $text_part;
continue;
}
$name = "<pre wp-pre-tag-$i></pre>";
$pre_tags[ $name ] = substr( $text_part, $start ) . '</pre>';
$text .= substr( $text_part, 0, $start ) . $name;
$i++;
}
$text .= $last_part;
}
// Change multiple <br>'s into two line breaks, which will turn into paragraphs.
$text = preg_replace( '|<br\s*/?>\s*<br\s*/?>|', "\n\n", $text );
$allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';
// Add a double line break above block-level opening tags.
$text = preg_replace( '!(<' . $allblocks . '[\s/>])!', "\n\n$1", $text );
// Add a double line break below block-level closing tags.
$text = preg_replace( '!(</' . $allblocks . '>)!', "$1\n\n", $text );
// Add a double line break after hr tags, which are self closing.
$text = preg_replace( '!(<hr\s*?/?>)!', "$1\n\n", $text );
// Standardize newline characters to "\n".
$text = str_replace( array( "\r\n", "\r" ), "\n", $text );
// Find newlines in all elements and add placeholders.
$text = wp_replace_in_html_tags( $text, array( "\n" => ' <!-- wpnl --> ' ) );
// Collapse line breaks before and after <option> elements so they don't get autop'd.
if ( strpos( $text, '<option' ) !== false ) {
$text = preg_replace( '|\s*<option|', '<option', $text );
$text = preg_replace( '|</option>\s*|', '</option>', $text );
}
/*
* Collapse line breaks inside <object> elements, before <param> and <embed> elements
* so they don't get autop'd.
*/
if ( strpos( $text, '</object>' ) !== false ) {
$text = preg_replace( '|(<object[^>]*>)\s*|', '$1', $text );
$text = preg_replace( '|\s*</object>|', '</object>', $text );
$text = preg_replace( '%\s*(</?(?:param|embed)[^>]*>)\s*%', '$1', $text );
}
/*
* Collapse line breaks inside <audio> and <video> elements,
* before and after <source> and <track> elements.
*/
if ( strpos( $text, '<source' ) !== false || strpos( $text, '<track' ) !== false ) {
$text = preg_replace( '%([<\[](?:audio|video)[^>\]]*[>\]])\s*%', '$1', $text );
$text = preg_replace( '%\s*([<\[]/(?:audio|video)[>\]])%', '$1', $text );
$text = preg_replace( '%\s*(<(?:source|track)[^>]*>)\s*%', '$1', $text );
}
// Collapse line breaks before and after <figcaption> elements.
if ( strpos( $text, '<figcaption' ) !== false ) {
$text = preg_replace( '|\s*(<figcaption[^>]*>)|', '$1', $text );
$text = preg_replace( '|</figcaption>\s*|', '</figcaption>', $text );
}
// Remove more than two contiguous line breaks.
$text = preg_replace( "/\n\n+/", "\n\n", $text );
// Split up the contents into an array of strings, separated by double line breaks.
$paragraphs = preg_split( '/\n\s*\n/', $text, -1, PREG_SPLIT_NO_EMPTY );
// Reset $text prior to rebuilding.
$text = '';
// Rebuild the content as a string, wrapping every bit with a <p>.
foreach ( $paragraphs as $paragraph ) {
$text .= '<p>' . trim( $paragraph, "\n" ) . "</p>\n";
}
// Under certain strange conditions it could create a P of entirely whitespace.
$text = preg_replace( '|<p>\s*</p>|', '', $text );
// Add a closing <p> inside <div>, <address>, or <form> tag if missing.
$text = preg_replace( '!<p>([^<]+)</(div|address|form)>!', '<p>$1</p></$2>', $text );
// If an opening or closing block element tag is wrapped in a <p>, unwrap it.
$text = preg_replace( '!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', '$1', $text );
// In some cases <li> may get wrapped in <p>, fix them.
$text = preg_replace( '|<p>(<li.+?)</p>|', '$1', $text );
// If a <blockquote> is wrapped with a <p>, move it inside the <blockquote>.
$text = preg_replace( '|<p><blockquote([^>]*)>|i', '<blockquote$1><p>', $text );
$text = str_replace( '</blockquote></p>', '</p></blockquote>', $text );
// If an opening or closing block element tag is preceded by an opening <p> tag, remove it.
$text = preg_replace( '!<p>\s*(</?' . $allblocks . '[^>]*>)!', '$1', $text );
// If an opening or closing block element tag is followed by a closing <p> tag, remove it.
$text = preg_replace( '!(</?' . $allblocks . '[^>]*>)\s*</p>!', '$1', $text );
// Optionally insert line breaks.
if ( $br ) {
// Replace newlines that shouldn't be touched with a placeholder.
$text = preg_replace_callback( '/<(script|style|svg).*?<\/\\1>/s', '_autop_newline_preservation_helper', $text );
// Normalize <br>
$text = str_replace( array( '<br>', '<br/>' ), '<br />', $text );
// Replace any new line characters that aren't preceded by a <br /> with a <br />.
$text = preg_replace( '|(?<!<br />)\s*\n|', "<br />\n", $text );
// Replace newline placeholders with newlines.
$text = str_replace( '<WPPreserveNewline />', "\n", $text );
}
// If a <br /> tag is after an opening or closing block tag, remove it.
$text = preg_replace( '!(</?' . $allblocks . '[^>]*>)\s*<br />!', '$1', $text );
// If a <br /> tag is before a subset of opening or closing block tags, remove it.
$text = preg_replace( '!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $text );
$text = preg_replace( "|\n</p>$|", '</p>', $text );
// Replace placeholder <pre> tags with their original content.
if ( ! empty( $pre_tags ) ) {
$text = str_replace( array_keys( $pre_tags ), array_values( $pre_tags ), $text );
}
// Restore newlines in all elements.
if ( false !== strpos( $text, '<!-- wpnl -->' ) ) {
$text = str_replace( array( ' <!-- wpnl --> ', '<!-- wpnl -->' ), "\n", $text );
}
return $text;
}
```
| Uses | Description |
| --- | --- |
| [wp\_replace\_in\_html\_tags()](wp_replace_in_html_tags) wp-includes/formatting.php | Replaces characters or phrases within HTML elements only. |
| Used By | Description |
| --- | --- |
| [wp\_richedit\_pre()](wp_richedit_pre) wp-includes/deprecated.php | Formats text for the rich text editor. |
| [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 |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress get_block_metadata_i18n_schema(): object get\_block\_metadata\_i18n\_schema(): object
============================================
Gets i18n schema for block’s metadata read from `block.json` file.
object The schema for block's metadata.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function get_block_metadata_i18n_schema() {
static $i18n_block_schema;
if ( ! isset( $i18n_block_schema ) ) {
$i18n_block_schema = wp_json_file_decode( __DIR__ . '/block-i18n.json' );
}
return $i18n_block_schema;
}
```
| Uses | Description |
| --- | --- |
| [wp\_json\_file\_decode()](wp_json_file_decode) wp-includes/functions.php | Reads and decodes a JSON file. |
| Used By | 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. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress the_modified_date( string $format = '', string $before = '', string $after = '', bool $echo = true ): string|void the\_modified\_date( string $format = '', string $before = '', string $after = '', bool $echo = true ): string|void
===================================================================================================================
Displays the date on which the post was last modified.
`$format` string Optional PHP date format. Defaults to the `'date_format'` option. Default: `''`
`$before` string Optional Output before the date. Default: `''`
`$after` string Optional Output after the date. Default: `''`
`$echo` bool Optional Whether to echo the date or return it. Default: `true`
string|void String if retrieving.
This tag works just like [the\_modified\_time()](the_modified_time) , which also displays the time/date a post was last modified. This tag must be used within [The Loop](https://codex.wordpress.org/The_Loop "The Loop"). If no format parameter is specified, the **Default date format** (please note that says Date format) setting from [Administration](https://wordpress.org/support/article/administration-screens/ "Administration Panels") > [Settings](https://wordpress.org/support/article/administration-screens/ "Administration Panels") > [General](https://wordpress.org/support/article/settings-general-screen/ "Settings General SubPanel") is used for the display format.
If the post or page is not yet modified, the modified date is the same as the creation date.
Use [get\_the\_modified\_date()](get_the_modified_date) to retrieve the value.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function the_modified_date( $format = '', $before = '', $after = '', $echo = true ) {
$the_modified_date = $before . get_the_modified_date( $format ) . $after;
/**
* Filters the date a post was last modified for display.
*
* @since 2.1.0
*
* @param string|false $the_modified_date The last modified date or false if no post is found.
* @param string $format PHP date format.
* @param string $before HTML output before the date.
* @param string $after HTML output after the date.
*/
$the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $format, $before, $after );
if ( $echo ) {
echo $the_modified_date;
} else {
return $the_modified_date;
}
}
```
[apply\_filters( 'the\_modified\_date', string|false $the\_modified\_date, string $format, string $before, string $after )](../hooks/the_modified_date)
Filters the date a post was last modified for display.
| Uses | Description |
| --- | --- |
| [get\_the\_modified\_date()](get_the_modified_date) wp-includes/general-template.php | Retrieves the date on which the post was last modified. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_original_referer_field( bool $echo = true, string $jump_back_to = 'current' ): string wp\_original\_referer\_field( bool $echo = true, string $jump\_back\_to = 'current' ): string
=============================================================================================
Retrieves or displays original referer hidden field for forms.
The input name is ‘\_wp\_original\_http\_referer’ and will be either the same value of [wp\_referer\_field()](wp_referer_field) , if that was posted already or it will be the current page, if it doesn’t exist.
`$echo` bool Optional Whether to echo the original http referer. Default: `true`
`$jump_back_to` string Optional Can be `'previous'` or page you want to jump back to.
Default `'current'`. Default: `'current'`
string Original referer field.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
$ref = wp_get_original_referer();
if ( ! $ref ) {
$ref = ( 'previous' === $jump_back_to ) ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] );
}
$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />';
if ( $echo ) {
echo $orig_referer_field;
}
return $orig_referer_field;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_original\_referer()](wp_get_original_referer) wp-includes/functions.php | Retrieves original referer that was posted, if it exists. |
| [wp\_get\_referer()](wp_get_referer) wp-includes/functions.php | Retrieves referer from ‘\_wp\_http\_referer’ or HTTP referer. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| Used By | Description |
| --- | --- |
| [the\_block\_editor\_meta\_box\_post\_form\_hidden\_fields()](the_block_editor_meta_box_post_form_hidden_fields) wp-admin/includes/post.php | Renders the hidden form required for the meta boxes form. |
| Version | Description |
| --- | --- |
| [2.0.4](https://developer.wordpress.org/reference/since/2.0.4/) | Introduced. |
wordpress get_intermediate_image_sizes(): string[] get\_intermediate\_image\_sizes(): string[]
===========================================
Gets the available intermediate image size names.
string[] An array of image size names.
Details of returned value.
```
var_dump( get_intermediate_image_sizes() );
array(4) {
[0]=>
string(9) "thumbnail"
[1]=>
string(6) "medium"
[2]=>
string(12) "medium_large"
[3]=>
string(5) "large"
[4]=>
string(10) "custom-size"
}
```
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function get_intermediate_image_sizes() {
$default_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' );
$additional_sizes = wp_get_additional_image_sizes();
if ( ! empty( $additional_sizes ) ) {
$default_sizes = array_merge( $default_sizes, array_keys( $additional_sizes ) );
}
/**
* Filters the list of intermediate image sizes.
*
* @since 2.5.0
*
* @param string[] $default_sizes An array of intermediate image size names. Defaults
* are 'thumbnail', 'medium', 'medium_large', 'large'.
*/
return apply_filters( 'intermediate_image_sizes', $default_sizes );
}
```
[apply\_filters( 'intermediate\_image\_sizes', string[] $default\_sizes )](../hooks/intermediate_image_sizes)
Filters the list of intermediate image sizes.
| Uses | Description |
| --- | --- |
| [wp\_get\_additional\_image\_sizes()](wp_get_additional_image_sizes) wp-includes/media.php | Retrieves additional image sizes. |
| [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\_registered\_image\_subsizes()](wp_get_registered_image_subsizes) wp-includes/media.php | Returns a normalized list of all currently registered image sub-sizes. |
| [WP\_Widget\_Media\_Gallery::get\_instance\_schema()](../classes/wp_widget_media_gallery/get_instance_schema) wp-includes/widgets/class-wp-widget-media-gallery.php | Get schema for properties of a widget instance (item). |
| [WP\_Widget\_Media\_Image::get\_instance\_schema()](../classes/wp_widget_media_image/get_instance_schema) wp-includes/widgets/class-wp-widget-media-image.php | Get schema for properties of a widget instance (item). |
| [WP\_Widget\_Media\_Image::render\_media()](../classes/wp_widget_media_image/render_media) wp-includes/widgets/class-wp-widget-media-image.php | Render the media on the frontend. |
| [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. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_localize_community_events() wp\_localize\_community\_events()
=================================
Localizes community events data that needs to be passed to dashboard.js.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_localize_community_events() {
if ( ! wp_script_is( 'dashboard' ) ) {
return;
}
require_once ABSPATH . 'wp-admin/includes/class-wp-community-events.php';
$user_id = get_current_user_id();
$saved_location = get_user_option( 'community-events-location', $user_id );
$saved_ip_address = isset( $saved_location['ip'] ) ? $saved_location['ip'] : false;
$current_ip_address = WP_Community_Events::get_unsafe_client_ip();
/*
* If the user's location is based on their IP address, then update their
* location when their IP address changes. This allows them to see events
* in their current city when travelling. Otherwise, they would always be
* shown events in the city where they were when they first loaded the
* Dashboard, which could have been months or years ago.
*/
if ( $saved_ip_address && $current_ip_address && $current_ip_address !== $saved_ip_address ) {
$saved_location['ip'] = $current_ip_address;
update_user_meta( $user_id, 'community-events-location', $saved_location );
}
$events_client = new WP_Community_Events( $user_id, $saved_location );
wp_localize_script(
'dashboard',
'communityEventsData',
array(
'nonce' => wp_create_nonce( 'community_events' ),
'cache' => $events_client->get_cached_events(),
'time_format' => get_option( 'time_format' ),
)
);
}
```
| Uses | Description |
| --- | --- |
| [WP\_Community\_Events::\_\_construct()](../classes/wp_community_events/__construct) wp-admin/includes/class-wp-community-events.php | Constructor for [WP\_Community\_Events](../classes/wp_community_events). |
| [WP\_Community\_Events::get\_unsafe\_client\_ip()](../classes/wp_community_events/get_unsafe_client_ip) wp-admin/includes/class-wp-community-events.php | Determines the user’s actual IP address and attempts to partially anonymize an IP address by converting it to a network ID. |
| [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\_script\_is()](wp_script_is) wp-includes/functions.wp-scripts.php | Determines whether a script has been added to the queue. |
| [wp\_localize\_script()](wp_localize_script) wp-includes/functions.wp-scripts.php | Localize a script. |
| [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Introduced. |
wordpress wp_enqueue_media( array $args = array() ) wp\_enqueue\_media( array $args = array() )
===========================================
Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs.
`$args` array Optional Arguments for enqueuing media scripts.
* `post`int|[WP\_Post](../classes/wp_post)Post ID or post object.
Default: `array()`
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_enqueue_media( $args = array() ) {
// Enqueue me just once per page, please.
if ( did_action( 'wp_enqueue_media' ) ) {
return;
}
global $content_width, $wpdb, $wp_locale;
$defaults = array(
'post' => null,
);
$args = wp_parse_args( $args, $defaults );
// We're going to pass the old thickbox media tabs to `media_upload_tabs`
// to ensure plugins will work. We will then unset those tabs.
$tabs = array(
// handler action suffix => tab label
'type' => '',
'type_url' => '',
'gallery' => '',
'library' => '',
);
/** This filter is documented in wp-admin/includes/media.php */
$tabs = apply_filters( 'media_upload_tabs', $tabs );
unset( $tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library'] );
$props = array(
'link' => get_option( 'image_default_link_type' ), // DB default is 'file'.
'align' => get_option( 'image_default_align' ), // Empty default.
'size' => get_option( 'image_default_size' ), // Empty default.
);
$exts = array_merge( wp_get_audio_extensions(), wp_get_video_extensions() );
$mimes = get_allowed_mime_types();
$ext_mimes = array();
foreach ( $exts as $ext ) {
foreach ( $mimes as $ext_preg => $mime_match ) {
if ( preg_match( '#' . $ext . '#i', $ext_preg ) ) {
$ext_mimes[ $ext ] = $mime_match;
break;
}
}
}
/**
* Allows showing or hiding the "Create Audio Playlist" button in the media library.
*
* By default, the "Create Audio Playlist" button will always be shown in
* the media library. If this filter returns `null`, a query will be run
* to determine whether the media library contains any audio items. This
* was the default behavior prior to version 4.8.0, but this query is
* expensive for large media libraries.
*
* @since 4.7.4
* @since 4.8.0 The filter's default value is `true` rather than `null`.
*
* @link https://core.trac.wordpress.org/ticket/31071
*
* @param bool|null $show Whether to show the button, or `null` to decide based
* on whether any audio files exist in the media library.
*/
$show_audio_playlist = apply_filters( 'media_library_show_audio_playlist', true );
if ( null === $show_audio_playlist ) {
$show_audio_playlist = $wpdb->get_var(
"
SELECT ID
FROM $wpdb->posts
WHERE post_type = 'attachment'
AND post_mime_type LIKE 'audio%'
LIMIT 1
"
);
}
/**
* Allows showing or hiding the "Create Video Playlist" button in the media library.
*
* By default, the "Create Video Playlist" button will always be shown in
* the media library. If this filter returns `null`, a query will be run
* to determine whether the media library contains any video items. This
* was the default behavior prior to version 4.8.0, but this query is
* expensive for large media libraries.
*
* @since 4.7.4
* @since 4.8.0 The filter's default value is `true` rather than `null`.
*
* @link https://core.trac.wordpress.org/ticket/31071
*
* @param bool|null $show Whether to show the button, or `null` to decide based
* on whether any video files exist in the media library.
*/
$show_video_playlist = apply_filters( 'media_library_show_video_playlist', true );
if ( null === $show_video_playlist ) {
$show_video_playlist = $wpdb->get_var(
"
SELECT ID
FROM $wpdb->posts
WHERE post_type = 'attachment'
AND post_mime_type LIKE 'video%'
LIMIT 1
"
);
}
/**
* Allows overriding the list of months displayed in the media library.
*
* By default (if this filter does not return an array), a query will be
* run to determine the months that have media items. This query can be
* expensive for large media libraries, so it may be desirable for sites to
* override this behavior.
*
* @since 4.7.4
*
* @link https://core.trac.wordpress.org/ticket/31071
*
* @param stdClass[]|null $months An array of objects with `month` and `year`
* properties, or `null` for default behavior.
*/
$months = apply_filters( 'media_library_months_with_files', null );
if ( ! is_array( $months ) ) {
$months = $wpdb->get_results(
$wpdb->prepare(
"
SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
FROM $wpdb->posts
WHERE post_type = %s
ORDER BY post_date DESC
",
'attachment'
)
);
}
foreach ( $months as $month_year ) {
$month_year->text = sprintf(
/* translators: 1: Month, 2: Year. */
__( '%1$s %2$d' ),
$wp_locale->get_month( $month_year->month ),
$month_year->year
);
}
/**
* Filters whether the Media Library grid has infinite scrolling. Default `false`.
*
* @since 5.8.0
*
* @param bool $infinite Whether the Media Library grid has infinite scrolling.
*/
$infinite_scrolling = apply_filters( 'media_library_infinite_scrolling', false );
$settings = array(
'tabs' => $tabs,
'tabUrl' => add_query_arg( array( 'chromeless' => true ), admin_url( 'media-upload.php' ) ),
'mimeTypes' => wp_list_pluck( get_post_mime_types(), 0 ),
/** This filter is documented in wp-admin/includes/media.php */
'captions' => ! apply_filters( 'disable_captions', '' ),
'nonce' => array(
'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
),
'post' => array(
'id' => 0,
),
'defaultProps' => $props,
'attachmentCounts' => array(
'audio' => ( $show_audio_playlist ) ? 1 : 0,
'video' => ( $show_video_playlist ) ? 1 : 0,
),
'oEmbedProxyUrl' => rest_url( 'oembed/1.0/proxy' ),
'embedExts' => $exts,
'embedMimes' => $ext_mimes,
'contentWidth' => $content_width,
'months' => $months,
'mediaTrash' => MEDIA_TRASH ? 1 : 0,
'infiniteScrolling' => ( $infinite_scrolling ) ? 1 : 0,
);
$post = null;
if ( isset( $args['post'] ) ) {
$post = get_post( $args['post'] );
$settings['post'] = array(
'id' => $post->ID,
'nonce' => wp_create_nonce( 'update-post_' . $post->ID ),
);
$thumbnail_support = current_theme_supports( 'post-thumbnails', $post->post_type ) && post_type_supports( $post->post_type, 'thumbnail' );
if ( ! $thumbnail_support && 'attachment' === $post->post_type && $post->post_mime_type ) {
if ( wp_attachment_is( 'audio', $post ) ) {
$thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' );
} elseif ( wp_attachment_is( 'video', $post ) ) {
$thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' );
}
}
if ( $thumbnail_support ) {
$featured_image_id = get_post_meta( $post->ID, '_thumbnail_id', true );
$settings['post']['featuredImageId'] = $featured_image_id ? $featured_image_id : -1;
}
}
if ( $post ) {
$post_type_object = get_post_type_object( $post->post_type );
} else {
$post_type_object = get_post_type_object( 'post' );
}
$strings = array(
// Generic.
'mediaFrameDefaultTitle' => __( 'Media' ),
'url' => __( 'URL' ),
'addMedia' => __( 'Add media' ),
'search' => __( 'Search' ),
'select' => __( 'Select' ),
'cancel' => __( 'Cancel' ),
'update' => __( 'Update' ),
'replace' => __( 'Replace' ),
'remove' => __( 'Remove' ),
'back' => __( 'Back' ),
/*
* translators: This is a would-be plural string used in the media manager.
* If there is not a word you can use in your language to avoid issues with the
* lack of plural support here, turn it into "selected: %d" then translate it.
*/
'selected' => __( '%d selected' ),
'dragInfo' => __( 'Drag and drop to reorder media files.' ),
// Upload.
'uploadFilesTitle' => __( 'Upload files' ),
'uploadImagesTitle' => __( 'Upload images' ),
// Library.
'mediaLibraryTitle' => __( 'Media Library' ),
'insertMediaTitle' => __( 'Add media' ),
'createNewGallery' => __( 'Create a new gallery' ),
'createNewPlaylist' => __( 'Create a new playlist' ),
'createNewVideoPlaylist' => __( 'Create a new video playlist' ),
'returnToLibrary' => __( '← Go to library' ),
'allMediaItems' => __( 'All media items' ),
'allDates' => __( 'All dates' ),
'noItemsFound' => __( 'No items found.' ),
'insertIntoPost' => $post_type_object->labels->insert_into_item,
'unattached' => _x( 'Unattached', 'media items' ),
'mine' => _x( 'Mine', 'media items' ),
'trash' => _x( 'Trash', 'noun' ),
'uploadedToThisPost' => $post_type_object->labels->uploaded_to_this_item,
'warnDelete' => __( "You are about to permanently delete this item from your site.\nThis action cannot be undone.\n 'Cancel' to stop, 'OK' to delete." ),
'warnBulkDelete' => __( "You are about to permanently delete these items from your site.\nThis action cannot be undone.\n 'Cancel' to stop, 'OK' to delete." ),
'warnBulkTrash' => __( "You are about to trash these items.\n 'Cancel' to stop, 'OK' to delete." ),
'bulkSelect' => __( 'Bulk select' ),
'trashSelected' => __( 'Move to Trash' ),
'restoreSelected' => __( 'Restore from Trash' ),
'deletePermanently' => __( 'Delete permanently' ),
'errorDeleting' => __( 'Error in deleting the attachment.' ),
'apply' => __( 'Apply' ),
'filterByDate' => __( 'Filter by date' ),
'filterByType' => __( 'Filter by type' ),
'searchLabel' => __( 'Search' ),
'searchMediaLabel' => __( 'Search media' ), // Backward compatibility pre-5.3.
'searchMediaPlaceholder' => __( 'Search media items...' ), // Placeholder (no ellipsis), backward compatibility pre-5.3.
/* translators: %d: Number of attachments found in a search. */
'mediaFound' => __( 'Number of media items found: %d' ),
'noMedia' => __( 'No media items found.' ),
'noMediaTryNewSearch' => __( 'No media items found. Try a different search.' ),
// Library Details.
'attachmentDetails' => __( 'Attachment details' ),
// From URL.
'insertFromUrlTitle' => __( 'Insert from URL' ),
// Featured Images.
'setFeaturedImageTitle' => $post_type_object->labels->featured_image,
'setFeaturedImage' => $post_type_object->labels->set_featured_image,
// Gallery.
'createGalleryTitle' => __( 'Create gallery' ),
'editGalleryTitle' => __( 'Edit gallery' ),
'cancelGalleryTitle' => __( '← Cancel gallery' ),
'insertGallery' => __( 'Insert gallery' ),
'updateGallery' => __( 'Update gallery' ),
'addToGallery' => __( 'Add to gallery' ),
'addToGalleryTitle' => __( 'Add to gallery' ),
'reverseOrder' => __( 'Reverse order' ),
// Edit Image.
'imageDetailsTitle' => __( 'Image details' ),
'imageReplaceTitle' => __( 'Replace image' ),
'imageDetailsCancel' => __( 'Cancel edit' ),
'editImage' => __( 'Edit image' ),
// Crop Image.
'chooseImage' => __( 'Choose image' ),
'selectAndCrop' => __( 'Select and crop' ),
'skipCropping' => __( 'Skip cropping' ),
'cropImage' => __( 'Crop image' ),
'cropYourImage' => __( 'Crop your image' ),
'cropping' => __( 'Cropping…' ),
/* translators: 1: Suggested width number, 2: Suggested height number. */
'suggestedDimensions' => __( 'Suggested image dimensions: %1$s by %2$s pixels.' ),
'cropError' => __( 'There has been an error cropping your image.' ),
// Edit Audio.
'audioDetailsTitle' => __( 'Audio details' ),
'audioReplaceTitle' => __( 'Replace audio' ),
'audioAddSourceTitle' => __( 'Add audio source' ),
'audioDetailsCancel' => __( 'Cancel edit' ),
// Edit Video.
'videoDetailsTitle' => __( 'Video details' ),
'videoReplaceTitle' => __( 'Replace video' ),
'videoAddSourceTitle' => __( 'Add video source' ),
'videoDetailsCancel' => __( 'Cancel edit' ),
'videoSelectPosterImageTitle' => __( 'Select poster image' ),
'videoAddTrackTitle' => __( 'Add subtitles' ),
// Playlist.
'playlistDragInfo' => __( 'Drag and drop to reorder tracks.' ),
'createPlaylistTitle' => __( 'Create audio playlist' ),
'editPlaylistTitle' => __( 'Edit audio playlist' ),
'cancelPlaylistTitle' => __( '← Cancel audio playlist' ),
'insertPlaylist' => __( 'Insert audio playlist' ),
'updatePlaylist' => __( 'Update audio playlist' ),
'addToPlaylist' => __( 'Add to audio playlist' ),
'addToPlaylistTitle' => __( 'Add to Audio Playlist' ),
// Video Playlist.
'videoPlaylistDragInfo' => __( 'Drag and drop to reorder videos.' ),
'createVideoPlaylistTitle' => __( 'Create video playlist' ),
'editVideoPlaylistTitle' => __( 'Edit video playlist' ),
'cancelVideoPlaylistTitle' => __( '← Cancel video playlist' ),
'insertVideoPlaylist' => __( 'Insert video playlist' ),
'updateVideoPlaylist' => __( 'Update video playlist' ),
'addToVideoPlaylist' => __( 'Add to video playlist' ),
'addToVideoPlaylistTitle' => __( 'Add to video Playlist' ),
// Headings.
'filterAttachments' => __( 'Filter media' ),
'attachmentsList' => __( 'Media list' ),
);
/**
* Filters the media view settings.
*
* @since 3.5.0
*
* @param array $settings List of media view settings.
* @param WP_Post $post Post object.
*/
$settings = apply_filters( 'media_view_settings', $settings, $post );
/**
* Filters the media view strings.
*
* @since 3.5.0
*
* @param string[] $strings Array of media view strings keyed by the name they'll be referenced by in JavaScript.
* @param WP_Post $post Post object.
*/
$strings = apply_filters( 'media_view_strings', $strings, $post );
$strings['settings'] = $settings;
// Ensure we enqueue media-editor first, that way media-views
// is registered internally before we try to localize it. See #24724.
wp_enqueue_script( 'media-editor' );
wp_localize_script( 'media-views', '_wpMediaViewsL10n', $strings );
wp_enqueue_script( 'media-audiovideo' );
wp_enqueue_style( 'media-views' );
if ( is_admin() ) {
wp_enqueue_script( 'mce-view' );
wp_enqueue_script( 'image-edit' );
}
wp_enqueue_style( 'imgareaselect' );
wp_plupload_default_settings();
require_once ABSPATH . WPINC . '/media-template.php';
add_action( 'admin_footer', 'wp_print_media_templates' );
add_action( 'wp_footer', 'wp_print_media_templates' );
add_action( 'customize_controls_print_footer_scripts', 'wp_print_media_templates' );
/**
* Fires at the conclusion of wp_enqueue_media().
*
* @since 3.5.0
*/
do_action( 'wp_enqueue_media' );
}
```
[apply\_filters( 'disable\_captions', bool $bool )](../hooks/disable_captions)
Filters whether to disable captions.
[apply\_filters( 'media\_library\_infinite\_scrolling', bool $infinite )](../hooks/media_library_infinite_scrolling)
Filters whether the Media Library grid has infinite scrolling. Default `false`.
[apply\_filters( 'media\_library\_months\_with\_files', stdClass[]|null $months )](../hooks/media_library_months_with_files)
Allows overriding the list of months displayed in the media library.
[apply\_filters( 'media\_library\_show\_audio\_playlist', bool|null $show )](../hooks/media_library_show_audio_playlist)
Allows showing or hiding the “Create Audio Playlist” button in the media library.
[apply\_filters( 'media\_library\_show\_video\_playlist', bool|null $show )](../hooks/media_library_show_video_playlist)
Allows showing or hiding the “Create Video Playlist” button in the media library.
[apply\_filters( 'media\_upload\_tabs', string[] $\_default\_tabs )](../hooks/media_upload_tabs)
Filters the available tabs in the legacy (pre-3.5.0) media popup.
[apply\_filters( 'media\_view\_settings', array $settings, WP\_Post $post )](../hooks/media_view_settings)
Filters the media view settings.
[apply\_filters( 'media\_view\_strings', string[] $strings, WP\_Post $post )](../hooks/media_view_strings)
Filters the media view strings.
[do\_action( 'wp\_enqueue\_media' )](../hooks/wp_enqueue_media)
Fires at the conclusion of [wp\_enqueue\_media()](wp_enqueue_media) .
| Uses | Description |
| --- | --- |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| [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\_audio\_extensions()](wp_get_audio_extensions) wp-includes/media.php | Returns a filtered list of supported audio formats. |
| [wp\_attachment\_is()](wp_attachment_is) wp-includes/post.php | Verifies an attachment is of a given type. |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| [get\_post\_mime\_types()](get_post_mime_types) wp-includes/post.php | Gets default post mime types. |
| [WP\_Locale::get\_month()](../classes/wp_locale/get_month) wp-includes/class-wp-locale.php | Retrieves the full translated month by month number. |
| [post\_type\_supports()](post_type_supports) wp-includes/post.php | Checks a post type’s support for a given feature. |
| [get\_allowed\_mime\_types()](get_allowed_mime_types) wp-includes/functions.php | Retrieves the list of allowed mime types and file extensions. |
| [wp\_get\_video\_extensions()](wp_get_video_extensions) wp-includes/media.php | Returns a filtered list of supported video formats. |
| [wp\_plupload\_default\_settings()](wp_plupload_default_settings) wp-includes/media.php | Prints default Plupload arguments. |
| [wp\_localize\_script()](wp_localize_script) wp-includes/functions.wp-scripts.php | Localize a script. |
| [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. |
| [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. |
| [get\_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. |
| [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). |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [rest\_url()](rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint. |
| [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. |
| [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. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [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::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\_Customize\_Media\_Control::enqueue()](../classes/wp_customize_media_control/enqueue) wp-includes/customize/class-wp-customize-media-control.php | Enqueue control related scripts/styles. |
| [media\_buttons()](media_buttons) wp-admin/includes/media.php | Adds the media button to the editor. |
| [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\_Header\_Image\_Control::enqueue()](../classes/wp_customize_header_image_control/enqueue) wp-includes/customize/class-wp-customize-header-image-control.php | |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
| programming_docs |
wordpress check_password_reset_key( string $key, string $login ): WP_User|WP_Error check\_password\_reset\_key( string $key, string $login ): WP\_User|WP\_Error
=============================================================================
Retrieves a user row based on password reset key and login.
A key is considered ‘expired’ if it exactly matches the value of the user\_activation\_key field, rather than being matched after going through the hashing process. This field is now hashed; old values are no longer accepted but have a different [WP\_Error](../classes/wp_error) code so good user feedback can be provided.
`$key` string Required Hash to validate sending user's password. `$login` string Required The user login. [WP\_User](../classes/wp_user)|[WP\_Error](../classes/wp_error) [WP\_User](../classes/wp_user) object on success, [WP\_Error](../classes/wp_error) object for invalid or expired keys.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function check_password_reset_key( $key, $login ) {
global $wpdb, $wp_hasher;
$key = preg_replace( '/[^a-z0-9]/i', '', $key );
if ( empty( $key ) || ! is_string( $key ) ) {
return new WP_Error( 'invalid_key', __( 'Invalid key.' ) );
}
if ( empty( $login ) || ! is_string( $login ) ) {
return new WP_Error( 'invalid_key', __( 'Invalid key.' ) );
}
$user = get_user_by( 'login', $login );
if ( ! $user ) {
return new WP_Error( 'invalid_key', __( 'Invalid key.' ) );
}
if ( empty( $wp_hasher ) ) {
require_once ABSPATH . WPINC . '/class-phpass.php';
$wp_hasher = new PasswordHash( 8, true );
}
/**
* Filters the expiration time of password reset keys.
*
* @since 4.3.0
*
* @param int $expiration The expiration time in seconds.
*/
$expiration_duration = apply_filters( 'password_reset_expiration', DAY_IN_SECONDS );
if ( false !== strpos( $user->user_activation_key, ':' ) ) {
list( $pass_request_time, $pass_key ) = explode( ':', $user->user_activation_key, 2 );
$expiration_time = $pass_request_time + $expiration_duration;
} else {
$pass_key = $user->user_activation_key;
$expiration_time = false;
}
if ( ! $pass_key ) {
return new WP_Error( 'invalid_key', __( 'Invalid key.' ) );
}
$hash_is_correct = $wp_hasher->CheckPassword( $key, $pass_key );
if ( $hash_is_correct && $expiration_time && time() < $expiration_time ) {
return $user;
} elseif ( $hash_is_correct && $expiration_time ) {
// Key has an expiration time that's passed.
return new WP_Error( 'expired_key', __( 'Invalid key.' ) );
}
if ( hash_equals( $user->user_activation_key, $key ) || ( $hash_is_correct && ! $expiration_time ) ) {
$return = new WP_Error( 'expired_key', __( 'Invalid key.' ) );
$user_id = $user->ID;
/**
* Filters the return value of check_password_reset_key() when an
* old-style key is used.
*
* @since 3.7.0 Previously plain-text keys were stored in the database.
* @since 4.3.0 Previously key hashes were stored without an expiration time.
*
* @param WP_Error $return A WP_Error object denoting an expired key.
* Return a WP_User object to validate the key.
* @param int $user_id The matched user ID.
*/
return apply_filters( 'password_reset_key_expired', $return, $user_id );
}
return new WP_Error( 'invalid_key', __( 'Invalid key.' ) );
}
```
[apply\_filters( 'password\_reset\_expiration', int $expiration )](../hooks/password_reset_expiration)
Filters the expiration time of password reset keys.
[apply\_filters( 'password\_reset\_key\_expired', WP\_Error $return, int $user\_id )](../hooks/password_reset_key_expired)
Filters the return value of [check\_password\_reset\_key()](check_password_reset_key) when an old-style key is used.
| Uses | Description |
| --- | --- |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress _wp_admin_bar_init(): bool \_wp\_admin\_bar\_init(): 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.
Instantiates the admin bar object and set it up as a global for access elsewhere.
UNHOOKING THIS FUNCTION WILL NOT PROPERLY REMOVE THE ADMIN BAR.
For that, use show\_admin\_bar(false) or the [‘show\_admin\_bar’](../hooks/show_admin_bar) filter.
bool Whether the admin bar was successfully initialized.
File: `wp-includes/admin-bar.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/admin-bar.php/)
```
function _wp_admin_bar_init() {
global $wp_admin_bar;
if ( ! is_admin_bar_showing() ) {
return false;
}
/* Load the admin bar class code ready for instantiation */
require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
/* Instantiate the admin bar */
/**
* Filters the admin bar class to instantiate.
*
* @since 3.1.0
*
* @param string $wp_admin_bar_class Admin bar class to use. Default 'WP_Admin_Bar'.
*/
$admin_bar_class = apply_filters( 'wp_admin_bar_class', 'WP_Admin_Bar' );
if ( class_exists( $admin_bar_class ) ) {
$wp_admin_bar = new $admin_bar_class;
} else {
return false;
}
$wp_admin_bar->initialize();
$wp_admin_bar->add_menus();
return true;
}
```
[apply\_filters( 'wp\_admin\_bar\_class', string $wp\_admin\_bar\_class )](../hooks/wp_admin_bar_class)
Filters the admin bar class to instantiate.
| Uses | Description |
| --- | --- |
| [WP\_Admin\_Bar::add\_menus()](../classes/wp_admin_bar/add_menus) wp-includes/class-wp-admin-bar.php | Adds menus to the admin bar. |
| [WP\_Admin\_Bar::initialize()](../classes/wp_admin_bar/initialize) wp-includes/class-wp-admin-bar.php | Initializes the admin bar. |
| [is\_admin\_bar\_showing()](is_admin_bar_showing) wp-includes/admin-bar.php | Determines whether the admin bar should be showing. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_embed_defaults( string $url = '' ): int[] wp\_embed\_defaults( string $url = '' ): int[]
==============================================
Creates default array of embed parameters.
The width defaults to the content width as specified by the theme. If the theme does not specify a content width, then 500px is used.
The default height is 1.5 times the width, or 1000px, whichever is smaller.
The [’embed\_defaults’](%e2%80%99embed_defaults%e2%80%99) filter can be used to adjust either of these values.
`$url` string Optional The URL that should be embedded. Default: `''`
int[] Indexed array of the embed width and height in pixels.
* intThe embed width.
* `1`intThe embed height.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function wp_embed_defaults( $url = '' ) {
if ( ! empty( $GLOBALS['content_width'] ) ) {
$width = (int) $GLOBALS['content_width'];
}
if ( empty( $width ) ) {
$width = 500;
}
$height = min( ceil( $width * 1.5 ), 1000 );
/**
* Filters the default array of embed dimensions.
*
* @since 2.9.0
*
* @param int[] $size {
* Indexed array of the embed width and height in pixels.
*
* @type int $0 The embed width.
* @type int $1 The embed height.
* }
* @param string $url The URL that should be embedded.
*/
return apply_filters( 'embed_defaults', compact( 'width', 'height' ), $url );
}
```
[apply\_filters( 'embed\_defaults', int[] $size, string $url )](../hooks/embed_defaults)
Filters the default array of embed dimensions.
| 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\_Embed::get\_embed\_handler\_html()](../classes/wp_embed/get_embed_handler_html) wp-includes/class-wp-embed.php | Returns embed HTML for a given URL from embed handlers. |
| [WP\_Embed::shortcode()](../classes/wp_embed/shortcode) wp-includes/class-wp-embed.php | The [do\_shortcode()](do_shortcode) callback function. |
| [WP\_oEmbed::fetch()](../classes/wp_oembed/fetch) wp-includes/class-wp-oembed.php | Connects to a oEmbed provider and returns the result. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress wp_nav_menu_post_type_meta_boxes() wp\_nav\_menu\_post\_type\_meta\_boxes()
========================================
Creates meta boxes for any post type 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_post_type_meta_boxes() {
$post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'object' );
if ( ! $post_types ) {
return;
}
foreach ( $post_types as $post_type ) {
/**
* Filters whether a menu items meta box will be added for the current
* object type.
*
* If a falsey value is returned instead of an object, the menu items
* meta box for the current meta box object will not be added.
*
* @since 3.0.0
*
* @param WP_Post_Type|false $post_type The current object to add a menu items
* meta box for.
*/
$post_type = apply_filters( 'nav_menu_meta_box_object', $post_type );
if ( $post_type ) {
$id = $post_type->name;
// Give pages a higher priority.
$priority = ( 'page' === $post_type->name ? 'core' : 'default' );
add_meta_box( "add-post-type-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type );
}
}
}
```
[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. |
| [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. |
| 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 wp_update_plugins( array $extra_stats = array() ) wp\_update\_plugins( array $extra\_stats = array() )
====================================================
Checks for available updates to plugins 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 plugins 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_plugins( $extra_stats = array() ) {
if ( wp_installing() ) {
return;
}
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
// If running blog-side, bail unless we've not checked in the last 12 hours.
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
$translations = wp_get_installed_translations( 'plugins' );
$active = get_option( 'active_plugins', array() );
$current = get_site_transient( 'update_plugins' );
if ( ! is_object( $current ) ) {
$current = new stdClass;
}
$updates = new stdClass;
$updates->last_checked = time();
$updates->response = array();
$updates->translations = array();
$updates->no_update = array();
$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-plugins.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( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
if ( $time_not_changed && ! $extra_stats ) {
$plugin_changed = false;
foreach ( $plugins as $file => $p ) {
$updates->checked[ $file ] = $p['Version'];
if ( ! isset( $current->checked[ $file ] ) || (string) $current->checked[ $file ] !== (string) $p['Version'] ) {
$plugin_changed = true;
}
}
if ( isset( $current->response ) && is_array( $current->response ) ) {
foreach ( $current->response as $plugin_file => $update_details ) {
if ( ! isset( $plugins[ $plugin_file ] ) ) {
$plugin_changed = true;
break;
}
}
}
// Bail if we've checked recently and if nothing has changed.
if ( ! $plugin_changed ) {
return;
}
}
// Update last_checked for current to prevent multiple blocking requests if request hangs.
$current->last_checked = time();
set_site_transient( 'update_plugins', $current );
$to_send = compact( 'plugins', 'active' );
$locales = array_values( get_available_languages() );
/**
* Filters the locales requested for plugin translations.
*
* @since 3.7.0
* @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
*
* @param string[] $locales Plugin locales. Default is all available locales of the site.
*/
$locales = apply_filters( 'plugins_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 plugins.
$timeout = 3 + (int) ( count( $plugins ) / 10 );
}
$options = array(
'timeout' => $timeout,
'body' => array(
'plugins' => wp_json_encode( $to_send ),
'translations' => wp_json_encode( $translations ),
'locale' => wp_json_encode( $locales ),
'all' => wp_json_encode( true ),
),
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
);
if ( $extra_stats ) {
$options['body']['update_stats'] = wp_json_encode( $extra_stats );
}
$url = 'http://api.wordpress.org/plugins/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;
}
$response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
if ( $response && is_array( $response ) ) {
$updates->response = $response['plugins'];
$updates->translations = $response['translations'];
$updates->no_update = $response['no_update'];
}
// Support updates for any plugins using the `Update URI` header field.
foreach ( $plugins as $plugin_file => $plugin_data ) {
if ( ! $plugin_data['UpdateURI'] || isset( $updates->response[ $plugin_file ] ) ) {
continue;
}
$hostname = wp_parse_url( sanitize_url( $plugin_data['UpdateURI'] ), PHP_URL_HOST );
/**
* Filters the update response for a given plugin hostname.
*
* The dynamic portion of the hook name, `$hostname`, refers to the hostname
* of the URI specified in the `Update URI` header field.
*
* @since 5.8.0
*
* @param array|false $update {
* The plugin update data with the latest details. Default false.
*
* @type string $id Optional. ID of the plugin for update purposes, should be a URI
* specified in the `Update URI` header field.
* @type string $slug Slug of the plugin.
* @type string $version The version of the plugin.
* @type string $url The URL for details of the plugin.
* @type string $package Optional. The update ZIP for the plugin.
* @type string $tested Optional. The version of WordPress the plugin is tested against.
* @type string $requires_php Optional. The version of PHP which the plugin requires.
* @type bool $autoupdate Optional. Whether the plugin should automatically update.
* @type array $icons Optional. Array of plugin icons.
* @type array $banners Optional. Array of plugin banners.
* @type array $banners_rtl Optional. Array of plugin RTL banners.
* @type array $translations {
* Optional. List of translation updates for the plugin.
*
* @type string $language The language the translation update is for.
* @type string $version The version of the plugin 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 $plugin_data Plugin headers.
* @param string $plugin_file Plugin filename.
* @param string[] $locales Installed locales to look up translations for.
*/
$update = apply_filters( "update_plugins_{$hostname}", false, $plugin_data, $plugin_file, $locales );
if ( ! $update ) {
continue;
}
$update = (object) $update;
// Is it valid? We require at least a version.
if ( ! isset( $update->version ) ) {
continue;
}
// These should remain constant.
$update->id = $plugin_data['UpdateURI'];
$update->plugin = $plugin_file;
// 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'] = 'plugin';
$translation['slug'] = isset( $update->slug ) ? $update->slug : $update->id;
$updates->translations[] = $translation;
}
}
}
unset( $updates->no_update[ $plugin_file ], $updates->response[ $plugin_file ] );
if ( version_compare( $update->new_version, $plugin_data['Version'], '>' ) ) {
$updates->response[ $plugin_file ] = $update;
} else {
$updates->no_update[ $plugin_file ] = $update;
}
}
$sanitize_plugin_update_payload = static function( &$item ) {
$item = (object) $item;
unset( $item->translations, $item->compatibility );
return $item;
};
array_walk( $updates->response, $sanitize_plugin_update_payload );
array_walk( $updates->no_update, $sanitize_plugin_update_payload );
set_site_transient( 'update_plugins', $updates );
}
```
[apply\_filters( 'plugins\_update\_check\_locales', string[] $locales )](../hooks/plugins_update_check_locales)
Filters the locales requested for plugin translations.
[apply\_filters( "update\_plugins\_{$hostname}", array|false $update, array $plugin\_data, string $plugin\_file, string[] $locales )](../hooks/update_plugins_hostname)
Filters the update response for a given plugin 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. |
| [get\_plugins()](get_plugins) wp-admin/includes/plugin.php | Checks the plugins directory and retrieve all plugin files with plugin data. |
| [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. |
| [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\_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\_plugin()](wp_ajax_update_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for updating a plugin. |
| [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. |
| [install\_plugin\_install\_status()](install_plugin_install_status) wp-admin/includes/plugin-install.php | Determines the status we can perform on a plugin. |
| [\_maybe\_update\_plugins()](_maybe_update_plugins) wp-includes/update.php | Checks the last time plugins were run before checking plugin versions. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
| programming_docs |
wordpress wp_edit_theme_plugin_file( string[] $args ): true|WP_Error wp\_edit\_theme\_plugin\_file( string[] $args ): true|WP\_Error
===============================================================
Attempts to edit a file for a theme or plugin.
When editing a PHP file, loopback requests will be made to the admin and the homepage to attempt to see if there is a fatal error introduced. If so, the PHP change will be reverted.
`$args` string[] Required Args. Note that all of the arg values are already unslashed. They are, however, coming straight from `$_POST` and are not validated or sanitized in any way.
* `file`stringRelative path to file.
* `plugin`stringPath to the plugin file relative to the plugins directory.
* `theme`stringTheme being edited.
* `newcontent`stringNew content for the file.
* `nonce`stringNonce.
true|[WP\_Error](../classes/wp_error) True on success or `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 wp_edit_theme_plugin_file( $args ) {
if ( empty( $args['file'] ) ) {
return new WP_Error( 'missing_file' );
}
if ( 0 !== validate_file( $args['file'] ) ) {
return new WP_Error( 'bad_file' );
}
if ( ! isset( $args['newcontent'] ) ) {
return new WP_Error( 'missing_content' );
}
if ( ! isset( $args['nonce'] ) ) {
return new WP_Error( 'missing_nonce' );
}
$file = $args['file'];
$content = $args['newcontent'];
$plugin = null;
$theme = null;
$real_file = null;
if ( ! empty( $args['plugin'] ) ) {
$plugin = $args['plugin'];
if ( ! current_user_can( 'edit_plugins' ) ) {
return new WP_Error( 'unauthorized', __( 'Sorry, you are not allowed to edit plugins for this site.' ) );
}
if ( ! wp_verify_nonce( $args['nonce'], 'edit-plugin_' . $file ) ) {
return new WP_Error( 'nonce_failure' );
}
if ( ! array_key_exists( $plugin, get_plugins() ) ) {
return new WP_Error( 'invalid_plugin' );
}
if ( 0 !== validate_file( $file, get_plugin_files( $plugin ) ) ) {
return new WP_Error( 'bad_plugin_file_path', __( 'Sorry, that file cannot be edited.' ) );
}
$editable_extensions = wp_get_plugin_file_editable_extensions( $plugin );
$real_file = WP_PLUGIN_DIR . '/' . $file;
$is_active = in_array(
$plugin,
(array) get_option( 'active_plugins', array() ),
true
);
} elseif ( ! empty( $args['theme'] ) ) {
$stylesheet = $args['theme'];
if ( 0 !== validate_file( $stylesheet ) ) {
return new WP_Error( 'bad_theme_path' );
}
if ( ! current_user_can( 'edit_themes' ) ) {
return new WP_Error( 'unauthorized', __( 'Sorry, you are not allowed to edit templates for this site.' ) );
}
$theme = wp_get_theme( $stylesheet );
if ( ! $theme->exists() ) {
return new WP_Error( 'non_existent_theme', __( 'The requested theme does not exist.' ) );
}
if ( ! wp_verify_nonce( $args['nonce'], 'edit-theme_' . $stylesheet . '_' . $file ) ) {
return new WP_Error( 'nonce_failure' );
}
if ( $theme->errors() && 'theme_no_stylesheet' === $theme->errors()->get_error_code() ) {
return new WP_Error(
'theme_no_stylesheet',
__( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message()
);
}
$editable_extensions = wp_get_theme_file_editable_extensions( $theme );
$allowed_files = array();
foreach ( $editable_extensions as $type ) {
switch ( $type ) {
case 'php':
$allowed_files = array_merge( $allowed_files, $theme->get_files( 'php', -1 ) );
break;
case 'css':
$style_files = $theme->get_files( 'css', -1 );
$allowed_files['style.css'] = $style_files['style.css'];
$allowed_files = array_merge( $allowed_files, $style_files );
break;
default:
$allowed_files = array_merge( $allowed_files, $theme->get_files( $type, -1 ) );
break;
}
}
// Compare based on relative paths.
if ( 0 !== validate_file( $file, array_keys( $allowed_files ) ) ) {
return new WP_Error( 'disallowed_theme_file', __( 'Sorry, that file cannot be edited.' ) );
}
$real_file = $theme->get_stylesheet_directory() . '/' . $file;
$is_active = ( get_stylesheet() === $stylesheet || get_template() === $stylesheet );
} else {
return new WP_Error( 'missing_theme_or_plugin' );
}
// Ensure file is real.
if ( ! is_file( $real_file ) ) {
return new WP_Error( 'file_does_not_exist', __( 'File does not exist! Please double check the name and try again.' ) );
}
// Ensure file extension is allowed.
$extension = null;
if ( preg_match( '/\.([^.]+)$/', $real_file, $matches ) ) {
$extension = strtolower( $matches[1] );
if ( ! in_array( $extension, $editable_extensions, true ) ) {
return new WP_Error( 'illegal_file_type', __( 'Files of this type are not editable.' ) );
}
}
$previous_content = file_get_contents( $real_file );
if ( ! is_writable( $real_file ) ) {
return new WP_Error( 'file_not_writable' );
}
$f = fopen( $real_file, 'w+' );
if ( false === $f ) {
return new WP_Error( 'file_not_writable' );
}
$written = fwrite( $f, $content );
fclose( $f );
if ( false === $written ) {
return new WP_Error( 'unable_to_write', __( 'Unable to write to file.' ) );
}
wp_opcache_invalidate( $real_file, true );
if ( $is_active && 'php' === $extension ) {
$scrape_key = md5( rand() );
$transient = 'scrape_key_' . $scrape_key;
$scrape_nonce = (string) rand();
// It shouldn't take more than 60 seconds to make the two loopback requests.
set_transient( $transient, $scrape_nonce, 60 );
$cookies = wp_unslash( $_COOKIE );
$scrape_params = array(
'wp_scrape_key' => $scrape_key,
'wp_scrape_nonce' => $scrape_nonce,
);
$headers = array(
'Cache-Control' => 'no-cache',
);
/** This filter is documented in wp-includes/class-wp-http-streams.php */
$sslverify = apply_filters( 'https_local_ssl_verify', false );
// Include Basic auth in loopback requests.
if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) {
$headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) );
}
// Make sure PHP process doesn't die before loopback requests complete.
set_time_limit( 5 * MINUTE_IN_SECONDS );
// Time to wait for loopback requests to finish.
$timeout = 100; // 100 seconds.
$needle_start = "###### wp_scraping_result_start:$scrape_key ######";
$needle_end = "###### wp_scraping_result_end:$scrape_key ######";
// Attempt loopback request to editor to see if user just whitescreened themselves.
if ( $plugin ) {
$url = add_query_arg( compact( 'plugin', 'file' ), admin_url( 'plugin-editor.php' ) );
} elseif ( isset( $stylesheet ) ) {
$url = add_query_arg(
array(
'theme' => $stylesheet,
'file' => $file,
),
admin_url( 'theme-editor.php' )
);
} else {
$url = admin_url();
}
if ( function_exists( 'session_status' ) && PHP_SESSION_ACTIVE === session_status() ) {
// Close any active session to prevent HTTP requests from timing out
// when attempting to connect back to the site.
session_write_close();
}
$url = add_query_arg( $scrape_params, $url );
$r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) );
$body = wp_remote_retrieve_body( $r );
$scrape_result_position = strpos( $body, $needle_start );
$loopback_request_failure = array(
'code' => 'loopback_request_failed',
'message' => __( 'Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.' ),
);
$json_parse_failure = array(
'code' => 'json_parse_error',
);
$result = null;
if ( false === $scrape_result_position ) {
$result = $loopback_request_failure;
} else {
$error_output = substr( $body, $scrape_result_position + strlen( $needle_start ) );
$error_output = substr( $error_output, 0, strpos( $error_output, $needle_end ) );
$result = json_decode( trim( $error_output ), true );
if ( empty( $result ) ) {
$result = $json_parse_failure;
}
}
// Try making request to homepage as well to see if visitors have been whitescreened.
if ( true === $result ) {
$url = home_url( '/' );
$url = add_query_arg( $scrape_params, $url );
$r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) );
$body = wp_remote_retrieve_body( $r );
$scrape_result_position = strpos( $body, $needle_start );
if ( false === $scrape_result_position ) {
$result = $loopback_request_failure;
} else {
$error_output = substr( $body, $scrape_result_position + strlen( $needle_start ) );
$error_output = substr( $error_output, 0, strpos( $error_output, $needle_end ) );
$result = json_decode( trim( $error_output ), true );
if ( empty( $result ) ) {
$result = $json_parse_failure;
}
}
}
delete_transient( $transient );
if ( true !== $result ) {
// Roll-back file change.
file_put_contents( $real_file, $previous_content );
wp_opcache_invalidate( $real_file, true );
if ( ! isset( $result['message'] ) ) {
$message = __( 'Something went wrong.' );
} else {
$message = $result['message'];
unset( $result['message'] );
}
return new WP_Error( 'php_error', $message, $result );
}
}
if ( $theme instanceof WP_Theme ) {
$theme->cache_delete();
}
return true;
}
```
[apply\_filters( 'https\_local\_ssl\_verify', bool $ssl\_verify, string $url )](../hooks/https_local_ssl_verify)
Filters whether SSL should be verified for local HTTP API requests.
| Uses | Description |
| --- | --- |
| [wp\_opcache\_invalidate()](wp_opcache_invalidate) wp-admin/includes/file.php | Attempts to clear the opcode cache for an individual PHP file. |
| [wp\_get\_plugin\_file\_editable\_extensions()](wp_get_plugin_file_editable_extensions) wp-admin/includes/file.php | Gets the list of file extensions that are editable in plugins. |
| [delete\_transient()](delete_transient) wp-includes/option.php | Deletes a transient. |
| [set\_transient()](set_transient) wp-includes/option.php | Sets/updates the value of a transient. |
| [wp\_remote\_retrieve\_body()](wp_remote_retrieve_body) wp-includes/http.php | Retrieve only the body from the raw response. |
| [wp\_remote\_get()](wp_remote_get) wp-includes/http.php | Performs an HTTP request using the GET method and returns its response. |
| [validate\_file()](validate_file) wp-includes/functions.php | Validates a file name and path against an allowed set of rules. |
| [wp\_verify\_nonce()](wp_verify_nonce) wp-includes/pluggable.php | Verifies that a correct security nonce was used with time limit. |
| [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. |
| [get\_template()](get_template) wp-includes/theme.php | Retrieves name of the active theme. |
| [get\_plugin\_files()](get_plugin_files) wp-admin/includes/plugin.php | Gets a list of a plugin’s files. |
| [get\_plugins()](get_plugins) wp-admin/includes/plugin.php | Checks the plugins directory and retrieve all plugin files with plugin data. |
| [wp\_get\_theme\_file\_editable\_extensions()](wp_get_theme_file_editable_extensions) wp-admin/includes/file.php | Gets the list of file extensions that are editable for a given 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. |
| [wp\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| [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. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [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. |
| [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\_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. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
wordpress wp_quicktags() wp\_quicktags()
===============
This function has been deprecated. Use [wp\_editor()](wp_editor) instead.
Handles quicktags.
* [wp\_editor()](wp_editor)
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function wp_quicktags() {
_deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
}
```
| 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.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress register_taxonomy( string $taxonomy, array|string $object_type, array|string $args = array() ): WP_Taxonomy|WP_Error register\_taxonomy( string $taxonomy, array|string $object\_type, array|string $args = array() ): WP\_Taxonomy|WP\_Error
========================================================================================================================
Creates or modifies a taxonomy object.
Note: Do not use before the [‘init’](../hooks/init) hook.
A simple function for creating or modifying a taxonomy object based on the parameters given. If modifying an existing taxonomy object, note that the `$object_type` value from the original registration will be overwritten.
`$taxonomy` string Required Taxonomy key, must not exceed 32 characters and may only contain lowercase alphanumeric characters, dashes, and underscores. See [sanitize\_key()](sanitize_key) . `$object_type` array|string Required Object type or array of object types with which the taxonomy should be associated. `$args` array|string Optional Array or query string of arguments for registering a taxonomy.
* `labels`string[]An array of labels for this taxonomy. By default, Tag labels are used for non-hierarchical taxonomies, and Category labels are used for hierarchical taxonomies. See accepted values in [get\_taxonomy\_labels()](get_taxonomy_labels) .
* `description`stringA short descriptive summary of what the taxonomy is for.
* `public`boolWhether a taxonomy is intended for use publicly either via the admin interface or by front-end users. The default settings of `$publicly_queryable`, `$show_ui`, and `$show_in_nav_menus` are inherited from `$public`.
* `publicly_queryable`boolWhether the taxonomy is publicly queryable.
If not set, the default is inherited from `$public`
* `hierarchical`boolWhether the taxonomy is hierarchical. Default false.
* `show_ui`boolWhether to generate and allow a UI for managing terms in this taxonomy in the admin. If not set, the default is inherited from `$public` (default true).
* `show_in_menu`boolWhether to show the taxonomy in the admin menu. If true, the taxonomy is shown as a submenu of the object type menu. If false, no menu is shown.
`$show_ui` must be true. If not set, default is inherited from `$show_ui` (default true).
* `show_in_nav_menus`boolMakes this taxonomy available for selection in navigation menus. If not set, the default is inherited from `$public` (default true).
* `show_in_rest`boolWhether to include the taxonomy in the REST API. Set this to true for the taxonomy to be available in the block editor.
* `rest_base`stringTo change the base url of REST API route. Default is $taxonomy.
* `rest_namespace`stringTo change the namespace URL of REST API route. Default is wp/v2.
* `rest_controller_class`stringREST API Controller class name. Default is '[WP\_REST\_Terms\_Controller](../classes/wp_rest_terms_controller)'.
* `show_tagcloud`boolWhether to list the taxonomy in the Tag Cloud Widget controls. If not set, the default is inherited from `$show_ui` (default true).
* `show_in_quick_edit`boolWhether to show the taxonomy in the quick/bulk edit panel. It not set, the default is inherited from `$show_ui` (default true).
* `show_admin_column`boolWhether to display a column for the taxonomy on its post type listing screens. Default false.
* `meta_box_cb`bool|callableProvide a callback function for the meta box display. If not set, [post\_categories\_meta\_box()](post_categories_meta_box) is used for hierarchical taxonomies, and [post\_tags\_meta\_box()](post_tags_meta_box) is used for non-hierarchical. If false, no meta box is shown.
* `meta_box_sanitize_cb`callableCallback function for sanitizing taxonomy data saved from a meta box. If no callback is defined, an appropriate one is determined based on the value of `$meta_box_cb`.
* `capabilities`string[] Array of capabilities for this taxonomy.
+ `manage_terms`stringDefault `'manage_categories'`.
+ `edit_terms`stringDefault `'manage_categories'`.
+ `delete_terms`stringDefault `'manage_categories'`.
+ `assign_terms`stringDefault `'edit_posts'`.
+ `rewrite`bool|array Triggers the handling of rewrites for this taxonomy. Default true, using $taxonomy as slug. To prevent rewrite, set to false. To specify rewrite rules, an array can be passed with any of these keys:
- `slug`stringCustomize the permastruct slug. Default `$taxonomy` key.
- `with_front`boolShould the permastruct be prepended with WP\_Rewrite::$front. Default true.
- `hierarchical`boolEither hierarchical rewrite tag or not. Default false.
- `ep_mask`intAssign an endpoint mask. Default `EP_NONE`.
- `query_var`string|boolSets the query var key for this taxonomy. Default `$taxonomy` key. If false, a taxonomy cannot be loaded at `?{query_var}={term_slug}`. If a string, the query `?{query_var}={term_slug}` will be valid.
- `update_count_callback`callableWorks much like a hook, in that it will be called when the count is updated. Default [\_update\_post\_term\_count()](_update_post_term_count) for taxonomies attached to post types, which confirms that the objects are published before counting them. Default [\_update\_generic\_term\_count()](_update_generic_term_count) for taxonomies attached to other object types, such as users.
- `default_term`string|array Default term to be used for the taxonomy.
* `name`stringName of default term.
* `slug`stringSlug for default term.
* `description`stringDescription for default term.
* `sort`boolWhether terms in this taxonomy should be sorted in the order they are provided to `wp_set_object_terms()`. Default null which equates to false.
* `args`arrayArray of arguments to automatically use inside `wp_get_object_terms()` for this taxonomy.
* `_builtin`boolThis taxonomy is a "built-in" taxonomy. INTERNAL USE ONLY! Default false. Default: `array()`
[WP\_Taxonomy](../classes/wp_taxonomy)|[WP\_Error](../classes/wp_error) The registered taxonomy object on success, [WP\_Error](../classes/wp_error) object on failure.
This function adds or overwrites a taxonomy. It takes in a name, an object name that it affects, and an array of parameters. It does not return anything.
Care should be used in selecting a taxonomy name so that it does not conflict with other taxonomies, post types, and [reserved WordPress public and private query variables](https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp.php). A complete list of those is described in the Reserved Terms section. In particular, capital letters should be avoided.
Better **be safe than sorry** when registering custom taxonomies for custom post types. Use [register\_taxonomy\_for\_object\_type()](register_taxonomy_for_object_type) right after the function to interconnect them. Else you could run into minetraps where the post type isn’t attached inside filter callback that run during `parse_request` or `pre_get_posts`.
$taxonomy is the name of the taxonomy. Name should only contain lowercase letters and the underscore character, and not be more than 32 characters long (database structure restriction). Default: *None*
$object\_type is the name of the object type for the taxonomy object. Object-types can be built-in Post Type or any Custom Post Type that may be registered. Default is *None.*
Built-in Post Types:
* **post**
* **page**
* **attachment**
* **revision**
* **nav\_menu\_item**
* **custom\_css**
* **customize\_changeset** Custom Post Types:
* **{custom\_post\_type}** – Custom Post Type names must be all in lower-case and without any spaces.
* **null** – Setting explicitly to null registers the taxonomy but doesn’t associate it with any objects, so it won’t be directly available within the Admin UI. You will need to manually register it using the ‘taxonomy’ parameter (passed through $args) when registering a custom post\_type (see [register\_post\_type()](register_post_type) ), or using [register\_taxonomy\_for\_object\_type()](register_taxonomy_for_object_type) . $args (*array/string*) (*optional*) An array of Arguments. Default: *None*
label (*string*) (*optional*) A **plural** descriptive name for the taxonomy marked for translation. Default: overridden by *$labels->name*
labels (*array*) (*optional*) labels – An array of labels for this taxonomy. By default tag labels are used for non-hierarchical types and category labels for hierarchical ones. Default: if empty, name is set to label value, and singular\_name is set to name value
* ‘**name’** – general name for the taxonomy, usually plural. The same as and overridden by $tax->label. Default is `_x( 'Post Tags', 'taxonomy general name' )` or `_x( 'Categories', 'taxonomy general name' )`. When internationalizing this string, please use a [gettext context](https://codex.wordpress.org/I18n_for_WordPress_Developers#Disambiguation_by_context "I18n for WordPress Developers") matching your post type. Example: `_x('Writers', 'taxonomy general name');`
* ‘**singular\_name’** – name for one object of this taxonomy. Default is `_x( 'Post Tag', 'taxonomy singular name' )` or `_x( 'Category', 'taxonomy singular name' )`. When internationalizing this string, please use a [gettext context](https://codex.wordpress.org/I18n_for_WordPress_Developers#Disambiguation_by_context "I18n for WordPress Developers") matching your post type. Example: `_x('Writer', 'taxonomy singular name');`
* ‘**menu\_name’** – the menu name text. This string is the name to give menu items. If not set, defaults to value of *name* label.
* ‘**all\_items’** – the all items text. Default is `__( 'All Tags' )` or `__( 'All Categories' )`
* ‘**edit\_item’** – the edit item text. Default is `__( 'Edit Tag' )` or `__( 'Edit Category' )`
* ‘**view\_item’** – the view item text, Default is `__( 'View Tag' )` or `__( 'View Category' )`
* ‘**update\_item’** – the update item text. Default is `__( 'Update Tag' )` or `__( 'Update Category' )`
* ‘**add\_new\_item’** – the add new item text. Default is `__( 'Add New Tag' )` or `__( 'Add New Category' )`
* ‘**new\_item\_name’** – the new item name text. Default is `__( 'New Tag Name' )` or `__( 'New Category Name' )`
* ‘**parent\_item’** – the parent item text. This string is not used on non-hierarchical taxonomies such as post tags. Default is null or `__( 'Parent Category' )`
* ‘**parent\_item\_colon’** – The same as `parent_item`, but with colon `:` in the end null, `__( 'Parent Category:' )`
* ‘**search\_items’** – the search items text. Default is `__( 'Search Tags' )` or `__( 'Search Categories' )`
* ‘**popular\_items’** – the popular items text. This string is not used on hierarchical taxonomies. Default is `__( 'Popular Tags' )` or null
* ‘**separate\_items\_with\_commas’** – the separate item with commas text used in the taxonomy meta box. This string is not used on hierarchical taxonomies. Default is `__( 'Separate tags with commas' )`, or null
* ‘**add\_or\_remove\_items’** – the add or remove items text and used in the meta box when JavaScript is disabled. This string is not used on hierarchical taxonomies. Default is `__( 'Add or remove tags' )` or null
* ‘**choose\_from\_most\_used’** – the choose from most used text used in the taxonomy meta box. This string is not used on hierarchical taxonomies. Default is `__( 'Choose from the most used tags' )` or null
* ‘**not\_found’** (3.6+) – the text displayed via clicking ‘Choose from the most used tags’ in the taxonomy meta box when no tags are available and (4.2+) – the text used in the terms list table when there are no items for a taxonomy. Default is `__( 'No tags found.' )` or `__( 'No categories found.' )`
* ‘**back\_to\_items’** – the text displayed after a term has been updated for a link back to main index. Default is `__( '← Back to tags' )` or `__( '← Back to categories' )` public (*boolean*) (*optional*) Whether a taxonomy is intended for use publicly either via the admin interface or by front-end users. The default settings of `$publicly\_queryable`, `$show\_ui`, and `$show\_in\_nav\_menus` are inherited from `$public`. Default: true publicly\_queryable (*boolean*) (*optional*) Whether the taxonomy is publicly queryable. Default: $public show\_ui (*boolean*) (*optional*) Whether to generate a default UI for managing this taxonomy. Default: if not set, defaults to value of *public* argument. As of [3.5](https://codex.wordpress.org/Version_3.5 "Version 3.5"), setting this to **false** for attachment taxonomies will hide the UI. show\_in\_menu (*boolean*) (*optional*) Where to show the taxonomy in the admin menu. show\_ui must be true. Default: value of show\_ui argument
* ‘false’ – do not display in the admin menu
* ‘true’ – show as a submenu of associated object types show\_in\_nav\_menus (*boolean*) (*optional*) true makes this taxonomy available for selection in navigation menus. Default: if not set, defaults to value of *public* argument show\_in\_rest (*boolean*) (*optional*) Whether to include the taxonomy in the REST API. You will need to set this to true in order to use the taxonomy in your gutenberg metablock. Default: false rest\_base ([*string*](https://codex.wordpress.org/How_to_Pass_Tag_Parameters#String "How to Pass Tag Parameters")) (*optional*) To change the base url of REST API route. Default: $taxonomy rest\_controller\_class ([*string*](https://codex.wordpress.org/How_to_Pass_Tag_Parameters#String "How to Pass Tag Parameters")) (*optional*) REST API Controller class name. Default: [WP\_REST\_Terms\_Controller](../classes/wp_rest_terms_controller "Class Reference/WP REST Terms Controller (page does not exist)")
show\_tagcloud (*boolean*) (*optional*) Whether to allow the Tag Cloud widget to use this taxonomy. Default: if not set, defaults to value of *show\_ui* argument show\_in\_quick\_edit (*boolean*) (*optional*) Whether to show the taxonomy in the quick/bulk edit panel. (Available since [4.2](https://codex.wordpress.org/Version_4.2 "Version 4.2")) Default: if not set, defaults to value of *show\_ui* argument meta\_box\_cb (*callback*) (*optional*) Provide a callback function name for the meta box display. (Available since [3.8](https://codex.wordpress.org/Version_3.8 "Version 3.8")) Default: null **Note:** Defaults to the categories meta box ([post\_categories\_meta\_box()](post_categories_meta_box) in meta-boxes.php) for hierarchical taxonomies and the tags meta box ([post\_tags\_meta\_box()](post_tags_meta_box) ) for non-hierarchical taxonomies. No meta box is shown if set to false.
show\_admin\_column (*boolean*) (*optional*) Whether to allow automatic creation of taxonomy columns on associated post-types table. (Available since [3.5](https://codex.wordpress.org/Version_3.5 "Version 3.5")) Default: false description (*string*) (*optional*) Include a description of the taxonomy. Default: “” hierarchical (*boolean*) (*optional*) Is this taxonomy hierarchical (have descendants) like categories or not hierarchical like tags. Default: false **Note:** Hierarchical taxonomies will have a list with checkboxes to select an existing category in the taxonomy admin box on the post edit page (like default post categories). Non-hierarchical taxonomies will just have an empty text field to type-in taxonomy terms to associate with the post (like default post tags).
update\_count\_callback (*string*) (*optional*) A function name that will be called when the count of an associated *$object\_type*, such as post, is updated. Works much like a hook. Default: None – but see Note, below. **Note:** While the default is '', when actually performing the count update in [wp\_update\_term\_count\_now()](wp_update_term_count_now) , if the taxonomy is only attached to post types (as opposed to other WordPress objects, like user), the built-in [\_update\_post\_term\_count()](_update_post_term_count) function will be used to count only published posts associated with that term, otherwise [\_update\_generic\_term\_count()](_update_generic_term_count) will be used instead, that does no such checking.
This is significant in the case of **attachments**. Because an attachment is a type of post, the default [\_update\_post\_term\_count()](_update_post_term_count) will be used. However, this may be undesirable, because this will only count attachments that are actually attached to another post (like when you insert an image into a post). This means that attachments that you simply upload to WordPress using the Media Library, but do not actually attach to another post will **not** be counted. If your intention behind associating a taxonomy with attachments was to leverage the Media Library as a sort of Document Management solution, you are probably more interested in the counts of unattached Media items, than in those attached to posts. In this case, you should force the use of [\_update\_generic\_term\_count()](_update_generic_term_count) by setting ‘\_update\_generic\_term\_count’ as the value for update\_count\_callback.
Another important consideration is that [\_update\_post\_term\_count()](_update_post_term_count) only counts **published** posts. If you are using custom statuses, or using custom post types where being published is not necessarily a consideration for being counted in the term count, then you will need to provide your own callback that doesn’t include the post\_status portion of the where clause.
query\_var (*boolean or string*) (*optional*) False to disable the query\_var, set as string to use custom query\_var instead of default which is $taxonomy, the taxonomy’s “name”. True is not seen as a valid entry and will result in 404 issues. Default: $taxonomy **Note:** The query\_var is used for direct queries through [WP\_Query](../classes/wp_query) like `new WP_Query(array('people'=>$person_name))` and URL queries like `/?people=$person_name`. Setting query\_var to false will disable these methods, but you can still fetch posts with an explicit [WP\_Query](../classes/wp_query) taxonomy query like `WP_Query(array('taxonomy'=>'people', 'term'=>$person_name))`.
rewrite (*boolean/array*) (*optional*) Set to false to prevent automatic URL rewriting a.k.a. “pretty permalinks”. Pass an *$args* array to override default URL settings for permalinks as outlined below: Default: true
* ‘**slug’** – Used as pretty permalink text (i.e. /tag/) – defaults to $taxonomy (taxonomy’s name slug)
* ‘**with\_front’** – allowing permalinks to be prepended with front base – defaults to true
* ‘**hierarchical’** – true or false allow hierarchical urls (implemented in Version 3.1) – defaults to false
* ‘**ep\_mask’** – (Required for pretty permalinks) Assign an endpoint mask for this taxonomy – defaults to EP\_NONE. If you do not specify the EP\_MASK, pretty permalinks will not work. For more info see [this Make WordPress Plugins summary of endpoints](https://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/). **Note:** You may need to flush the rewrite rules after changing this. You can do it manually by going to the Permalink Settings page and re-saving the rules — you don’t need to change them — or by calling $[wp\_rewrite::flush\_rules()](../classes/wp_rewrite/flush_rules). You should only flush the rules once after the taxonomy has been created, not every time the plugin/theme loads.
capabilities (*array*) (*optional*) An array of the capabilities for this taxonomy. Default: *None*
* ‘**manage\_terms’** – ‘manage\_categories’
* ‘**edit\_terms’** – ‘manage\_categories’
* ‘**delete\_terms’** – ‘manage\_categories’
* ‘**assign\_terms’** – ‘edit\_posts’ sort (*boolean*) (*optional*) Whether this taxonomy should remember the order in which terms are added to objects. Default: *None*
\_builtin (*boolean*) (*not for general use*) Whether this taxonomy is a native or “built-in” taxonomy. **Note: this entry is for documentation – core developers recommend you don’t use this when registering your own taxonomy** Default: false Avoiding the following reserved terms is particularly important if you are passing the term through the $\_GET or $\_POST array. Doing so can cause WordPress to respond with a 404 error without any other hint or explanation.
* attachment
* attachment\_id
* author
* author\_name
* calendar
* cat
* category
* category\_\_and
* category\_\_in
* category\_\_not\_in
* category\_name
* comments\_per\_page
* comments\_popup
* custom
* customize\_messenger\_channel
* customized
* cpage
* day
* debug
* embed
* error
* exact
* feed
* fields
* hour
* link\_category
* m
* minute
* monthnum
* more
* name
* nav\_menu
* nonce
* nopaging
* offset
* order
* orderby
* p
* page
* page\_id
* paged
* pagename
* pb
* perm
* post
* post\_\_in
* post\_\_not\_in
* post\_format
* post\_mime\_type
* post\_status
* post\_tag
* post\_type
* posts
* posts\_per\_archive\_page
* posts\_per\_page
* preview
* robots
* s
* search
* second
* sentence
* showposts
* static
* status
* subpost
* subpost\_id
* tag
* tag\_\_and
* tag\_\_in
* tag\_\_not\_in
* tag\_id
* tag\_slug\_\_and
* tag\_slug\_\_in
* taxonomy
* tb
* term
* terms
* theme
* title
* type
* types
* w
* withcomments
* withoutcomments
* year File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
global $wp_taxonomies;
if ( ! is_array( $wp_taxonomies ) ) {
$wp_taxonomies = array();
}
$args = wp_parse_args( $args );
if ( empty( $taxonomy ) || strlen( $taxonomy ) > 32 ) {
_doing_it_wrong( __FUNCTION__, __( 'Taxonomy names must be between 1 and 32 characters in length.' ), '4.2.0' );
return new WP_Error( 'taxonomy_length_invalid', __( 'Taxonomy names must be between 1 and 32 characters in length.' ) );
}
$taxonomy_object = new WP_Taxonomy( $taxonomy, $object_type, $args );
$taxonomy_object->add_rewrite_rules();
$wp_taxonomies[ $taxonomy ] = $taxonomy_object;
$taxonomy_object->add_hooks();
// Add default term.
if ( ! empty( $taxonomy_object->default_term ) ) {
$term = term_exists( $taxonomy_object->default_term['name'], $taxonomy );
if ( $term ) {
update_option( 'default_term_' . $taxonomy_object->name, $term['term_id'] );
} else {
$term = wp_insert_term(
$taxonomy_object->default_term['name'],
$taxonomy,
array(
'slug' => sanitize_title( $taxonomy_object->default_term['slug'] ),
'description' => $taxonomy_object->default_term['description'],
)
);
// Update `term_id` in options.
if ( ! is_wp_error( $term ) ) {
update_option( 'default_term_' . $taxonomy_object->name, $term['term_id'] );
}
}
}
/**
* Fires after a taxonomy is registered.
*
* @since 3.3.0
*
* @param string $taxonomy Taxonomy slug.
* @param array|string $object_type Object type or array of object types.
* @param array $args Array of taxonomy registration arguments.
*/
do_action( 'registered_taxonomy', $taxonomy, $object_type, (array) $taxonomy_object );
/**
* Fires after a specific taxonomy is registered.
*
* The dynamic portion of the filter name, `$taxonomy`, refers to the taxonomy key.
*
* Possible hook names include:
*
* - `registered_taxonomy_category`
* - `registered_taxonomy_post_tag`
*
* @since 6.0.0
*
* @param string $taxonomy Taxonomy slug.
* @param array|string $object_type Object type or array of object types.
* @param array $args Array of taxonomy registration arguments.
*/
do_action( "registered_taxonomy_{$taxonomy}", $taxonomy, $object_type, (array) $taxonomy_object );
return $taxonomy_object;
}
```
[do\_action( 'registered\_taxonomy', string $taxonomy, array|string $object\_type, array $args )](../hooks/registered_taxonomy)
Fires after a taxonomy is registered.
[do\_action( "registered\_taxonomy\_{$taxonomy}", string $taxonomy, array|string $object\_type, array $args )](../hooks/registered_taxonomy_taxonomy)
Fires after a specific taxonomy is registered.
| Uses | Description |
| --- | --- |
| [WP\_Taxonomy::\_\_construct()](../classes/wp_taxonomy/__construct) wp-includes/class-wp-taxonomy.php | Constructor. |
| [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
| [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. |
| [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. |
| [\_\_()](__) 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. |
| [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. |
| [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 |
| --- | --- |
| [create\_initial\_taxonomies()](create_initial_taxonomies) wp-includes/taxonomy.php | Creates the initial taxonomies. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced `rest_namespace` argument. |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced `default_term` argument. |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Added the registered taxonomy object as a return value. |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced `meta_box_sanitize_cb` argument. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced `show_in_rest`, `'rest_base'` and `'rest_controller_class'` arguments to register the taxonomy in REST API. |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced `publicly_queryable` argument. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `public` argument now controls whether the taxonomy can be queried on the front end. |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced `show_in_quick_edit` argument. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
| programming_docs |
wordpress wp_get_term_taxonomy_parent_id( int $term_id, string $taxonomy ): int|false wp\_get\_term\_taxonomy\_parent\_id( int $term\_id, string $taxonomy ): int|false
=================================================================================
Returns the term’s parent’s term ID.
`$term_id` int Required Term ID. `$taxonomy` string Required Taxonomy name. int|false Parent term ID on success, false on failure.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function wp_get_term_taxonomy_parent_id( $term_id, $taxonomy ) {
$term = get_term( $term_id, $taxonomy );
if ( ! $term || is_wp_error( $term ) ) {
return false;
}
return (int) $term->parent;
}
```
| Uses | Description |
| --- | --- |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress get_theme_root( string $stylesheet_or_template = '' ): string get\_theme\_root( string $stylesheet\_or\_template = '' ): string
=================================================================
Retrieves path to themes directory.
Does not have trailing slash.
`$stylesheet_or_template` string Optional The stylesheet or template name of the theme.
Default is to leverage the main theme root. Default: `''`
string Themes directory path.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_theme_root( $stylesheet_or_template = '' ) {
global $wp_theme_directories;
$theme_root = '';
if ( $stylesheet_or_template ) {
$theme_root = get_raw_theme_root( $stylesheet_or_template );
if ( $theme_root ) {
// Always prepend WP_CONTENT_DIR unless the root currently registered as a theme directory.
// This gives relative theme roots the benefit of the doubt when things go haywire.
if ( ! in_array( $theme_root, (array) $wp_theme_directories, true ) ) {
$theme_root = WP_CONTENT_DIR . $theme_root;
}
}
}
if ( ! $theme_root ) {
$theme_root = WP_CONTENT_DIR . '/themes';
}
/**
* Filters the absolute path to the themes directory.
*
* @since 1.5.0
*
* @param string $theme_root Absolute path to themes directory.
*/
return apply_filters( 'theme_root', $theme_root );
}
```
[apply\_filters( 'theme\_root', string $theme\_root )](../hooks/theme_root)
Filters the absolute path to the themes directory.
| Uses | Description |
| --- | --- |
| [get\_raw\_theme\_root()](get_raw_theme_root) wp-includes/theme.php | Gets the raw theme root relative to the content directory with no filters applied. |
| [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\_theme\_folders()](get_block_theme_folders) wp-includes/block-template-utils.php | For backward compatibility reasons, block themes might be using block-templates or block-template-parts, this function ensures we fallback to these folders properly. |
| [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. |
| [WP\_Automatic\_Updater::update()](../classes/wp_automatic_updater/update) wp-admin/includes/class-wp-automatic-updater.php | Updates an item, if appropriate. |
| [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. |
| [WP\_Upgrader::fs\_connect()](../classes/wp_upgrader/fs_connect) wp-admin/includes/class-wp-upgrader.php | Connect to the filesystem. |
| [WP\_Filesystem\_Base::wp\_themes\_dir()](../classes/wp_filesystem_base/wp_themes_dir) wp-admin/includes/class-wp-filesystem-base.php | Returns the path on the remote filesystem of the Themes Directory. |
| [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. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_list_pages( array|string $args = '' ): void|string wp\_list\_pages( array|string $args = '' ): void|string
=======================================================
Retrieves or displays a list of pages (or hierarchical post type items) in list (li) format.
* [get\_pages()](get_pages)
`$args` array|string Optional Array or string of arguments to generate a list of pages. See [get\_pages()](get_pages) for additional arguments.
* `child_of`intDisplay only the sub-pages of a single page by ID. Default 0 (all pages).
* `authors`stringComma-separated list of author IDs. Default empty (all authors).
* `date_format`stringPHP date format to use for the listed pages. Relies on the `'show_date'` parameter.
Default is the value of `'date_format'` option.
* `depth`intNumber of levels in the hierarchy of pages to include in the generated list.
Accepts -1 (any depth), 0 (all pages), 1 (top-level pages only), and n (pages to the given n depth). Default 0.
* `echo`boolWhether or not to echo the list of pages. Default true.
* `exclude`stringComma-separated list of page IDs to exclude.
* `include`arrayComma-separated list of page IDs to include.
* `link_after`stringText or HTML to follow the page link label. Default null.
* `link_before`stringText or HTML to precede the page link label. Default null.
* `post_type`stringPost type to query for. Default `'page'`.
* `post_status`string|arrayComma-separated list or array of post statuses to include. Default `'publish'`.
* `show_date`stringWhether to display the page publish or modified date for each page. Accepts `'modified'` or any other value. An empty value hides the date.
* `sort_column`stringComma-separated list of column names to sort the pages by. Accepts `'post_author'`, `'post_date'`, `'post_title'`, `'post_name'`, `'post_modified'`, `'post_modified_gmt'`, `'menu_order'`, `'post_parent'`, `'ID'`, `'rand'`, or `'comment_count'`. Default `'post_title'`.
* `title_li`stringList heading. Passing a null or empty value will result in no heading, and the list will not be wrapped with unordered list `<ul>` tags. Default `'Pages'`.
* `item_spacing`stringWhether to preserve whitespace within the menu's HTML. Accepts `'preserve'` or `'discard'`.
Default `'preserve'`.
* `walker`[Walker](../classes/walker)
[Walker](../classes/walker) instance to use for listing pages. Default empty which results in a [Walker\_Page](../classes/walker_page) instance being used.
More Arguments from get\_pages( ... $args ) Array or string of arguments to retrieve pages.
* `child_of`intPage ID to return child and grandchild pages of. Note: The value of `$hierarchical` has no bearing on whether `$child_of` returns hierarchical results. Default 0, or no restriction.
* `sort_order`stringHow to sort retrieved pages. Accepts `'ASC'`, `'DESC'`. Default `'ASC'`.
* `sort_column`stringWhat columns to sort pages by, comma-separated. Accepts `'post_author'`, `'post_date'`, `'post_title'`, `'post_name'`, `'post_modified'`, `'menu_order'`, `'post_modified_gmt'`, `'post_parent'`, `'ID'`, `'rand'`, `'comment*count'`.
`'post*'` can be omitted for any values that start with it.
Default `'post_title'`.
* `hierarchical`boolWhether to return pages hierarchically. If false in conjunction with `$child_of` also being false, both arguments will be disregarded.
Default true.
* `exclude`int[]Array of page IDs to exclude.
* `include`int[]Array of page IDs to include. Cannot be used with `$child_of`, `$parent`, `$exclude`, `$meta_key`, `$meta_value`, or `$hierarchical`.
* `meta_key`stringOnly include pages with this meta key.
* `meta_value`stringOnly include pages with this meta value. Requires `$meta_key`.
* `authors`stringA comma-separated list of author IDs.
* `parent`intPage ID to return direct children of. Default -1, or no restriction.
* `exclude_tree`string|int[]Comma-separated string or array of page IDs to exclude.
* `number`intThe number of pages to return. Default 0, or all pages.
* `offset`intThe number of pages to skip before returning. Requires `$number`.
Default 0.
* `post_type`stringThe post type to query. Default `'page'`.
* `post_status`string|arrayA comma-separated list or array of post statuses to include.
Default `'publish'`.
Default: `''`
void|string Void if `'echo'` argument is true, HTML list of pages if `'echo'` is false.
The following classes are applied to menu items, i.e. to the HTML <li> tags, generated by [wp\_list\_pages()](wp_list_pages) . **Note:** The [wp\_list\_pages()](wp_list_pages) and [wp\_page\_menu()](wp_page_menu) functions output the same CSS classes.
* **.page\_item**
This class is added to menu items that correspond to a static page.
* **.page-item-$ID**
This class is added to menu items that correspond to a static page, where $ID is the static page ID.
* **.current\_page\_item**
This class is added to menu items that correspond to the currently rendered static page.
* **.current\_page\_parent**
This class is added to menu items that correspond to the hierarchical parent of the currently rendered static page.
* **.current\_page\_ancestor**
This class is added to menu items that correspond to a hierarchical ancestor of the currently rendered static page.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function wp_list_pages( $args = '' ) {
$defaults = array(
'depth' => 0,
'show_date' => '',
'date_format' => get_option( 'date_format' ),
'child_of' => 0,
'exclude' => '',
'title_li' => __( 'Pages' ),
'echo' => 1,
'authors' => '',
'sort_column' => 'menu_order, post_title',
'link_before' => '',
'link_after' => '',
'item_spacing' => 'preserve',
'walker' => '',
);
$parsed_args = wp_parse_args( $args, $defaults );
if ( ! in_array( $parsed_args['item_spacing'], array( 'preserve', 'discard' ), true ) ) {
// Invalid value, fall back to default.
$parsed_args['item_spacing'] = $defaults['item_spacing'];
}
$output = '';
$current_page = 0;
// Sanitize, mostly to keep spaces out.
$parsed_args['exclude'] = preg_replace( '/[^0-9,]/', '', $parsed_args['exclude'] );
// Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array).
$exclude_array = ( $parsed_args['exclude'] ) ? explode( ',', $parsed_args['exclude'] ) : array();
/**
* Filters the array of pages to exclude from the pages list.
*
* @since 2.1.0
*
* @param string[] $exclude_array An array of page IDs to exclude.
*/
$parsed_args['exclude'] = implode( ',', apply_filters( 'wp_list_pages_excludes', $exclude_array ) );
$parsed_args['hierarchical'] = 0;
// Query pages.
$pages = get_pages( $parsed_args );
if ( ! empty( $pages ) ) {
if ( $parsed_args['title_li'] ) {
$output .= '<li class="pagenav">' . $parsed_args['title_li'] . '<ul>';
}
global $wp_query;
if ( is_page() || is_attachment() || $wp_query->is_posts_page ) {
$current_page = get_queried_object_id();
} elseif ( is_singular() ) {
$queried_object = get_queried_object();
if ( is_post_type_hierarchical( $queried_object->post_type ) ) {
$current_page = $queried_object->ID;
}
}
$output .= walk_page_tree( $pages, $parsed_args['depth'], $current_page, $parsed_args );
if ( $parsed_args['title_li'] ) {
$output .= '</ul></li>';
}
}
/**
* Filters the HTML output of the pages to list.
*
* @since 1.5.1
* @since 4.4.0 `$pages` added as arguments.
*
* @see wp_list_pages()
*
* @param string $output HTML output of the pages list.
* @param array $parsed_args An array of page-listing arguments. See wp_list_pages()
* for information on accepted arguments.
* @param WP_Post[] $pages Array of the page objects.
*/
$html = apply_filters( 'wp_list_pages', $output, $parsed_args, $pages );
if ( $parsed_args['echo'] ) {
echo $html;
} else {
return $html;
}
}
```
[apply\_filters( 'wp\_list\_pages', string $output, array $parsed\_args, WP\_Post[] $pages )](../hooks/wp_list_pages)
Filters the HTML output of the pages to list.
[apply\_filters( 'wp\_list\_pages\_excludes', string[] $exclude\_array )](../hooks/wp_list_pages_excludes)
Filters the array of pages to exclude from the pages list.
| 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). |
| [is\_page()](is_page) wp-includes/query.php | Determines whether the query is for an existing single page. |
| [is\_attachment()](is_attachment) wp-includes/query.php | Determines whether the query is for an existing attachment page. |
| [get\_queried\_object\_id()](get_queried_object_id) wp-includes/query.php | Retrieves the ID of the currently queried object. |
| [get\_queried\_object()](get_queried_object) wp-includes/query.php | Retrieves the currently queried object. |
| [walk\_page\_tree()](walk_page_tree) wp-includes/post-template.php | Retrieves HTML list content for page list. |
| [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| [is\_post\_type\_hierarchical()](is_post_type_hierarchical) wp-includes/post.php | Determines whether the post type is hierarchical. |
| [\_\_()](__) 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. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [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\_page\_menu()](wp_page_menu) wp-includes/post-template.php | Displays or retrieves a list of pages with an optional home link. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Added the `item_spacing` argument. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_delete_link( int $link_id ): true wp\_delete\_link( int $link\_id ): true
=======================================
Deletes a specified link from the database.
`$link_id` int Required ID of the link to delete true Always true.
File: `wp-admin/includes/bookmark.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/bookmark.php/)
```
function wp_delete_link( $link_id ) {
global $wpdb;
/**
* Fires before a link is deleted.
*
* @since 2.0.0
*
* @param int $link_id ID of the link to delete.
*/
do_action( 'delete_link', $link_id );
wp_delete_object_term_relationships( $link_id, 'link_category' );
$wpdb->delete( $wpdb->links, array( 'link_id' => $link_id ) );
/**
* Fires after a link has been deleted.
*
* @since 2.2.0
*
* @param int $link_id ID of the deleted link.
*/
do_action( 'deleted_link', $link_id );
clean_bookmark_cache( $link_id );
return true;
}
```
[do\_action( 'deleted\_link', int $link\_id )](../hooks/deleted_link)
Fires after a link has been deleted.
[do\_action( 'delete\_link', int $link\_id )](../hooks/delete_link)
Fires before a link is deleted.
| Uses | Description |
| --- | --- |
| [wp\_delete\_object\_term\_relationships()](wp_delete_object_term_relationships) wp-includes/taxonomy.php | Unlinks the object from the taxonomy or taxonomies. |
| [clean\_bookmark\_cache()](clean_bookmark_cache) wp-includes/bookmark.php | Deletes the bookmark cache. |
| [wpdb::delete()](../classes/wpdb/delete) wp-includes/class-wpdb.php | Deletes a row in the table. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [wpmu\_delete\_user()](wpmu_delete_user) wp-admin/includes/ms.php | Delete a user from the network and remove from all sites. |
| [wp\_delete\_user()](wp_delete_user) wp-admin/includes/user.php | Remove user and optionally reassign posts and links to another user. |
| [wp\_ajax\_delete\_link()](wp_ajax_delete_link) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a link. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress site_icon_url( int $size = 512, string $url = '', int $blog_id ) site\_icon\_url( int $size = 512, string $url = '', int $blog\_id )
===================================================================
Displays the Site Icon URL.
`$size` int Optional Size of the site icon. Default 512 (pixels). Default: `512`
`$url` string Optional Fallback url if no site icon is found. Default: `''`
`$blog_id` int Optional ID of the blog to get the site icon for. Default current blog. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
echo esc_url( get_site_icon_url( $size, $url, $blog_id ) );
}
```
| Uses | Description |
| --- | --- |
| [get\_site\_icon\_url()](get_site_icon_url) wp-includes/general-template.php | Returns the Site Icon URL. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
wordpress is_protected_endpoint(): bool is\_protected\_endpoint(): bool
===============================
Determines whether we are currently on an endpoint that should be protected against WSODs.
bool True if the current endpoint should be protected.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function is_protected_endpoint() {
// Protect login pages.
if ( isset( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) {
return true;
}
// Protect the admin backend.
if ( is_admin() && ! wp_doing_ajax() ) {
return true;
}
// Protect Ajax actions that could help resolve a fatal error should be available.
if ( is_protected_ajax_action() ) {
return true;
}
/**
* Filters whether the current request is against a protected endpoint.
*
* This filter is only fired when an endpoint is requested which is not already protected by
* WordPress core. As such, it exclusively allows providing further protected endpoints in
* addition to the admin backend, login pages and protected Ajax actions.
*
* @since 5.2.0
*
* @param bool $is_protected_endpoint Whether the currently requested endpoint is protected.
* Default false.
*/
return (bool) apply_filters( 'is_protected_endpoint', false );
}
```
[apply\_filters( 'is\_protected\_endpoint', bool $is\_protected\_endpoint )](../hooks/is_protected_endpoint)
Filters whether the current request is against a protected endpoint.
| Uses | Description |
| --- | --- |
| [is\_protected\_ajax\_action()](is_protected_ajax_action) wp-includes/load.php | Determines whether we are currently handling an Ajax action that should be protected against WSODs. |
| [wp\_doing\_ajax()](wp_doing_ajax) wp-includes/load.php | Determines whether the current request is a WordPress Ajax request. |
| [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\_Recovery\_Mode::handle\_error()](../classes/wp_recovery_mode/handle_error) wp-includes/class-wp-recovery-mode.php | Handles a fatal error occurring. |
| [WP\_Fatal\_Error\_Handler::display\_default\_error\_template()](../classes/wp_fatal_error_handler/display_default_error_template) wp-includes/class-wp-fatal-error-handler.php | Displays the default PHP error template. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
| programming_docs |
wordpress wp_ajax_save_attachment_compat() wp\_ajax\_save\_attachment\_compat()
====================================
Ajax handler for saving backward compatible attachment attributes.
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_attachment_compat() {
if ( ! isset( $_REQUEST['id'] ) ) {
wp_send_json_error();
}
$id = absint( $_REQUEST['id'] );
if ( ! $id ) {
wp_send_json_error();
}
if ( empty( $_REQUEST['attachments'] ) || empty( $_REQUEST['attachments'][ $id ] ) ) {
wp_send_json_error();
}
$attachment_data = $_REQUEST['attachments'][ $id ];
check_ajax_referer( 'update-post_' . $id, 'nonce' );
if ( ! current_user_can( 'edit_post', $id ) ) {
wp_send_json_error();
}
$post = get_post( $id, ARRAY_A );
if ( 'attachment' !== $post['post_type'] ) {
wp_send_json_error();
}
/** This filter is documented in wp-admin/includes/media.php */
$post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data );
if ( isset( $post['errors'] ) ) {
$errors = $post['errors']; // @todo return me and display me!
unset( $post['errors'] );
}
wp_update_post( $post );
foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) {
if ( isset( $attachment_data[ $taxonomy ] ) ) {
wp_set_object_terms( $id, array_map( 'trim', preg_split( '/,+/', $attachment_data[ $taxonomy ] ) ), $taxonomy, false );
}
}
$attachment = wp_prepare_attachment_for_js( $id );
if ( ! $attachment ) {
wp_send_json_error();
}
wp_send_json_success( $attachment );
}
```
[apply\_filters( 'attachment\_fields\_to\_save', array $post, array $attachment )](../hooks/attachment_fields_to_save)
Filters the attachment fields to be saved.
| Uses | Description |
| --- | --- |
| [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. |
| [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\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [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. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [wp\_send\_json\_success()](wp_send_json_success) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating success. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress wp_print_request_filesystem_credentials_modal() wp\_print\_request\_filesystem\_credentials\_modal()
====================================================
Prints the filesystem credentials modal when needed.
File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/)
```
function wp_print_request_filesystem_credentials_modal() {
$filesystem_method = get_filesystem_method();
ob_start();
$filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
ob_end_clean();
$request_filesystem_credentials = ( 'direct' !== $filesystem_method && ! $filesystem_credentials_are_stored );
if ( ! $request_filesystem_credentials ) {
return;
}
?>
<div id="request-filesystem-credentials-dialog" class="notification-dialog-wrap request-filesystem-credentials-dialog">
<div class="notification-dialog-background"></div>
<div class="notification-dialog" role="dialog" aria-labelledby="request-filesystem-credentials-title" tabindex="0">
<div class="request-filesystem-credentials-dialog-content">
<?php request_filesystem_credentials( site_url() ); ?>
</div>
</div>
</div>
<?php
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [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. |
| [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. |
| [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. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress get_comment_author_email_link( string $linktext = '', string $before = '', string $after = '', int|WP_Comment $comment = null ): string get\_comment\_author\_email\_link( string $linktext = '', string $before = '', string $after = '', int|WP\_Comment $comment = null ): string
============================================================================================================================================
Returns the HTML email link to the author of the current comment.
Care should be taken to protect the email address and assure that email harvesters do not capture your commenter’s email address. Most assume that their email address will not appear in raw form on the site. Doing so will enable anyone, including those that people don’t want to get the email address and use it for their own means good and bad.
`$linktext` string Optional Text to display instead of the comment author's email address.
Default: `''`
`$before` string Optional Text or HTML to display before the email link. Default: `''`
`$after` string Optional Text or HTML to display after the email link. Default: `''`
`$comment` int|[WP\_Comment](../classes/wp_comment) Optional Comment ID or [WP\_Comment](../classes/wp_comment) object. Default is the current comment. Default: `null`
string HTML markup for the comment author email link. By default, the email address is obfuscated via the ['comment\_email'](../hooks/comment_email) filter with [antispambot()](antispambot) .
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_comment_author_email_link( $linktext = '', $before = '', $after = '', $comment = null ) {
$comment = get_comment( $comment );
/**
* Filters the comment author's email for display.
*
* Care should be taken to protect the email address and assure that email
* harvesters do not capture your commenter's email address.
*
* @since 1.2.0
* @since 4.1.0 The `$comment` parameter was added.
*
* @param string $comment_author_email The comment author's email address.
* @param WP_Comment $comment The comment object.
*/
$email = apply_filters( 'comment_email', $comment->comment_author_email, $comment );
if ( ( ! empty( $email ) ) && ( '@' !== $email ) ) {
$display = ( '' !== $linktext ) ? $linktext : $email;
$return = $before;
$return .= sprintf( '<a href="%1$s">%2$s</a>', esc_url( 'mailto:' . $email ), esc_html( $display ) );
$return .= $after;
return $return;
} else {
return '';
}
}
```
[apply\_filters( 'comment\_email', string $comment\_author\_email, WP\_Comment $comment )](../hooks/comment_email)
Filters the comment author’s email for display.
| 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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Used By | Description |
| --- | --- |
| [comment\_author\_email\_link()](comment_author_email_link) wp-includes/comment-template.php | Displays the HTML email link to the author of the current comment. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Added the `$comment` parameter. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress get_objects_in_term( int|int[] $term_ids, string|string[] $taxonomies, array|string $args = array() ): string[]|WP_Error get\_objects\_in\_term( int|int[] $term\_ids, string|string[] $taxonomies, array|string $args = array() ): string[]|WP\_Error
=============================================================================================================================
Retrieves object IDs of valid taxonomy and term.
The strings of `$taxonomies` must exist before this function will continue.
On failure of finding a valid taxonomy, it will return a [WP\_Error](../classes/wp_error).
The `$terms` aren’t checked the same as `$taxonomies`, but still need to exist for object IDs to be returned.
It is possible to change the order that object IDs are returned by using `$args` with either ASC or DESC array. The value should be in the key named ‘order’.
`$term_ids` int|int[] Required Term ID or array of term IDs of terms that will be used. `$taxonomies` string|string[] Required String of taxonomy name or Array of string values of taxonomy names. `$args` array|string Optional Change the order of the object IDs, either ASC or DESC. Default: `array()`
string[]|[WP\_Error](../classes/wp_error) An array of object IDs as numeric strings on success, [WP\_Error](../classes/wp_error) if the taxonomy does not exist.
If an object is in more than one of the terms passed to $terms, the results returned will contain duplicate object\_ids.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function get_objects_in_term( $term_ids, $taxonomies, $args = array() ) {
global $wpdb;
if ( ! is_array( $term_ids ) ) {
$term_ids = array( $term_ids );
}
if ( ! is_array( $taxonomies ) ) {
$taxonomies = array( $taxonomies );
}
foreach ( (array) $taxonomies as $taxonomy ) {
if ( ! taxonomy_exists( $taxonomy ) ) {
return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
}
}
$defaults = array( 'order' => 'ASC' );
$args = wp_parse_args( $args, $defaults );
$order = ( 'desc' === strtolower( $args['order'] ) ) ? 'DESC' : 'ASC';
$term_ids = array_map( 'intval', $term_ids );
$taxonomies = "'" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
$term_ids = "'" . implode( "', '", $term_ids ) . "'";
$sql = "SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($term_ids) ORDER BY tr.object_id $order";
$last_changed = wp_cache_get_last_changed( 'terms' );
$cache_key = 'get_objects_in_term:' . md5( $sql ) . ":$last_changed";
$cache = wp_cache_get( $cache_key, 'terms' );
if ( false === $cache ) {
$object_ids = $wpdb->get_col( $sql );
wp_cache_set( $cache_key, $object_ids, 'terms' );
} else {
$object_ids = (array) $cache;
}
if ( ! $object_ids ) {
return array();
}
return $object_ids;
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_get\_last\_changed()](wp_cache_get_last_changed) wp-includes/functions.php | Gets last changed date for the specified cache group. |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [wp\_delete\_nav\_menu()](wp_delete_nav_menu) wp-includes/nav-menu.php | Deletes a navigation menu. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress get_page_by_path( string $page_path, string $output = OBJECT, string|array $post_type = 'page' ): WP_Post|array|null get\_page\_by\_path( string $page\_path, string $output = OBJECT, string|array $post\_type = 'page' ): WP\_Post|array|null
==========================================================================================================================
Retrieves a page given its path.
`$page_path` string Required Page path. `$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_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
global $wpdb;
$last_changed = wp_cache_get_last_changed( 'posts' );
$hash = md5( $page_path . serialize( $post_type ) );
$cache_key = "get_page_by_path:$hash:$last_changed";
$cached = wp_cache_get( $cache_key, 'posts' );
if ( false !== $cached ) {
// Special case: '0' is a bad `$page_path`.
if ( '0' === $cached || 0 === $cached ) {
return;
} else {
return get_post( $cached, $output );
}
}
$page_path = rawurlencode( urldecode( $page_path ) );
$page_path = str_replace( '%2F', '/', $page_path );
$page_path = str_replace( '%20', ' ', $page_path );
$parts = explode( '/', trim( $page_path, '/' ) );
$parts = array_map( 'sanitize_title_for_query', $parts );
$escaped_parts = esc_sql( $parts );
$in_string = "'" . implode( "','", $escaped_parts ) . "'";
if ( is_array( $post_type ) ) {
$post_types = $post_type;
} else {
$post_types = array( $post_type, 'attachment' );
}
$post_types = esc_sql( $post_types );
$post_type_in_string = "'" . implode( "','", $post_types ) . "'";
$sql = "
SELECT ID, post_name, post_parent, post_type
FROM $wpdb->posts
WHERE post_name IN ($in_string)
AND post_type IN ($post_type_in_string)
";
$pages = $wpdb->get_results( $sql, OBJECT_K );
$revparts = array_reverse( $parts );
$foundid = 0;
foreach ( (array) $pages as $page ) {
if ( $page->post_name == $revparts[0] ) {
$count = 0;
$p = $page;
/*
* Loop through the given path parts from right to left,
* ensuring each matches the post ancestry.
*/
while ( 0 != $p->post_parent && isset( $pages[ $p->post_parent ] ) ) {
$count++;
$parent = $pages[ $p->post_parent ];
if ( ! isset( $revparts[ $count ] ) || $parent->post_name != $revparts[ $count ] ) {
break;
}
$p = $parent;
}
if ( 0 == $p->post_parent && count( $revparts ) == $count + 1 && $p->post_name == $revparts[ $count ] ) {
$foundid = $page->ID;
if ( $page->post_type == $post_type ) {
break;
}
}
}
}
// We cache misses as well as hits.
wp_cache_set( $cache_key, $foundid, 'posts' );
if ( $foundid ) {
return get_post( $foundid, $output );
}
return null;
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_get\_last\_changed()](wp_cache_get_last_changed) wp-includes/functions.php | Gets last changed date for the specified cache group. |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [esc\_sql()](esc_sql) wp-includes/formatting.php | Escapes data for use in a MySQL query. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [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). |
| Used By | Description |
| --- | --- |
| [get\_post\_embed\_url()](get_post_embed_url) wp-includes/embed.php | Retrieves the URL to embed a specific post in an iframe. |
| [wp\_resolve\_numeric\_slug\_conflicts()](wp_resolve_numeric_slug_conflicts) wp-includes/rewrite.php | Resolves numeric slugs that collide with date permalinks. |
| [wp\_install\_maybe\_enable\_pretty\_permalinks()](wp_install_maybe_enable_pretty_permalinks) wp-admin/includes/upgrade.php | Maybe enable pretty permalinks on installation. |
| [WP::parse\_request()](../classes/wp/parse_request) wp-includes/class-wp.php | Parses the request to find the correct WordPress query. |
| [WP\_Query::is\_page()](../classes/wp_query/is_page) wp-includes/class-wp-query.php | Is the query for an existing single page? |
| [WP\_Query::is\_single()](../classes/wp_query/is_single) wp-includes/class-wp-query.php | Is the query for an existing single post? |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| [WP\_Query::parse\_query()](../classes/wp_query/parse_query) wp-includes/class-wp-query.php | Parse a query string and set query type booleans. |
| [url\_to\_postid()](url_to_postid) wp-includes/rewrite.php | Examines a URL and try to determine the post ID it represents. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress media_upload_form_handler(): null|array|void media\_upload\_form\_handler(): null|array|void
===============================================
Handles form submissions for the legacy media uploader.
null|array|void Array of error messages keyed by attachment ID, null or void on success.
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function media_upload_form_handler() {
check_admin_referer( 'media-form' );
$errors = null;
if ( isset( $_POST['send'] ) ) {
$keys = array_keys( $_POST['send'] );
$send_id = (int) reset( $keys );
}
if ( ! empty( $_POST['attachments'] ) ) {
foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
$post = get_post( $attachment_id, ARRAY_A );
$_post = $post;
if ( ! current_user_can( 'edit_post', $attachment_id ) ) {
continue;
}
if ( isset( $attachment['post_content'] ) ) {
$post['post_content'] = $attachment['post_content'];
}
if ( isset( $attachment['post_title'] ) ) {
$post['post_title'] = $attachment['post_title'];
}
if ( isset( $attachment['post_excerpt'] ) ) {
$post['post_excerpt'] = $attachment['post_excerpt'];
}
if ( isset( $attachment['menu_order'] ) ) {
$post['menu_order'] = $attachment['menu_order'];
}
if ( isset( $send_id ) && $attachment_id == $send_id ) {
if ( isset( $attachment['post_parent'] ) ) {
$post['post_parent'] = $attachment['post_parent'];
}
}
/**
* Filters the attachment fields to be saved.
*
* @since 2.5.0
*
* @see wp_get_attachment_metadata()
*
* @param array $post An array of post data.
* @param array $attachment An array of attachment metadata.
*/
$post = apply_filters( 'attachment_fields_to_save', $post, $attachment );
if ( isset( $attachment['image_alt'] ) ) {
$image_alt = wp_unslash( $attachment['image_alt'] );
if ( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) !== $image_alt ) {
$image_alt = wp_strip_all_tags( $image_alt, true );
// update_post_meta() expects slashed.
update_post_meta( $attachment_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
}
}
if ( isset( $post['errors'] ) ) {
$errors[ $attachment_id ] = $post['errors'];
unset( $post['errors'] );
}
if ( $post != $_post ) {
wp_update_post( $post );
}
foreach ( get_attachment_taxonomies( $post ) as $t ) {
if ( isset( $attachment[ $t ] ) ) {
wp_set_object_terms( $attachment_id, array_map( 'trim', preg_split( '/,+/', $attachment[ $t ] ) ), $t, false );
}
}
}
}
if ( isset( $_POST['insert-gallery'] ) || isset( $_POST['update-gallery'] ) ) {
?>
<script type="text/javascript">
var win = window.dialogArguments || opener || parent || top;
win.tb_remove();
</script>
<?php
exit;
}
if ( isset( $send_id ) ) {
$attachment = wp_unslash( $_POST['attachments'][ $send_id ] );
$html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
if ( ! empty( $attachment['url'] ) ) {
$rel = '';
if ( strpos( $attachment['url'], 'attachment_id' ) || get_attachment_link( $send_id ) == $attachment['url'] ) {
$rel = " rel='attachment wp-att-" . esc_attr( $send_id ) . "'";
}
$html = "<a href='{$attachment['url']}'$rel>$html</a>";
}
/**
* Filters the HTML markup for a media item sent to the editor.
*
* @since 2.5.0
*
* @see wp_get_attachment_metadata()
*
* @param string $html HTML markup for a media item sent to the editor.
* @param int $send_id The first key from the $_POST['send'] data.
* @param array $attachment Array of attachment metadata.
*/
$html = apply_filters( 'media_send_to_editor', $html, $send_id, $attachment );
return media_send_to_editor( $html );
}
return $errors;
}
```
[apply\_filters( 'attachment\_fields\_to\_save', array $post, array $attachment )](../hooks/attachment_fields_to_save)
Filters the attachment fields to be saved.
[apply\_filters( 'media\_send\_to\_editor', string $html, int $send\_id, array $attachment )](../hooks/media_send_to_editor)
Filters the HTML markup for a media item sent to the editor.
| Uses | Description |
| --- | --- |
| [media\_send\_to\_editor()](media_send_to_editor) wp-admin/includes/media.php | Adds image HTML to editor. |
| [wp\_strip\_all\_tags()](wp_strip_all_tags) wp-includes/formatting.php | Properly strips all HTML tags including script and style |
| [check\_admin\_referer()](check_admin_referer) wp-includes/pluggable.php | Ensures intent by verifying that a user was referred from another admin page with the correct security nonce. |
| [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [get\_attachment\_taxonomies()](get_attachment_taxonomies) wp-includes/media.php | Retrieves taxonomies attached to given the attachment. |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within 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. |
| [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\_media\_upload\_handler()](wp_media_upload_handler) wp-admin/includes/media.php | Handles the process of uploading media. |
| [media\_upload\_gallery()](media_upload_gallery) wp-admin/includes/media.php | Retrieves the legacy media uploader form in an iframe. |
| [media\_upload\_library()](media_upload_library) wp-admin/includes/media.php | Retrieves the legacy media library form in an iframe. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
| programming_docs |
wordpress wp_ajax_send_attachment_to_editor() wp\_ajax\_send\_attachment\_to\_editor()
========================================
Ajax handler for sending an attachment to the editor.
Generates the HTML to send an attachment to the editor.
Backward compatible with the [‘media\_send\_to\_editor’](../hooks/media_send_to_editor) filter and the chain of filters that follow.
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_send_attachment_to_editor() {
check_ajax_referer( 'media-send-to-editor', 'nonce' );
$attachment = wp_unslash( $_POST['attachment'] );
$id = (int) $attachment['id'];
$post = get_post( $id );
if ( ! $post ) {
wp_send_json_error();
}
if ( 'attachment' !== $post->post_type ) {
wp_send_json_error();
}
if ( current_user_can( 'edit_post', $id ) ) {
// If this attachment is unattached, attach it. Primarily a back compat thing.
$insert_into_post_id = (int) $_POST['post_id'];
if ( 0 == $post->post_parent && $insert_into_post_id ) {
wp_update_post(
array(
'ID' => $id,
'post_parent' => $insert_into_post_id,
)
);
}
}
$url = empty( $attachment['url'] ) ? '' : $attachment['url'];
$rel = ( strpos( $url, 'attachment_id' ) || get_attachment_link( $id ) == $url );
remove_filter( 'media_send_to_editor', 'image_media_send_to_editor' );
if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) {
$align = isset( $attachment['align'] ) ? $attachment['align'] : 'none';
$size = isset( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium';
$alt = isset( $attachment['image_alt'] ) ? $attachment['image_alt'] : '';
// No whitespace-only captions.
$caption = isset( $attachment['post_excerpt'] ) ? $attachment['post_excerpt'] : '';
if ( '' === trim( $caption ) ) {
$caption = '';
}
$title = ''; // We no longer insert title tags into <img> tags, as they are redundant.
$html = get_image_send_to_editor( $id, $caption, $title, $align, $url, $rel, $size, $alt );
} elseif ( wp_attachment_is( 'video', $post ) || wp_attachment_is( 'audio', $post ) ) {
$html = stripslashes_deep( $_POST['html'] );
} else {
$html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
$rel = $rel ? ' rel="attachment wp-att-' . $id . '"' : ''; // Hard-coded string, $id is already sanitized.
if ( ! empty( $url ) ) {
$html = '<a href="' . esc_url( $url ) . '"' . $rel . '>' . $html . '</a>';
}
}
/** This filter is documented in wp-admin/includes/media.php */
$html = apply_filters( 'media_send_to_editor', $html, $id, $attachment );
wp_send_json_success( $html );
}
```
[apply\_filters( 'media\_send\_to\_editor', string $html, int $send\_id, array $attachment )](../hooks/media_send_to_editor)
Filters the HTML markup for a media item sent to the editor.
| Uses | Description |
| --- | --- |
| [wp\_attachment\_is()](wp_attachment_is) wp-includes/post.php | Verifies an attachment is of a given type. |
| [get\_image\_send\_to\_editor()](get_image_send_to_editor) wp-admin/includes/media.php | Retrieves the image HTML to send to the editor. |
| [stripslashes\_deep()](stripslashes_deep) wp-includes/formatting.php | Navigates through an array, object, or scalar, and removes slashes from the values. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress delete_meta( int $mid ): bool delete\_meta( int $mid ): bool
==============================
Deletes post meta data by meta ID.
`$mid` int Required bool
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function delete_meta( $mid ) {
return delete_metadata_by_mid( 'post', $mid );
}
```
| Uses | Description |
| --- | --- |
| [delete\_metadata\_by\_mid()](delete_metadata_by_mid) wp-includes/meta.php | Deletes metadata by meta ID. |
| Used By | Description |
| --- | --- |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [wp\_ajax\_delete\_meta()](wp_ajax_delete_meta) wp-admin/includes/ajax-actions.php | Ajax handler for deleting meta. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress wp_dashboard_rss_output( string $widget_id ) wp\_dashboard\_rss\_output( string $widget\_id )
================================================
Display generic dashboard RSS widget feed.
`$widget_id` string Required File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_dashboard_rss_output( $widget_id ) {
$widgets = get_option( 'dashboard_widget_options' );
echo '<div class="rss-widget">';
wp_widget_rss_output( $widgets[ $widget_id ] );
echo '</div>';
}
```
| Uses | Description |
| --- | --- |
| [wp\_widget\_rss\_output()](wp_widget_rss_output) wp-includes/widgets.php | Display the RSS entries in a list. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_increase_content_media_count( int $amount = 1 ): int wp\_increase\_content\_media\_count( int $amount = 1 ): int
===========================================================
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.
Increases an internal content media count variable.
`$amount` int Optional Amount to increase by. Default: `1`
int The latest content media count, after the increase.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_increase_content_media_count( $amount = 1 ) {
static $content_media_count = 0;
$content_media_count += $amount;
return $content_media_count;
}
```
| 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 wp_recovery_mode_nag() wp\_recovery\_mode\_nag()
=========================
Displays a notice when the user is in recovery mode.
File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
```
function wp_recovery_mode_nag() {
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 );
?>
<div class="notice notice-info">
<p>
<?php
printf(
/* translators: %s: Recovery Mode exit link. */
__( 'You are in recovery mode. This means there may be an error with a theme or plugin. To exit recovery mode, log out or use the Exit button. <a href="%s">Exit Recovery Mode</a>' ),
esc_url( $url )
);
?>
</p>
</div>
<?php
}
```
| 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-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [add\_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 newblog_notify_siteadmin( WP_Site|int $blog_id, string $deprecated = '' ): bool newblog\_notify\_siteadmin( WP\_Site|int $blog\_id, string $deprecated = '' ): bool
===================================================================================
Notifies the network admin that a new site has been activated.
Filter [‘newblog\_notify\_siteadmin’](../hooks/newblog_notify_siteadmin) to change the content of the notification email.
`$blog_id` [WP\_Site](../classes/wp_site)|int Required The new site's object or ID. `$deprecated` string Optional Not used. Default: `''`
bool
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
if ( is_object( $blog_id ) ) {
$blog_id = $blog_id->blog_id;
}
if ( 'yes' !== get_site_option( 'registrationnotification' ) ) {
return false;
}
$email = get_site_option( 'admin_email' );
if ( is_email( $email ) == false ) {
return false;
}
$options_site_url = esc_url( network_admin_url( 'settings.php' ) );
switch_to_blog( $blog_id );
$blogname = get_option( 'blogname' );
$siteurl = site_url();
restore_current_blog();
$msg = sprintf(
/* translators: New site notification email. 1: Site URL, 2: User IP address, 3: URL to Network Settings screen. */
__(
'New Site: %1$s
URL: %2$s
Remote IP address: %3$s
Disable these notifications: %4$s'
),
$blogname,
$siteurl,
wp_unslash( $_SERVER['REMOTE_ADDR'] ),
$options_site_url
);
/**
* Filters the message body of the new site activation email sent
* to the network administrator.
*
* @since MU (3.0.0)
* @since 5.4.0 The `$blog_id` parameter was added.
*
* @param string $msg Email body.
* @param int|string $blog_id The new site's ID as an integer or numeric string.
*/
$msg = apply_filters( 'newblog_notify_siteadmin', $msg, $blog_id );
/* translators: New site notification email subject. %s: New site URL. */
wp_mail( $email, sprintf( __( 'New Site Registration: %s' ), $siteurl ), $msg );
return true;
}
```
[apply\_filters( 'newblog\_notify\_siteadmin', string $msg, int|string $blog\_id )](../hooks/newblog_notify_siteadmin)
Filters the message body of the new site activation email sent to the network administrator.
| Uses | Description |
| --- | --- |
| [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. |
| [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the 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. |
| [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) . |
| [\_\_()](__) 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\_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\_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/) | MU (3.0.0) |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress _future_post_hook( int $deprecated, WP_Post $post ) \_future\_post\_hook( int $deprecated, 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.
Hook used to schedule publication for a post marked for the future.
The $post properties used and must exist are ‘ID’ and ‘post\_date\_gmt’.
`$deprecated` int Required Not used. Can be set to null. Never implemented. Not marked as deprecated with [\_deprecated\_argument()](_deprecated_argument) as it conflicts with [wp\_transition\_post\_status()](wp_transition_post_status) and the default filter for [\_future\_post\_hook()](_future_post_hook) . More Arguments from \_future\_post\_hook( ... $deprecated ) Not used. Can be set to null. Never implemented. Not marked as deprecated with [\_deprecated\_argument()](_deprecated_argument) as it conflicts with [wp\_transition\_post\_status()](wp_transition_post_status) and the default filter for [\_future\_post\_hook()](_future_post_hook) . `$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 _future_post_hook( $deprecated, $post ) {
wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) );
wp_schedule_single_event( strtotime( get_gmt_from_date( $post->post_date ) . ' GMT' ), 'publish_future_post', array( $post->ID ) );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [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. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress add_contextual_help( string $screen, string $help ) add\_contextual\_help( string $screen, string $help )
=====================================================
This function has been deprecated. Use [WP\_Screen::add\_help\_tab()](../classes/wp_screen/add_help_tab) instead.
Add contextual help text for a page.
Creates an ‘Overview’ help tab.
* [WP\_Screen::add\_help\_tab()](../classes/wp_screen/add_help_tab)
`$screen` string Required The handle for the screen to add help to. This is usually the hook name returned by the `add_*_page()` functions. `$help` string Required The content of an `'Overview'` help tab. File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function add_contextual_help( $screen, $help ) {
_deprecated_function( __FUNCTION__, '3.3.0', 'get_current_screen()->add_help_tab()' );
if ( is_string( $screen ) )
$screen = convert_to_screen( $screen );
WP_Screen::add_old_compat_help( $screen, $help );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Screen::add\_old\_compat\_help()](../classes/wp_screen/add_old_compat_help) wp-admin/includes/class-wp-screen.php | Sets the old string-based contextual help for the screen for backward compatibility. |
| [convert\_to\_screen()](convert_to_screen) wp-admin/includes/template.php | Converts a screen string to a 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::add\_help\_tab()](../classes/wp_screen/add_help_tab) |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress includes_url( string $path = '', string|null $scheme = null ): string includes\_url( string $path = '', string|null $scheme = null ): string
======================================================================
Retrieves the URL to the includes directory.
`$path` string Optional Path relative to the includes URL. Default: `''`
`$scheme` string|null Optional Scheme to give the includes URL context. Accepts `'http'`, `'https'`, or `'relative'`. Default: `null`
string Includes URL link with optional path appended.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function includes_url( $path = '', $scheme = null ) {
$url = site_url( '/' . WPINC . '/', $scheme );
if ( $path && is_string( $path ) ) {
$url .= ltrim( $path, '/' );
}
/**
* Filters the URL to the includes directory.
*
* @since 2.8.0
* @since 5.8.0 The `$scheme` parameter was added.
*
* @param string $url The complete URL to the includes directory including scheme and path.
* @param string $path Path relative to the URL to the wp-includes directory. Blank string
* if no path is specified.
* @param string|null $scheme Scheme to give the includes URL context. Accepts
* 'http', 'https', 'relative', or null. Default null.
*/
return apply_filters( 'includes_url', $url, $path, $scheme );
}
```
[apply\_filters( 'includes\_url', string $url, string $path, string|null $scheme )](../hooks/includes_url)
Filters the URL to the includes directory.
| 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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| 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. |
| [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. |
| [do\_favicon()](do_favicon) wp-includes/functions.php | Displays the favicon.ico file content. |
| [wp\_register\_tinymce\_scripts()](wp_register_tinymce_scripts) wp-includes/script-loader.php | Registers TinyMCE scripts. |
| [wp\_tinymce\_inline\_scripts()](wp_tinymce_inline_scripts) wp-includes/script-loader.php | Adds inline scripts required for the TinyMCE in the block editor. |
| [\_WP\_Editors::get\_baseurl()](../classes/_wp_editors/get_baseurl) wp-includes/class-wp-editor.php | Returns the TinyMCE base URL. |
| [\_WP\_Editors::default\_settings()](../classes/_wp_editors/default_settings) wp-includes/class-wp-editor.php | Returns the default TinyMCE settings. |
| [the\_embed\_site\_title()](the_embed_site_title) wp-includes/embed.php | Prints the necessary markup for the site title in an embed template. |
| [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. |
| [wp\_ajax\_parse\_embed()](wp_ajax_parse_embed) wp-admin/includes/ajax-actions.php | Apply [embed] Ajax handlers to a string. |
| [\_thickbox\_path\_admin\_subfolder()](_thickbox_path_admin_subfolder) wp-admin/includes/ms.php | Thickbox image paths for Network Admin. |
| [translate\_smiley()](translate_smiley) wp-includes/formatting.php | Converts one smiley code to the icon graphic file equivalent. |
| [wlwmanifest\_link()](wlwmanifest_link) wp-includes/general-template.php | Displays the link to the Windows Live Writer manifest file. |
| [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\_mime\_type\_icon()](wp_mime_type_icon) wp-includes/post.php | Retrieves the icon for a MIME type or attachment. |
| [wp\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
| programming_docs |
wordpress get_attachment_template(): string get\_attachment\_template(): string
===================================
Retrieves path of attachment template in current or parent template.
The hierarchy for this template looks like:
1. {mime\_type}-{sub\_type}.php
2. {sub\_type}.php
3. {mime\_type}.php
4. attachment.php
An example of this is:
1. image-jpeg.php
2. jpeg.php
3. image.php
4. attachment.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 ‘attachment’.
* [get\_query\_template()](get_query_template)
string Full path to attachment template file.
File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
```
function get_attachment_template() {
$attachment = get_queried_object();
$templates = array();
if ( $attachment ) {
if ( false !== strpos( $attachment->post_mime_type, '/' ) ) {
list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
} else {
list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
}
if ( ! empty( $subtype ) ) {
$templates[] = "{$type}-{$subtype}.php";
$templates[] = "{$subtype}.php";
}
$templates[] = "{$type}.php";
}
$templates[] = 'attachment.php';
return get_query_template( 'attachment', $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.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | The order of the mime type logic was reversed so the hierarchy is more logical. |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_ajax_search_install_plugins() wp\_ajax\_search\_install\_plugins()
====================================
Ajax handler for searching plugins to install.
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_search_install_plugins() {
check_ajax_referer( 'updates' );
$pagenow = isset( $_POST['pagenow'] ) ? sanitize_key( $_POST['pagenow'] ) : '';
if ( 'plugin-install-network' === $pagenow || 'plugin-install' === $pagenow ) {
set_current_screen( $pagenow );
}
/** @var WP_Plugin_Install_List_Table $wp_list_table */
$wp_list_table = _get_list_table(
'WP_Plugin_Install_List_Table',
array(
'screen' => get_current_screen(),
)
);
$status = array();
if ( ! $wp_list_table->ajax_user_can() ) {
$status['errorMessage'] = __( 'Sorry, you are not allowed to manage plugins for this site.' );
wp_send_json_error( $status );
}
// Set the correct requester, so pagination works.
$_SERVER['REQUEST_URI'] = add_query_arg(
array_diff_key(
$_POST,
array(
'_ajax_nonce' => null,
'action' => null,
)
),
network_admin_url( 'plugin-install.php', 'relative' )
);
$wp_list_table->prepare_items();
ob_start();
$wp_list_table->display();
$status['count'] = (int) $wp_list_table->get_pagination_arg( 'total_items' );
$status['items'] = ob_get_clean();
wp_send_json_success( $status );
}
```
| Uses | Description |
| --- | --- |
| [set\_current\_screen()](set_current_screen) wp-admin/includes/screen.php | Set the current screen object |
| [get\_current\_screen()](get_current_screen) wp-admin/includes/screen.php | Get the current screen object |
| [WP\_List\_Table::display()](../classes/wp_list_table/display) wp-admin/includes/class-wp-list-table.php | Displays the table. |
| [WP\_List\_Table::ajax\_user\_can()](../classes/wp_list_table/ajax_user_can) wp-admin/includes/class-wp-list-table.php | Checks the current user’s permissions |
| [WP\_List\_Table::prepare\_items()](../classes/wp_list_table/prepare_items) wp-admin/includes/class-wp-list-table.php | Prepares the list of items for displaying. |
| [WP\_List\_Table::get\_pagination\_arg()](../classes/wp_list_table/get_pagination_arg) wp-admin/includes/class-wp-list-table.php | Access the pagination args. |
| [\_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. |
| [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the network. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [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. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress wp_dashboard() wp\_dashboard()
===============
Displays the dashboard.
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_dashboard() {
$screen = get_current_screen();
$columns = absint( $screen->get_columns() );
$columns_css = '';
if ( $columns ) {
$columns_css = " columns-$columns";
}
?>
<div id="dashboard-widgets" class="metabox-holder<?php echo $columns_css; ?>">
<div id="postbox-container-1" class="postbox-container">
<?php do_meta_boxes( $screen->id, 'normal', '' ); ?>
</div>
<div id="postbox-container-2" class="postbox-container">
<?php do_meta_boxes( $screen->id, 'side', '' ); ?>
</div>
<div id="postbox-container-3" class="postbox-container">
<?php do_meta_boxes( $screen->id, 'column3', '' ); ?>
</div>
<div id="postbox-container-4" class="postbox-container">
<?php do_meta_boxes( $screen->id, 'column4', '' ); ?>
</div>
</div>
<?php
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
}
```
| Uses | Description |
| --- | --- |
| [get\_current\_screen()](get_current_screen) wp-admin/includes/screen.php | Get the current screen object |
| [do\_meta\_boxes()](do_meta_boxes) wp-admin/includes/template.php | Meta-Box template function. |
| [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress install_global_terms() install\_global\_terms()
========================
This function has been deprecated.
Install global terms.
File: `wp-admin/includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms-deprecated.php/)
```
function install_global_terms() {
_deprecated_function( __FUNCTION__, '6.1.0' );
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | This function has been deprecated. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_block_theme_folders( string $theme_stylesheet = null ): string[] get\_block\_theme\_folders( string $theme\_stylesheet = null ): string[]
========================================================================
For backward compatibility reasons, block themes might be using block-templates or block-template-parts, this function ensures we fallback to these folders properly.
`$theme_stylesheet` string Optional The stylesheet. Default is to leverage the main theme root. Default: `null`
string[] Folder names used by block themes.
* `wp_template`stringTheme-relative directory name for block templates.
* `wp_template_part`stringTheme-relative directory name for block template parts.
File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function get_block_theme_folders( $theme_stylesheet = null ) {
$theme_name = null === $theme_stylesheet ? get_stylesheet() : $theme_stylesheet;
$root_dir = get_theme_root( $theme_name );
$theme_dir = "$root_dir/$theme_name";
if ( file_exists( $theme_dir . '/block-templates' ) || file_exists( $theme_dir . '/block-template-parts' ) ) {
return array(
'wp_template' => 'block-templates',
'wp_template_part' => 'block-template-parts',
);
}
return array(
'wp_template' => 'templates',
'wp_template_part' => 'parts',
);
}
```
| Uses | Description |
| --- | --- |
| [get\_theme\_root()](get_theme_root) wp-includes/theme.php | Retrieves path to themes directory. |
| [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. |
| 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 wp_ajax_send_password_reset() wp\_ajax\_send\_password\_reset()
=================================
Ajax handler sends a password reset link.
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_send_password_reset() {
// Validate the nonce for this action.
$user_id = isset( $_POST['user_id'] ) ? (int) $_POST['user_id'] : 0;
check_ajax_referer( 'reset-password-for-' . $user_id, 'nonce' );
// Verify user capabilities.
if ( ! current_user_can( 'edit_user', $user_id ) ) {
wp_send_json_error( __( 'Cannot send password reset, permission denied.' ) );
}
// Send the password reset link.
$user = get_userdata( $user_id );
$results = retrieve_password( $user->user_login );
if ( true === $results ) {
wp_send_json_success(
/* translators: %s: User's display name. */
sprintf( __( 'A password reset link was emailed to %s.' ), $user->display_name )
);
} else {
wp_send_json_error( $results->get_error_message() );
}
}
```
| Uses | Description |
| --- | --- |
| [retrieve\_password()](retrieve_password) wp-includes/user.php | Handles sending a password retrieval email to a user. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [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\_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.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress wp_dashboard_site_health() wp\_dashboard\_site\_health()
=============================
Displays the Site Health Status widget.
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_dashboard_site_health() {
$get_issues = get_transient( 'health-check-site-status-result' );
$issue_counts = array();
if ( false !== $get_issues ) {
$issue_counts = json_decode( $get_issues, true );
}
if ( ! is_array( $issue_counts ) || ! $issue_counts ) {
$issue_counts = array(
'good' => 0,
'recommended' => 0,
'critical' => 0,
);
}
$issues_total = $issue_counts['recommended'] + $issue_counts['critical'];
?>
<div class="health-check-widget">
<div class="health-check-widget-title-section site-health-progress-wrapper loading hide-if-no-js">
<div class="site-health-progress">
<svg role="img" aria-hidden="true" focusable="false" width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">
<circle r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
<circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
</svg>
</div>
<div class="site-health-progress-label">
<?php if ( false === $get_issues ) : ?>
<?php _e( 'No information yet…' ); ?>
<?php else : ?>
<?php _e( 'Results are still loading…' ); ?>
<?php endif; ?>
</div>
</div>
<div class="site-health-details">
<?php if ( false === $get_issues ) : ?>
<p>
<?php
printf(
/* translators: %s: URL to Site Health screen. */
__( 'Site health checks will automatically run periodically to gather information about your site. You can also <a href="%s">visit the Site Health screen</a> to gather information about your site now.' ),
esc_url( admin_url( 'site-health.php' ) )
);
?>
</p>
<?php else : ?>
<p>
<?php if ( $issues_total <= 0 ) : ?>
<?php _e( 'Great job! Your site currently passes all site health checks.' ); ?>
<?php elseif ( 1 === (int) $issue_counts['critical'] ) : ?>
<?php _e( 'Your site has a critical issue that should be addressed as soon as possible to improve its performance and security.' ); ?>
<?php elseif ( $issue_counts['critical'] > 1 ) : ?>
<?php _e( 'Your site has critical issues that should be addressed as soon as possible to improve its performance and security.' ); ?>
<?php elseif ( 1 === (int) $issue_counts['recommended'] ) : ?>
<?php _e( 'Your site’s health is looking good, but there is still one thing you can do to improve its performance and security.' ); ?>
<?php else : ?>
<?php _e( 'Your site’s health is looking good, but there are still some things you can do to improve its performance and security.' ); ?>
<?php endif; ?>
</p>
<?php endif; ?>
<?php if ( $issues_total > 0 && false !== $get_issues ) : ?>
<p>
<?php
printf(
/* translators: 1: Number of issues. 2: URL to Site Health screen. */
_n(
'Take a look at the <strong>%1$d item</strong> on the <a href="%2$s">Site Health screen</a>.',
'Take a look at the <strong>%1$d items</strong> on the <a href="%2$s">Site Health screen</a>.',
$issues_total
),
$issues_total,
esc_url( admin_url( 'site-health.php' ) )
);
?>
</p>
<?php endif; ?>
</div>
</div>
<?php
}
```
| Uses | Description |
| --- | --- |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [get\_transient()](get_transient) wp-includes/option.php | Retrieves the value of a transient. |
| [\_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. |
| Version | Description |
| --- | --- |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Introduced. |
wordpress wp_post_revision_title( int|object $revision, bool $link = true ): string|false wp\_post\_revision\_title( int|object $revision, bool $link = true ): string|false
==================================================================================
Retrieves formatted date timestamp of a revision (linked to that revisions’s page).
`$revision` int|object Required Revision ID or revision object. `$link` bool Optional Whether to link to revision's page. Default: `true`
string|false i18n formatted datetimestamp or localized 'Current Revision'.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function wp_post_revision_title( $revision, $link = true ) {
$revision = get_post( $revision );
if ( ! $revision ) {
return $revision;
}
if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ), true ) ) {
return false;
}
/* translators: Revision date format, see https://www.php.net/manual/datetime.format.php */
$datef = _x( 'F j, Y @ H:i:s', 'revision date format' );
/* translators: %s: Revision date. */
$autosavef = __( '%s [Autosave]' );
/* translators: %s: Revision date. */
$currentf = __( '%s [Current Revision]' );
$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
$edit_link = get_edit_post_link( $revision->ID );
if ( $link && current_user_can( 'edit_post', $revision->ID ) && $edit_link ) {
$date = "<a href='$edit_link'>$date</a>";
}
if ( ! wp_is_post_revision( $revision ) ) {
$date = sprintf( $currentf, $date );
} elseif ( wp_is_post_autosave( $revision ) ) {
$date = sprintf( $autosavef, $date );
}
return $date;
}
```
| 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. |
| [get\_edit\_post\_link()](get_edit_post_link) wp-includes/link-template.php | Retrieves the edit post link for post. |
| [wp\_is\_post\_autosave()](wp_is_post_autosave) wp-includes/revision.php | Determines if the specified post is an autosave. |
| [wp\_is\_post\_revision()](wp_is_post_revision) wp-includes/revision.php | Determines if the specified post is a revision. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [\_\_()](__) 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. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress wp_link_manager_disabled_message() wp\_link\_manager\_disabled\_message()
======================================
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 ‘disabled’ message for the WordPress Link Manager.
File: `wp-admin/includes/bookmark.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/bookmark.php/)
```
function wp_link_manager_disabled_message() {
global $pagenow;
if ( ! in_array( $pagenow, array( 'link-manager.php', 'link-add.php', 'link.php' ), true ) ) {
return;
}
add_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
$really_can_manage_links = current_user_can( 'manage_links' );
remove_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
if ( $really_can_manage_links ) {
$plugins = get_plugins();
if ( empty( $plugins['link-manager/link-manager.php'] ) ) {
if ( current_user_can( 'install_plugins' ) ) {
$install_url = wp_nonce_url(
self_admin_url( 'update.php?action=install-plugin&plugin=link-manager' ),
'install-plugin_link-manager'
);
wp_die(
sprintf(
/* translators: %s: A link to install the Link Manager plugin. */
__( 'If you are looking to use the link manager, please install the <a href="%s">Link Manager plugin</a>.' ),
esc_url( $install_url )
)
);
}
} elseif ( is_plugin_inactive( 'link-manager/link-manager.php' ) ) {
if ( current_user_can( 'activate_plugins' ) ) {
$activate_url = wp_nonce_url(
self_admin_url( 'plugins.php?action=activate&plugin=link-manager/link-manager.php' ),
'activate-plugin_link-manager/link-manager.php'
);
wp_die(
sprintf(
/* translators: %s: A link to activate the Link Manager plugin. */
__( 'Please activate the <a href="%s">Link Manager plugin</a> to use the link manager.' ),
esc_url( $activate_url )
)
);
}
}
}
wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) );
}
```
| Uses | Description |
| --- | --- |
| [is\_plugin\_inactive()](is_plugin_inactive) wp-admin/includes/plugin.php | Determines whether the plugin is inactive. |
| [get\_plugins()](get_plugins) wp-admin/includes/plugin.php | Checks the plugins directory and retrieve all plugin files with plugin data. |
| [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. |
| [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. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
| programming_docs |
wordpress block_template_part( string $part ) block\_template\_part( string $part )
=====================================
Prints a block template part.
`$part` string Required The block template part to print. Use "header" or "footer". File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function block_template_part( $part ) {
$template_part = get_block_template( get_stylesheet() . '//' . $part, 'wp_template_part' );
if ( ! $template_part || empty( $template_part->content ) ) {
return;
}
echo do_blocks( $template_part->content );
}
```
| Uses | Description |
| --- | --- |
| [get\_block\_template()](get_block_template) wp-includes/block-template-utils.php | Retrieves a single unified template object using its id. |
| [do\_blocks()](do_blocks) wp-includes/blocks.php | Parses dynamic blocks out of `post_content` and re-renders them. |
| [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. |
| Used By | Description |
| --- | --- |
| [block\_header\_area()](block_header_area) wp-includes/block-template-utils.php | Prints the header block template part. |
| [block\_footer\_area()](block_footer_area) wp-includes/block-template-utils.php | Prints the footer block template part. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress wp_default_packages_inline_scripts( WP_Scripts $scripts ) wp\_default\_packages\_inline\_scripts( WP\_Scripts $scripts )
==============================================================
Adds inline scripts required for the WordPress JavaScript packages.
`$scripts` [WP\_Scripts](../classes/wp_scripts) Required [WP\_Scripts](../classes/wp_scripts) object. File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_default_packages_inline_scripts( $scripts ) {
global $wp_locale, $wpdb;
if ( isset( $scripts->registered['wp-api-fetch'] ) ) {
$scripts->registered['wp-api-fetch']->deps[] = 'wp-hooks';
}
$scripts->add_inline_script(
'wp-api-fetch',
sprintf(
'wp.apiFetch.use( wp.apiFetch.createRootURLMiddleware( "%s" ) );',
sanitize_url( get_rest_url() )
),
'after'
);
$scripts->add_inline_script(
'wp-api-fetch',
implode(
"\n",
array(
sprintf(
'wp.apiFetch.nonceMiddleware = wp.apiFetch.createNonceMiddleware( "%s" );',
wp_installing() ? '' : wp_create_nonce( 'wp_rest' )
),
'wp.apiFetch.use( wp.apiFetch.nonceMiddleware );',
'wp.apiFetch.use( wp.apiFetch.mediaUploadMiddleware );',
sprintf(
'wp.apiFetch.nonceEndpoint = "%s";',
admin_url( 'admin-ajax.php?action=rest-nonce' )
),
)
),
'after'
);
$meta_key = $wpdb->get_blog_prefix() . 'persisted_preferences';
$user_id = get_current_user_id();
$preload_data = get_user_meta( $user_id, $meta_key, true );
$scripts->add_inline_script(
'wp-preferences',
sprintf(
'( function() {
var serverData = %s;
var userId = "%d";
var persistenceLayer = wp.preferencesPersistence.__unstableCreatePersistenceLayer( serverData, userId );
var preferencesStore = wp.preferences.store;
wp.data.dispatch( preferencesStore ).setPersistenceLayer( persistenceLayer );
} ) ();',
wp_json_encode( $preload_data ),
$user_id
)
);
// Backwards compatibility - configure the old wp-data persistence system.
$scripts->add_inline_script(
'wp-data',
implode(
"\n",
array(
'( function() {',
' var userId = ' . get_current_user_ID() . ';',
' var storageKey = "WP_DATA_USER_" + userId;',
' wp.data',
' .use( wp.data.plugins.persistence, { storageKey: storageKey } );',
'} )();',
)
)
);
// Calculate the timezone abbr (EDT, PST) if possible.
$timezone_string = get_option( 'timezone_string', 'UTC' );
$timezone_abbr = '';
if ( ! empty( $timezone_string ) ) {
$timezone_date = new DateTime( 'now', new DateTimeZone( $timezone_string ) );
$timezone_abbr = $timezone_date->format( 'T' );
}
$scripts->add_inline_script(
'wp-date',
sprintf(
'wp.date.setSettings( %s );',
wp_json_encode(
array(
'l10n' => array(
'locale' => get_user_locale(),
'months' => array_values( $wp_locale->month ),
'monthsShort' => array_values( $wp_locale->month_abbrev ),
'weekdays' => array_values( $wp_locale->weekday ),
'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ),
'meridiem' => (object) $wp_locale->meridiem,
'relative' => array(
/* translators: %s: Duration. */
'future' => __( '%s from now' ),
/* translators: %s: Duration. */
'past' => __( '%s ago' ),
),
'startOfWeek' => (int) get_option( 'start_of_week', 0 ),
),
'formats' => array(
/* translators: Time format, see https://www.php.net/manual/datetime.format.php */
'time' => get_option( 'time_format', __( 'g:i a' ) ),
/* translators: Date format, see https://www.php.net/manual/datetime.format.php */
'date' => get_option( 'date_format', __( 'F j, Y' ) ),
/* translators: Date/Time format, see https://www.php.net/manual/datetime.format.php */
'datetime' => __( 'F j, Y g:i a' ),
/* translators: Abbreviated date/time format, see https://www.php.net/manual/datetime.format.php */
'datetimeAbbreviated' => __( 'M j, Y g:i a' ),
),
'timezone' => array(
'offset' => (float) get_option( 'gmt_offset', 0 ),
'string' => $timezone_string,
'abbr' => $timezone_abbr,
),
)
)
),
'after'
);
// Loading the old editor and its config to ensure the classic block works as expected.
$scripts->add_inline_script(
'editor',
'window.wp.oldEditor = window.wp.editor;',
'after'
);
/*
* wp-editor module is exposed as window.wp.editor.
* Problem: there is quite some code expecting window.wp.oldEditor object available under window.wp.editor.
* Solution: fuse the two objects together to maintain backward compatibility.
* For more context, see https://github.com/WordPress/gutenberg/issues/33203.
*/
$scripts->add_inline_script(
'wp-editor',
'Object.assign( window.wp.editor, window.wp.oldEditor );',
'after'
);
}
```
| Uses | Description |
| --- | --- |
| [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. |
| [get\_rest\_url()](get_rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint on a site. |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [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. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [get\_user\_meta()](get_user_meta) wp-includes/user.php | Retrieves user meta field for a user. |
| [wpdb::get\_blog\_prefix()](../classes/wpdb/get_blog_prefix) wp-includes/class-wpdb.php | Gets blog prefix. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [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. |
| Used By | Description |
| --- | --- |
| [wp\_default\_packages()](wp_default_packages) wp-includes/script-loader.php | Registers all the WordPress packages scripts. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress wp_get_single_post( int $postid, string $mode = OBJECT ): WP_Post|null wp\_get\_single\_post( int $postid, string $mode = OBJECT ): WP\_Post|null
==========================================================================
This function has been deprecated. Use [get\_post()](get_post) instead.
Retrieve a single post, based on post ID.
Has categories in ‘post\_category’ property or key. Has tags in ‘tags\_input’ property or key.
* [get\_post()](get_post)
`$postid` int Required Post ID. `$mode` string Optional How to return result, either OBJECT, ARRAY\_N, or ARRAY\_A. Default: `OBJECT`
[WP\_Post](../classes/wp_post)|null Post object or array holding post contents and information
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_get_single_post( $postid = 0, $mode = OBJECT ) {
_deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
return get_post( $postid, $mode );
}
```
| 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) |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress wp_scheduled_delete() wp\_scheduled\_delete()
=======================
Permanently deletes comments or posts of any type that have held a status of ‘trash’ for the number of days defined in EMPTY\_TRASH\_DAYS.
The default value of `EMPTY_TRASH_DAYS` is 30 (days).
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_scheduled_delete() {
global $wpdb;
$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
$posts_to_delete = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < %d", $delete_timestamp ), ARRAY_A );
foreach ( (array) $posts_to_delete as $post ) {
$post_id = (int) $post['post_id'];
if ( ! $post_id ) {
continue;
}
$del_post = get_post( $post_id );
if ( ! $del_post || 'trash' !== $del_post->post_status ) {
delete_post_meta( $post_id, '_wp_trash_meta_status' );
delete_post_meta( $post_id, '_wp_trash_meta_time' );
} else {
wp_delete_post( $post_id );
}
}
$comments_to_delete = $wpdb->get_results( $wpdb->prepare( "SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < %d", $delete_timestamp ), ARRAY_A );
foreach ( (array) $comments_to_delete as $comment ) {
$comment_id = (int) $comment['comment_id'];
if ( ! $comment_id ) {
continue;
}
$del_comment = get_comment( $comment_id );
if ( ! $del_comment || 'trash' !== $del_comment->comment_approved ) {
delete_comment_meta( $comment_id, '_wp_trash_meta_time' );
delete_comment_meta( $comment_id, '_wp_trash_meta_status' );
} else {
wp_delete_comment( $del_comment );
}
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. |
| [wp\_delete\_comment()](wp_delete_comment) wp-includes/comment.php | Trashes or deletes a comment. |
| [delete\_comment\_meta()](delete_comment_meta) wp-includes/comment.php | Removes metadata matching criteria from a comment. |
| [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. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress wp_mime_type_icon( string|int $mime ): string|false wp\_mime\_type\_icon( string|int $mime ): string|false
======================================================
Retrieves the icon for a MIME type or attachment.
`$mime` string|int Required MIME type or attachment ID. string|false Icon, false otherwise.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_mime_type_icon( $mime = 0 ) {
if ( ! is_numeric( $mime ) ) {
$icon = wp_cache_get( "mime_type_icon_$mime" );
}
$post_id = 0;
if ( empty( $icon ) ) {
$post_mimes = array();
if ( is_numeric( $mime ) ) {
$mime = (int) $mime;
$post = get_post( $mime );
if ( $post ) {
$post_id = (int) $post->ID;
$file = get_attached_file( $post_id );
$ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $file );
if ( ! empty( $ext ) ) {
$post_mimes[] = $ext;
$ext_type = wp_ext2type( $ext );
if ( $ext_type ) {
$post_mimes[] = $ext_type;
}
}
$mime = $post->post_mime_type;
} else {
$mime = 0;
}
} else {
$post_mimes[] = $mime;
}
$icon_files = wp_cache_get( 'icon_files' );
if ( ! is_array( $icon_files ) ) {
/**
* Filters the icon directory path.
*
* @since 2.0.0
*
* @param string $path Icon directory absolute path.
*/
$icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
/**
* Filters the icon directory URI.
*
* @since 2.0.0
*
* @param string $uri Icon directory URI.
*/
$icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url( 'images/media' ) );
/**
* Filters the array of icon directory URIs.
*
* @since 2.5.0
*
* @param string[] $uris Array of icon directory URIs keyed by directory absolute path.
*/
$dirs = apply_filters( 'icon_dirs', array( $icon_dir => $icon_dir_uri ) );
$icon_files = array();
while ( $dirs ) {
$keys = array_keys( $dirs );
$dir = array_shift( $keys );
$uri = array_shift( $dirs );
$dh = opendir( $dir );
if ( $dh ) {
while ( false !== $file = readdir( $dh ) ) {
$file = wp_basename( $file );
if ( '.' === substr( $file, 0, 1 ) ) {
continue;
}
$ext = strtolower( substr( $file, -4 ) );
if ( ! in_array( $ext, array( '.png', '.gif', '.jpg' ), true ) ) {
if ( is_dir( "$dir/$file" ) ) {
$dirs[ "$dir/$file" ] = "$uri/$file";
}
continue;
}
$icon_files[ "$dir/$file" ] = "$uri/$file";
}
closedir( $dh );
}
}
wp_cache_add( 'icon_files', $icon_files, 'default', 600 );
}
$types = array();
// Icon wp_basename - extension = MIME wildcard.
foreach ( $icon_files as $file => $uri ) {
$types[ preg_replace( '/^([^.]*).*$/', '$1', wp_basename( $file ) ) ] =& $icon_files[ $file ];
}
if ( ! empty( $mime ) ) {
$post_mimes[] = substr( $mime, 0, strpos( $mime, '/' ) );
$post_mimes[] = substr( $mime, strpos( $mime, '/' ) + 1 );
$post_mimes[] = str_replace( '/', '_', $mime );
}
$matches = wp_match_mime_types( array_keys( $types ), $post_mimes );
$matches['default'] = array( 'default' );
foreach ( $matches as $match => $wilds ) {
foreach ( $wilds as $wild ) {
if ( ! isset( $types[ $wild ] ) ) {
continue;
}
$icon = $types[ $wild ];
if ( ! is_numeric( $mime ) ) {
wp_cache_add( "mime_type_icon_$mime", $icon );
}
break 2;
}
}
}
/**
* Filters the mime type icon.
*
* @since 2.1.0
*
* @param string $icon Path to the mime type icon.
* @param string $mime Mime type.
* @param int $post_id Attachment ID. Will equal 0 if the function passed
* the mime type.
*/
return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id );
}
```
[apply\_filters( 'icon\_dir', string $path )](../hooks/icon_dir)
Filters the icon directory path.
[apply\_filters( 'icon\_dirs', string[] $uris )](../hooks/icon_dirs)
Filters the array of icon directory URIs.
[apply\_filters( 'icon\_dir\_uri', string $uri )](../hooks/icon_dir_uri)
Filters the icon directory URI.
[apply\_filters( 'wp\_mime\_type\_icon', string $icon, string $mime, int $post\_id )](../hooks/wp_mime_type_icon)
Filters the mime type icon.
| 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\_ext2type()](wp_ext2type) wp-includes/functions.php | Retrieves the file type based on the extension name. |
| [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. |
| [wp\_match\_mime\_types()](wp_match_mime_types) wp-includes/post.php | Checks a MIME-Type against a list. |
| [get\_attached\_file()](get_attached_file) wp-includes/post.php | Retrieves attached file path based on attachment ID. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [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. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [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. |
| [get\_attachment\_icon\_src()](get_attachment_icon_src) wp-includes/deprecated.php | Retrieve icon URL and Path. |
| [wp\_prepare\_attachment\_for\_js()](wp_prepare_attachment_for_js) wp-includes/media.php | Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model. |
| [wp\_playlist\_shortcode()](wp_playlist_shortcode) wp-includes/media.php | Builds the Playlist shortcode output. |
| [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) wp-includes/media.php | Retrieves an image to represent an attachment. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress add_role( string $role, string $display_name, bool[] $capabilities = array() ): WP_Role|void add\_role( string $role, string $display\_name, bool[] $capabilities = array() ): WP\_Role|void
===============================================================================================
Adds a role, if it does not exist.
`$role` string Required Role name. `$display_name` string Required Display name for role. `$capabilities` bool[] Optional List of capabilities keyed by the capability name, e.g. array( `'edit_posts'` => true, `'delete_posts'` => false ). Default: `array()`
[WP\_Role](../classes/wp_role)|void [WP\_Role](../classes/wp_role) object, if the role is added.
File: `wp-includes/capabilities.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/capabilities.php/)
```
function add_role( $role, $display_name, $capabilities = array() ) {
if ( empty( $role ) ) {
return;
}
return wp_roles()->add_role( $role, $display_name, $capabilities );
}
```
| Uses | Description |
| --- | --- |
| [wp\_roles()](wp_roles) wp-includes/capabilities.php | Retrieves the global [WP\_Roles](../classes/wp_roles) instance and instantiates it if necessary. |
| [WP\_Roles::add\_role()](../classes/wp_roles/add_role) wp-includes/class-wp-roles.php | Adds a role name with capabilities to the list. |
| Used By | Description |
| --- | --- |
| [populate\_roles\_160()](populate_roles_160) wp-admin/includes/schema.php | Create the roles for WordPress 2.0 |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress _get_path_to_translation( string $domain, bool $reset = false ): string|false \_get\_path\_to\_translation( string $domain, bool $reset = false ): string|false
=================================================================================
This function has been deprecated. Use [\_load\_textdomain\_just\_in\_time()](_load_textdomain_just_in_time) 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 [\_load\_textdomain\_just\_in\_time()](_load_textdomain_just_in_time) instead.
Gets the path to a translation file for loading a textdomain just in time.
Caches the retrieved results internally.
* [\_load\_textdomain\_just\_in\_time()](_load_textdomain_just_in_time)
`$domain` string Required Text domain. Unique identifier for retrieving translated strings. `$reset` bool Optional Whether to reset the internal cache. Used by the switch to locale functionality. Default: `false`
string|false The path to the translation file or false if no translation file was found.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function _get_path_to_translation( $domain, $reset = false ) {
_deprecated_function( __FUNCTION__, '6.1.0', 'WP_Textdomain_Registry' );
static $available_translations = array();
if ( true === $reset ) {
$available_translations = array();
}
if ( ! isset( $available_translations[ $domain ] ) ) {
$available_translations[ $domain ] = _get_path_to_translation_from_lang_dir( $domain );
}
return $available_translations[ $domain ];
}
```
| Uses | Description |
| --- | --- |
| [\_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. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | This function has been deprecated. Use [\_load\_textdomain\_just\_in\_time()](_load_textdomain_just_in_time) instead. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress wp_delete_comment( int|WP_Comment $comment_id, bool $force_delete = false ): bool wp\_delete\_comment( int|WP\_Comment $comment\_id, bool $force\_delete = false ): bool
======================================================================================
Trashes or deletes a comment.
The comment is moved to Trash instead of permanently deleted unless Trash is disabled, item is already in the Trash, or $force\_delete is true.
The post comment count will be updated if the comment was approved and has a post ID available.
`$comment_id` int|[WP\_Comment](../classes/wp_comment) Required Comment ID or [WP\_Comment](../classes/wp_comment) object. `$force_delete` bool Optional Whether to bypass Trash and force deletion. Default: `false`
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_delete_comment( $comment_id, $force_delete = false ) {
global $wpdb;
$comment = get_comment( $comment_id );
if ( ! $comment ) {
return false;
}
if ( ! $force_delete && EMPTY_TRASH_DAYS && ! in_array( wp_get_comment_status( $comment ), array( 'trash', 'spam' ), true ) ) {
return wp_trash_comment( $comment_id );
}
/**
* Fires immediately before a comment is deleted from the database.
*
* @since 1.2.0
* @since 4.9.0 Added the `$comment` parameter.
*
* @param string $comment_id The comment ID as a numeric string.
* @param WP_Comment $comment The comment to be deleted.
*/
do_action( 'delete_comment', $comment->comment_ID, $comment );
// Move children up a level.
$children = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_parent = %d", $comment->comment_ID ) );
if ( ! empty( $children ) ) {
$wpdb->update( $wpdb->comments, array( 'comment_parent' => $comment->comment_parent ), array( 'comment_parent' => $comment->comment_ID ) );
clean_comment_cache( $children );
}
// Delete metadata.
$meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->commentmeta WHERE comment_id = %d", $comment->comment_ID ) );
foreach ( $meta_ids as $mid ) {
delete_metadata_by_mid( 'comment', $mid );
}
if ( ! $wpdb->delete( $wpdb->comments, array( 'comment_ID' => $comment->comment_ID ) ) ) {
return false;
}
/**
* Fires immediately after a comment is deleted from the database.
*
* @since 2.9.0
* @since 4.9.0 Added the `$comment` parameter.
*
* @param string $comment_id The comment ID as a numeric string.
* @param WP_Comment $comment The deleted comment.
*/
do_action( 'deleted_comment', $comment->comment_ID, $comment );
$post_id = $comment->comment_post_ID;
if ( $post_id && 1 == $comment->comment_approved ) {
wp_update_comment_count( $post_id );
}
clean_comment_cache( $comment->comment_ID );
/** This action is documented in wp-includes/comment.php */
do_action( 'wp_set_comment_status', $comment->comment_ID, 'delete' );
wp_transition_comment_status( 'delete', $comment->comment_approved, $comment );
return true;
}
```
[do\_action( 'deleted\_comment', string $comment\_id, WP\_Comment $comment )](../hooks/deleted_comment)
Fires immediately after a comment is deleted from the database.
[do\_action( 'delete\_comment', string $comment\_id, WP\_Comment $comment )](../hooks/delete_comment)
Fires immediately before a comment is deleted from the database.
[do\_action( 'wp\_set\_comment\_status', string $comment\_id, string $comment\_status )](../hooks/wp_set_comment_status)
Fires immediately after transitioning a comment’s status from one to another in the database and removing the comment from the object cache, but prior to all status transition hooks.
| Uses | Description |
| --- | --- |
| [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. |
| [wpdb::delete()](../classes/wpdb/delete) wp-includes/class-wpdb.php | Deletes a row in the table. |
| [clean\_comment\_cache()](clean_comment_cache) wp-includes/comment.php | Removes a comment from the object cache. |
| [wp\_update\_comment\_count()](wp_update_comment_count) wp-includes/comment.php | Updates the comment count for post(s). |
| [wp\_get\_comment\_status()](wp_get_comment_status) wp-includes/comment.php | Retrieves the status of a comment by comment ID. |
| [wp\_transition\_comment\_status()](wp_transition_comment_status) wp-includes/comment.php | Calls hooks for when a comment status transition occurs. |
| [wp\_trash\_comment()](wp_trash_comment) wp-includes/comment.php | Moves a comment to the Trash |
| [delete\_metadata\_by\_mid()](delete_metadata_by_mid) wp-includes/meta.php | Deletes metadata by meta ID. |
| [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. |
| [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::delete\_item()](../classes/wp_rest_comments_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Deletes a comment. |
| [wp\_ajax\_delete\_comment()](wp_ajax_delete_comment) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a comment. |
| [wp\_scheduled\_delete()](wp_scheduled_delete) wp-includes/functions.php | Permanently deletes comments or posts of any type that have held a status of ‘trash’ for the number of days defined in EMPTY\_TRASH\_DAYS. |
| [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [wp\_xmlrpc\_server::wp\_deleteComment()](../classes/wp_xmlrpc_server/wp_deletecomment) wp-includes/class-wp-xmlrpc-server.php | Delete a comment. |
| [wp\_trash\_comment()](wp_trash_comment) wp-includes/comment.php | Moves a comment to the Trash |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress load_image_to_edit( int $attachment_id, string $mime_type, string|int[] $size = 'full' ): resource|GdImage|false load\_image\_to\_edit( int $attachment\_id, string $mime\_type, string|int[] $size = 'full' ): resource|GdImage|false
=====================================================================================================================
Loads an image resource for editing.
`$attachment_id` int Required Attachment ID. `$mime_type` string Required Image mime type. `$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'`
resource|GdImage|false The resulting image resource or GdImage instance 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( $attachment_id, $mime_type, $size = 'full' ) {
$filepath = _load_image_to_edit_path( $attachment_id, $size );
if ( empty( $filepath ) ) {
return false;
}
switch ( $mime_type ) {
case 'image/jpeg':
$image = imagecreatefromjpeg( $filepath );
break;
case 'image/png':
$image = imagecreatefrompng( $filepath );
break;
case 'image/gif':
$image = imagecreatefromgif( $filepath );
break;
case 'image/webp':
$image = false;
if ( function_exists( 'imagecreatefromwebp' ) ) {
$image = imagecreatefromwebp( $filepath );
}
break;
default:
$image = false;
break;
}
if ( is_gd_image( $image ) ) {
/**
* Filters the current image being loaded for editing.
*
* @since 2.9.0
*
* @param resource|GdImage $image 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).
*/
$image = apply_filters( 'load_image_to_edit', $image, $attachment_id, $size );
if ( function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) {
imagealphablending( $image, false );
imagesavealpha( $image, true );
}
}
return $image;
}
```
[apply\_filters( 'load\_image\_to\_edit', resource|GdImage $image, int $attachment\_id, string|int[] $size )](../hooks/load_image_to_edit)
Filters the current image being loaded for editing.
| Uses | Description |
| --- | --- |
| [is\_gd\_image()](is_gd_image) wp-includes/media.php | Determines whether the value is an acceptable type for GD image functions. |
| [\_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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress urlencode_deep( mixed $value ): mixed urlencode\_deep( mixed $value ): mixed
======================================
Navigates through an array, object, or scalar, and encodes the values to be used in a URL.
`$value` mixed Required The array or string to be encoded. mixed The encoded value.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function urlencode_deep( $value ) {
return map_deep( $value, 'urlencode' );
}
```
| Uses | Description |
| --- | --- |
| [map\_deep()](map_deep) wp-includes/formatting.php | Maps a function to all non-iterable elements of an array or an object. |
| Used By | Description |
| --- | --- |
| [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\_Users\_Controller::get\_items()](../classes/wp_rest_users_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves all users. |
| [WP\_REST\_Revisions\_Controller::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\_Terms\_Controller::get\_items()](../classes/wp_rest_terms_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Retrieves terms associated with a taxonomy. |
| [WP\_REST\_Posts\_Controller::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\_items()](../classes/wp_rest_comments_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Retrieves a list of comment items. |
| [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress add_site_meta( int $site_id, string $meta_key, mixed $meta_value, bool $unique = false ): int|false add\_site\_meta( int $site\_id, string $meta\_key, mixed $meta\_value, bool $unique = false ): int|false
========================================================================================================
Adds metadata to a site.
`$site_id` int Required Site ID. `$meta_key` string Required Metadata name. `$meta_value` mixed Required Metadata value. Must be serializable if non-scalar. `$unique` bool Optional Whether the same key should not be added.
Default: `false`
int|false Meta ID on success, false on failure.
File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function add_site_meta( $site_id, $meta_key, $meta_value, $unique = false ) {
return add_metadata( 'blog', $site_id, $meta_key, $meta_value, $unique );
}
```
| Uses | Description |
| --- | --- |
| [add\_metadata()](add_metadata) wp-includes/meta.php | Adds metadata for the specified object. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress wp_cache_incr( int|string $key, int $offset = 1, string $group = '' ): int|false wp\_cache\_incr( int|string $key, int $offset = 1, string $group = '' ): int|false
==================================================================================
Increments numeric cache item’s value.
* [WP\_Object\_Cache::incr()](../classes/wp_object_cache/incr)
`$key` int|string Required The key for the cache contents that should be incremented. `$offset` int Optional The amount by which to increment the item's value.
Default: `1`
`$group` string Optional The group the key is in. Default: `''`
int|false The item's new value on success, false on failure.
File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_incr( $key, $offset = 1, $group = '' ) {
global $wp_object_cache;
return $wp_object_cache->incr( $key, $offset, $group );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::incr()](../classes/wp_object_cache/incr) wp-includes/class-wp-object-cache.php | Increments numeric cache item’s value. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress get_blog_list( int $start, int $num = 10, string $deprecated = '' ) get\_blog\_list( int $start, int $num = 10, string $deprecated = '' )
=====================================================================
This function has been deprecated. Use [wp\_get\_sites()](wp_get_sites) instead.
Deprecated functionality to retrieve a list of all sites.
* [wp\_get\_sites()](wp_get_sites)
`$start` int Optional Offset for retrieving the blog list. Default 0. `$num` int Optional Number of blogs to list. Default: `10`
`$deprecated` string Optional Unused. Default: `''`
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_get_sites()' );
global $wpdb;
$blogs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", get_current_network_id() ), ARRAY_A );
$blog_list = array();
foreach ( (array) $blogs as $details ) {
$blog_list[ $details['blog_id'] ] = $details;
$blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" );
}
if ( ! $blog_list ) {
return array();
}
if ( 'all' === $num ) {
return array_slice( $blog_list, $start, count( $blog_list ) );
} else {
return array_slice( $blog_list, $start, $num );
}
}
```
| Uses | Description |
| --- | --- |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [wpdb::get\_blog\_prefix()](../classes/wpdb/get_blog_prefix) wp-includes/class-wpdb.php | Gets blog prefix. |
| [\_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::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [get\_most\_active\_blogs()](get_most_active_blogs) wp-includes/ms-deprecated.php | Deprecated functionality to retrieve a list of the most active sites. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [wp\_get\_sites()](wp_get_sites) |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress wp_create_tag( int|string $tag_name ): array|WP_Error wp\_create\_tag( int|string $tag\_name ): array|WP\_Error
=========================================================
Adds a new tag to the database if it does not already exist.
`$tag_name` int|string Required array|[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 wp_create_tag( $tag_name ) {
return wp_create_term( $tag_name, 'post_tag' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_create\_term()](wp_create_term) wp-admin/includes/taxonomy.php | Adds a new term to the database if it does not already exist. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
| programming_docs |
wordpress noindex() noindex()
=========
This function has been deprecated. Use [wp\_no\_robots()](wp_no_robots) instead.
Displays a `noindex` meta tag if required by the blog configuration.
If a blog is marked as not being public then the `noindex` meta tag will be output to tell web robots not to index the page content.
Typical usage is as a [‘wp\_head’](../hooks/wp_head) callback:
```
add_action( 'wp_head', 'noindex' );
```
* [wp\_no\_robots()](wp_no_robots)
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function noindex() {
_deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_noindex()' );
// If the blog is not public, tell robots to go away.
if ( '0' == get_option( 'blog_public' ) ) {
wp_no_robots();
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_no\_robots()](wp_no_robots) wp-includes/deprecated.php | Display a `noindex` meta tag. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Use [wp\_robots\_noindex()](wp_robots_noindex) instead on `'wp_robots'` filter. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress get_admin_url( int|null $blog_id = null, string $path = '', string $scheme = 'admin' ): string get\_admin\_url( int|null $blog\_id = null, string $path = '', string $scheme = 'admin' ): string
=================================================================================================
Retrieves the URL to the admin area for a given site.
`$blog_id` int|null Optional Site ID. Default null (current site). Default: `null`
`$path` string Optional Path relative to the admin URL. Default: `''`
`$scheme` string Optional The scheme to use. Accepts `'http'` or `'https'`, to force those schemes. Default `'admin'`, which obeys [force\_ssl\_admin()](force_ssl_admin) and [is\_ssl()](is_ssl) . Default: `'admin'`
string Admin URL link with optional path appended.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_admin_url( $blog_id = null, $path = '', $scheme = 'admin' ) {
$url = get_site_url( $blog_id, 'wp-admin/', $scheme );
if ( $path && is_string( $path ) ) {
$url .= ltrim( $path, '/' );
}
/**
* Filters the admin area URL.
*
* @since 2.8.0
* @since 5.8.0 The `$scheme` parameter was added.
*
* @param string $url The complete admin area URL including scheme and path.
* @param string $path Path relative to the admin area URL. Blank string if no path is specified.
* @param int|null $blog_id Site ID, or null for the current site.
* @param string|null $scheme The scheme to use. Accepts 'http', 'https',
* 'admin', or null. Default 'admin', which obeys force_ssl_admin() and is_ssl().
*/
return apply_filters( 'admin_url', $url, $path, $blog_id, $scheme );
}
```
[apply\_filters( 'admin\_url', string $url, string $path, int|null $blog\_id, string|null $scheme )](../hooks/admin_url)
Filters the admin area URL.
| Uses | Description |
| --- | --- |
| [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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_load\_press\_this()](wp_load_press_this) wp-admin/press-this.php | |
| [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. |
| [\_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. |
| [get\_dashboard\_url()](get_dashboard_url) wp-includes/link-template.php | Retrieves the URL to the user’s dashboard. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [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\_xmlrpc\_server::initialise\_blog\_option\_info()](../classes/wp_xmlrpc_server/initialise_blog_option_info) wp-includes/class-wp-xmlrpc-server.php | Set up blog options property. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress add_magic_quotes( array $array ): array add\_magic\_quotes( array $array ): array
=========================================
Walks the array while sanitizing the contents.
`$array` array Required Array to walk while sanitizing contents. array Sanitized $array.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function add_magic_quotes( $array ) {
foreach ( (array) $array as $k => $v ) {
if ( is_array( $v ) ) {
$array[ $k ] = add_magic_quotes( $v );
} elseif ( is_string( $v ) ) {
$array[ $k ] = addslashes( $v );
} else {
continue;
}
}
return $array;
}
```
| Uses | Description |
| --- | --- |
| [add\_magic\_quotes()](add_magic_quotes) wp-includes/functions.php | Walks the array while sanitizing the contents. |
| Used By | Description |
| --- | --- |
| [\_fix\_attachment\_links()](_fix_attachment_links) wp-admin/includes/post.php | Replaces hrefs of attachment anchors with up-to-date permalinks. |
| [wp\_magic\_quotes()](wp_magic_quotes) wp-includes/load.php | Add magic quotes to `$_GET`, `$_POST`, `$_COOKIE`, and `$_SERVER`. |
| [add\_magic\_quotes()](add_magic_quotes) wp-includes/functions.php | Walks the array while sanitizing the contents. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Non-string values are left untouched. |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_maybe_load_embeds() wp\_maybe\_load\_embeds()
=========================
Determines if default embed handlers should be loaded.
Checks to make sure that the embeds library hasn’t already been loaded. If it hasn’t, then it will load the embeds library.
* [wp\_embed\_register\_handler()](wp_embed_register_handler)
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function wp_maybe_load_embeds() {
/**
* Filters whether to load the default embed handlers.
*
* Returning a falsey value will prevent loading the default embed handlers.
*
* @since 2.9.0
*
* @param bool $maybe_load_embeds Whether to load the embeds library. Default true.
*/
if ( ! apply_filters( 'load_default_embeds', true ) ) {
return;
}
wp_embed_register_handler( 'youtube_embed_url', '#https?://(www.)?youtube\.com/(?:v|embed)/([^/]+)#i', 'wp_embed_handler_youtube' );
/**
* Filters the audio embed handler callback.
*
* @since 3.6.0
*
* @param callable $handler Audio embed handler callback function.
*/
wp_embed_register_handler( 'audio', '#^https?://.+?\.(' . implode( '|', wp_get_audio_extensions() ) . ')$#i', apply_filters( 'wp_audio_embed_handler', 'wp_embed_handler_audio' ), 9999 );
/**
* Filters the video embed handler callback.
*
* @since 3.6.0
*
* @param callable $handler Video embed handler callback function.
*/
wp_embed_register_handler( 'video', '#^https?://.+?\.(' . implode( '|', wp_get_video_extensions() ) . ')$#i', apply_filters( 'wp_video_embed_handler', 'wp_embed_handler_video' ), 9999 );
}
```
[apply\_filters( 'load\_default\_embeds', bool $maybe\_load\_embeds )](../hooks/load_default_embeds)
Filters whether to load the default embed handlers.
[apply\_filters( 'wp\_audio\_embed\_handler', callable $handler )](../hooks/wp_audio_embed_handler)
Filters the audio embed handler callback.
[apply\_filters( 'wp\_video\_embed\_handler', callable $handler )](../hooks/wp_video_embed_handler)
Filters the video embed handler callback.
| Uses | Description |
| --- | --- |
| [wp\_get\_video\_extensions()](wp_get_video_extensions) wp-includes/media.php | Returns a filtered list of supported video formats. |
| [wp\_embed\_register\_handler()](wp_embed_register_handler) wp-includes/embed.php | Registers an embed handler. |
| [wp\_get\_audio\_extensions()](wp_get_audio_extensions) wp-includes/media.php | Returns a filtered list of supported audio formats. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress get_allowed_themes(): WP_Theme[] get\_allowed\_themes(): WP\_Theme[]
===================================
This function has been deprecated. Use [wp\_get\_themes()](wp_get_themes) instead.
Get the allowed themes for the current site.
* [wp\_get\_themes()](wp_get_themes)
[WP\_Theme](../classes/wp_theme)[] Array of [WP\_Theme](../classes/wp_theme) objects keyed by their name.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function get_allowed_themes() {
_deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'allowed' => true ) )" );
$themes = wp_get_themes( array( 'allowed' => true ) );
$wp_themes = array();
foreach ( $themes as $theme ) {
$wp_themes[ $theme->get('Name') ] = $theme;
}
return $wp_themes;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_themes()](wp_get_themes) wp-includes/theme.php | Returns an array of [WP\_Theme](../classes/wp_theme) objects based on the arguments. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Use [wp\_get\_themes()](wp_get_themes) |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress rest_api_default_filters() rest\_api\_default\_filters()
=============================
Registers the default REST API filters.
Attached to the [‘rest\_api\_init’](../hooks/rest_api_init) action to make testing and disabling these filters easier.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_api_default_filters() {
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
// Deprecated reporting.
add_action( 'deprecated_function_run', 'rest_handle_deprecated_function', 10, 3 );
add_filter( 'deprecated_function_trigger_error', '__return_false' );
add_action( 'deprecated_argument_run', 'rest_handle_deprecated_argument', 10, 3 );
add_filter( 'deprecated_argument_trigger_error', '__return_false' );
add_action( 'doing_it_wrong_run', 'rest_handle_doing_it_wrong', 10, 3 );
add_filter( 'doing_it_wrong_trigger_error', '__return_false' );
}
// Default serving.
add_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
add_filter( 'rest_post_dispatch', 'rest_send_allow_header', 10, 3 );
add_filter( 'rest_post_dispatch', 'rest_filter_response_fields', 10, 3 );
add_filter( 'rest_pre_dispatch', 'rest_handle_options_request', 10, 3 );
add_filter( 'rest_index', 'rest_add_application_passwords_to_index' );
}
```
| Uses | Description |
| --- | --- |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_img_tag_add_srcset_and_sizes_attr( string $image, string $context, int $attachment_id ): string wp\_img\_tag\_add\_srcset\_and\_sizes\_attr( string $image, string $context, int $attachment\_id ): string
==========================================================================================================
Adds `srcset` and `sizes` attributes to an existing `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 `'loading'` attribute added.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_img_tag_add_srcset_and_sizes_attr( $image, $context, $attachment_id ) {
/**
* Filters whether to add the `srcset` and `sizes` 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_srcset_and_sizes_attr', true, $image, $context, $attachment_id );
if ( true === $add ) {
$image_meta = wp_get_attachment_metadata( $attachment_id );
return wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id );
}
return $image;
}
```
[apply\_filters( 'wp\_img\_tag\_add\_srcset\_and\_sizes\_attr', bool $value, string $image, string $context, int $attachment\_id )](../hooks/wp_img_tag_add_srcset_and_sizes_attr)
Filters whether to add the `srcset` and `sizes` HTML attributes to the img tag. Default `true`.
| Uses | Description |
| --- | --- |
| [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\_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 wp_set_script_translations( string $handle, string $domain = 'default', string $path = '' ): bool wp\_set\_script\_translations( string $handle, string $domain = 'default', string $path = '' ): bool
====================================================================================================
Sets translated strings for a script.
Works only if the script has already been registered.
* [WP\_Scripts::set\_translations()](../classes/wp_scripts/set_translations)
`$handle` string Required Script handle the textdomain will be attached to. `$domain` string Optional Text domain. Default `'default'`. Default: `'default'`
`$path` string Optional The full file path to the directory containing translation files. Default: `''`
bool True if the text domain was successfully localized, false otherwise.
File: `wp-includes/functions.wp-scripts.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-scripts.php/)
```
function wp_set_script_translations( $handle, $domain = 'default', $path = '' ) {
global $wp_scripts;
if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
return false;
}
return $wp_scripts->set_translations( $handle, $domain, $path );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Scripts::set\_translations()](../classes/wp_scripts/set_translations) wp-includes/class-wp-scripts.php | Sets a translation textdomain. |
| 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. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | The `$domain` parameter was made optional. |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress block_has_support( WP_Block_Type $block_type, array $feature, mixed $default = false ): bool block\_has\_support( WP\_Block\_Type $block\_type, array $feature, mixed $default = false ): bool
=================================================================================================
Checks whether the current block type supports the feature requested.
`$block_type` [WP\_Block\_Type](../classes/wp_block_type) Required Block type to check for support. `$feature` array Required Path to a specific feature to check support for. `$default` mixed Optional Fallback value for feature support. Default: `false`
bool Whether the feature is supported.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function block_has_support( $block_type, $feature, $default = false ) {
$block_support = $default;
if ( $block_type && property_exists( $block_type, 'supports' ) ) {
$block_support = _wp_array_get( $block_type->supports, $feature, $default );
}
return true === $block_support || is_array( $block_support );
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_array\_get()](_wp_array_get) wp-includes/functions.php | Accesses an array in depth based on a path of keys. |
| Used By | Description |
| --- | --- |
| [WP\_Theme\_JSON::get\_layout\_styles()](../classes/wp_theme_json/get_layout_styles) wp-includes/class-wp-theme-json.php | Gets the CSS layout rules for a particular block from theme.json layout definitions. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress wp_ajax_wp_privacy_erase_personal_data() wp\_ajax\_wp\_privacy\_erase\_personal\_data()
==============================================
Ajax handler for erasing personal data.
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_privacy_erase_personal_data() {
if ( empty( $_POST['id'] ) ) {
wp_send_json_error( __( 'Missing request ID.' ) );
}
$request_id = (int) $_POST['id'];
if ( $request_id < 1 ) {
wp_send_json_error( __( 'Invalid request ID.' ) );
}
// Both capabilities are required to avoid confusion, see `_wp_personal_data_removal_page()`.
if ( ! current_user_can( 'erase_others_personal_data' ) || ! current_user_can( 'delete_users' ) ) {
wp_send_json_error( __( 'Sorry, you are not allowed to perform this action.' ) );
}
check_ajax_referer( 'wp-privacy-erase-personal-data-' . $request_id, 'security' );
// Get the request.
$request = wp_get_user_request( $request_id );
if ( ! $request || 'remove_personal_data' !== $request->action_name ) {
wp_send_json_error( __( 'Invalid request type.' ) );
}
$email_address = $request->email;
if ( ! is_email( $email_address ) ) {
wp_send_json_error( __( 'Invalid email address in request.' ) );
}
if ( ! isset( $_POST['eraser'] ) ) {
wp_send_json_error( __( 'Missing eraser index.' ) );
}
$eraser_index = (int) $_POST['eraser'];
if ( ! isset( $_POST['page'] ) ) {
wp_send_json_error( __( 'Missing page index.' ) );
}
$page = (int) $_POST['page'];
/**
* Filters the array of personal data eraser callbacks.
*
* @since 4.9.6
*
* @param array $args {
* An array of callable erasers of personal data. Default empty array.
*
* @type array ...$0 {
* Array of personal data exporters.
*
* @type callable $callback Callable eraser that accepts an email address and
* a page and returns an array with boolean values for
* whether items were removed or retained and any messages
* from the eraser, as well as if additional pages are
* available.
* @type string $exporter_friendly_name Translated user facing friendly name for the eraser.
* }
* }
*/
$erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() );
// Do we have any registered erasers?
if ( 0 < count( $erasers ) ) {
if ( $eraser_index < 1 ) {
wp_send_json_error( __( 'Eraser index cannot be less than one.' ) );
}
if ( $eraser_index > count( $erasers ) ) {
wp_send_json_error( __( 'Eraser index is out of range.' ) );
}
if ( $page < 1 ) {
wp_send_json_error( __( 'Page index cannot be less than one.' ) );
}
$eraser_keys = array_keys( $erasers );
$eraser_key = $eraser_keys[ $eraser_index - 1 ];
$eraser = $erasers[ $eraser_key ];
if ( ! is_array( $eraser ) ) {
/* translators: %d: Eraser array index. */
wp_send_json_error( sprintf( __( 'Expected an array describing the eraser at index %d.' ), $eraser_index ) );
}
if ( ! array_key_exists( 'eraser_friendly_name', $eraser ) ) {
/* translators: %d: Eraser array index. */
wp_send_json_error( sprintf( __( 'Eraser array at index %d does not include a friendly name.' ), $eraser_index ) );
}
$eraser_friendly_name = $eraser['eraser_friendly_name'];
if ( ! array_key_exists( 'callback', $eraser ) ) {
wp_send_json_error(
sprintf(
/* translators: %s: Eraser friendly name. */
__( 'Eraser does not include a callback: %s.' ),
esc_html( $eraser_friendly_name )
)
);
}
if ( ! is_callable( $eraser['callback'] ) ) {
wp_send_json_error(
sprintf(
/* translators: %s: Eraser friendly name. */
__( 'Eraser callback is not valid: %s.' ),
esc_html( $eraser_friendly_name )
)
);
}
$callback = $eraser['callback'];
$response = call_user_func( $callback, $email_address, $page );
if ( is_wp_error( $response ) ) {
wp_send_json_error( $response );
}
if ( ! is_array( $response ) ) {
wp_send_json_error(
sprintf(
/* translators: 1: Eraser friendly name, 2: Eraser array index. */
__( 'Did not receive array from %1$s eraser (index %2$d).' ),
esc_html( $eraser_friendly_name ),
$eraser_index
)
);
}
if ( ! array_key_exists( 'items_removed', $response ) ) {
wp_send_json_error(
sprintf(
/* translators: 1: Eraser friendly name, 2: Eraser array index. */
__( 'Expected items_removed key in response array from %1$s eraser (index %2$d).' ),
esc_html( $eraser_friendly_name ),
$eraser_index
)
);
}
if ( ! array_key_exists( 'items_retained', $response ) ) {
wp_send_json_error(
sprintf(
/* translators: 1: Eraser friendly name, 2: Eraser array index. */
__( 'Expected items_retained key in response array from %1$s eraser (index %2$d).' ),
esc_html( $eraser_friendly_name ),
$eraser_index
)
);
}
if ( ! array_key_exists( 'messages', $response ) ) {
wp_send_json_error(
sprintf(
/* translators: 1: Eraser friendly name, 2: Eraser array index. */
__( 'Expected messages key in response array from %1$s eraser (index %2$d).' ),
esc_html( $eraser_friendly_name ),
$eraser_index
)
);
}
if ( ! is_array( $response['messages'] ) ) {
wp_send_json_error(
sprintf(
/* translators: 1: Eraser friendly name, 2: Eraser array index. */
__( 'Expected messages key to reference an array in response array from %1$s eraser (index %2$d).' ),
esc_html( $eraser_friendly_name ),
$eraser_index
)
);
}
if ( ! array_key_exists( 'done', $response ) ) {
wp_send_json_error(
sprintf(
/* translators: 1: Eraser friendly name, 2: Eraser array index. */
__( 'Expected done flag in response array from %1$s eraser (index %2$d).' ),
esc_html( $eraser_friendly_name ),
$eraser_index
)
);
}
} else {
// No erasers, so we're done.
$eraser_key = '';
$response = array(
'items_removed' => false,
'items_retained' => false,
'messages' => array(),
'done' => true,
);
}
/**
* Filters a page of personal data eraser data.
*
* Allows the erasure response to be consumed by destinations in addition to Ajax.
*
* @since 4.9.6
*
* @param array $response The personal data for the given exporter and page.
* @param int $eraser_index The index of the eraser that provided this data.
* @param string $email_address The email address associated with this personal data.
* @param int $page The page for this response.
* @param int $request_id The privacy request post ID associated with this request.
* @param string $eraser_key The key (slug) of the eraser that provided this data.
*/
$response = apply_filters( 'wp_privacy_personal_data_erasure_page', $response, $eraser_index, $email_address, $page, $request_id, $eraser_key );
if ( is_wp_error( $response ) ) {
wp_send_json_error( $response );
}
wp_send_json_success( $response );
}
```
[apply\_filters( 'wp\_privacy\_personal\_data\_erasers', array $args )](../hooks/wp_privacy_personal_data_erasers)
Filters the array of personal data eraser callbacks.
[apply\_filters( 'wp\_privacy\_personal\_data\_erasure\_page', array $response, int $eraser\_index, string $email\_address, int $page, int $request\_id, string $eraser\_key )](../hooks/wp_privacy_personal_data_erasure_page)
Filters a page of personal data eraser data.
| 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. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_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. |
| [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. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
| programming_docs |
wordpress the_excerpt() the\_excerpt()
==============
Displays the post excerpt.
Displays the [excerpt](https://codex.wordpress.org/Excerpt "Excerpt") of the current post after applying several filters to it including auto-p formatting which turns double line-breaks into [HTML](https://codex.wordpress.org/Glossary#HTML "Glossary") paragraphs. It uses [get\_the\_excerpt()](get_the_excerpt) to first generate a **trimmed-down version** of the full post content should there not be an explicit excerpt for the post.
The trimmed-down version contains a ‘more’ tag at the end which by default is the […] or “hellip” symbol. A user-supplied excerpt is NOT by default given such a symbol. To add it, you must either modify the raw $post->post\_excerpt manually in your template before calling [the\_excerpt()](the_excerpt) , add a filter for 'get\_the\_excerpt' with a priority lower than 10, or add a filter for 'wp\_trim\_excerpt' (comparing the first and second parameter, because a user-supplied excerpt does not get altered in any way by this function).
See [get\_the\_excerpt()](get_the_excerpt) for more details.
An auto-generated excerpt will also have all shortcodes and tags removed. It is trimmed down to a word-boundary and the default length is 55 words. For languages in which words are (or can be) described with single characters (ie. East-Asian languages) the word-boundary is actually the character.
**Note:** If the current post is an [attachment](https://codex.wordpress.org/Using_Image_and_File_Attachments "Using Image and File Attachments"), such as in the *attachment.php* and *image.php* template loops, then the attachment caption is displayed. Captions do not include the “[…]” text.
Excerpts provide an alternative to the use of the [<!--more-->](https://codex.wordpress.org/Customizing_the_Read_More "Customizing the Read More") quicktag. Whereas this more tag requires a post author to manually create a ‘split’ in the post contents, which is then used to generate a “read more” link on index pages, the excerpts require, but do not necessarily demand, a post author to supply a ‘teaser’ for the full post contents.
The <!--more--> quicktag requires templates to use [[the\_content()](the_content)](the_content "Template Tags/the content") whereas using excerpts requires, and allows, template writers to explicitly choose whether to display full posts (using [the\_content()](the_content) ) or excerpts (using [the\_excerpt()](the_excerpt) ).
The choice of whether to display a full post or an excerpt can then be based on factors such as the template used, the type of page, the category of the post, etcetera. In other words, with a <!--more--> quicktag the post author decides what happens, whereas the template writer is in control with excerpts. Moreover, although <!--more--> can be used to create a real split using the $stripteaser parameter, it would be hard and complicated to then differentiate based on characteristics, causing this to become a basically site-wide choice.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function the_excerpt() {
/**
* Filters the displayed post excerpt.
*
* @since 0.71
*
* @see get_the_excerpt()
*
* @param string $post_excerpt The post excerpt.
*/
echo apply_filters( 'the_excerpt', get_the_excerpt() );
}
```
[apply\_filters( 'the\_excerpt', string $post\_excerpt )](../hooks/the_excerpt)
Filters the displayed post excerpt.
| Uses | Description |
| --- | --- |
| [get\_the\_excerpt()](get_the_excerpt) wp-includes/post-template.php | Retrieves the post excerpt. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_title( string $sep = '»', bool $display = true, string $seplocation = '' ): string|void wp\_title( string $sep = '»', bool $display = true, string $seplocation = '' ): string|void
=================================================================================================
Displays or retrieves page title for all areas of blog.
By default, the page title will display the separator before the page title, so that the blog title will be before the page title. This is not good for title display, since the blog title shows up on most tabs and not what is important, which is the page that the user is looking at.
There are also SEO benefits to having the blog title after or to the ‘right’ of the page title. However, it is mostly common sense to have the blog title to the right with most browsers supporting tabs. You can achieve this by using the seplocation parameter and setting the value to ‘right’. This change was introduced around 2.5.0, in case backward compatibility of themes is important.
`$sep` string Optional How to separate the various items within the page title.
Default `'»'`. Default: `'»'`
`$display` bool Optional Whether to display or retrieve title. Default: `true`
`$seplocation` string Optional Location of the separator (`'left'` or `'right'`). Default: `''`
string|void String when `$display` is false, nothing otherwise.
Plugins might use the [wp\_title](../hooks/wp_title "Plugin API/Filter Reference/wp title") filter to generate a value. While it is possible to construct a “title” by doing things such as concatenating with `bloginfo` (the Site Name), if you do not use the `wp_title` function in your theme, you will likely have errors or unexpected behavior.
The function returns a concatenated string. It always queries the database for a default string; the value of the default string depends on the type of post or page:
**Single post** the title of the post
**Date-based archive** the date (e.g., “2006”, “2006 – January”) **Category** the name of the category
**Author page** the public name of the user The function then prepends or appends the **sep** string and returns the entire value.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_title( $sep = '»', $display = true, $seplocation = '' ) {
global $wp_locale;
$m = get_query_var( 'm' );
$year = get_query_var( 'year' );
$monthnum = get_query_var( 'monthnum' );
$day = get_query_var( 'day' );
$search = get_query_var( 's' );
$title = '';
$t_sep = '%WP_TITLE_SEP%'; // Temporary separator, for accurate flipping, if necessary.
// If there is a post.
if ( is_single() || ( is_home() && ! is_front_page() ) || ( is_page() && ! is_front_page() ) ) {
$title = single_post_title( '', false );
}
// If there's a post type archive.
if ( is_post_type_archive() ) {
$post_type = get_query_var( 'post_type' );
if ( is_array( $post_type ) ) {
$post_type = reset( $post_type );
}
$post_type_object = get_post_type_object( $post_type );
if ( ! $post_type_object->has_archive ) {
$title = post_type_archive_title( '', false );
}
}
// If there's a category or tag.
if ( is_category() || is_tag() ) {
$title = single_term_title( '', false );
}
// If there's a taxonomy.
if ( is_tax() ) {
$term = get_queried_object();
if ( $term ) {
$tax = get_taxonomy( $term->taxonomy );
$title = single_term_title( $tax->labels->name . $t_sep, false );
}
}
// If there's an author.
if ( is_author() && ! is_post_type_archive() ) {
$author = get_queried_object();
if ( $author ) {
$title = $author->display_name;
}
}
// Post type archives with has_archive should override terms.
if ( is_post_type_archive() && $post_type_object->has_archive ) {
$title = post_type_archive_title( '', false );
}
// If there's a month.
if ( is_archive() && ! empty( $m ) ) {
$my_year = substr( $m, 0, 4 );
$my_month = substr( $m, 4, 2 );
$my_day = (int) substr( $m, 6, 2 );
$title = $my_year .
( $my_month ? $t_sep . $wp_locale->get_month( $my_month ) : '' ) .
( $my_day ? $t_sep . $my_day : '' );
}
// If there's a year.
if ( is_archive() && ! empty( $year ) ) {
$title = $year;
if ( ! empty( $monthnum ) ) {
$title .= $t_sep . $wp_locale->get_month( $monthnum );
}
if ( ! empty( $day ) ) {
$title .= $t_sep . zeroise( $day, 2 );
}
}
// If it's a search.
if ( is_search() ) {
/* translators: 1: Separator, 2: Search query. */
$title = sprintf( __( 'Search Results %1$s %2$s' ), $t_sep, strip_tags( $search ) );
}
// If it's a 404 page.
if ( is_404() ) {
$title = __( 'Page not found' );
}
$prefix = '';
if ( ! empty( $title ) ) {
$prefix = " $sep ";
}
/**
* Filters the parts of the page title.
*
* @since 4.0.0
*
* @param string[] $title_array Array of parts of the page title.
*/
$title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) );
// Determines position of the separator and direction of the breadcrumb.
if ( 'right' === $seplocation ) { // Separator on right, so reverse the order.
$title_array = array_reverse( $title_array );
$title = implode( " $sep ", $title_array ) . $prefix;
} else {
$title = $prefix . implode( " $sep ", $title_array );
}
/**
* Filters the text of the page title.
*
* @since 2.0.0
*
* @param string $title Page title.
* @param string $sep Title separator.
* @param string $seplocation Location of the separator ('left' or 'right').
*/
$title = apply_filters( 'wp_title', $title, $sep, $seplocation );
// Send it out.
if ( $display ) {
echo $title;
} else {
return $title;
}
}
```
[apply\_filters( 'wp\_title', string $title, string $sep, string $seplocation )](../hooks/wp_title)
Filters the text of the page title.
[apply\_filters( 'wp\_title\_parts', string[] $title\_array )](../hooks/wp_title_parts)
Filters the parts of the page title.
| Uses | Description |
| --- | --- |
| [is\_category()](is_category) wp-includes/query.php | Determines whether the query is for an existing category archive page. |
| [zeroise()](zeroise) wp-includes/formatting.php | Add leading zeros when necessary. |
| [is\_archive()](is_archive) wp-includes/query.php | Determines whether the query is for an existing archive page. |
| [get\_queried\_object()](get_queried_object) wp-includes/query.php | Retrieves the currently queried object. |
| [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. |
| [is\_author()](is_author) wp-includes/query.php | Determines whether the query is for an existing author archive page. |
| [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\_page()](is_page) wp-includes/query.php | Determines whether the query is for an existing single page. |
| [is\_front\_page()](is_front_page) wp-includes/query.php | Determines whether the query is for the front page of the site. |
| [is\_home()](is_home) wp-includes/query.php | Determines whether the query is for the blog homepage. |
| [is\_404()](is_404) wp-includes/query.php | Determines whether the query has resulted in a 404 (returns no results). |
| [is\_search()](is_search) wp-includes/query.php | Determines whether the query is for a search. |
| [is\_single()](is_single) wp-includes/query.php | Determines whether the query is for an existing single post. |
| [single\_term\_title()](single_term_title) wp-includes/general-template.php | Displays or retrieves page title for taxonomy term archive. |
| [post\_type\_archive\_title()](post_type_archive_title) wp-includes/general-template.php | Displays or retrieves title for a post type archive. |
| [single\_post\_title()](single_post_title) wp-includes/general-template.php | Displays or retrieves page title for post. |
| [WP\_Locale::get\_month()](../classes/wp_locale/get_month) wp-includes/class-wp-locale.php | Retrieves the full translated month by month number. |
| [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. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress is_local_attachment( string $url ): bool is\_local\_attachment( string $url ): bool
==========================================
Determines whether an attachment URI is local and really an attachment.
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.
`$url` string Required URL to check 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 is_local_attachment( $url ) {
if ( strpos( $url, home_url() ) === false ) {
return false;
}
if ( strpos( $url, home_url( '/?attachment_id=' ) ) !== false ) {
return true;
}
$id = url_to_postid( $url );
if ( $id ) {
$post = get_post( $id );
if ( 'attachment' === $post->post_type ) {
return true;
}
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [url\_to\_postid()](url_to_postid) wp-includes/rewrite.php | Examines a URL and try to determine the post ID it represents. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [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 |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress list_cats( int $optionall = 1, string $all = 'All', string $sort_column = 'ID', string $sort_order = 'asc', string $file = '', bool $list = true, int $optiondates, int $optioncount, int $hide_empty = 1, int $use_desc_for_title = 1, bool $children = false, int $child_of, int $categories, int $recurse, string $feed = '', string $feed_image = '', string $exclude = '', bool $hierarchical = false ): null|false list\_cats( int $optionall = 1, string $all = 'All', string $sort\_column = 'ID', string $sort\_order = 'asc', string $file = '', bool $list = true, int $optiondates, int $optioncount, int $hide\_empty = 1, int $use\_desc\_for\_title = 1, bool $children = false, int $child\_of, int $categories, int $recurse, string $feed = '', string $feed\_image = '', string $exclude = '', bool $hierarchical = false ): null|false
=================================================================================================================================================================================================================================================================================================================================================================================================================================
This function has been deprecated. Use [wp\_list\_categories()](wp_list_categories) instead.
Lists categories.
* [wp\_list\_categories()](wp_list_categories)
`$optionall` int Optional Default: `1`
`$all` string Optional Default: `'All'`
`$sort_column` string Optional Default: `'ID'`
`$sort_order` string Optional Default: `'asc'`
`$file` string Optional Default: `''`
`$list` bool Optional Default: `true`
`$optiondates` int Required `$optioncount` int Required `$hide_empty` int Optional Default: `1`
`$use_desc_for_title` int Optional Default: `1`
`$children` bool Optional Default: `false`
`$child_of` int Required `$categories` int Required `$recurse` int Required `$feed` string Optional Default: `''`
`$feed_image` string Optional Default: `''`
`$exclude` string Optional Default: `''`
`$hierarchical` bool Optional Default: `false`
null|false
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
$optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
$recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) {
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
$query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children',
'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical');
return wp_list_cats($query);
}
```
| Uses | Description |
| --- | --- |
| [wp\_list\_cats()](wp_list_cats) wp-includes/deprecated.php | Lists categories. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [wp\_list\_categories()](wp_list_categories) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress get_post_modified_time( string $format = 'U', bool $gmt = false, int|WP_Post $post = null, bool $translate = false ): string|int|false get\_post\_modified\_time( string $format = 'U', bool $gmt = false, int|WP\_Post $post = null, bool $translate = false ): string|int|false
==========================================================================================================================================
Retrieves the time at which the post was last modified.
`$format` string Optional Format to use for retrieving the time the post was modified. Accepts `'G'`, `'U'`, or PHP date format. Default `'U'`. Default: `'U'`
`$gmt` bool Optional Whether to retrieve the GMT time. Default: `false`
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Default is global `$post` object. Default: `null`
`$translate` bool Optional Whether to translate the time string. Default: `false`
string|int|false Formatted date string or Unix timestamp if `$format` is `'U'` or `'G'`.
False on failure.
One level »lower« than [get\_the\_modified\_time()](get_the_modified_time) , but can take more arguments.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function get_post_modified_time( $format = 'U', $gmt = false, $post = null, $translate = false ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$source = ( $gmt ) ? 'gmt' : 'local';
$datetime = get_post_datetime( $post, 'modified', $source );
if ( false === $datetime ) {
return false;
}
if ( 'U' === $format || 'G' === $format ) {
$time = $datetime->getTimestamp();
// Returns a sum of timestamp with timezone offset. Ideally should never be used.
if ( ! $gmt ) {
$time += $datetime->getOffset();
}
} elseif ( $translate ) {
$time = wp_date( $format, $datetime->getTimestamp(), $gmt ? new DateTimeZone( 'UTC' ) : null );
} else {
if ( $gmt ) {
$datetime = $datetime->setTimezone( new DateTimeZone( 'UTC' ) );
}
$time = $datetime->format( $format );
}
/**
* Filters the localized time a post was last modified.
*
* @since 2.8.0
*
* @param string|int $time Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
* @param string $format Format to use for retrieving the time the post was modified.
* Accepts 'G', 'U', or PHP date format. Default 'U'.
* @param bool $gmt Whether to retrieve the GMT time. Default false.
*/
return apply_filters( 'get_post_modified_time', $time, $format, $gmt );
}
```
[apply\_filters( 'get\_post\_modified\_time', string|int $time, string $format, bool $gmt )](../hooks/get_post_modified_time)
Filters the localized time a post was last modified.
| Uses | Description |
| --- | --- |
| [wp\_date()](wp_date) wp-includes/functions.php | Retrieves the date, in localized format. |
| [get\_post\_datetime()](get_post_datetime) wp-includes/general-template.php | Retrieves post published or modified time as a `DateTimeImmutable` object instance. |
| [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\_modified\_date()](get_the_modified_date) wp-includes/general-template.php | Retrieves the date on which the post was last modified. |
| [get\_the\_modified\_time()](get_the_modified_time) wp-includes/general-template.php | Retrieves the time at which the post was last modified. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress install_theme_information() install\_theme\_information()
=============================
Displays theme information in dialog box form.
File: `wp-admin/includes/theme-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme-install.php/)
```
function install_theme_information() {
global $wp_list_table;
$theme = themes_api( 'theme_information', array( 'slug' => wp_unslash( $_REQUEST['theme'] ) ) );
if ( is_wp_error( $theme ) ) {
wp_die( $theme );
}
iframe_header( __( 'Theme Installation' ) );
if ( ! isset( $wp_list_table ) ) {
$wp_list_table = _get_list_table( 'WP_Theme_Install_List_Table' );
}
$wp_list_table->theme_installer_single( $theme );
iframe_footer();
exit;
}
```
| Uses | Description |
| --- | --- |
| [themes\_api()](themes_api) wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. |
| [\_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. |
| [iframe\_header()](iframe_header) wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. |
| [iframe\_footer()](iframe_footer) wp-admin/includes/template.php | Generic Iframe footer for use with Thickbox. |
| [\_\_()](__) 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\_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 |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress get_background_color(): string get\_background\_color(): string
================================
Retrieves value for custom background color.
string
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_background_color() {
return get_theme_mod( 'background_color', get_theme_support( 'custom-background', 'default-color' ) );
}
```
| 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 |
| --- | --- |
| [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| [background\_color()](background_color) wp-includes/theme.php | Displays background color value. |
| [\_custom\_background\_cb()](_custom_background_cb) wp-includes/theme.php | Default custom background callback. |
| [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 delete_comment_meta( int $comment_id, string $meta_key, mixed $meta_value = '' ): bool delete\_comment\_meta( int $comment\_id, string $meta\_key, mixed $meta\_value = '' ): bool
===========================================================================================
Removes metadata matching criteria from a comment.
You can match based on the key, or key and value. Removing based on key and value, will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed.
`$comment_id` int Required Comment ID. `$meta_key` string Required Metadata name. `$meta_value` mixed Optional Metadata value. If provided, rows will only be removed that match the value.
Must be serializable if non-scalar. Default: `''`
bool True on success, false on failure.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function delete_comment_meta( $comment_id, $meta_key, $meta_value = '' ) {
return delete_metadata( 'comment', $comment_id, $meta_key, $meta_value );
}
```
| Uses | Description |
| --- | --- |
| [delete\_metadata()](delete_metadata) wp-includes/meta.php | Deletes metadata for the specified object. |
| Used By | Description |
| --- | --- |
| [wp\_scheduled\_delete()](wp_scheduled_delete) wp-includes/functions.php | Permanently deletes comments or posts of any type that have held a status of ‘trash’ for the number of days defined in EMPTY\_TRASH\_DAYS. |
| [wp\_spam\_comment()](wp_spam_comment) wp-includes/comment.php | Marks a comment as Spam. |
| [wp\_unspam\_comment()](wp_unspam_comment) wp-includes/comment.php | Removes a comment from the Spam. |
| [wp\_trash\_comment()](wp_trash_comment) wp-includes/comment.php | Moves a comment to the Trash |
| [wp\_untrash\_comment()](wp_untrash_comment) wp-includes/comment.php | Removes a comment from the Trash |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress walk_nav_menu_tree( array $items, int $depth, stdClass $args ): string walk\_nav\_menu\_tree( array $items, int $depth, stdClass $args ): string
=========================================================================
Retrieves the HTML list content for nav menu items.
`$items` array Required The menu items, sorted by each menu item's menu order. `$depth` int Required Depth of the item in reference to parents. `$args` stdClass Required An object containing [wp\_nav\_menu()](wp_nav_menu) arguments. More Arguments from wp\_nav\_menu( ... $args ) Array of nav menu arguments.
* `menu`int|string|[WP\_Term](../classes/wp_term)Desired menu. Accepts a menu ID, slug, name, or object.
* `menu_class`stringCSS class to use for the ul element which forms the menu.
Default `'menu'`.
* `menu_id`stringThe ID that is applied to the ul element which forms the menu.
Default is the menu slug, incremented.
* `container`stringWhether to wrap the ul, and what to wrap it with.
Default `'div'`.
* `container_class`stringClass that is applied to the container.
Default 'menu-{menu slug}-container'.
* `container_id`stringThe ID that is applied to the container.
* `container_aria_label`stringThe aria-label attribute that is applied to the container when it's a nav element.
* `fallback_cb`callable|falseIf the menu doesn't exist, a callback function will fire.
Default is `'wp_page_menu'`. Set to false for no fallback.
* `before`stringText before the link markup.
* `after`stringText after the link markup.
* `link_before`stringText before the link text.
* `link_after`stringText after the link text.
* `echo`boolWhether to echo the menu or return it. Default true.
* `depth`intHow many levels of the hierarchy are to be included.
0 means all. Default 0.
Default 0.
* `walker`objectInstance of a custom walker class.
* `theme_location`stringTheme location to be used. Must be registered with [register\_nav\_menu()](register_nav_menu) in order to be selectable by the user.
* `items_wrap`stringHow the list items should be wrapped. Uses printf() format with numbered placeholders. Default is a ul with an id and class.
* `item_spacing`stringWhether to preserve whitespace within the menu's HTML.
Accepts `'preserve'` or `'discard'`. Default `'preserve'`.
string The HTML list content for the menu items.
File: `wp-includes/nav-menu-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu-template.php/)
```
function walk_nav_menu_tree( $items, $depth, $args ) {
$walker = ( empty( $args->walker ) ) ? new Walker_Nav_Menu : $args->walker;
return $walker->walk( $items, $depth, $args );
}
```
| Uses | Description |
| --- | --- |
| [Walker::walk()](../classes/walker/walk) wp-includes/class-wp-walker.php | Displays array of elements hierarchically. |
| Used By | Description |
| --- | --- |
| [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\_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. |
| [wp\_nav\_menu()](wp_nav_menu) wp-includes/nav-menu-template.php | Displays a navigation menu. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_theme_updates(): array get\_theme\_updates(): array
============================
Retrieves themes with updates available.
array
File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
```
function get_theme_updates() {
$current = get_site_transient( 'update_themes' );
if ( ! isset( $current->response ) ) {
return array();
}
$update_themes = array();
foreach ( $current->response as $stylesheet => $data ) {
$update_themes[ $stylesheet ] = wp_get_theme( $stylesheet );
$update_themes[ $stylesheet ]->update = $data;
}
return $update_themes;
}
```
| Uses | Description |
| --- | --- |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [wp\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| Used By | Description |
| --- | --- |
| [WP\_Debug\_Data::debug\_data()](../classes/wp_debug_data/debug_data) wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| [WP\_Site\_Health::get\_test\_theme\_version()](../classes/wp_site_health/get_test_theme_version) wp-admin/includes/class-wp-site-health.php | Tests if themes are outdated, or unnecessary. |
| [WP\_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. |
| [list\_theme\_updates()](list_theme_updates) wp-admin/update-core.php | Display the upgrade themes form. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress wp_create_user_request( string $email_address = '', string $action_name = '', array $request_data = array(), string $status = 'pending' ): int|WP_Error wp\_create\_user\_request( string $email\_address = '', string $action\_name = '', array $request\_data = array(), string $status = 'pending' ): int|WP\_Error
==============================================================================================================================================================
Creates and logs a user request to perform a specific action.
Requests are stored inside a post type named `user_request` since they can apply to both users on the site, or guests without a user account.
`$email_address` string Optional User email address. This can be the address of a registered or non-registered user. Default: `''`
`$action_name` string Optional Name of the action that is being confirmed. Required. Default: `''`
`$request_data` array Optional Misc data you want to send with the verification request and pass to the actions once the request is confirmed. Default: `array()`
`$status` string Optional request status (pending or confirmed). Default `'pending'`. Default: `'pending'`
int|[WP\_Error](../classes/wp_error) Returns the request ID if successful, or a [WP\_Error](../classes/wp_error) object on failure.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_create_user_request( $email_address = '', $action_name = '', $request_data = array(), $status = 'pending' ) {
$email_address = sanitize_email( $email_address );
$action_name = sanitize_key( $action_name );
if ( ! is_email( $email_address ) ) {
return new WP_Error( 'invalid_email', __( 'Invalid email address.' ) );
}
if ( ! in_array( $action_name, _wp_privacy_action_request_types(), true ) ) {
return new WP_Error( 'invalid_action', __( 'Invalid action name.' ) );
}
if ( ! in_array( $status, array( 'pending', 'confirmed' ), true ) ) {
return new WP_Error( 'invalid_status', __( 'Invalid request status.' ) );
}
$user = get_user_by( 'email', $email_address );
$user_id = $user && ! is_wp_error( $user ) ? $user->ID : 0;
// Check for duplicates.
$requests_query = new WP_Query(
array(
'post_type' => 'user_request',
'post_name__in' => array( $action_name ), // Action name stored in post_name column.
'title' => $email_address, // Email address stored in post_title column.
'post_status' => array(
'request-pending',
'request-confirmed',
),
'fields' => 'ids',
)
);
if ( $requests_query->found_posts ) {
return new WP_Error( 'duplicate_request', __( 'An incomplete personal data request for this email address already exists.' ) );
}
$request_id = wp_insert_post(
array(
'post_author' => $user_id,
'post_name' => $action_name,
'post_title' => $email_address,
'post_content' => wp_json_encode( $request_data ),
'post_status' => 'request-' . $status,
'post_type' => 'user_request',
'post_date' => current_time( 'mysql', false ),
'post_date_gmt' => current_time( 'mysql', true ),
),
true
);
return $request_id;
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_privacy\_action\_request\_types()](_wp_privacy_action_request_types) wp-includes/user.php | Gets all personal data request types. |
| [sanitize\_email()](sanitize_email) wp-includes/formatting.php | Strips out all characters that are not allowable in an email. |
| [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [WP\_Query::\_\_construct()](../classes/wp_query/__construct) wp-includes/class-wp-query.php | Constructor. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. |
| [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\_personal\_data\_handle\_actions()](_wp_personal_data_handle_actions) wp-admin/includes/privacy-tools.php | Handle list table actions. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Added the `$status` parameter. |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
wordpress get_header_video_settings(): array get\_header\_video\_settings(): array
=====================================
Retrieves header video settings.
array
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_header_video_settings() {
$header = get_custom_header();
$video_url = get_header_video_url();
$video_type = wp_check_filetype( $video_url, wp_get_mime_types() );
$settings = array(
'mimeType' => '',
'posterUrl' => get_header_image(),
'videoUrl' => $video_url,
'width' => absint( $header->width ),
'height' => absint( $header->height ),
'minWidth' => 900,
'minHeight' => 500,
'l10n' => array(
'pause' => __( 'Pause' ),
'play' => __( 'Play' ),
'pauseSpeak' => __( 'Video is paused.' ),
'playSpeak' => __( 'Video is playing.' ),
),
);
if ( preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video_url ) ) {
$settings['mimeType'] = 'video/x-youtube';
} elseif ( ! empty( $video_type['type'] ) ) {
$settings['mimeType'] = $video_type['type'];
}
/**
* Filters header video settings.
*
* @since 4.7.0
*
* @param array $settings An array of header video settings.
*/
return apply_filters( 'header_video_settings', $settings );
}
```
[apply\_filters( 'header\_video\_settings', array $settings )](../hooks/header_video_settings)
Filters header video settings.
| Uses | Description |
| --- | --- |
| [get\_header\_video\_url()](get_header_video_url) wp-includes/theme.php | Retrieves header video URL for custom header. |
| [get\_custom\_header()](get_custom_header) wp-includes/theme.php | Gets the header image data. |
| [get\_header\_image()](get_header_image) wp-includes/theme.php | Retrieves header image for custom header. |
| [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. |
| [\_\_()](__) 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. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Manager::export\_header\_video\_settings()](../classes/wp_customize_manager/export_header_video_settings) wp-includes/class-wp-customize-manager.php | Exports header video settings to facilitate selective refresh. |
| [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 wp_get_active_and_valid_plugins(): string[] wp\_get\_active\_and\_valid\_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.
Retrieve an array of active and valid plugin files.
While upgrading or installing WordPress, no plugins are returned.
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 paths to plugin files relative to the plugins directory.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_get_active_and_valid_plugins() {
$plugins = array();
$active_plugins = (array) get_option( 'active_plugins', array() );
// Check for hacks file if the option is enabled.
if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
_deprecated_file( 'my-hacks.php', '1.5.0' );
array_unshift( $plugins, ABSPATH . 'my-hacks.php' );
}
if ( empty( $active_plugins ) || wp_installing() ) {
return $plugins;
}
$network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
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.
// Not already included as a network plugin.
&& ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins, true ) )
) {
$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
}
}
/*
* Remove plugins from the list of active plugins when we're on an endpoint
* that should be protected against WSODs and the plugin is paused.
*/
if ( wp_is_recovery_mode() ) {
$plugins = wp_skip_paused_plugins( $plugins );
}
return $plugins;
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_recovery\_mode()](wp_is_recovery_mode) wp-includes/load.php | Is WordPress in Recovery Mode. |
| [wp\_skip\_paused\_plugins()](wp_skip_paused_plugins) wp-includes/load.php | Filters a given list of plugins, removing any paused plugins from it. |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [\_deprecated\_file()](_deprecated_file) wp-includes/functions.php | Marks a file as deprecated and inform when it has been used. |
| [validate\_file()](validate_file) wp-includes/functions.php | Validates a file name and path against an allowed set of rules. |
| [wp\_get\_active\_network\_plugins()](wp_get_active_network_plugins) wp-includes/ms-load.php | Returns array of network plugin files to be included in global scope. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [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. |
| programming_docs |
wordpress mysql_to_rfc3339( string $date_string ): string mysql\_to\_rfc3339( string $date\_string ): string
==================================================
Parses and formats a MySQL datetime (Y-m-d H:i:s) for ISO8601 (Y-m-d\TH:i:s).
Explicitly strips timezones, as datetimes are not saved with any timezone information. Including any information on the offset could be misleading.
Despite historical function name, the output does not conform to RFC3339 format, which must contain timezone.
`$date_string` string Required Date string to parse and format. string Date formatted for ISO8601 without time zone.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function mysql_to_rfc3339( $date_string ) {
return mysql2date( 'Y-m-d\TH:i:s', $date_string, false );
}
```
| Uses | Description |
| --- | --- |
| [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Revisions\_Controller::prepare\_date\_response()](../classes/wp_rest_revisions_controller/prepare_date_response) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Checks the post\_date\_gmt or modified\_gmt and prepare any post or modified date for single post output. |
| [WP\_REST\_Posts\_Controller::prepare\_date\_response()](../classes/wp_rest_posts_controller/prepare_date_response) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks the post\_date\_gmt or modified\_gmt and prepare any post or modified date for single post output. |
| [WP\_REST\_Comments\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_comments_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Prepares a single comment output for response. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress plugins_api( string $action, array|object $args = array() ): object|array|WP_Error plugins\_api( string $action, array|object $args = array() ): object|array|WP\_Error
====================================================================================
Retrieves plugin installer pages from the WordPress.org Plugins API.
It is possible for a plugin to override the Plugin API result with three filters. Assume this is for plugins, which can extend on the Plugin Info to offer more choices. This is very powerful and must be used with care when overriding the filters.
The first filter, [‘plugins\_api\_args’](../hooks/plugins_api_args), is for the args and gives the action as the second parameter. The hook for [‘plugins\_api\_args’](../hooks/plugins_api_args) must ensure that an object is returned.
The second filter, [‘plugins\_api’](../hooks/plugins_api), allows a plugin to override the WordPress.org Plugin Installation API entirely. If `$action` is ‘query\_plugins’ or ‘plugin\_information’, an object MUST be passed. If `$action` is ‘hot\_tags’ or ‘hot\_categories’, an array MUST be passed.
Finally, the third filter, [‘plugins\_api\_result’](../hooks/plugins_api_result), makes it possible to filter the response object or array, depending on the `$action` type.
Supported arguments per action:
| Argument Name | query\_plugins | plugin\_information | hot\_tags | hot\_categories |
| --- | --- | --- | --- | --- |
| `$slug` | No | Yes | No | No |
| `$per_page` | Yes | No | No | No |
| `$page` | Yes | No | No | No |
| `$number` | No | No | Yes | Yes |
| `$search` | Yes | No | No | No |
| `$tag` | Yes | No | No | No |
| `$author` | Yes | No | No | No |
| `$user` | Yes | No | No | No |
| `$browse` | Yes | No | No | No |
| `$locale` | Yes | Yes | No | No |
| `$installed_plugins` | Yes | No | No | No |
| `$is_ssl` | Yes | Yes | No | No |
| `$fields` | Yes | Yes | No | No |
`$action` string Required API action to perform: `'query_plugins'`, `'plugin_information'`, `'hot_tags'` or `'hot_categories'`. `$args` array|object Optional Array or object of arguments to serialize for the Plugin Info API.
* `slug`stringThe plugin slug.
* `per_page`intNumber of plugins per page. Default 24.
* `page`intNumber of current page. Default 1.
* `number`intNumber of tags or categories to be queried.
* `search`stringA search term.
* `tag`stringTag to filter plugins.
* `author`stringUsername of an plugin author to filter plugins.
* `user`stringUsername to query for their favorites.
* `browse`stringBrowse view: `'popular'`, `'new'`, `'beta'`, `'recommended'`.
* `locale`stringLocale to provide context-sensitive results. Default is the value of [get\_locale()](get_locale) .
* `installed_plugins`stringInstalled plugins to provide context-sensitive results.
* `is_ssl`boolWhether links should be returned with https or not. Default false.
* `fields`array Array of fields which should or should not be returned.
+ `short_description`boolWhether to return the plugin short description. Default true.
+ `description`boolWhether to return the plugin full description. Default false.
+ `sections`boolWhether to return the plugin readme sections: description, installation, FAQ, screenshots, other notes, and changelog. Default false.
+ `tested`boolWhether to return the 'Compatible up to' value. Default true.
+ `requires`boolWhether to return the required WordPress version. Default true.
+ `requires_php`boolWhether to return the required PHP version. Default true.
+ `rating`boolWhether to return the rating in percent and total number of ratings.
Default true.
+ `ratings`boolWhether to return the number of rating for each star (1-5). Default true.
+ `downloaded`boolWhether to return the download count. Default true.
+ `downloadlink`boolWhether to return the download link for the package. Default true.
+ `last_updated`boolWhether to return the date of the last update. Default true.
+ `added`boolWhether to return the date when the plugin was added to the wordpress.org repository. Default true.
+ `tags`boolWhether to return the assigned tags. Default true.
+ `compatibility`boolWhether to return the WordPress compatibility list. Default true.
+ `homepage`boolWhether to return the plugin homepage link. Default true.
+ `versions`boolWhether to return the list of all available versions. Default false.
+ `donate_link`boolWhether to return the donation link. Default true.
+ `reviews`boolWhether to return the plugin reviews. Default false.
+ `banners`boolWhether to return the banner images links. Default false.
+ `icons`boolWhether to return the icon links. Default false.
+ `active_installs`boolWhether to return the number of active installations. Default false.
+ `group`boolWhether to return the assigned group. Default false.
+ `contributors`boolWhether to return the list of contributors. Default false. Default: `array()`
object|array|[WP\_Error](../classes/wp_error) Response object or array on success, [WP\_Error](../classes/wp_error) on failure. See the [function reference article](plugins_api) for more information on the make-up of possible return values depending on the value of `$action`.
File: `wp-admin/includes/plugin-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin-install.php/)
```
function plugins_api( $action, $args = array() ) {
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
if ( is_array( $args ) ) {
$args = (object) $args;
}
if ( 'query_plugins' === $action ) {
if ( ! isset( $args->per_page ) ) {
$args->per_page = 24;
}
}
if ( ! isset( $args->locale ) ) {
$args->locale = get_user_locale();
}
if ( ! isset( $args->wp_version ) ) {
$args->wp_version = substr( $wp_version, 0, 3 ); // x.y
}
/**
* Filters the WordPress.org Plugin Installation API arguments.
*
* Important: An object MUST be returned to this filter.
*
* @since 2.7.0
*
* @param object $args Plugin API arguments.
* @param string $action The type of information being requested from the Plugin Installation API.
*/
$args = apply_filters( 'plugins_api_args', $args, $action );
/**
* Filters the response for the current WordPress.org Plugin Installation API request.
*
* Returning a non-false value will effectively short-circuit the WordPress.org API request.
*
* If `$action` is 'query_plugins' or 'plugin_information', an object MUST be passed.
* If `$action` is 'hot_tags' or 'hot_categories', an array should be passed.
*
* @since 2.7.0
*
* @param false|object|array $result The result object or array. Default false.
* @param string $action The type of information being requested from the Plugin Installation API.
* @param object $args Plugin API arguments.
*/
$res = apply_filters( 'plugins_api', false, $action, $args );
if ( false === $res ) {
$url = 'http://api.wordpress.org/plugins/info/1.2/';
$url = add_query_arg(
array(
'action' => $action,
'request' => $args,
),
$url
);
$http_url = $url;
$ssl = wp_http_supports( array( 'ssl' ) );
if ( $ssl ) {
$url = set_url_scheme( $url, 'https' );
}
$http_args = array(
'timeout' => 15,
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
);
$request = wp_remote_get( $url, $http_args );
if ( $ssl && is_wp_error( $request ) ) {
if ( ! wp_is_json_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_get( $http_url, $http_args );
}
if ( is_wp_error( $request ) ) {
$res = new WP_Error(
'plugins_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_array( $res ) ) {
// Object casting is required in order to match the info/1.0 format.
$res = (object) $res;
} elseif ( null === $res ) {
$res = new WP_Error(
'plugins_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 )
);
}
if ( isset( $res->error ) ) {
$res = new WP_Error( 'plugins_api_failed', $res->error );
}
}
} elseif ( ! is_wp_error( $res ) ) {
$res->external = true;
}
/**
* Filters the Plugin Installation API response results.
*
* @since 2.7.0
*
* @param object|WP_Error $res Response object or WP_Error.
* @param string $action The type of information being requested from the Plugin Installation API.
* @param object $args Plugin API arguments.
*/
return apply_filters( 'plugins_api_result', $res, $action, $args );
}
```
[apply\_filters( 'plugins\_api', false|object|array $result, string $action, object $args )](../hooks/plugins_api)
Filters the response for the current WordPress.org Plugin Installation API request.
[apply\_filters( 'plugins\_api\_args', object $args, string $action )](../hooks/plugins_api_args)
Filters the WordPress.org Plugin Installation API arguments.
[apply\_filters( 'plugins\_api\_result', object|WP\_Error $res, string $action, object $args )](../hooks/plugins_api_result)
Filters the Plugin Installation API response results.
| 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. |
| [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [wp\_http\_supports()](wp_http_supports) wp-includes/http.php | Determines if there is an HTTP Transport that can process this request. |
| [wp\_remote\_get()](wp_remote_get) wp-includes/http.php | Performs an HTTP request using the GET method and returns its response. |
| [wp\_remote\_retrieve\_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. |
| [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. |
| [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\_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::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\_ajax\_install\_plugin()](wp_ajax_install_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for installing a plugin. |
| [install\_popular\_tags()](install_popular_tags) wp-admin/includes/plugin-install.php | Retrieves popular WordPress plugin tags. |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| [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 | |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_shortlink_wp_head() wp\_shortlink\_wp\_head()
=========================
Injects rel=shortlink into the head if a shortlink is defined for the current page.
Attached to the [‘wp\_head’](../hooks/wp_head) action.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function wp_shortlink_wp_head() {
$shortlink = wp_get_shortlink( 0, 'query' );
if ( empty( $shortlink ) ) {
return;
}
echo "<link rel='shortlink' href='" . esc_url( $shortlink ) . "' />\n";
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_shortlink()](wp_get_shortlink) wp-includes/link-template.php | Returns a shortlink for a post, page, attachment, or site. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_maybe_update_network_site_counts_on_update( WP_Site $new_site, WP_Site|null $old_site = null ) wp\_maybe\_update\_network\_site\_counts\_on\_update( WP\_Site $new\_site, WP\_Site|null $old\_site = null )
============================================================================================================
Updates the count of sites for a network based on a changed site.
`$new_site` [WP\_Site](../classes/wp_site) Required The site object that has been inserted, updated or deleted. `$old_site` [WP\_Site](../classes/wp_site)|null Optional If $new\_site has been updated, this must be the previous state of that site. Default: `null`
File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function wp_maybe_update_network_site_counts_on_update( $new_site, $old_site = null ) {
if ( null === $old_site ) {
wp_maybe_update_network_site_counts( $new_site->network_id );
return;
}
if ( $new_site->network_id != $old_site->network_id ) {
wp_maybe_update_network_site_counts( $new_site->network_id );
wp_maybe_update_network_site_counts( $old_site->network_id );
}
}
```
| Uses | Description |
| --- | --- |
| [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 |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress the_title_rss() the\_title\_rss()
=================
Displays the post title in the feed.
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function the_title_rss() {
echo get_the_title_rss();
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_title\_rss()](get_the_title_rss) wp-includes/feed.php | Retrieves the current post title for the feed. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_paused_plugins(): WP_Paused_Extensions_Storage wp\_paused\_plugins(): WP\_Paused\_Extensions\_Storage
======================================================
Get the instance for storing paused plugins.
[WP\_Paused\_Extensions\_Storage](../classes/wp_paused_extensions_storage)
File: `wp-includes/error-protection.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/error-protection.php/)
```
function wp_paused_plugins() {
static $storage = null;
if ( null === $storage ) {
$storage = new WP_Paused_Extensions_Storage( 'plugin' );
}
return $storage;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Paused\_Extensions\_Storage::\_\_construct()](../classes/wp_paused_extensions_storage/__construct) wp-includes/class-wp-paused-extensions-storage.php | Constructor. |
| Used By | Description |
| --- | --- |
| [WP\_Recovery\_Mode::store\_error()](../classes/wp_recovery_mode/store_error) wp-includes/class-wp-recovery-mode.php | Stores the given error so that the extension causing it is paused. |
| [WP\_Recovery\_Mode::exit\_recovery\_mode()](../classes/wp_recovery_mode/exit_recovery_mode) wp-includes/class-wp-recovery-mode.php | Ends the current recovery mode session. |
| [wp\_skip\_paused\_plugins()](wp_skip_paused_plugins) wp-includes/load.php | Filters a given list of plugins, removing any paused plugins from it. |
| [resume\_plugin()](resume_plugin) wp-admin/includes/plugin.php | Tries to resume a single plugin. |
| [deactivate\_plugins()](deactivate_plugins) wp-admin/includes/plugin.php | Deactivates a single plugin or multiple plugins. |
wordpress trackback_response( int|bool $error, string $error_message = '' ) trackback\_response( int|bool $error, string $error\_message = '' )
===================================================================
Response to a trackback.
Responds with an error or success XML message.
`$error` int|bool Required Whether there was an error.
Default `'0'`. Accepts `'0'` or `'1'`, true or false. `$error_message` string Optional Error message if an error occurred. Default: `''`
File: `wp-trackback.php`. [View all references](https://developer.wordpress.org/reference/files/wp-trackback.php/)
```
function trackback_response( $error = 0, $error_message = '' ) {
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) );
if ( $error ) {
echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
echo "<response>\n";
echo "<error>1</error>\n";
echo "<message>$error_message</message>\n";
echo '</response>';
die();
} else {
echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
echo "<response>\n";
echo "<error>0</error>\n";
echo '</response>';
}
}
```
| Uses | Description |
| --- | --- |
| [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. |
| programming_docs |
wordpress wp_is_application_passwords_available_for_user( int|WP_User $user ): bool wp\_is\_application\_passwords\_available\_for\_user( int|WP\_User $user ): bool
================================================================================
Checks if Application Passwords is available for a specific user.
By default all users can use Application Passwords. Use [‘wp\_is\_application\_passwords\_available\_for\_user’](../hooks/wp_is_application_passwords_available_for_user) to restrict availability to certain users.
`$user` int|[WP\_User](../classes/wp_user) Required The user to check. bool
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_is_application_passwords_available_for_user( $user ) {
if ( ! wp_is_application_passwords_available() ) {
return false;
}
if ( ! is_object( $user ) ) {
$user = get_userdata( $user );
}
if ( ! $user || ! $user->exists() ) {
return false;
}
/**
* Filters whether Application Passwords is available for a specific user.
*
* @since 5.6.0
*
* @param bool $available True if available, false otherwise.
* @param WP_User $user The user to check.
*/
return apply_filters( 'wp_is_application_passwords_available_for_user', true, $user );
}
```
[apply\_filters( 'wp\_is\_application\_passwords\_available\_for\_user', bool $available, WP\_User $user )](../hooks/wp_is_application_passwords_available_for_user)
Filters whether Application Passwords is available for a specific user.
| Uses | Description |
| --- | --- |
| [wp\_is\_application\_passwords\_available()](wp_is_application_passwords_available) wp-includes/user.php | Checks if Application Passwords is globally available. |
| [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. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Application\_Passwords\_Controller::get\_user()](../classes/wp_rest_application_passwords_controller/get_user) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Gets the requested user. |
| [wp\_authenticate\_application\_password()](wp_authenticate_application_password) wp-includes/user.php | Authenticates the user using an application password. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress wp_kses_attr_check( string $name, string $value, string $whole, string $vless, string $element, array $allowed_html ): bool wp\_kses\_attr\_check( string $name, string $value, string $whole, string $vless, string $element, array $allowed\_html ): bool
===============================================================================================================================
Determines whether an attribute is allowed.
`$name` string Required The attribute name. Passed by reference. Returns empty string when not allowed. `$value` string Required The attribute value. Passed by reference. Returns a filtered value. `$whole` string Required The `name=value` input. Passed by reference. Returns filtered input. `$vless` string Required Whether the attribute is valueless. Use `'y'` or `'n'`. `$element` string Required The name of the element to which this attribute belongs. `$allowed_html` array Required The full list of allowed elements and attributes. bool Whether or not the attribute is allowed.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_kses_attr_check( &$name, &$value, &$whole, $vless, $element, $allowed_html ) {
$name_low = strtolower( $name );
$element_low = strtolower( $element );
if ( ! isset( $allowed_html[ $element_low ] ) ) {
$name = '';
$value = '';
$whole = '';
return false;
}
$allowed_attr = $allowed_html[ $element_low ];
if ( ! isset( $allowed_attr[ $name_low ] ) || '' === $allowed_attr[ $name_low ] ) {
/*
* Allow `data-*` attributes.
*
* When specifying `$allowed_html`, the attribute name should be set as
* `data-*` (not to be mixed with the HTML 4.0 `data` attribute, see
* https://www.w3.org/TR/html40/struct/objects.html#adef-data).
*
* Note: the attribute name should only contain `A-Za-z0-9_-` chars,
* double hyphens `--` are not accepted by WordPress.
*/
if ( strpos( $name_low, 'data-' ) === 0 && ! empty( $allowed_attr['data-*'] )
&& preg_match( '/^data(?:-[a-z0-9_]+)+$/', $name_low, $match )
) {
/*
* Add the whole attribute name to the allowed attributes and set any restrictions
* for the `data-*` attribute values for the current element.
*/
$allowed_attr[ $match[0] ] = $allowed_attr['data-*'];
} else {
$name = '';
$value = '';
$whole = '';
return false;
}
}
if ( 'style' === $name_low ) {
$new_value = safecss_filter_attr( $value );
if ( empty( $new_value ) ) {
$name = '';
$value = '';
$whole = '';
return false;
}
$whole = str_replace( $value, $new_value, $whole );
$value = $new_value;
}
if ( is_array( $allowed_attr[ $name_low ] ) ) {
// There are some checks.
foreach ( $allowed_attr[ $name_low ] as $currkey => $currval ) {
if ( ! wp_kses_check_attr_val( $value, $vless, $currkey, $currval ) ) {
$name = '';
$value = '';
$whole = '';
return false;
}
}
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [safecss\_filter\_attr()](safecss_filter_attr) wp-includes/kses.php | Filters an inline style attribute and removes disallowed rules. |
| [wp\_kses\_check\_attr\_val()](wp_kses_check_attr_val) wp-includes/kses.php | Performs different checks for attribute values. |
| Used By | Description |
| --- | --- |
| [wp\_kses\_one\_attr()](wp_kses_one_attr) wp-includes/kses.php | Filters one HTML attribute and ensures its value is allowed. |
| [wp\_kses\_attr()](wp_kses_attr) wp-includes/kses.php | Removes all attributes, if none are allowed for this element. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Added support for `data-*` wildcard attributes. |
| [4.2.3](https://developer.wordpress.org/reference/since/4.2.3/) | Introduced. |
wordpress add_menu_classes( array $menu ): array add\_menu\_classes( array $menu ): array
========================================
Adds CSS classes for top-level administration menu items.
The list of added classes includes `.menu-top-first` and `.menu-top-last`.
`$menu` array Required The array of administration menu items. array The array of administration menu items with the CSS classes added.
File: `wp-admin/includes/menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/menu.php/)
```
function add_menu_classes( $menu ) {
$first_item = false;
$last_order = false;
$items_count = count( $menu );
$i = 0;
foreach ( $menu as $order => $top ) {
$i++;
if ( 0 == $order ) { // Dashboard is always shown/single.
$menu[0][4] = add_cssclass( 'menu-top-first', $top[4] );
$last_order = 0;
continue;
}
if ( 0 === strpos( $top[2], 'separator' ) && false !== $last_order ) { // If separator.
$first_item = true;
$classes = $menu[ $last_order ][4];
$menu[ $last_order ][4] = add_cssclass( 'menu-top-last', $classes );
continue;
}
if ( $first_item ) {
$classes = $menu[ $order ][4];
$menu[ $order ][4] = add_cssclass( 'menu-top-first', $classes );
$first_item = false;
}
if ( $i == $items_count ) { // Last item.
$classes = $menu[ $order ][4];
$menu[ $order ][4] = add_cssclass( 'menu-top-last', $classes );
}
$last_order = $order;
}
/**
* Filters administration menu array with classes added for top-level items.
*
* @since 2.7.0
*
* @param array $menu Associative array of administration menu items.
*/
return apply_filters( 'add_menu_classes', $menu );
}
```
[apply\_filters( 'add\_menu\_classes', array $menu )](../hooks/add_menu_classes)
Filters administration menu array with classes added for top-level items.
| Uses | Description |
| --- | --- |
| [add\_cssclass()](add_cssclass) wp-admin/includes/menu.php | Adds a CSS class to a string. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_get_update_data(): array wp\_get\_update\_data(): array
==============================
Collects counts and UI strings for available updates.
array
File: `wp-includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/update.php/)
```
function wp_get_update_data() {
$counts = array(
'plugins' => 0,
'themes' => 0,
'wordpress' => 0,
'translations' => 0,
);
$plugins = current_user_can( 'update_plugins' );
if ( $plugins ) {
$update_plugins = get_site_transient( 'update_plugins' );
if ( ! empty( $update_plugins->response ) ) {
$counts['plugins'] = count( $update_plugins->response );
}
}
$themes = current_user_can( 'update_themes' );
if ( $themes ) {
$update_themes = get_site_transient( 'update_themes' );
if ( ! empty( $update_themes->response ) ) {
$counts['themes'] = count( $update_themes->response );
}
}
$core = current_user_can( 'update_core' );
if ( $core && function_exists( 'get_core_updates' ) ) {
$update_wordpress = get_core_updates( array( 'dismissed' => false ) );
if ( ! empty( $update_wordpress )
&& ! in_array( $update_wordpress[0]->response, array( 'development', 'latest' ), true )
&& current_user_can( 'update_core' )
) {
$counts['wordpress'] = 1;
}
}
if ( ( $core || $plugins || $themes ) && wp_get_translation_updates() ) {
$counts['translations'] = 1;
}
$counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress'] + $counts['translations'];
$titles = array();
if ( $counts['wordpress'] ) {
/* translators: %d: Number of available WordPress updates. */
$titles['wordpress'] = sprintf( __( '%d WordPress Update' ), $counts['wordpress'] );
}
if ( $counts['plugins'] ) {
/* translators: %d: Number of available plugin updates. */
$titles['plugins'] = sprintf( _n( '%d Plugin Update', '%d Plugin Updates', $counts['plugins'] ), $counts['plugins'] );
}
if ( $counts['themes'] ) {
/* translators: %d: Number of available theme updates. */
$titles['themes'] = sprintf( _n( '%d Theme Update', '%d Theme Updates', $counts['themes'] ), $counts['themes'] );
}
if ( $counts['translations'] ) {
$titles['translations'] = __( 'Translation Updates' );
}
$update_title = $titles ? esc_attr( implode( ', ', $titles ) ) : '';
$update_data = array(
'counts' => $counts,
'title' => $update_title,
);
/**
* Filters the returned array of update data for plugins, themes, and WordPress core.
*
* @since 3.5.0
*
* @param array $update_data {
* Fetched update data.
*
* @type array $counts An array of counts for available plugin, theme, and WordPress updates.
* @type string $update_title Titles of available updates.
* }
* @param array $titles An array of update counts and UI strings for available updates.
*/
return apply_filters( 'wp_get_update_data', $update_data, $titles );
}
```
[apply\_filters( 'wp\_get\_update\_data', array $update\_data, array $titles )](../hooks/wp_get_update_data)
Filters the returned array of update data for plugins, themes, and WordPress core.
| Uses | Description |
| --- | --- |
| [get\_core\_updates()](get_core_updates) wp-admin/includes/update.php | Gets available core updates. |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [wp\_get\_translation\_updates()](wp_get_translation_updates) wp-includes/update.php | Retrieves a list of all language updates available. |
| [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. |
| [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\_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\_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. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress get_users( array $args = array() ): array get\_users( array $args = array() ): array
==========================================
Retrieves list of users matching criteria.
* [WP\_User\_Query](../classes/wp_user_query)
`$args` array Optional Arguments to retrieve users. See [WP\_User\_Query::prepare\_query()](../classes/wp_user_query/prepare_query) for more information on accepted arguments. More Arguments from WP\_User\_Query::prepare\_query( ... $query ) Array or string of Query parameters.
* `blog_id`intThe site ID. Default is the current site.
* `role`string|string[]An array or a comma-separated list of role names that users must match to be included in results. Note that this is an inclusive list: users must match \*each\* role.
* `role__in`string[]An array of role names. Matched users must have at least one of these roles.
* `role__not_in`string[]An array of role names to exclude. Users matching one or more of these roles will not be included in results.
* `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.
* `capability`string|string[]An array or a comma-separated list of capability names that users must match to be included in results. Note that this is an inclusive list: users must match \*each\* capability.
Does NOT work for capabilities not in the database or filtered via ['map\_meta\_cap'](../hooks/map_meta_cap).
* `capability__in`string[]An array of capability names. Matched users must have at least one of these capabilities.
Does NOT work for capabilities not in the database or filtered via ['map\_meta\_cap'](../hooks/map_meta_cap).
* `capability__not_in`string[]An array of capability names to exclude. Users matching one or more of these capabilities will not be included in results.
Does NOT work for capabilities not in the database or filtered via ['map\_meta\_cap'](../hooks/map_meta_cap).
* `include`int[]An array of user IDs to include.
* `exclude`int[]An array of user IDs to exclude.
* `search`stringSearch keyword. Searches for possible string matches on columns.
When `$search_columns` is left empty, it tries to determine which column to search in based on search string.
* `search_columns`string[]Array of column names to be searched. Accepts `'ID'`, `'user_login'`, `'user_email'`, `'user_url'`, `'user_nicename'`, `'display_name'`.
* `orderby`string|arrayField(s) to sort the retrieved users by. May be a single value, an array of values, or a multi-dimensional array with fields as keys and orders (`'ASC'` or `'DESC'`) as values. Accepted values are:
+ `'ID'`
+ `'display_name'` (or `'name'`)
+ `'include'`
+ `'user_login'` (or `'login'`)
+ `'login__in'`
+ `'user_nicename'` (or `'nicename'`),
+ `'nicename__in'`
+ 'user\_email (or `'email'`)
+ `'user_url'` (or `'url'`),
+ `'user_registered'` (or `'registered'`)
+ `'post_count'`
+ `'meta_value'`,
+ `'meta_value_num'`
+ The value of `$meta_key`
+ An array key of `$meta_query` To use `'meta_value'` or `'meta_value_num'`, `$meta_key` must be also be defined. Default `'user_login'`.
* `order`stringDesignates ascending or descending order of users. Order values passed as part of an `$orderby` array take precedence over this parameter. Accepts `'ASC'`, `'DESC'`. Default `'ASC'`.
* `offset`intNumber of users to offset in retrieved results. Can be used in conjunction with pagination. Default 0.
* `number`intNumber of users to limit the query for. Can be used in conjunction with pagination. Value -1 (all) is supported, but should be used with caution on larger sites.
Default -1 (all users).
* `paged`intWhen used with number, defines the page of results to return.
Default 1.
* `count_total`boolWhether to count the total number of users found. If pagination is not needed, setting this to false can improve performance.
Default true.
* `fields`string|string[]Which fields to return. Single or all fields (string), or array of fields. Accepts:
+ `'ID'`
+ `'display_name'`
+ `'user_login'`
+ `'user_nicename'`
+ `'user_email'`
+ `'user_url'`
+ `'user_registered'`
+ `'user_pass'`
+ `'user_activation_key'`
+ `'user_status'`
+ `'spam'` (only available on multisite installs)
+ `'deleted'` (only available on multisite installs)
+ `'all'` for all fields and loads user meta.
+ `'all_with_meta'` Deprecated. Use `'all'`. Default `'all'`.
* `who`stringType of users to query. Accepts `'authors'`.
Default empty (all users).
* `has_published_posts`bool|string[]Pass an array of post types to filter results to users who have published posts in those post types. `true` is an alias for all public post types.
* `nicename`stringThe user nicename.
* `nicename__in`string[]An array of nicenames to include. Users matching one of these nicenames will be included in results.
* `nicename__not_in`string[]An array of nicenames to exclude. Users matching one of these nicenames will not be included in results.
* `login`stringThe user login.
* `login__in`string[]An array of logins to include. Users matching one of these logins will be included in results.
* `login__not_in`string[]An array of logins to exclude. Users matching one of these logins will not be included in results.
Default: `array()`
array List of users.
Return value is an array of IDs, stdClass objects, or [WP\_User](../classes/wp_user "Class Reference/WP User") objects, depending on the value of the ‘fields‘ parameter.
* If ‘fields‘ is set to ‘all’ (default), or ‘all\_with\_meta’, it will return an array of [WP\_User](../classes/wp_user "Class Reference/WP User") objects.
* If ‘fields‘ is set to an array of [wp\_users](https://codex.wordpress.org/Database_Description#Table:_wp_users "Database Description") table fields, it will return an array of stdClass objects with only those fields.
* If ‘fields‘ is set to any individual [wp\_users](https://codex.wordpress.org/Database_Description#Table:_wp_users "Database Description") table field, an array of IDs will be returned.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function get_users( $args = array() ) {
$args = wp_parse_args( $args );
$args['count_total'] = false;
$user_search = new WP_User_Query( $args );
return (array) $user_search->get_results();
}
```
| Uses | Description |
| --- | --- |
| [WP\_User\_Query::\_\_construct()](../classes/wp_user_query/__construct) wp-includes/class-wp-user-query.php | PHP5 constructor. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Used By | Description |
| --- | --- |
| [wp\_list\_users()](wp_list_users) wp-includes/user.php | Lists all the users of the site, with several options available. |
| [\_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\_uninitialize\_site()](wp_uninitialize_site) wp-includes/ms-site.php | Runs the uninitialization routine for a given site. |
| [populate\_network\_meta()](populate_network_meta) wp-admin/includes/schema.php | Creates WordPress network meta and sets the default values. |
| [wpmu\_delete\_blog()](wpmu_delete_blog) wp-admin/includes/ms.php | Delete a site. |
| [wp\_ajax\_autocomplete\_user()](wp_ajax_autocomplete_user) wp-admin/includes/ajax-actions.php | Ajax handler for user autocomplete. |
| [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.php | |
| [wp\_dropdown\_users()](wp_dropdown_users) wp-includes/user.php | Creates dropdown HTML content of users. |
| [wp\_list\_authors()](wp_list_authors) wp-includes/author-template.php | Lists all the authors of the site, with several options available. |
| [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\_getUsers()](../classes/wp_xmlrpc_server/wp_getusers) wp-includes/class-wp-xmlrpc-server.php | Retrieve users. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress edit_comment(): int|WP_Error edit\_comment(): int|WP\_Error
==============================
Updates a comment with values provided in $\_POST.
int|[WP\_Error](../classes/wp_error) The value 1 if the comment was updated, 0 if not updated.
A [WP\_Error](../classes/wp_error) object on failure.
File: `wp-admin/includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/comment.php/)
```
function edit_comment() {
if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) ) {
wp_die( __( 'Sorry, you are not allowed to edit comments on this post.' ) );
}
if ( isset( $_POST['newcomment_author'] ) ) {
$_POST['comment_author'] = $_POST['newcomment_author'];
}
if ( isset( $_POST['newcomment_author_email'] ) ) {
$_POST['comment_author_email'] = $_POST['newcomment_author_email'];
}
if ( isset( $_POST['newcomment_author_url'] ) ) {
$_POST['comment_author_url'] = $_POST['newcomment_author_url'];
}
if ( isset( $_POST['comment_status'] ) ) {
$_POST['comment_approved'] = $_POST['comment_status'];
}
if ( isset( $_POST['content'] ) ) {
$_POST['comment_content'] = $_POST['content'];
}
if ( isset( $_POST['comment_ID'] ) ) {
$_POST['comment_ID'] = (int) $_POST['comment_ID'];
}
foreach ( array( 'aa', 'mm', 'jj', 'hh', 'mn' ) as $timeunit ) {
if ( ! empty( $_POST[ 'hidden_' . $timeunit ] ) && $_POST[ 'hidden_' . $timeunit ] !== $_POST[ $timeunit ] ) {
$_POST['edit_date'] = '1';
break;
}
}
if ( ! empty( $_POST['edit_date'] ) ) {
$aa = $_POST['aa'];
$mm = $_POST['mm'];
$jj = $_POST['jj'];
$hh = $_POST['hh'];
$mn = $_POST['mn'];
$ss = $_POST['ss'];
$jj = ( $jj > 31 ) ? 31 : $jj;
$hh = ( $hh > 23 ) ? $hh - 24 : $hh;
$mn = ( $mn > 59 ) ? $mn - 60 : $mn;
$ss = ( $ss > 59 ) ? $ss - 60 : $ss;
$_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
}
return wp_update_comment( $_POST, true );
}
```
| Uses | Description |
| --- | --- |
| [wp\_update\_comment()](wp_update_comment) wp-includes/comment.php | Updates an existing comment in the database. |
| [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\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_edit\_comment()](wp_ajax_edit_comment) wp-admin/includes/ajax-actions.php | Ajax handler for editing a comment. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | A return value was added. |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress comment_type( string|false $commenttxt = false, string|false $trackbacktxt = false, string|false $pingbacktxt = false ) comment\_type( string|false $commenttxt = false, string|false $trackbacktxt = false, string|false $pingbacktxt = false )
========================================================================================================================
Displays the comment type of the current comment.
`$commenttxt` string|false Optional String to display for comment type. Default: `false`
`$trackbacktxt` string|false Optional String to display for trackback type. Default: `false`
`$pingbacktxt` string|false Optional String to display for pingback type. Default: `false`
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function comment_type( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false ) {
if ( false === $commenttxt ) {
$commenttxt = _x( 'Comment', 'noun' );
}
if ( false === $trackbacktxt ) {
$trackbacktxt = __( 'Trackback' );
}
if ( false === $pingbacktxt ) {
$pingbacktxt = __( 'Pingback' );
}
$type = get_comment_type();
switch ( $type ) {
case 'trackback':
echo $trackbacktxt;
break;
case 'pingback':
echo $pingbacktxt;
break;
default:
echo $commenttxt;
}
}
```
| Uses | Description |
| --- | --- |
| [get\_comment\_type()](get_comment_type) wp-includes/comment-template.php | Retrieves the comment type of the current comment. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress update_option_new_admin_email( string $old_value, string $value ) update\_option\_new\_admin\_email( string $old\_value, string $value )
======================================================================
Sends a confirmation request email when a change of site admin email address is attempted.
The new site admin address will not become active until confirmed.
`$old_value` string Required The old site admin email address. `$value` string Required The proposed new site admin email address. File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function update_option_new_admin_email( $old_value, $value ) {
if ( get_option( 'admin_email' ) === $value || ! is_email( $value ) ) {
return;
}
$hash = md5( $value . time() . wp_rand() );
$new_admin_email = array(
'hash' => $hash,
'newemail' => $value,
);
update_option( 'adminhash', $new_admin_email );
$switched_locale = switch_to_locale( get_user_locale() );
/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
$email_text = __(
'Howdy ###USERNAME###,
Someone with administrator capabilities recently requested to have the
administration email address changed on this site:
###SITEURL###
To confirm this change, please click on the following link:
###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 site admin 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 proposed new site admin email address.
* ###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_admin_email {
* Data relating to the new site admin email address.
*
* @type string $hash The secure hash used in the confirmation link URL.
* @type string $newemail The proposed new site admin email address.
* }
*/
$content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email );
$current_user = wp_get_current_user();
$content = str_replace( '###USERNAME###', $current_user->user_login, $content );
$content = str_replace( '###ADMIN_URL###', esc_url( self_admin_url( 'options.php?adminhash=' . $hash ) ), $content );
$content = str_replace( '###EMAIL###', $value, $content );
$content = str_replace( '###SITENAME###', wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), $content );
$content = str_replace( '###SITEURL###', home_url(), $content );
if ( '' !== get_option( 'blogname' ) ) {
$site_title = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
} else {
$site_title = parse_url( home_url(), PHP_URL_HOST );
}
wp_mail(
$value,
sprintf(
/* translators: New admin email address notification email subject. %s: Site title. */
__( '[%s] New Admin Email Address' ),
$site_title
),
$content
);
if ( $switched_locale ) {
restore_previous_locale();
}
}
```
[apply\_filters( 'new\_admin\_email\_content', string $email\_text, array $new\_admin\_email )](../hooks/new_admin_email_content)
Filters the text of the email sent when a change of site admin email address is attempted.
| 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. |
| [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. |
| [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. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [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.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 the_author_msn() the\_author\_msn()
==================
This function has been deprecated. Use [the\_author\_meta()](the_author_meta) instead.
Display the MSN address of the author of the current post.
* [the\_author\_meta()](the_author_meta)
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function the_author_msn() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'msn\')' );
the_author_meta('msn');
}
```
| 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 set_url_scheme( string $url, string|null $scheme = null ): string set\_url\_scheme( string $url, string|null $scheme = null ): string
===================================================================
Sets the scheme for a URL.
`$url` string Required Absolute URL that includes a scheme `$scheme` string|null Optional Scheme to give $url. Currently `'http'`, `'https'`, `'login'`, `'login_post'`, `'admin'`, `'relative'`, `'rest'`, `'rpc'`, or null. Default: `null`
string URL with chosen scheme.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function set_url_scheme( $url, $scheme = null ) {
$orig_scheme = $scheme;
if ( ! $scheme ) {
$scheme = is_ssl() ? 'https' : 'http';
} elseif ( 'admin' === $scheme || 'login' === $scheme || 'login_post' === $scheme || 'rpc' === $scheme ) {
$scheme = is_ssl() || force_ssl_admin() ? 'https' : 'http';
} elseif ( 'http' !== $scheme && 'https' !== $scheme && 'relative' !== $scheme ) {
$scheme = is_ssl() ? 'https' : 'http';
}
$url = trim( $url );
if ( substr( $url, 0, 2 ) === '//' ) {
$url = 'http:' . $url;
}
if ( 'relative' === $scheme ) {
$url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) );
if ( '' !== $url && '/' === $url[0] ) {
$url = '/' . ltrim( $url, "/ \t\n\r\0\x0B" );
}
} else {
$url = preg_replace( '#^\w+://#', $scheme . '://', $url );
}
/**
* Filters the resulting URL after setting the scheme.
*
* @since 3.4.0
*
* @param string $url The complete URL including scheme and path.
* @param string $scheme Scheme applied to the URL. One of 'http', 'https', or 'relative'.
* @param string|null $orig_scheme Scheme requested for the URL. One of 'http', 'https', 'login',
* 'login_post', 'admin', 'relative', 'rest', 'rpc', or null.
*/
return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme );
}
```
[apply\_filters( 'set\_url\_scheme', string $url, string $scheme, string|null $orig\_scheme )](../hooks/set_url_scheme)
Filters the resulting URL after setting the scheme.
| Uses | Description |
| --- | --- |
| [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. |
| [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\_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 |
| [get\_self\_link()](get_self_link) wp-includes/feed.php | Returns the link for the currently displayed feed. |
| [wp\_check\_php\_version()](wp_check_php_version) wp-admin/includes/misc.php | Checks if the user needs to update PHP. |
| [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\_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. |
| [get\_header\_video\_url()](get_header_video_url) wp-includes/theme.php | Retrieves header video URL for custom header. |
| [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. |
| [get\_preview\_post\_link()](get_preview_post_link) wp-includes/link-template.php | Retrieves the URL used for the post preview. |
| [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. |
| [wp\_admin\_canonical\_url()](wp_admin_canonical_url) wp-admin/includes/misc.php | Removes single-use URL parameters and create canonical link based on new URL. |
| [translations\_api()](translations_api) wp-admin/includes/translation-install.php | Retrieve translations from WordPress Translation API. |
| [themes\_api()](themes_api) wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. |
| [WP\_List\_Table::pagination()](../classes/wp_list_table/pagination) wp-admin/includes/class-wp-list-table.php | Displays the pagination. |
| [WP\_List\_Table::print\_column\_headers()](../classes/wp_list_table/print_column_headers) wp-admin/includes/class-wp-list-table.php | Prints column headers, accounting for hidden and sortable columns. |
| [get\_core\_checksums()](get_core_checksums) wp-admin/includes/update.php | Gets and caches the checksums for the given version of WordPress. |
| [wp\_check\_browser\_version()](wp_check_browser_version) wp-admin/includes/dashboard.php | Checks if the user needs a browser update. |
| [plugins\_api()](plugins_api) wp-admin/includes/plugin-install.php | Retrieves plugin installer pages from the WordPress.org Plugins API. |
| [add\_menu\_page()](add_menu_page) wp-admin/includes/plugin.php | Adds a top-level menu page. |
| [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor |
| [wp\_ajax\_query\_themes()](wp_ajax_query_themes) wp-admin/includes/ajax-actions.php | Ajax handler for getting themes from [themes\_api()](themes_api) . |
| [get\_home\_path()](get_home_path) wp-admin/includes/file.php | Gets the absolute filesystem path to the root of the WordPress installation. |
| [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. |
| [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. |
| [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| [\_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. |
| [auth\_redirect()](auth_redirect) wp-includes/pluggable.php | Checks if a user is logged in, if not it redirects them to the login page. |
| [url\_is\_accessable\_via\_ssl()](url_is_accessable_via_ssl) wp-includes/deprecated.php | Determines if the URL can be accessed over SSL. |
| [content\_url()](content_url) wp-includes/link-template.php | Retrieves the URL to the content directory. |
| [plugins\_url()](plugins_url) wp-includes/link-template.php | Retrieves a URL within the plugins or mu-plugins directory. |
| [network\_site\_url()](network_site_url) wp-includes/link-template.php | Retrieves the site URL for the current network. |
| [network\_home\_url()](network_home_url) wp-includes/link-template.php | Retrieves the home URL for the current network. |
| [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. |
| [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\_menu\_item\_classes\_by\_context()](_wp_menu_item_classes_by_context) wp-includes/nav-menu-template.php | Adds the class property classes for the current context, if applicable. |
| [wp\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [url\_to\_postid()](url_to_postid) wp-includes/rewrite.php | Examines a URL and try to determine the post ID it represents. |
| [filter\_SSL()](filter_ssl) wp-includes/ms-functions.php | Formats a URL to use https. |
| [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. |
| [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `'rest'` scheme was added. |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
| programming_docs |
wordpress start_wp() start\_wp()
===========
This function has been deprecated.
Sets up the WordPress Loop.
Use The Loop instead.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function start_wp() {
global $wp_query;
_deprecated_function( __FUNCTION__, '1.5.0', __('new WordPress Loop') );
// Since the old style loop is being used, advance the query iterator here.
$wp_query->next_post();
setup_postdata( get_post() );
}
```
| Uses | Description |
| --- | --- |
| [setup\_postdata()](setup_postdata) wp-includes/query.php | Set up global post data. |
| [WP\_Query::next\_post()](../classes/wp_query/next_post) wp-includes/class-wp-query.php | Set up the next post and iterate current post index. |
| [\_\_()](__) 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. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | This function has been deprecated. |
| [1.0.1](https://developer.wordpress.org/reference/since/1.0.1/) | Introduced. |
wordpress get_role( string $role ): WP_Role|null get\_role( string $role ): WP\_Role|null
========================================
Retrieves role object.
`$role` string Required Role name. [WP\_Role](../classes/wp_role)|null [WP\_Role](../classes/wp_role) object if found, null if the role does not exist.
File: `wp-includes/capabilities.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/capabilities.php/)
```
function get_role( $role ) {
return wp_roles()->get_role( $role );
}
```
| Uses | Description |
| --- | --- |
| [wp\_roles()](wp_roles) wp-includes/capabilities.php | Retrieves the global [WP\_Roles](../classes/wp_roles) instance and instantiates it if necessary. |
| [WP\_Roles::get\_role()](../classes/wp_roles/get_role) wp-includes/class-wp-roles.php | Retrieves a role object by name. |
| Used By | Description |
| --- | --- |
| [populate\_roles\_160()](populate_roles_160) wp-admin/includes/schema.php | Create the roles for WordPress 2.0 |
| [populate\_roles\_210()](populate_roles_210) wp-admin/includes/schema.php | Create and modify WordPress roles for WordPress 2.1. |
| [populate\_roles\_230()](populate_roles_230) wp-admin/includes/schema.php | Create and modify WordPress roles for WordPress 2.3. |
| [populate\_roles\_250()](populate_roles_250) wp-admin/includes/schema.php | Create and modify WordPress roles for WordPress 2.5. |
| [populate\_roles\_260()](populate_roles_260) wp-admin/includes/schema.php | Create and modify WordPress roles for WordPress 2.6. |
| [populate\_roles\_270()](populate_roles_270) wp-admin/includes/schema.php | Create and modify WordPress roles for WordPress 2.7. |
| [populate\_roles\_280()](populate_roles_280) wp-admin/includes/schema.php | Create and modify WordPress roles for WordPress 2.8. |
| [populate\_roles\_300()](populate_roles_300) wp-admin/includes/schema.php | Create and modify WordPress roles for WordPress 3.0. |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [wp\_xmlrpc\_server::wp\_getUsers()](../classes/wp_xmlrpc_server/wp_getusers) wp-includes/class-wp-xmlrpc-server.php | Retrieve users. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_get_custom_css( string $stylesheet = '' ): string wp\_get\_custom\_css( string $stylesheet = '' ): string
=======================================================
Fetches the saved Custom CSS content for rendering.
`$stylesheet` string Optional A theme object stylesheet name. Defaults to the active theme. Default: `''`
string The Custom CSS Post content.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function wp_get_custom_css( $stylesheet = '' ) {
$css = '';
if ( empty( $stylesheet ) ) {
$stylesheet = get_stylesheet();
}
$post = wp_get_custom_css_post( $stylesheet );
if ( $post ) {
$css = $post->post_content;
}
/**
* Filters the custom CSS output into the head element.
*
* @since 4.7.0
*
* @param string $css CSS pulled in from the Custom CSS post type.
* @param string $stylesheet The theme stylesheet name.
*/
$css = apply_filters( 'wp_get_custom_css', $css, $stylesheet );
return $css;
}
```
[apply\_filters( 'wp\_get\_custom\_css', string $css, string $stylesheet )](../hooks/wp_get_custom_css)
Filters the custom CSS output into the head element.
| Uses | Description |
| --- | --- |
| [wp\_get\_custom\_css\_post()](wp_get_custom_css_post) wp-includes/theme.php | Fetches the `custom_css` post for a given theme. |
| [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_custom\_css\_cb()](wp_custom_css_cb) wp-includes/theme.php | Renders the Custom CSS style element. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress wp_admin_bar_header() wp\_admin\_bar\_header()
========================
Prints style and scripts for the admin bar.
File: `wp-includes/admin-bar.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/admin-bar.php/)
```
function wp_admin_bar_header() {
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
?>
<style<?php echo $type_attr; ?> media="print">#wpadminbar { display:none; }</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 |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress sanitize_post( object|WP_Post|array $post, string $context = 'display' ): object|WP_Post|array sanitize\_post( object|WP\_Post|array $post, string $context = 'display' ): object|WP\_Post|array
=================================================================================================
Sanitizes every post field.
If the context is ‘raw’, then the post object or array will get minimal sanitization of the integer fields.
* [sanitize\_post\_field()](sanitize_post_field)
`$post` object|[WP\_Post](../classes/wp_post)|array Required The post object or array `$context` string Optional How to sanitize post fields.
Accepts `'raw'`, `'edit'`, `'db'`, `'display'`, `'attribute'`, or `'js'`. Default `'display'`. Default: `'display'`
object|[WP\_Post](../classes/wp_post)|array The now sanitized post object or array (will be the same type as `$post`).
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function sanitize_post( $post, $context = 'display' ) {
if ( is_object( $post ) ) {
// Check if post already filtered for this context.
if ( isset( $post->filter ) && $context == $post->filter ) {
return $post;
}
if ( ! isset( $post->ID ) ) {
$post->ID = 0;
}
foreach ( array_keys( get_object_vars( $post ) ) as $field ) {
$post->$field = sanitize_post_field( $field, $post->$field, $post->ID, $context );
}
$post->filter = $context;
} elseif ( is_array( $post ) ) {
// Check if post already filtered for this context.
if ( isset( $post['filter'] ) && $context == $post['filter'] ) {
return $post;
}
if ( ! isset( $post['ID'] ) ) {
$post['ID'] = 0;
}
foreach ( array_keys( $post ) as $field ) {
$post[ $field ] = sanitize_post_field( $field, $post[ $field ], $post['ID'], $context );
}
$post['filter'] = $context;
}
return $post;
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_post\_field()](sanitize_post_field) wp-includes/post.php | Sanitizes a post field based on context. |
| 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. |
| [WP\_Post::get\_instance()](../classes/wp_post/get_instance) wp-includes/class-wp-post.php | Retrieve [WP\_Post](../classes/wp_post) instance. |
| [WP\_Post::filter()](../classes/wp_post/filter) wp-includes/class-wp-post.php | {@Missing Summary} |
| [update\_post\_cache()](update_post_cache) wp-includes/post.php | Updates posts in cache. |
| [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [\_set\_preview()](_set_preview) wp-includes/revision.php | Sets up the post object for preview based on the post autosave. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress image_constrain_size_for_editor( int $width, int $height, string|int[] $size = 'medium', string $context = null ): int[] image\_constrain\_size\_for\_editor( int $width, int $height, string|int[] $size = 'medium', string $context = null ): int[]
============================================================================================================================
Scales down the default size of an image.
This is so that the image is a better fit for the editor and theme.
The `$size` parameter accepts either an array or a string. The supported string values are ‘thumb’ or ‘thumbnail’ for the given thumbnail size or defaults at 128 width and 96 height in pixels. Also supported for the string value is ‘medium’, ‘medium\_large’ and ‘full’. The ‘full’ isn’t actually supported, but any value other than the supported will result in the content\_width size or 500 if that is not set.
Finally, there is a filter named [‘editor\_max\_image\_size’](../hooks/editor_max_image_size), that will be called on the calculated array for width and height, respectively.
`$width` int Required Width of the image in pixels. `$height` int Required Height of the image in pixels. `$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'`
`$context` string Optional Could be `'display'` (like in a theme) or `'edit'` (like inserting into an editor). Default: `null`
int[] An array of width and height values.
* intThe maximum width in pixels.
* `1`intThe maximum height in pixels.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function image_constrain_size_for_editor( $width, $height, $size = 'medium', $context = null ) {
global $content_width;
$_wp_additional_image_sizes = wp_get_additional_image_sizes();
if ( ! $context ) {
$context = is_admin() ? 'edit' : 'display';
}
if ( is_array( $size ) ) {
$max_width = $size[0];
$max_height = $size[1];
} elseif ( 'thumb' === $size || 'thumbnail' === $size ) {
$max_width = (int) get_option( 'thumbnail_size_w' );
$max_height = (int) get_option( 'thumbnail_size_h' );
// Last chance thumbnail size defaults.
if ( ! $max_width && ! $max_height ) {
$max_width = 128;
$max_height = 96;
}
} elseif ( 'medium' === $size ) {
$max_width = (int) get_option( 'medium_size_w' );
$max_height = (int) get_option( 'medium_size_h' );
} elseif ( 'medium_large' === $size ) {
$max_width = (int) get_option( 'medium_large_size_w' );
$max_height = (int) get_option( 'medium_large_size_h' );
if ( (int) $content_width > 0 ) {
$max_width = min( (int) $content_width, $max_width );
}
} elseif ( 'large' === $size ) {
/*
* We're inserting a large size image into the editor. If it's a really
* big image we'll scale it down to fit reasonably within the editor
* itself, and within the theme's content width if it's known. The user
* can resize it in the editor if they wish.
*/
$max_width = (int) get_option( 'large_size_w' );
$max_height = (int) get_option( 'large_size_h' );
if ( (int) $content_width > 0 ) {
$max_width = min( (int) $content_width, $max_width );
}
} elseif ( ! empty( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ), true ) ) {
$max_width = (int) $_wp_additional_image_sizes[ $size ]['width'];
$max_height = (int) $_wp_additional_image_sizes[ $size ]['height'];
// Only in admin. Assume that theme authors know what they're doing.
if ( (int) $content_width > 0 && 'edit' === $context ) {
$max_width = min( (int) $content_width, $max_width );
}
} else { // $size === 'full' has no constraint.
$max_width = $width;
$max_height = $height;
}
/**
* Filters the maximum image size dimensions for the editor.
*
* @since 2.5.0
*
* @param int[] $max_image_size {
* An array of width and height values.
*
* @type int $0 The maximum width in pixels.
* @type int $1 The maximum height in pixels.
* }
* @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 $context The context the image is being resized for.
* Possible values are 'display' (like in a theme)
* or 'edit' (like inserting into an editor).
*/
list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size, $context );
return wp_constrain_dimensions( $width, $height, $max_width, $max_height );
}
```
[apply\_filters( 'editor\_max\_image\_size', int[] $max\_image\_size, string|int[] $size, string $context )](../hooks/editor_max_image_size)
Filters the maximum image size dimensions for the editor.
| Uses | Description |
| --- | --- |
| [wp\_get\_additional\_image\_sizes()](wp_get_additional_image_sizes) wp-includes/media.php | Retrieves additional image sizes. |
| [wp\_constrain\_dimensions()](wp_constrain_dimensions) wp-includes/media.php | Calculates the new dimensions for a down-sampled image. |
| [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\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [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. |
| [image\_get\_intermediate\_size()](image_get_intermediate_size) wp-includes/media.php | Retrieves the image’s intermediate size (resized) path, width, and height. |
| [image\_downsize()](image_downsize) wp-includes/media.php | Scales an image to fit a particular size (such as ‘thumb’ or ‘medium’). |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress add_settings_section( string $id, string $title, callable $callback, string $page, array $args = array() ) add\_settings\_section( string $id, string $title, callable $callback, string $page, array $args = array() )
============================================================================================================
Adds a new section to a settings page.
Part of the Settings API. Use this to define new settings sections for an admin page.
Show settings sections in your admin page callback function with [do\_settings\_sections()](do_settings_sections) .
Add settings fields to your section with [add\_settings\_field()](add_settings_field) .
The $callback argument should be the name of a function that echoes out any content you want to show at the top of the settings section before the actual fields. It can output nothing if you want.
`$id` string Required Slug-name to identify the section. Used in the `'id'` attribute of tags. `$title` string Required Formatted title of the section. Shown as the heading for the section. `$callback` callable Required Function that echos out any content at the top of the section (between heading and fields). `$page` string Required The slug-name of the settings page on which to show the section. Built-in pages include `'general'`, `'reading'`, `'writing'`, `'discussion'`, `'media'`, etc. Create your own using [add\_options\_page()](add_options_page) ; `$args` array Optional Arguments used to create the settings section.
* `before_section`stringHTML content to prepend to the section's HTML output.
Receives the section's class name as `%s`.
* `after_section`stringHTML content to append to the section's HTML output.
* `section_class`stringThe class name to use for the section.
Default: `array()`
The callback function receives a single optional argument, which is an array with three elements. Example:
```
add_settings_section(
'eg_setting_section',
'Example settings section in reading',
'eg_setting_section_callback_function',
'reading'
);
function eg_setting_section_callback_function( $arg ) {
// echo section intro text here
echo '<p>id: ' . $arg['id'] . '</p>'; // id: eg_setting_section
echo '<p>title: ' . $arg['title'] . '</p>'; // title: Example settings section in reading
echo '<p>callback: ' . $arg['callback'] . '</p>'; // callback: eg_setting_section_callback_function
}
```
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function add_settings_section( $id, $title, $callback, $page, $args = array() ) {
global $wp_settings_sections;
$defaults = array(
'id' => $id,
'title' => $title,
'callback' => $callback,
'before_section' => '',
'after_section' => '',
'section_class' => '',
);
$section = wp_parse_args( $args, $defaults );
if ( 'misc' === $page ) {
_deprecated_argument(
__FUNCTION__,
'3.0.0',
sprintf(
/* translators: %s: misc */
__( 'The "%s" options group has been removed. Use another settings group.' ),
'misc'
)
);
$page = 'general';
}
if ( 'privacy' === $page ) {
_deprecated_argument(
__FUNCTION__,
'3.5.0',
sprintf(
/* translators: %s: privacy */
__( 'The "%s" options group has been removed. Use another settings group.' ),
'privacy'
)
);
$page = 'reading';
}
$wp_settings_sections[ $page ][ $id ] = $section;
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) 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. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Added an `$args` parameter for the section's HTML wrapper and class name. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
| programming_docs |
wordpress wp_caption_input_textarea( WP_Post $edit_post ): string wp\_caption\_input\_textarea( WP\_Post $edit\_post ): string
============================================================
Outputs a textarea element for inputting an attachment caption.
`$edit_post` [WP\_Post](../classes/wp_post) Required Attachment [WP\_Post](../classes/wp_post) object. string HTML markup for the textarea element.
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function wp_caption_input_textarea( $edit_post ) {
// Post data is already escaped.
$name = "attachments[{$edit_post->ID}][post_excerpt]";
return '<textarea name="' . $name . '" id="' . $name . '">' . $edit_post->post_excerpt . '</textarea>';
}
```
| 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 |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress __clear_multi_author_cache() \_\_clear\_multi\_author\_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.
Helper function to clear the cache for number of authors.
File: `wp-includes/author-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/author-template.php/)
```
function __clear_multi_author_cache() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
delete_transient( 'is_multi_author' );
}
```
| Uses | Description |
| --- | --- |
| [delete\_transient()](delete_transient) wp-includes/option.php | Deletes a transient. |
| Version | Description |
| --- | --- |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
wordpress get_attached_file( int $attachment_id, bool $unfiltered = false ): string|false get\_attached\_file( int $attachment\_id, bool $unfiltered = false ): string|false
==================================================================================
Retrieves attached file path based on attachment ID.
By default the path will go through the ‘get\_attached\_file’ filter, but passing a true to the $unfiltered argument of [get\_attached\_file()](get_attached_file) will return the file path unfiltered.
The function works by getting the single post meta name, named ‘\_wp\_attached\_file’ and returning it. This is a convenience function to prevent looking up the meta name and provide a mechanism for sending the attached filename through a filter.
`$attachment_id` int Required Attachment ID. `$unfiltered` bool Optional Whether to apply filters. Default: `false`
string|false The file path to where the attached file should be, false otherwise.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_attached_file( $attachment_id, $unfiltered = false ) {
$file = get_post_meta( $attachment_id, '_wp_attached_file', true );
// If the file is relative, prepend upload dir.
if ( $file && 0 !== strpos( $file, '/' ) && ! preg_match( '|^.:\\\|', $file ) ) {
$uploads = wp_get_upload_dir();
if ( false === $uploads['error'] ) {
$file = $uploads['basedir'] . "/$file";
}
}
if ( $unfiltered ) {
return $file;
}
/**
* Filters the attached file based on the given ID.
*
* @since 2.1.0
*
* @param string|false $file The file path to where the attached file should be, false otherwise.
* @param int $attachment_id Attachment ID.
*/
return apply_filters( 'get_attached_file', $file, $attachment_id );
}
```
[apply\_filters( 'get\_attached\_file', string|false $file, int $attachment\_id )](../hooks/get_attached_file)
Filters the attached file based on the given ID.
| Uses | Description |
| --- | --- |
| [wp\_get\_upload\_dir()](wp_get_upload_dir) wp-includes/functions.php | Retrieves uploads directory information. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| 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\_Customize\_Manager::\_validate\_header\_video()](../classes/wp_customize_manager/_validate_header_video) wp-includes/class-wp-customize-manager.php | Callback for validating the header\_video value. |
| [WP\_Customize\_Manager::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\_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\_attachment\_is()](wp_attachment_is) wp-includes/post.php | Verifies an attachment is of a given type. |
| [File\_Upload\_Upgrader::\_\_construct()](../classes/file_upload_upgrader/__construct) wp-admin/includes/class-file-upload-upgrader.php | Construct the upgrader for a form. |
| [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']`. |
| [\_copy\_image\_file()](_copy_image_file) wp-admin/includes/image.php | Copies an existing image file. |
| [\_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\_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. |
| [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. |
| [wp\_load\_image()](wp_load_image) wp-includes/deprecated.php | Load an image from a string, if PHP supports it. |
| [get\_attachment\_icon\_src()](get_attachment_icon_src) wp-includes/deprecated.php | Retrieve icon URL and Path. |
| [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\_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. |
| [get\_attachment\_taxonomies()](get_attachment_taxonomies) wp-includes/media.php | Retrieves taxonomies attached to given the 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\_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. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_get_associated_nav_menu_items( int $object_id, string $object_type = 'post_type', string $taxonomy = '' ): int[] wp\_get\_associated\_nav\_menu\_items( int $object\_id, string $object\_type = 'post\_type', string $taxonomy = '' ): int[]
===========================================================================================================================
Returns the menu items associated with a particular object.
`$object_id` int Optional The ID of the original object. Default 0. `$object_type` string Optional The type of object, such as `'post_type'` or `'taxonomy'`.
Default `'post_type'`. Default: `'post_type'`
`$taxonomy` string Optional If $object\_type is `'taxonomy'`, $taxonomy is the name of the tax that $object\_id belongs to. Default: `''`
int[] The array of menu item IDs; empty array if none.
File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_type', $taxonomy = '' ) {
$object_id = (int) $object_id;
$menu_item_ids = array();
$query = new WP_Query;
$menu_items = $query->query(
array(
'meta_key' => '_menu_item_object_id',
'meta_value' => $object_id,
'post_status' => 'any',
'post_type' => 'nav_menu_item',
'posts_per_page' => -1,
)
);
foreach ( (array) $menu_items as $menu_item ) {
if ( isset( $menu_item->ID ) && is_nav_menu_item( $menu_item->ID ) ) {
$menu_item_type = get_post_meta( $menu_item->ID, '_menu_item_type', true );
if (
'post_type' === $object_type &&
'post_type' === $menu_item_type
) {
$menu_item_ids[] = (int) $menu_item->ID;
} elseif (
'taxonomy' === $object_type &&
'taxonomy' === $menu_item_type &&
get_post_meta( $menu_item->ID, '_menu_item_object', true ) == $taxonomy
) {
$menu_item_ids[] = (int) $menu_item->ID;
}
}
}
return array_unique( $menu_item_ids );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::\_\_construct()](../classes/wp_query/__construct) wp-includes/class-wp-query.php | Constructor. |
| [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\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| Used By | Description |
| --- | --- |
| [\_wp\_delete\_post\_menu\_item()](_wp_delete_post_menu_item) wp-includes/nav-menu.php | Callback for handling a menu item when its original object is deleted. |
| [\_wp\_delete\_tax\_menu\_item()](_wp_delete_tax_menu_item) wp-includes/nav-menu.php | Serves as a callback for handling a menu item when its original object is deleted. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress is_user_option_local( string $key, int $user_id, int $blog_id ): bool is\_user\_option\_local( string $key, int $user\_id, int $blog\_id ): bool
==========================================================================
This function has been deprecated.
Check whether a usermeta key has to do with the current blog.
`$key` string Required `$user_id` int Optional Defaults to current user. `$blog_id` int Optional Defaults to current blog. bool
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
global $wpdb;
_deprecated_function( __FUNCTION__, '4.9.0' );
$current_user = wp_get_current_user();
if ( $blog_id == 0 ) {
$blog_id = get_current_blog_id();
}
$local_key = $wpdb->get_blog_prefix( $blog_id ) . $key;
return isset( $current_user->$local_key );
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [wpdb::get\_blog\_prefix()](../classes/wpdb/get_blog_prefix) wp-includes/class-wpdb.php | Gets blog prefix. |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | This function has been deprecated. |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress self_admin_url( string $path = '', string $scheme = 'admin' ): string self\_admin\_url( string $path = '', string $scheme = 'admin' ): string
=======================================================================
Retrieves the URL to the admin area for either the current site or the network depending on context.
`$path` string Optional Path relative to the admin URL. Default: `''`
`$scheme` string Optional The scheme to use. Default is `'admin'`, which obeys [force\_ssl\_admin()](force_ssl_admin) and [is\_ssl()](is_ssl) . `'http'` or `'https'` can be passed to force those schemes. Default: `'admin'`
string Admin URL link with optional path appended.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function self_admin_url( $path = '', $scheme = 'admin' ) {
if ( is_network_admin() ) {
$url = network_admin_url( $path, $scheme );
} elseif ( is_user_admin() ) {
$url = user_admin_url( $path, $scheme );
} else {
$url = admin_url( $path, $scheme );
}
/**
* Filters the admin URL for the current site or network depending on context.
*
* @since 4.9.0
*
* @param string $url The complete URL including scheme and path.
* @param string $path Path relative to the URL. Blank string if no path is specified.
* @param string $scheme The scheme to use.
*/
return apply_filters( 'self_admin_url', $url, $path, $scheme );
}
```
[apply\_filters( 'self\_admin\_url', string $url, string $path, string $scheme )](../hooks/self_admin_url)
Filters the admin URL for the current site or network depending on context.
| Uses | Description |
| --- | --- |
| [is\_network\_admin()](is_network_admin) wp-includes/load.php | Determines whether the current request is for the network administrative interface. |
| [is\_user\_admin()](is_user_admin) wp-includes/load.php | Determines whether the current request is for a user admin screen. |
| [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the network. |
| [user\_admin\_url()](user_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current user. |
| [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 |
| --- | --- |
| [core\_auto\_updates\_settings()](core_auto_updates_settings) wp-admin/update-core.php | Display WordPress auto-updates settings. |
| [WP\_REST\_Plugins\_Controller::is\_filesystem\_available()](../classes/wp_rest_plugins_controller/is_filesystem_available) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Determine if the endpoints are available. |
| [do\_block\_editor\_incompatible\_meta\_box()](do_block_editor_incompatible_meta_box) wp-admin/includes/template.php | Renders a “fake” meta box with an information message, shown on the block editor, when an incompatible meta box is found. |
| [wp\_load\_press\_this()](wp_load_press_this) wp-admin/press-this.php | |
| [wp\_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\_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\_Theme\_Control::content\_template()](../classes/wp_customize_theme_control/content_template) wp-includes/customize/class-wp-customize-theme-control.php | Render a JS template for theme display. |
| [customize\_themes\_print\_templates()](customize_themes_print_templates) wp-admin/includes/theme.php | Prints JS templates for the theme-browsing UI in the Customizer. |
| [wp\_print\_request\_filesystem\_credentials\_modal()](wp_print_request_filesystem_credentials_modal) wp-admin/includes/file.php | Prints the filesystem credentials modal when needed. |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [install\_themes\_upload()](install_themes_upload) wp-admin/includes/theme-install.php | Displays a form to upload themes from zip files. |
| [Language\_Pack\_Upgrader\_Skin::bulk\_footer()](../classes/language_pack_upgrader_skin/bulk_footer) wp-admin/includes/class-language-pack-upgrader-skin.php | |
| [Theme\_Upgrader\_Skin::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. |
| [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. |
| [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::get\_views()](../classes/wp_theme_install_list_table/get_views) wp-admin/includes/class-wp-theme-install-list-table.php | |
| [WP\_Theme\_Install\_List\_Table::single\_row()](../classes/wp_theme_install_list_table/single_row) wp-admin/includes/class-wp-theme-install-list-table.php | Prints a theme from the WordPress.org API. |
| [wp\_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\_dashboard()](install_dashboard) wp-admin/includes/plugin-install.php | Displays the Featured tab of Add Plugins screen. |
| [install\_plugins\_upload()](install_plugins_upload) wp-admin/includes/plugin-install.php | Displays a form to upload plugins from zip files. |
| [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\_Plugin\_Install\_List\_Table::display\_rows()](../classes/wp_plugin_install_list_table/display_rows) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [WP\_Plugin\_Install\_List\_Table::get\_views()](../classes/wp_plugin_install_list_table/get_views) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [wp\_link\_manager\_disabled\_message()](wp_link_manager_disabled_message) wp-admin/includes/bookmark.php | Outputs the ‘disabled’ message for the WordPress Link Manager. |
| [core\_upgrade\_preamble()](core_upgrade_preamble) wp-admin/update-core.php | Display upgrade WordPress for downloading latest or upgrading automatically form. |
| [list\_plugin\_updates()](list_plugin_updates) wp-admin/update-core.php | Display the upgrade plugins form. |
| [list\_theme\_updates()](list_theme_updates) wp-admin/update-core.php | Display the upgrade themes form. |
| [do\_core\_upgrade()](do_core_upgrade) wp-admin/update-core.php | Upgrade WordPress core display. |
| [get\_edit\_user\_link()](get_edit_user_link) wp-includes/link-template.php | Retrieves the edit user link. |
| [wp\_admin\_bar\_wp\_menu()](wp_admin_bar_wp_menu) wp-includes/admin-bar.php | Adds the WordPress logo menu. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress get_cancel_comment_reply_link( string $text = '' ): string get\_cancel\_comment\_reply\_link( string $text = '' ): string
==============================================================
Retrieves HTML content for cancel comment reply link.
`$text` string Optional Text to display for cancel reply link. If empty, defaults to 'Click here to cancel reply'. Default: `''`
string
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_cancel_comment_reply_link( $text = '' ) {
if ( empty( $text ) ) {
$text = __( 'Click here to cancel reply.' );
}
$style = isset( $_GET['replytocom'] ) ? '' : ' style="display:none;"';
$link = esc_html( remove_query_arg( array( 'replytocom', 'unapproved', 'moderation-hash' ) ) ) . '#respond';
$formatted_link = '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>';
/**
* Filters the cancel comment reply link HTML.
*
* @since 2.7.0
*
* @param string $formatted_link The HTML-formatted cancel comment reply link.
* @param string $link Cancel comment reply link URL.
* @param string $text Cancel comment reply link text.
*/
return apply_filters( 'cancel_comment_reply_link', $formatted_link, $link, $text );
}
```
[apply\_filters( 'cancel\_comment\_reply\_link', string $formatted\_link, string $link, string $text )](../hooks/cancel_comment_reply_link)
Filters the cancel comment reply link HTML.
| Uses | Description |
| --- | --- |
| [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. |
| [\_\_()](__) 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 |
| --- | --- |
| [cancel\_comment\_reply\_link()](cancel_comment_reply_link) wp-includes/comment-template.php | Displays HTML content for cancel comment reply link. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress get_template_part( string $slug, string $name = null, array $args = array() ): void|false get\_template\_part( string $slug, string $name = null, array $args = array() ): void|false
===========================================================================================
Loads a template part into a template.
Provides a simple mechanism for child themes to overload reusable sections of code in the theme.
Includes the named template part for a theme or if a name is specified then a specialised part will be included. If the theme contains no {slug}.php file then no template will be included.
The template is included using require, not require\_once, so you may include the same template part multiple times.
For the $name parameter, if the file is called "{slug}-special.php" then specify "special".
`$slug` string Required The slug name for the generic template. `$name` string Optional The name of the specialised template. Default: `null`
`$args` array Optional Additional arguments passed to the template.
Default: `array()`
void|false Void on success, false if the template does not exist.
```
get_template_part( $slug );
```
```
get_template_part( $slug, $name );
```
Note: `get_template_part()` fails silently
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function get_template_part( $slug, $name = null, $args = array() ) {
/**
* Fires before the specified template part file is loaded.
*
* The dynamic portion of the hook name, `$slug`, refers to the slug name
* for the generic template part.
*
* @since 3.0.0
* @since 5.5.0 The `$args` parameter was added.
*
* @param string $slug The slug name for the generic template.
* @param string|null $name The name of the specialized template.
* @param array $args Additional arguments passed to the template.
*/
do_action( "get_template_part_{$slug}", $slug, $name, $args );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "{$slug}-{$name}.php";
}
$templates[] = "{$slug}.php";
/**
* Fires before an attempt is made to locate and load a template part.
*
* @since 5.2.0
* @since 5.5.0 The `$args` parameter was added.
*
* @param string $slug The slug name for the generic template.
* @param string $name The name of the specialized template.
* @param string[] $templates Array of template files to search for, in order.
* @param array $args Additional arguments passed to the template.
*/
do_action( 'get_template_part', $slug, $name, $templates, $args );
if ( ! locate_template( $templates, true, false, $args ) ) {
return false;
}
}
```
[do\_action( 'get\_template\_part', string $slug, string $name, string[] $templates, array $args )](../hooks/get_template_part)
Fires before an attempt is made to locate and load a template part.
[do\_action( "get\_template\_part\_{$slug}", string $slug, string|null $name, array $args )](../hooks/get_template_part_slug)
Fires before the specified template part file is loaded.
| Uses | Description |
| --- | --- |
| [locate\_template()](locate_template) wp-includes/template.php | Retrieves the name of the highest priority template file that exists. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | The `$args` parameter was added. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_shrink_dimensions( int $width, int $height, int $wmax = 128, int $hmax = 96 ): array wp\_shrink\_dimensions( int $width, int $height, int $wmax = 128, int $hmax = 96 ): array
=========================================================================================
This function has been deprecated. Use [wp\_constrain\_dimensions()](wp_constrain_dimensions) instead.
Calculates the new dimensions for a downsampled image.
* [wp\_constrain\_dimensions()](wp_constrain_dimensions)
`$width` int Required Current width of the image `$height` int Required Current height of the image `$wmax` int Optional Maximum wanted width Default: `128`
`$hmax` int Optional Maximum wanted height Default: `96`
array Shrunk dimensions (width, height).
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_constrain_dimensions()' );
return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
}
```
| Uses | Description |
| --- | --- |
| [wp\_constrain\_dimensions()](wp_constrain_dimensions) wp-includes/media.php | Calculates the new dimensions for a down-sampled image. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [wp\_constrain\_dimensions()](wp_constrain_dimensions) |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress sanitize_user_field( string $field, mixed $value, int $user_id, string $context ): mixed sanitize\_user\_field( string $field, mixed $value, int $user\_id, string $context ): mixed
===========================================================================================
Sanitizes user 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 user Object field name. `$value` mixed Required The user Object value. `$user_id` int Required User ID. `$context` string Required How to sanitize user fields. Looks for `'raw'`, `'edit'`, `'db'`, `'display'`, `'attribute'` and `'js'`. mixed Sanitized value.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function sanitize_user_field( $field, $value, $user_id, $context ) {
$int_fields = array( 'ID' );
if ( in_array( $field, $int_fields, true ) ) {
$value = (int) $value;
}
if ( 'raw' === $context ) {
return $value;
}
if ( ! is_string( $value ) && ! is_numeric( $value ) ) {
return $value;
}
$prefixed = false !== strpos( $field, 'user_' );
if ( 'edit' === $context ) {
if ( $prefixed ) {
/** This filter is documented in wp-includes/post.php */
$value = apply_filters( "edit_{$field}", $value, $user_id );
} else {
/**
* Filters a user field value in the 'edit' context.
*
* The dynamic portion of the hook name, `$field`, refers to the prefixed user
* field being filtered, such as 'user_login', 'user_email', 'first_name', etc.
*
* @since 2.9.0
*
* @param mixed $value Value of the prefixed user field.
* @param int $user_id User ID.
*/
$value = apply_filters( "edit_user_{$field}", $value, $user_id );
}
if ( 'description' === $field ) {
$value = esc_html( $value ); // textarea_escaped?
} else {
$value = esc_attr( $value );
}
} elseif ( 'db' === $context ) {
if ( $prefixed ) {
/** This filter is documented in wp-includes/post.php */
$value = apply_filters( "pre_{$field}", $value );
} else {
/**
* Filters the value of a user field in the 'db' context.
*
* The dynamic portion of the hook name, `$field`, refers to the prefixed user
* field being filtered, such as 'user_login', 'user_email', 'first_name', etc.
*
* @since 2.9.0
*
* @param mixed $value Value of the prefixed user field.
*/
$value = apply_filters( "pre_user_{$field}", $value );
}
} else {
// Use display filters by default.
if ( $prefixed ) {
/** This filter is documented in wp-includes/post.php */
$value = apply_filters( "{$field}", $value, $user_id, $context );
} else {
/**
* Filters the value of a user field in a standard context.
*
* The dynamic portion of the hook name, `$field`, refers to the prefixed user
* field being filtered, such as 'user_login', 'user_email', 'first_name', etc.
*
* @since 2.9.0
*
* @param mixed $value The user object value to sanitize.
* @param int $user_id User ID.
* @param string $context The context to filter within.
*/
$value = apply_filters( "user_{$field}", $value, $user_id, $context );
}
}
if ( 'user_url' === $field ) {
$value = esc_url( $value );
}
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\_user\_{$field}", mixed $value, int $user\_id )](../hooks/edit_user_field)
Filters a user field value in the ‘edit’ context.
[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\_user\_{$field}", mixed $value )](../hooks/pre_user_field)
Filters the value of a user field in the ‘db’ context.
[apply\_filters( "pre\_{$field}", mixed $value )](../hooks/pre_field)
Filters the value of a specific post field before saving.
[apply\_filters( "user\_{$field}", mixed $value, int $user\_id, string $context )](../hooks/user_field)
Filters the value of a user field in a standard context.
[apply\_filters( "{$field}", mixed $value, int $post\_id, string $context )](../hooks/field)
Filters the value of a specific post field for display.
| Uses | Description |
| --- | --- |
| [esc\_js()](esc_js) wp-includes/formatting.php | Escapes single quotes, `"`, , `&`, and fixes line endings. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_User::\_\_get()](../classes/wp_user/__get) wp-includes/class-wp-user.php | Magic method for accessing custom fields. |
| [sanitize\_user\_object()](sanitize_user_object) wp-includes/deprecated.php | Sanitize every user field. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress do_all_pings() do\_all\_pings()
================
Performs all pingbacks, enclosures, trackbacks, and sends to pingback services.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function do_all_pings() {
/**
* Fires immediately after the `do_pings` event to hook services individually.
*
* @since 5.6.0
*/
do_action( 'do_all_pings' );
}
```
[do\_action( 'do\_all\_pings' )](../hooks/do_all_pings)
Fires immediately after the `do_pings` event to hook services individually.
| Uses | Description |
| --- | --- |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced `do_all_pings` action hook for individual services. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_img_tag_add_decoding_attr( string $image, string $context ): string wp\_img\_tag\_add\_decoding\_attr( string $image, string $context ): string
===========================================================================
Adds `decoding` attribute to an `img` HTML tag.
The `decoding` attribute allows developers to indicate whether the browser can decode the image off the main thread (`async`), on the main thread (`sync`) or as determined by the browser (`auto`).
By default WordPress adds `decoding="async"` to images but developers can use the [‘wp\_img\_tag\_add\_decoding\_attr’](../hooks/wp_img_tag_add_decoding_attr) filter to modify this to remove the attribute or set it to another accepted value.
`$image` string Required The HTML `img` tag where the attribute should be added. `$context` string Required Additional context to pass to the filters. string Converted `img` tag with `decoding` attribute added.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_img_tag_add_decoding_attr( $image, $context ) {
/**
* Filters the `decoding` attribute value to add to an image. Default `async`.
*
* Returning a falsey value will omit the attribute.
*
* @since 6.1.0
*
* @param string|false|null $value The `decoding` attribute value. Returning a falsey value
* will result in the attribute being omitted for the image.
* Otherwise, it may be: 'async' (default), 'sync', or 'auto'.
* @param string $image The HTML `img` tag to be filtered.
* @param string $context Additional context about how the function was called
* or where the img tag is.
*/
$value = apply_filters( 'wp_img_tag_add_decoding_attr', 'async', $image, $context );
if ( in_array( $value, array( 'async', 'sync', 'auto' ), true ) ) {
$image = str_replace( '<img ', '<img decoding="' . esc_attr( $value ) . '" ', $image );
}
return $image;
}
```
[apply\_filters( 'wp\_img\_tag\_add\_decoding\_attr', string|false|null $value, string $image, string $context )](../hooks/wp_img_tag_add_decoding_attr)
Filters the `decoding` attribute value to add to an image. Default `async`.
| 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 |
| --- | --- |
| [wp\_filter\_content\_tags()](wp_filter_content_tags) wp-includes/media.php | Filters specific tags in post content and modifies their markup. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress display_plugins_table() display\_plugins\_table()
=========================
Displays plugin content based on plugin list.
File: `wp-admin/includes/plugin-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin-install.php/)
```
function display_plugins_table() {
global $wp_list_table;
switch ( current_filter() ) {
case 'install_plugins_beta':
printf(
/* translators: %s: URL to "Features as Plugins" page. */
'<p>' . __( 'You are using a development version of WordPress. These feature plugins are also under development. <a href="%s">Learn more</a>.' ) . '</p>',
'https://make.wordpress.org/core/handbook/about/release-cycle/features-as-plugins/'
);
break;
case 'install_plugins_featured':
printf(
/* translators: %s: https://wordpress.org/plugins/ */
'<p>' . __( 'Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="%s">WordPress Plugin Directory</a> or upload a plugin in .zip format by clicking the button at the top of this page.' ) . '</p>',
__( 'https://wordpress.org/plugins/' )
);
break;
case 'install_plugins_recommended':
echo '<p>' . __( 'These suggestions are based on the plugins you and other users have installed.' ) . '</p>';
break;
case 'install_plugins_favorites':
if ( empty( $_GET['user'] ) && ! get_user_option( 'wporg_favorites' ) ) {
return;
}
break;
}
?>
<form id="plugin-filter" method="post">
<?php $wp_list_table->display(); ?>
</form>
<?php
}
```
| Uses | Description |
| --- | --- |
| [WP\_List\_Table::display()](../classes/wp_list_table/display) wp-admin/includes/class-wp-list-table.php | Displays the table. |
| [current\_filter()](current_filter) wp-includes/plugin.php | Retrieves the name of the current filter hook. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Used By | Description |
| --- | --- |
| [install\_dashboard()](install_dashboard) wp-admin/includes/plugin-install.php | Displays the Featured tab of Add Plugins screen. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress settings_fields( string $option_group ) settings\_fields( string $option\_group )
=========================================
Outputs nonce, action, and option\_page fields for a settings page.
`$option_group` string Required A settings group name. This should match the group name used in [register\_setting()](register_setting) . More Arguments from register\_setting( ... $option\_group ) 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'`. File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function settings_fields( $option_group ) {
echo "<input type='hidden' name='option_page' value='" . esc_attr( $option_group ) . "' />";
echo '<input type="hidden" name="action" value="update" />';
wp_nonce_field( "$option_group-options" );
}
```
| Uses | Description |
| --- | --- |
| [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
| [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. |
| programming_docs |
wordpress get_registered_nav_menus(): string[] get\_registered\_nav\_menus(): string[]
=======================================
Retrieves all registered navigation menu locations in a theme.
string[] Associative array of egistered navigation menu descriptions keyed by their location. If none are registered, an empty array.
File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function get_registered_nav_menus() {
global $_wp_registered_nav_menus;
if ( isset( $_wp_registered_nav_menus ) ) {
return $_wp_registered_nav_menus;
}
return array();
}
```
| Used By | Description |
| --- | --- |
| [WP\_REST\_Menus\_Controller::handle\_locations()](../classes/wp_rest_menus_controller/handle_locations) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Updates the menu’s locations from a REST request. |
| [WP\_REST\_Menus\_Controller::get\_item\_schema()](../classes/wp_rest_menus_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Retrieves the term’s schema, conforming to JSON Schema. |
| [WP\_REST\_Menu\_Locations\_Controller::get\_items()](../classes/wp_rest_menu_locations_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Retrieves all menu locations, depending on user context. |
| [WP\_REST\_Menu\_Locations\_Controller::get\_item()](../classes/wp_rest_menu_locations_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Retrieves a specific menu location. |
| [wp\_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. |
| [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\_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. |
| [has\_nav\_menu()](has_nav_menu) wp-includes/nav-menu.php | Determines whether a registered nav menu location has a menu assigned to it. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress build_comment_query_vars_from_block( WP_Block $block ): array build\_comment\_query\_vars\_from\_block( WP\_Block $block ): array
===================================================================
Helper function that constructs a comment query vars array from the passed block properties.
It’s used with the Comment Query Loop inner blocks.
`$block` [WP\_Block](../classes/wp_block) Required Block instance. array Returns the comment query parameters to use with the [WP\_Comment\_Query](../classes/wp_comment_query) constructor.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function build_comment_query_vars_from_block( $block ) {
$comment_args = array(
'orderby' => 'comment_date_gmt',
'order' => 'ASC',
'status' => 'approve',
'no_found_rows' => false,
);
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 );
}
}
if ( ! empty( $block->context['postId'] ) ) {
$comment_args['post_id'] = (int) $block->context['postId'];
}
if ( get_option( 'thread_comments' ) ) {
$comment_args['hierarchical'] = 'threaded';
} else {
$comment_args['hierarchical'] = false;
}
if ( get_option( 'page_comments' ) === '1' || get_option( 'page_comments' ) === true ) {
$per_page = get_option( 'comments_per_page' );
$default_page = get_option( 'default_comments_page' );
if ( $per_page > 0 ) {
$comment_args['number'] = $per_page;
$page = (int) get_query_var( 'cpage' );
if ( $page ) {
$comment_args['paged'] = $page;
} elseif ( 'oldest' === $default_page ) {
$comment_args['paged'] = 1;
} elseif ( 'newest' === $default_page ) {
$max_num_pages = (int) ( new WP_Comment_Query( $comment_args ) )->max_num_pages;
if ( 0 !== $max_num_pages ) {
$comment_args['paged'] = $max_num_pages;
}
}
// Set the `cpage` query var to ensure the previous and next pagination links are correct
// when inheriting the Discussion Settings.
if ( 0 === $page && isset( $comment_args['paged'] ) && $comment_args['paged'] > 0 ) {
set_query_var( 'cpage', $comment_args['paged'] );
}
}
}
return $comment_args;
}
```
| 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. |
| [set\_query\_var()](set_query_var) wp-includes/query.php | Sets the value of a query variable in the [WP\_Query](../classes/wp_query) class. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress wp_queue_posts_for_term_meta_lazyload( WP_Post[] $posts ) wp\_queue\_posts\_for\_term\_meta\_lazyload( WP\_Post[] $posts )
================================================================
Queues posts for lazy-loading of term meta.
`$posts` [WP\_Post](../classes/wp_post)[] Required Array of [WP\_Post](../classes/wp_post) objects. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_queue_posts_for_term_meta_lazyload( $posts ) {
$post_type_taxonomies = array();
$term_ids = array();
foreach ( $posts as $post ) {
if ( ! ( $post instanceof WP_Post ) ) {
continue;
}
if ( ! isset( $post_type_taxonomies[ $post->post_type ] ) ) {
$post_type_taxonomies[ $post->post_type ] = get_object_taxonomies( $post->post_type );
}
foreach ( $post_type_taxonomies[ $post->post_type ] as $taxonomy ) {
// Term cache should already be primed by `update_post_term_cache()`.
$terms = get_object_term_cache( $post->ID, $taxonomy );
if ( false !== $terms ) {
foreach ( $terms as $term ) {
if ( ! in_array( $term->term_id, $term_ids, true ) ) {
$term_ids[] = $term->term_id;
}
}
}
}
}
if ( $term_ids ) {
$lazyloader = wp_metadata_lazyloader();
$lazyloader->queue_objects( 'term', $term_ids );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_metadata\_lazyloader()](wp_metadata_lazyloader) wp-includes/meta.php | Retrieves the queue for lazy-loading metadata. |
| [get\_object\_term\_cache()](get_object_term_cache) wp-includes/taxonomy.php | Retrieves the cached term objects for the given object ID. |
| [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 |
| --- | --- |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. |
wordpress the_excerpt_embed() the\_excerpt\_embed()
=====================
Displays the post excerpt for the embed template.
Intended to be used in ‘The Loop’.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function the_excerpt_embed() {
$output = get_the_excerpt();
/**
* Filters the post excerpt for the embed template.
*
* @since 4.4.0
*
* @param string $output The current post excerpt.
*/
echo apply_filters( 'the_excerpt_embed', $output );
}
```
[apply\_filters( 'the\_excerpt\_embed', string $output )](../hooks/the_excerpt_embed)
Filters the post excerpt for the embed template.
| Uses | Description |
| --- | --- |
| [get\_the\_excerpt()](get_the_excerpt) wp-includes/post-template.php | Retrieves the post excerpt. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_ajax_get_community_events() wp\_ajax\_get\_community\_events()
==================================
Handles Ajax requests for community events
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_get_community_events() {
require_once ABSPATH . 'wp-admin/includes/class-wp-community-events.php';
check_ajax_referer( 'community_events' );
$search = isset( $_POST['location'] ) ? wp_unslash( $_POST['location'] ) : '';
$timezone = isset( $_POST['timezone'] ) ? wp_unslash( $_POST['timezone'] ) : '';
$user_id = get_current_user_id();
$saved_location = get_user_option( 'community-events-location', $user_id );
$events_client = new WP_Community_Events( $user_id, $saved_location );
$events = $events_client->get_events( $search, $timezone );
$ip_changed = false;
if ( is_wp_error( $events ) ) {
wp_send_json_error(
array(
'error' => $events->get_error_message(),
)
);
} else {
if ( empty( $saved_location['ip'] ) && ! empty( $events['location']['ip'] ) ) {
$ip_changed = true;
} elseif ( isset( $saved_location['ip'] ) && ! empty( $events['location']['ip'] ) && $saved_location['ip'] !== $events['location']['ip'] ) {
$ip_changed = true;
}
/*
* The location should only be updated when it changes. The API doesn't always return
* a full location; sometimes it's missing the description or country. The location
* that was saved during the initial request is known to be good and complete, though.
* It should be left intact until the user explicitly changes it (either by manually
* searching for a new location, or by changing their IP address).
*
* If the location was updated with an incomplete response from the API, then it could
* break assumptions that the UI makes (e.g., that there will always be a description
* that corresponds to a latitude/longitude location).
*
* The location is stored network-wide, so that the user doesn't have to set it on each site.
*/
if ( $ip_changed || $search ) {
update_user_meta( $user_id, 'community-events-location', $events['location'] );
}
wp_send_json_success( $events );
}
}
```
| Uses | Description |
| --- | --- |
| [WP\_Community\_Events::\_\_construct()](../classes/wp_community_events/__construct) wp-admin/includes/class-wp-community-events.php | Constructor for [WP\_Community\_Events](../classes/wp_community_events). |
| [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [wp\_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\_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. |
| [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/) | Introduced. |
wordpress wp_check_filetype_and_ext( string $file, string $filename, string[] $mimes = null ): array wp\_check\_filetype\_and\_ext( string $file, string $filename, string[] $mimes = null ): array
==============================================================================================
Attempts to determine the real file type of a file.
If unable to, the file name extension will be used to determine type.
If it’s determined that the extension does not match the file’s real type, then the "proper\_filename" value will be set with a proper filename and extension.
Currently this function only supports renaming images validated via [wp\_get\_image\_mime()](wp_get_image_mime) .
`$file` string Required Full path to the file. `$filename` string Required The name of the file (may differ from $file due to $file being in a tmp directory). `$mimes` string[] Optional Array of allowed mime types keyed by their file extension regex. Default: `null`
array Values for the extension, mime type, and corrected filename.
* `ext`string|falseFile extension, or false if the file doesn't match a mime type.
* `type`string|falseFile mime type, or false if the file doesn't match a mime type.
* `proper_filename`string|falseFile name with its correct extension, or false if it cannot be determined.
##### Usage:
```
$validate = wp_check_filetype_and_ext( $file, $filename, $mimes );
if( $validate['proper_filename'] !== false )
$filename = $validate['proper_filename'];
```
##### Notes:
Currently, this function only supports validating images known to getimagesize().
If using in a plugin/theme and you get an error about this function not being defined, you probably need to add `require_once ABSPATH .'wp-admin/includes/file.php';` before the function gets called.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
$proper_filename = false;
// Do basic extension validation and MIME mapping.
$wp_filetype = wp_check_filetype( $filename, $mimes );
$ext = $wp_filetype['ext'];
$type = $wp_filetype['type'];
// We can't do any further validation without a file to work with.
if ( ! file_exists( $file ) ) {
return compact( 'ext', 'type', 'proper_filename' );
}
$real_mime = false;
// Validate image types.
if ( $type && 0 === strpos( $type, 'image/' ) ) {
// Attempt to figure out what type of image it actually is.
$real_mime = wp_get_image_mime( $file );
if ( $real_mime && $real_mime != $type ) {
/**
* Filters the list mapping image mime types to their respective extensions.
*
* @since 3.0.0
*
* @param array $mime_to_ext Array of image mime types and their matching extensions.
*/
$mime_to_ext = apply_filters(
'getimagesize_mimes_to_exts',
array(
'image/jpeg' => 'jpg',
'image/png' => 'png',
'image/gif' => 'gif',
'image/bmp' => 'bmp',
'image/tiff' => 'tif',
'image/webp' => 'webp',
)
);
// Replace whatever is after the last period in the filename with the correct extension.
if ( ! empty( $mime_to_ext[ $real_mime ] ) ) {
$filename_parts = explode( '.', $filename );
array_pop( $filename_parts );
$filename_parts[] = $mime_to_ext[ $real_mime ];
$new_filename = implode( '.', $filename_parts );
if ( $new_filename != $filename ) {
$proper_filename = $new_filename; // Mark that it changed.
}
// Redefine the extension / MIME.
$wp_filetype = wp_check_filetype( $new_filename, $mimes );
$ext = $wp_filetype['ext'];
$type = $wp_filetype['type'];
} else {
// Reset $real_mime and try validating again.
$real_mime = false;
}
}
}
// Validate files that didn't get validated during previous checks.
if ( $type && ! $real_mime && extension_loaded( 'fileinfo' ) ) {
$finfo = finfo_open( FILEINFO_MIME_TYPE );
$real_mime = finfo_file( $finfo, $file );
finfo_close( $finfo );
// fileinfo often misidentifies obscure files as one of these types.
$nonspecific_types = array(
'application/octet-stream',
'application/encrypted',
'application/CDFV2-encrypted',
'application/zip',
);
/*
* If $real_mime doesn't match the content type we're expecting from the file's extension,
* we need to do some additional vetting. Media types and those listed in $nonspecific_types are
* allowed some leeway, but anything else must exactly match the real content type.
*/
if ( in_array( $real_mime, $nonspecific_types, true ) ) {
// File is a non-specific binary type. That's ok if it's a type that generally tends to be binary.
if ( ! in_array( substr( $type, 0, strcspn( $type, '/' ) ), array( 'application', 'video', 'audio' ), true ) ) {
$type = false;
$ext = false;
}
} elseif ( 0 === strpos( $real_mime, 'video/' ) || 0 === strpos( $real_mime, 'audio/' ) ) {
/*
* For these types, only the major type must match the real value.
* This means that common mismatches are forgiven: application/vnd.apple.numbers is often misidentified as application/zip,
* and some media files are commonly named with the wrong extension (.mov instead of .mp4)
*/
if ( substr( $real_mime, 0, strcspn( $real_mime, '/' ) ) !== substr( $type, 0, strcspn( $type, '/' ) ) ) {
$type = false;
$ext = false;
}
} elseif ( 'text/plain' === $real_mime ) {
// A few common file types are occasionally detected as text/plain; allow those.
if ( ! in_array(
$type,
array(
'text/plain',
'text/csv',
'application/csv',
'text/richtext',
'text/tsv',
'text/vtt',
),
true
)
) {
$type = false;
$ext = false;
}
} elseif ( 'application/csv' === $real_mime ) {
// Special casing for CSV files.
if ( ! in_array(
$type,
array(
'text/csv',
'text/plain',
'application/csv',
),
true
)
) {
$type = false;
$ext = false;
}
} elseif ( 'text/rtf' === $real_mime ) {
// Special casing for RTF files.
if ( ! in_array(
$type,
array(
'text/rtf',
'text/plain',
'application/rtf',
),
true
)
) {
$type = false;
$ext = false;
}
} else {
if ( $type !== $real_mime ) {
/*
* Everything else including image/* and application/*:
* If the real content type doesn't match the file extension, assume it's dangerous.
*/
$type = false;
$ext = false;
}
}
}
// The mime type must be allowed.
if ( $type ) {
$allowed = get_allowed_mime_types();
if ( ! in_array( $type, $allowed, true ) ) {
$type = false;
$ext = false;
}
}
/**
* Filters the "real" file type of the given file.
*
* @since 3.0.0
* @since 5.1.0 The $real_mime parameter was added.
*
* @param array $wp_check_filetype_and_ext {
* Values for the extension, mime type, and corrected filename.
*
* @type string|false $ext File extension, or false if the file doesn't match a mime type.
* @type string|false $type File mime type, or false if the file doesn't match a mime type.
* @type string|false $proper_filename File name with its correct extension, or false if it cannot be determined.
* }
* @param string $file Full path to the file.
* @param string $filename The name of the file (may differ from $file due to
* $file being in a tmp directory).
* @param string[] $mimes Array of mime types keyed by their file extension regex.
* @param string|false $real_mime The actual mime type or false if the type cannot be determined.
*/
return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes, $real_mime );
}
```
[apply\_filters( 'getimagesize\_mimes\_to\_exts', array $mime\_to\_ext )](../hooks/getimagesize_mimes_to_exts)
Filters the list mapping image mime types to their respective extensions.
[apply\_filters( 'wp\_check\_filetype\_and\_ext', array $wp\_check\_filetype\_and\_ext, string $file, string $filename, string[] $mimes, string|false $real\_mime )](../hooks/wp_check_filetype_and_ext)
Filters the “real” file type of the given file.
| Uses | Description |
| --- | --- |
| [wp\_get\_image\_mime()](wp_get_image_mime) wp-includes/functions.php | Returns the real mime type of an image file. |
| [wp\_check\_filetype()](wp_check_filetype) wp-includes/functions.php | Retrieves the file type from the file name. |
| [get\_allowed\_mime\_types()](get_allowed_mime_types) wp-includes/functions.php | Retrieves the list of allowed mime types and file extensions. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [\_wp\_handle\_upload()](_wp_handle_upload) wp-admin/includes/file.php | Handles PHP uploads in WordPress. |
| [wp\_ajax\_upload\_attachment()](wp_ajax_upload_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for uploading attachments |
| [Custom\_Image\_Header::step\_2\_manage\_upload()](../classes/custom_image_header/step_2_manage_upload) wp-admin/includes/class-custom-image-header.php | Upload the file to be cropped in the second step. |
| [Custom\_Background::handle\_upload()](../classes/custom_background/handle_upload) wp-admin/includes/class-custom-background.php | Handles an Image upload for the background image. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress get_the_tags( int|WP_Post $post ): WP_Term[]|false|WP_Error get\_the\_tags( int|WP\_Post $post ): WP\_Term[]|false|WP\_Error
================================================================
Retrieves the tags for a post.
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or object. [WP\_Term](../classes/wp_term)[]|false|[WP\_Error](../classes/wp_error) Array of [WP\_Term](../classes/wp_term) objects on success, false if there are no terms or the post does not exist, [WP\_Error](../classes/wp_error) on failure.
This function returns an array of objects, one object for each tag assigned to the post. If this function is used in [The Loop](https://codex.wordpress.org/The_Loop "The Loop"), then no ID need be passed.
This function does not display anything; you should access the objects and then echo or otherwise use the desired member variables.
The following example displays the tag name of each tag assigned to the post (this is like using [[the\_tags()](the_tags)](https://codex.wordpress.org/Template_Tags/the_tags "Template Tags/the tags") , but without linking each tag to the tag view, and using spaces instead of commas):
```
<?php
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
echo $tag->name . ' ';
}
}
?>
```
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function get_the_tags( $post = 0 ) {
$terms = get_the_terms( $post, 'post_tag' );
/**
* Filters the array of tags for the given post.
*
* @since 2.3.0
*
* @see get_the_terms()
*
* @param WP_Term[]|false|WP_Error $terms Array of WP_Term objects on success, false if there are no terms
* or the post does not exist, WP_Error on failure.
*/
return apply_filters( 'get_the_tags', $terms );
}
```
[apply\_filters( 'get\_the\_tags', WP\_Term[]|false|WP\_Error $terms )](../hooks/get_the_tags)
Filters the array of tags for the given post.
| 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. |
| [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\_category\_rss()](get_the_category_rss) wp-includes/feed.php | Retrieves all of the post categories, formatted for use in feeds. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_terms_checklist( int $post_id, array|string $args = array() ): string wp\_terms\_checklist( int $post\_id, array|string $args = array() ): string
===========================================================================
Outputs an unordered list of checkbox input elements labelled with term names.
Taxonomy-independent version of [wp\_category\_checklist()](wp_category_checklist) .
`$post_id` int Optional Post ID. Default 0. `$args` array|string Optional Array or string of arguments for generating a terms checklist.
* `descendants_and_self`intID of the category to output along with its descendants.
Default 0.
* `selected_cats`int[]Array of category IDs to mark as checked. Default false.
* `popular_cats`int[]Array of category IDs to receive the "popular-category" class.
Default false.
* `walker`[Walker](../classes/walker)
[Walker](../classes/walker) object to use to build the output. Default empty which results in a [Walker\_Category\_Checklist](../classes/walker_category_checklist) instance being used.
* `taxonomy`stringTaxonomy to generate the checklist for. Default `'category'`.
* `checked_ontop`boolWhether to move checked items out of the hierarchy and to the top of the list. Default true.
* `echo`boolWhether to echo the generated markup. False to return the markup instead of echoing it. Default true.
Default: `array()`
string HTML list of input elements.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function wp_terms_checklist( $post_id = 0, $args = array() ) {
$defaults = array(
'descendants_and_self' => 0,
'selected_cats' => false,
'popular_cats' => false,
'walker' => null,
'taxonomy' => 'category',
'checked_ontop' => true,
'echo' => true,
);
/**
* Filters the taxonomy terms checklist arguments.
*
* @since 3.4.0
*
* @see wp_terms_checklist()
*
* @param array|string $args An array or string of arguments.
* @param int $post_id The post ID.
*/
$params = apply_filters( 'wp_terms_checklist_args', $args, $post_id );
$parsed_args = wp_parse_args( $params, $defaults );
if ( empty( $parsed_args['walker'] ) || ! ( $parsed_args['walker'] instanceof Walker ) ) {
$walker = new Walker_Category_Checklist;
} else {
$walker = $parsed_args['walker'];
}
$taxonomy = $parsed_args['taxonomy'];
$descendants_and_self = (int) $parsed_args['descendants_and_self'];
$args = array( 'taxonomy' => $taxonomy );
$tax = get_taxonomy( $taxonomy );
$args['disabled'] = ! current_user_can( $tax->cap->assign_terms );
$args['list_only'] = ! empty( $parsed_args['list_only'] );
if ( is_array( $parsed_args['selected_cats'] ) ) {
$args['selected_cats'] = array_map( 'intval', $parsed_args['selected_cats'] );
} elseif ( $post_id ) {
$args['selected_cats'] = wp_get_object_terms( $post_id, $taxonomy, array_merge( $args, array( 'fields' => 'ids' ) ) );
} else {
$args['selected_cats'] = array();
}
if ( is_array( $parsed_args['popular_cats'] ) ) {
$args['popular_cats'] = array_map( 'intval', $parsed_args['popular_cats'] );
} else {
$args['popular_cats'] = get_terms(
array(
'taxonomy' => $taxonomy,
'fields' => 'ids',
'orderby' => 'count',
'order' => 'DESC',
'number' => 10,
'hierarchical' => false,
)
);
}
if ( $descendants_and_self ) {
$categories = (array) get_terms(
array(
'taxonomy' => $taxonomy,
'child_of' => $descendants_and_self,
'hierarchical' => 0,
'hide_empty' => 0,
)
);
$self = get_term( $descendants_and_self, $taxonomy );
array_unshift( $categories, $self );
} else {
$categories = (array) get_terms(
array(
'taxonomy' => $taxonomy,
'get' => 'all',
)
);
}
$output = '';
if ( $parsed_args['checked_ontop'] ) {
// Post-process $categories rather than adding an exclude to the get_terms() query
// to keep the query the same across all posts (for any query cache).
$checked_categories = array();
$keys = array_keys( $categories );
foreach ( $keys as $k ) {
if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'], true ) ) {
$checked_categories[] = $categories[ $k ];
unset( $categories[ $k ] );
}
}
// Put checked categories on top.
$output .= $walker->walk( $checked_categories, 0, $args );
}
// Then the rest of them.
$output .= $walker->walk( $categories, 0, $args );
if ( $parsed_args['echo'] ) {
echo $output;
}
return $output;
}
```
[apply\_filters( 'wp\_terms\_checklist\_args', array|string $args, int $post\_id )](../hooks/wp_terms_checklist_args)
Filters the taxonomy terms checklist arguments.
| Uses | Description |
| --- | --- |
| [Walker::walk()](../classes/walker/walk) wp-includes/class-wp-walker.php | Displays array of elements hierarchically. |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [get\_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. |
| Used By | Description |
| --- | --- |
| [wp\_category\_checklist()](wp_category_checklist) wp-admin/includes/template.php | Outputs an unordered list of checkbox input elements labeled with category names. |
| [\_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. |
| [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.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced the `$echo` argument. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress sanitize_meta( string $meta_key, mixed $meta_value, string $object_type, string $object_subtype = '' ): mixed sanitize\_meta( string $meta\_key, mixed $meta\_value, string $object\_type, string $object\_subtype = '' ): mixed
==================================================================================================================
Sanitizes meta value.
`$meta_key` string Required Metadata key. `$meta_value` mixed Required Metadata value to sanitize. `$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_subtype` string Optional The subtype of the object type. Default: `''`
mixed Sanitized $meta\_value.
* This function applies filters that can be hooked to perform specific sanitization procedures for the particular metadata type and key. Does not sanitize anything on its own. Custom filters must be hooked in to do the work. The filter hook tag has the form “`sanitize_{$meta_type}_meta_{$meta_key}`“.
* This function is called by [add\_metadata()](add_metadata) and [update\_metadata()](update_metadata) WordPress functions.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype = '' ) {
if ( ! empty( $object_subtype ) && has_filter( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}" ) ) {
/**
* Filters the sanitization of a specific meta key of a specific meta type and subtype.
*
* The dynamic portions of the hook name, `$object_type`, `$meta_key`,
* and `$object_subtype`, refer to the metadata object type (comment, post, term, or user),
* the meta key value, and the object subtype respectively.
*
* @since 4.9.8
*
* @param mixed $meta_value Metadata value to sanitize.
* @param string $meta_key Metadata key.
* @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
* or any other object type with an associated meta table.
* @param string $object_subtype Object subtype.
*/
return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $meta_value, $meta_key, $object_type, $object_subtype );
}
/**
* Filters the sanitization of a specific meta key of a specific meta type.
*
* The dynamic portions of the hook name, `$meta_type`, and `$meta_key`,
* refer to the metadata object type (comment, post, term, or user) and the meta
* key value, respectively.
*
* @since 3.3.0
*
* @param mixed $meta_value Metadata value to sanitize.
* @param string $meta_key Metadata key.
* @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
* or any other object type with an associated meta table.
*/
return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}", $meta_value, $meta_key, $object_type );
}
```
[apply\_filters( "sanitize\_{$object\_type}\_meta\_{$meta\_key}", mixed $meta\_value, string $meta\_key, string $object\_type )](../hooks/sanitize_object_type_meta_meta_key)
Filters the sanitization of a specific meta key of a specific meta type.
[apply\_filters( "sanitize\_{$object\_type}\_meta\_{$meta\_key}\_for\_{$object\_subtype}", mixed $meta\_value, string $meta\_key, string $object\_type, string $object\_subtype )](../hooks/sanitize_object_type_meta_meta_key_for_object_subtype)
Filters the sanitization of a specific meta key of a specific meta type and subtype.
| Uses | Description |
| --- | --- |
| [has\_filter()](has_filter) wp-includes/plugin.php | Checks if any filter has been registered for a 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\_REST\_Meta\_Fields::is\_meta\_value\_same\_as\_stored\_value()](../classes/wp_rest_meta_fields/is_meta_value_same_as_stored_value) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Checks if the user provided value is equivalent to a stored value for the given meta key. |
| [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/) | The `$object_subtype` parameter was added. |
| [3.1.3](https://developer.wordpress.org/reference/since/3.1.3/) | Introduced. |
wordpress get_site_screen_help_tab_args(): array get\_site\_screen\_help\_tab\_args(): array
===========================================
Returns the arguments for the help tab on the Edit Site screens.
array Help tab arguments.
File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function get_site_screen_help_tab_args() {
return array(
'id' => 'overview',
'title' => __( 'Overview' ),
'content' =>
'<p>' . __( 'The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.' ) . '</p>' .
'<p>' . __( '<strong>Info</strong> — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.' ) . '</p>' .
'<p>' . __( '<strong>Users</strong> — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.' ) . '</p>' .
'<p>' . sprintf(
/* translators: %s: URL to Network Themes screen. */
__( '<strong>Themes</strong> — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ),
network_admin_url( 'themes.php' )
) . '</p>' .
'<p>' . __( '<strong>Settings</strong> — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.' ) . '</p>',
);
}
```
| Uses | Description |
| --- | --- |
| [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the network. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
wordpress _insert_into_post_button( $type ) \_insert\_into\_post\_button( $type )
=====================================
This function has been deprecated.
This was once used to display an ‘Insert into Post’ button.
Now it is deprecated and stubbed.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function _insert_into_post_button( $type ) {
_deprecated_function( __FUNCTION__, '3.5.0' );
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress _register_theme_block_patterns() \_register\_theme\_block\_patterns()
====================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
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:
/\*\*
* Title: My Pattern
* Slug: my-theme/my-pattern
The output of the PHP source corresponds to the content of the pattern, e.g.:
```
<main><p><?php echo "Hello"; ?></p></main>
```
If applicable, this will collect from both parent and child theme.
Other settable fields include:
* Description
* Viewport Width
* Categories (comma-separated values)
* Keywords (comma-separated values)
* Block Types (comma-separated values)
* Post Types (comma-separated values)
* Inserter (yes/no)
File: `wp-includes/block-patterns.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-patterns.php/)
```
function _register_theme_block_patterns() {
$default_headers = array(
'title' => 'Title',
'slug' => 'Slug',
'description' => 'Description',
'viewportWidth' => 'Viewport Width',
'categories' => 'Categories',
'keywords' => 'Keywords',
'blockTypes' => 'Block Types',
'postTypes' => 'Post Types',
'inserter' => 'Inserter',
);
/*
* Register patterns for the active theme. If the theme is a child theme,
* let it override any patterns from the parent theme that shares the same slug.
*/
$themes = array();
$stylesheet = get_stylesheet();
$template = get_template();
if ( $stylesheet !== $template ) {
$themes[] = wp_get_theme( $stylesheet );
}
$themes[] = wp_get_theme( $template );
foreach ( $themes as $theme ) {
$dirpath = $theme->get_stylesheet_directory() . '/patterns/';
if ( ! is_dir( $dirpath ) || ! is_readable( $dirpath ) ) {
continue;
}
if ( file_exists( $dirpath ) ) {
$files = glob( $dirpath . '*.php' );
if ( $files ) {
foreach ( $files as $file ) {
$pattern_data = get_file_data( $file, $default_headers );
if ( empty( $pattern_data['slug'] ) ) {
_doing_it_wrong(
'_register_theme_block_patterns',
sprintf(
/* translators: %s: file name. */
__( 'Could not register file "%s" as a block pattern ("Slug" field missing)' ),
$file
),
'6.0.0'
);
continue;
}
if ( ! preg_match( '/^[A-z0-9\/_-]+$/', $pattern_data['slug'] ) ) {
_doing_it_wrong(
'_register_theme_block_patterns',
sprintf(
/* translators: %1s: file name; %2s: slug value found. */
__( 'Could not register file "%1$s" as a block pattern (invalid slug "%2$s")' ),
$file,
$pattern_data['slug']
),
'6.0.0'
);
}
if ( WP_Block_Patterns_Registry::get_instance()->is_registered( $pattern_data['slug'] ) ) {
continue;
}
// Title is a required property.
if ( ! $pattern_data['title'] ) {
_doing_it_wrong(
'_register_theme_block_patterns',
sprintf(
/* translators: %1s: file name; %2s: slug value found. */
__( 'Could not register file "%s" as a block pattern ("Title" field missing)' ),
$file
),
'6.0.0'
);
continue;
}
// For properties of type array, parse data as comma-separated.
foreach ( array( 'categories', 'keywords', 'blockTypes', 'postTypes' ) as $property ) {
if ( ! empty( $pattern_data[ $property ] ) ) {
$pattern_data[ $property ] = array_filter(
preg_split(
'/[\s,]+/',
(string) $pattern_data[ $property ]
)
);
} else {
unset( $pattern_data[ $property ] );
}
}
// Parse properties of type int.
foreach ( array( 'viewportWidth' ) as $property ) {
if ( ! empty( $pattern_data[ $property ] ) ) {
$pattern_data[ $property ] = (int) $pattern_data[ $property ];
} else {
unset( $pattern_data[ $property ] );
}
}
// Parse properties of type bool.
foreach ( array( 'inserter' ) as $property ) {
if ( ! empty( $pattern_data[ $property ] ) ) {
$pattern_data[ $property ] = in_array(
strtolower( $pattern_data[ $property ] ),
array( 'yes', 'true' ),
true
);
} else {
unset( $pattern_data[ $property ] );
}
}
// Translate the pattern metadata.
$text_domain = $theme->get( 'TextDomain' );
//phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText, WordPress.WP.I18n.NonSingularStringLiteralContext, WordPress.WP.I18n.NonSingularStringLiteralDomain, WordPress.WP.I18n.LowLevelTranslationFunction
$pattern_data['title'] = translate_with_gettext_context( $pattern_data['title'], 'Pattern title', $text_domain );
if ( ! empty( $pattern_data['description'] ) ) {
//phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText, WordPress.WP.I18n.NonSingularStringLiteralContext, WordPress.WP.I18n.NonSingularStringLiteralDomain, WordPress.WP.I18n.LowLevelTranslationFunction
$pattern_data['description'] = translate_with_gettext_context( $pattern_data['description'], 'Pattern description', $text_domain );
}
// The actual pattern content is the output of the file.
ob_start();
include $file;
$pattern_data['content'] = ob_get_clean();
if ( ! $pattern_data['content'] ) {
continue;
}
register_block_pattern( $pattern_data['slug'], $pattern_data );
}
}
}
}
}
```
| Uses | Description |
| --- | --- |
| [WP\_Block\_Patterns\_Registry::get\_instance()](../classes/wp_block_patterns_registry/get_instance) wp-includes/class-wp-block-patterns-registry.php | Utility method to retrieve the main instance of the class. |
| [register\_block\_pattern()](register_block_pattern) wp-includes/class-wp-block-patterns-registry.php | Registers a new block pattern. |
| [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. |
| [translate\_with\_gettext\_context()](translate_with_gettext_context) wp-includes/l10n.php | Retrieves the translation of $text in the context defined in $context. |
| [get\_file\_data()](get_file_data) wp-includes/functions.php | Retrieves metadata from a file. |
| [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. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
| programming_docs |
wordpress get_blog_details( int|string|array $fields = null, bool $get_all = true ): WP_Site|false get\_blog\_details( int|string|array $fields = null, bool $get\_all = true ): WP\_Site|false
============================================================================================
Retrieve the details for a blog from the blogs table and blog options.
`$fields` int|string|array Optional A blog ID, a blog slug, or an array of fields to query against.
If not specified the current blog ID is used. Default: `null`
`$get_all` bool Optional Whether to retrieve all details or only the details in the blogs table.
Default is true. Default: `true`
[WP\_Site](../classes/wp_site)|false Blog details on success. False on failure.
File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function get_blog_details( $fields = null, $get_all = true ) {
global $wpdb;
if ( is_array( $fields ) ) {
if ( isset( $fields['blog_id'] ) ) {
$blog_id = $fields['blog_id'];
} elseif ( isset( $fields['domain'] ) && isset( $fields['path'] ) ) {
$key = md5( $fields['domain'] . $fields['path'] );
$blog = wp_cache_get( $key, 'blog-lookup' );
if ( false !== $blog ) {
return $blog;
}
if ( 'www.' === substr( $fields['domain'], 0, 4 ) ) {
$nowww = substr( $fields['domain'], 4 );
$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) AND path = %s ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'], $fields['path'] ) );
} else {
$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $fields['domain'], $fields['path'] ) );
}
if ( $blog ) {
wp_cache_set( $blog->blog_id . 'short', $blog, 'blog-details' );
$blog_id = $blog->blog_id;
} else {
return false;
}
} elseif ( isset( $fields['domain'] ) && is_subdomain_install() ) {
$key = md5( $fields['domain'] );
$blog = wp_cache_get( $key, 'blog-lookup' );
if ( false !== $blog ) {
return $blog;
}
if ( 'www.' === substr( $fields['domain'], 0, 4 ) ) {
$nowww = substr( $fields['domain'], 4 );
$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'] ) );
} else {
$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s", $fields['domain'] ) );
}
if ( $blog ) {
wp_cache_set( $blog->blog_id . 'short', $blog, 'blog-details' );
$blog_id = $blog->blog_id;
} else {
return false;
}
} else {
return false;
}
} else {
if ( ! $fields ) {
$blog_id = get_current_blog_id();
} elseif ( ! is_numeric( $fields ) ) {
$blog_id = get_id_from_blogname( $fields );
} else {
$blog_id = $fields;
}
}
$blog_id = (int) $blog_id;
$all = $get_all ? '' : 'short';
$details = wp_cache_get( $blog_id . $all, 'blog-details' );
if ( $details ) {
if ( ! is_object( $details ) ) {
if ( -1 == $details ) {
return false;
} else {
// Clear old pre-serialized objects. Cache clients do better with that.
wp_cache_delete( $blog_id . $all, 'blog-details' );
unset( $details );
}
} else {
return $details;
}
}
// Try the other cache.
if ( $get_all ) {
$details = wp_cache_get( $blog_id . 'short', 'blog-details' );
} else {
$details = wp_cache_get( $blog_id, 'blog-details' );
// If short was requested and full cache is set, we can return.
if ( $details ) {
if ( ! is_object( $details ) ) {
if ( -1 == $details ) {
return false;
} else {
// Clear old pre-serialized objects. Cache clients do better with that.
wp_cache_delete( $blog_id, 'blog-details' );
unset( $details );
}
} else {
return $details;
}
}
}
if ( empty( $details ) ) {
$details = WP_Site::get_instance( $blog_id );
if ( ! $details ) {
// Set the full cache.
wp_cache_set( $blog_id, -1, 'blog-details' );
return false;
}
}
if ( ! $details instanceof WP_Site ) {
$details = new WP_Site( $details );
}
if ( ! $get_all ) {
wp_cache_set( $blog_id . $all, $details, 'blog-details' );
return $details;
}
$switched_blog = false;
if ( get_current_blog_id() !== $blog_id ) {
switch_to_blog( $blog_id );
$switched_blog = true;
}
$details->blogname = get_option( 'blogname' );
$details->siteurl = get_option( 'siteurl' );
$details->post_count = get_option( 'post_count' );
$details->home = get_option( 'home' );
if ( $switched_blog ) {
restore_current_blog();
}
/**
* Filters a blog's details.
*
* @since MU (3.0.0)
* @deprecated 4.7.0 Use {@see 'site_details'} instead.
*
* @param WP_Site $details The blog details.
*/
$details = apply_filters_deprecated( 'blog_details', array( $details ), '4.7.0', 'site_details' );
wp_cache_set( $blog_id . $all, $details, 'blog-details' );
$key = md5( $details->domain . $details->path );
wp_cache_set( $key, $details, 'blog-lookup' );
return $details;
}
```
[apply\_filters\_deprecated( 'blog\_details', WP\_Site $details )](../hooks/blog_details)
Filters a blog’s details.
| Uses | Description |
| --- | --- |
| [apply\_filters\_deprecated()](apply_filters_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated filter hook. |
| [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\_Site::\_\_construct()](../classes/wp_site/__construct) wp-includes/class-wp-site.php | Creates a new [WP\_Site](../classes/wp_site) object. |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [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) . |
| [get\_id\_from\_blogname()](get_id_from_blogname) wp-includes/ms-blogs.php | Retrieves a site’s ID given its (subdomain or directory) slug. |
| [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. |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| [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\_lostpassword\_url()](wp_lostpassword_url) wp-includes/general-template.php | Returns the URL that allows the user to reset the lost password. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress wp_print_styles( string|bool|array $handles = false ): string[] wp\_print\_styles( string|bool|array $handles = false ): string[]
=================================================================
Display styles that are in the $handles queue.
Passing an empty array to $handles prints the queue, passing an array with one string prints that style, and passing an array of strings prints those styles.
`$handles` string|bool|array Optional Styles to be printed. Default `'false'`. Default: `false`
string[] On success, an array of handles of processed [WP\_Dependencies](../classes/wp_dependencies) items; otherwise, an empty array.
File: `wp-includes/functions.wp-styles.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-styles.php/)
```
function wp_print_styles( $handles = false ) {
global $wp_styles;
if ( '' === $handles ) { // For 'wp_head'.
$handles = false;
}
if ( ! $handles ) {
/**
* Fires before styles in the $handles queue are printed.
*
* @since 2.6.0
*/
do_action( 'wp_print_styles' );
}
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
if ( ! ( $wp_styles instanceof WP_Styles ) ) {
if ( ! $handles ) {
return array(); // No need to instantiate if nothing is there.
}
}
return wp_styles()->do_items( $handles );
}
```
[do\_action( 'wp\_print\_styles' )](../hooks/wp_print_styles)
Fires before styles in the $handles queue are printed.
| Uses | Description |
| --- | --- |
| [wp\_styles()](wp_styles) wp-includes/functions.wp-styles.php | Initialize $wp\_styles if it has not been set. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [wp\_admin\_css()](wp_admin_css) wp-includes/general-template.php | Enqueues or directly prints a stylesheet link to the specified CSS file. |
| [\_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.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress validate_plugin( string $plugin ): int|WP_Error validate\_plugin( string $plugin ): int|WP\_Error
=================================================
Validates the plugin path.
Checks that the main plugin file exists and is a valid plugin. See [validate\_file()](validate_file) .
`$plugin` string Required Path to the plugin file relative to the plugins directory. int|[WP\_Error](../classes/wp_error) 0 on success, [WP\_Error](../classes/wp_error) on failure.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function validate_plugin( $plugin ) {
if ( validate_file( $plugin ) ) {
return new WP_Error( 'plugin_invalid', __( 'Invalid plugin path.' ) );
}
if ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin ) ) {
return new WP_Error( 'plugin_not_found', __( 'Plugin file does not exist.' ) );
}
$installed_plugins = get_plugins();
if ( ! isset( $installed_plugins[ $plugin ] ) ) {
return new WP_Error( 'no_plugin_header', __( 'The plugin does not have a valid header.' ) );
}
return 0;
}
```
| Uses | Description |
| --- | --- |
| [get\_plugins()](get_plugins) wp-admin/includes/plugin.php | Checks the plugins directory and retrieve all plugin files with plugin data. |
| [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 |
| --- | --- |
| [activate\_plugin()](activate_plugin) wp-admin/includes/plugin.php | Attempts activation of plugin in a “sandbox” and redirects on success. |
| [validate\_active\_plugins()](validate_active_plugins) wp-admin/includes/plugin.php | Validates active plugins. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_remote_retrieve_cookie_value( array|WP_Error $response, string $name ): string wp\_remote\_retrieve\_cookie\_value( array|WP\_Error $response, string $name ): string
======================================================================================
Retrieve a single cookie’s value by name from the raw response.
`$response` array|[WP\_Error](../classes/wp_error) Required HTTP response. `$name` string Required The name of the cookie to retrieve. string The value of the cookie, or empty string if the cookie is not present in the response.
File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/)
```
function wp_remote_retrieve_cookie_value( $response, $name ) {
$cookie = wp_remote_retrieve_cookie( $response, $name );
if ( ! is_a( $cookie, 'WP_Http_Cookie' ) ) {
return '';
}
return $cookie->value;
}
```
| Uses | 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 wp_rand( int $min = null, int $max = null ): int wp\_rand( int $min = null, int $max = null ): int
=================================================
Generates a random non-negative number.
`$min` int Optional Lower limit for the generated number.
Accepts positive integers or zero. Defaults to 0. Default: `null`
`$max` int Optional Upper limit for the generated number.
Accepts positive integers. Defaults to 4294967295. Default: `null`
int A random non-negative number between min and max.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_rand( $min = null, $max = null ) {
global $rnd_value;
// Some misconfigured 32-bit environments (Entropy PHP, for example)
// truncate integers larger than PHP_INT_MAX to PHP_INT_MAX rather than overflowing them to floats.
$max_random_number = 3000000000 === 2147483647 ? (float) '4294967295' : 4294967295; // 4294967295 = 0xffffffff
if ( null === $min ) {
$min = 0;
}
if ( null === $max ) {
$max = $max_random_number;
}
// We only handle ints, floats are truncated to their integer value.
$min = (int) $min;
$max = (int) $max;
// Use PHP's CSPRNG, or a compatible method.
static $use_random_int_functionality = true;
if ( $use_random_int_functionality ) {
try {
// wp_rand() can accept arguments in either order, PHP cannot.
$_max = max( $min, $max );
$_min = min( $min, $max );
$val = random_int( $_min, $_max );
if ( false !== $val ) {
return absint( $val );
} else {
$use_random_int_functionality = false;
}
} catch ( Error $e ) {
$use_random_int_functionality = false;
} catch ( Exception $e ) {
$use_random_int_functionality = false;
}
}
// Reset $rnd_value after 14 uses.
// 32 (md5) + 40 (sha1) + 40 (sha1) / 8 = 14 random numbers from $rnd_value.
if ( strlen( $rnd_value ) < 8 ) {
if ( defined( 'WP_SETUP_CONFIG' ) ) {
static $seed = '';
} else {
$seed = get_transient( 'random_seed' );
}
$rnd_value = md5( uniqid( microtime() . mt_rand(), true ) . $seed );
$rnd_value .= sha1( $rnd_value );
$rnd_value .= sha1( $rnd_value . $seed );
$seed = md5( $seed . $rnd_value );
if ( ! defined( 'WP_SETUP_CONFIG' ) && ! defined( 'WP_INSTALLING' ) ) {
set_transient( 'random_seed', $seed );
}
}
// Take the first 8 digits for our value.
$value = substr( $rnd_value, 0, 8 );
// Strip the first eight, leaving the remainder for the next call to wp_rand().
$rnd_value = substr( $rnd_value, 8 );
$value = abs( hexdec( $value ) );
// Reduce the value to be within the min - max range.
$value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 1 );
return abs( (int) $value );
}
```
| Uses | Description |
| --- | --- |
| [set\_transient()](set_transient) wp-includes/option.php | Sets/updates the value of a transient. |
| [get\_transient()](get_transient) wp-includes/option.php | Retrieves the value of a transient. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| Used By | Description |
| --- | --- |
| [print\_embed\_sharing\_dialog()](print_embed_sharing_dialog) wp-includes/embed.php | Prints the necessary markup for the embed sharing dialog. |
| [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\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. |
| [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. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Returns zero instead of a random number if both `$min` and `$max` are zero. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Uses PHP7 random\_int() or the random\_compat library if available. |
| [2.6.2](https://developer.wordpress.org/reference/since/2.6.2/) | Introduced. |
wordpress convert_smilies( string $text ): string convert\_smilies( string $text ): string
========================================
Converts text equivalent of smilies to images.
Will only convert smilies if the option ‘use\_smilies’ is true and the global used in the function isn’t empty.
`$text` string Required Content to convert smilies from text. string Converted content with text smilies replaced with images.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function convert_smilies( $text ) {
global $wp_smiliessearch;
$output = '';
if ( get_option( 'use_smilies' ) && ! empty( $wp_smiliessearch ) ) {
// HTML loop taken from texturize function, could possible be consolidated.
$textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // Capture the tags as well as in between.
$stop = count( $textarr ); // Loop stuff.
// Ignore proessing 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] ) {
$content = preg_replace_callback( $wp_smiliessearch, 'translate_smiley', $content );
}
// Did we exit ignore block?
if ( '' !== $ignore_block_element && '</' . $ignore_block_element . '>' === $content ) {
$ignore_block_element = '';
}
$output .= $content;
}
} else {
// Return default text.
$output = $text;
}
return $output;
}
```
| Uses | Description |
| --- | --- |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| 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. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress get_submit_button( string $text = '', string $type = 'primary large', string $name = 'submit', bool $wrap = true, array|string $other_attributes = '' ): string get\_submit\_button( string $text = '', string $type = 'primary large', string $name = 'submit', bool $wrap = true, array|string $other\_attributes = '' ): string
==================================================================================================================================================================
Returns a submit button, with provided text and appropriate class.
`$text` string Optional The text of the button. Default 'Save Changes'. Default: `''`
`$type` string Optional The type and CSS class(es) of the button. Core values include `'primary'`, `'small'`, and `'large'`. Default: `'primary large'`
`$name` string Optional The HTML name of the submit button. Defaults to "submit".
If no id attribute is given in $other\_attributes below, `$name` will be used as the button's id. Default `'submit'`. Default: `'submit'`
`$wrap` bool Optional True if the output button should be wrapped in a paragraph tag, false otherwise. Default: `true`
`$other_attributes` array|string Optional Other attributes that should be output with the button, mapping attributes to their values, such as `array( 'tabindex' => '1' )`.
These attributes will be output as `attribute="value"`, such as `tabindex="1"`. Other attributes can also be provided as a string such as `tabindex="1"`, though the array format is typically cleaner.
Default: `''`
string Submit button HTML.
* $type can be a single value, or a space separated list of values, or an array of values. The values determine the HTML classes of the button.
+ If $type is ‘delete’, the classes are ‘button delete’.
+ Otherwise the first class is ‘button’, followed by any of these in order of appearance:
- type value ‘primary’ makes class ‘button-primary’
- type value ‘small’ makes class ‘button-small’
- type value ‘large’ makes class ‘button-large’
- type value ‘secondary’ or ‘button-secondary’ is ignored (the ‘button’ class has the styling)
- any other type value ‘foo’ makes the class ‘foo’+ For example, the default $type ‘primary large’ results in a button with HTML classes ‘button button-primary button-large’.
* The related function [submit\_button()](submit_button) echos the button instead of returning it as a string. It has a different default `$type`, ‘primary’, resulting in the HTML classes ‘button button-primary’.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' ) {
if ( ! is_array( $type ) ) {
$type = explode( ' ', $type );
}
$button_shorthand = array( 'primary', 'small', 'large' );
$classes = array( 'button' );
foreach ( $type as $t ) {
if ( 'secondary' === $t || 'button-secondary' === $t ) {
continue;
}
$classes[] = in_array( $t, $button_shorthand, true ) ? 'button-' . $t : $t;
}
// Remove empty items, remove duplicate items, and finally build a string.
$class = implode( ' ', array_unique( array_filter( $classes ) ) );
$text = $text ? $text : __( 'Save Changes' );
// Default the id attribute to $name unless an id was specifically provided in $other_attributes.
$id = $name;
if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) {
$id = $other_attributes['id'];
unset( $other_attributes['id'] );
}
$attributes = '';
if ( is_array( $other_attributes ) ) {
foreach ( $other_attributes as $attribute => $value ) {
$attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important.
}
} elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string.
$attributes = $other_attributes;
}
// Don't output empty name and id attributes.
$name_attr = $name ? ' name="' . esc_attr( $name ) . '"' : '';
$id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$button = '<input type="submit"' . $name_attr . $id_attr . ' class="' . esc_attr( $class );
$button .= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />';
if ( $wrap ) {
$button = '<p class="submit">' . $button . '</p>';
}
return $button;
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| Used By | Description |
| --- | --- |
| [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). |
| [\_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\_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. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress wp_comment_form_unfiltered_html_nonce() wp\_comment\_form\_unfiltered\_html\_nonce()
============================================
Displays form token for unfiltered comments.
Will only display nonce token if the current user has permissions for unfiltered html. Won’t display the token for other users.
The function was backported to 2.0.10 and was added to versions 2.1.3 and above. Does not exist in versions prior to 2.0.10 in the 2.0 branch and in the 2.1 branch, prior to 2.1.3. Technically added in 2.2.0.
Backported to 2.0.10.
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function wp_comment_form_unfiltered_html_nonce() {
$post = get_post();
$post_id = $post ? $post->ID : 0;
if ( current_user_can( 'unfiltered_html' ) ) {
wp_nonce_field( 'unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment_disabled', false );
echo "<script>(function(){if(window===window.parent){document.getElementById('_wp_unfiltered_html_comment_disabled').name='_wp_unfiltered_html_comment';}})();</script>\n";
}
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [2.1.3](https://developer.wordpress.org/reference/since/2.1.3/) | Introduced. |
wordpress _wp_put_post_revision( int|WP_Post|array|null $post = null, bool $autosave = false ): int|WP_Error \_wp\_put\_post\_revision( int|WP\_Post|array|null $post = null, bool $autosave = false ): int|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.
Inserts post data into the posts table as a post revision.
`$post` int|[WP\_Post](../classes/wp_post)|array|null Optional Post ID, post object OR post array. Default: `null`
`$autosave` bool Optional Whether the revision is an autosave or not. Default: `false`
int|[WP\_Error](../classes/wp_error) [WP\_Error](../classes/wp_error) or 0 if error, new revision ID if success.
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function _wp_put_post_revision( $post = null, $autosave = false ) {
if ( is_object( $post ) ) {
$post = get_object_vars( $post );
} elseif ( ! is_array( $post ) ) {
$post = get_post( $post, ARRAY_A );
}
if ( ! $post || empty( $post['ID'] ) ) {
return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
}
if ( isset( $post['post_type'] ) && 'revision' === $post['post_type'] ) {
return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
}
$post = _wp_post_revision_data( $post, $autosave );
$post = wp_slash( $post ); // Since data is from DB.
$revision_id = wp_insert_post( $post, true );
if ( is_wp_error( $revision_id ) ) {
return $revision_id;
}
if ( $revision_id ) {
/**
* Fires once a revision has been saved.
*
* @since 2.6.0
*
* @param int $revision_id Post revision ID.
*/
do_action( '_wp_put_post_revision', $revision_id );
}
return $revision_id;
}
```
[do\_action( '\_wp\_put\_post\_revision', int $revision\_id )](../hooks/_wp_put_post_revision)
Fires once a revision has been saved.
| Uses | Description |
| --- | --- |
| [\_wp\_post\_revision\_data()](_wp_post_revision_data) wp-includes/revision.php | Returns a post array ready to be inserted into the posts table as a post revision. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| [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. |
| [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\_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\_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_destroy_all_sessions() wp\_destroy\_all\_sessions()
============================
Removes all session tokens for the current user from the database.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_destroy_all_sessions() {
$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
$manager->destroy_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_array_set( array $array, array $path, mixed $value = null ) \_wp\_array\_set( array $array, array $path, mixed $value = 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.
Sets an array in depth based on a path of keys.
It is the PHP equivalent of JavaScript’s `lodash.set()` and mirroring it may help other components retain some symmetry between client and server implementations.
Example usage:
```
$array = array();
_wp_array_set( $array, array( 'a', 'b', 'c', 1 ) );
$array becomes:
array(
'a' => array(
'b' => array(
'c' => 1,
),
),
);
```
`$array` array Required An array that we want to mutate to include a specific value in a path. `$path` array Required An array of keys describing the path that we want to mutate. `$value` mixed Optional The value that will be set. Default: `null`
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _wp_array_set( &$array, $path, $value = null ) {
// Confirm $array is valid.
if ( ! is_array( $array ) ) {
return;
}
// Confirm $path is valid.
if ( ! is_array( $path ) ) {
return;
}
$path_length = count( $path );
if ( 0 === $path_length ) {
return;
}
foreach ( $path as $path_element ) {
if (
! is_string( $path_element ) && ! is_integer( $path_element ) &&
! is_null( $path_element )
) {
return;
}
}
for ( $i = 0; $i < $path_length - 1; ++$i ) {
$path_element = $path[ $i ];
if (
! array_key_exists( $path_element, $array ) ||
! is_array( $array[ $path_element ] )
) {
$array[ $path_element ] = array();
}
$array = &$array[ $path_element ]; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.VariableRedeclaration
}
$array[ $path[ $i ] ] = $value;
}
```
| Used By | Description |
| --- | --- |
| [WP\_Theme\_JSON::set\_spacing\_sizes()](../classes/wp_theme_json/set_spacing_sizes) wp-includes/class-wp-theme-json.php | Sets the spacingSizes array based on the spacingScale values from theme.json. |
| [WP\_Theme\_JSON::get\_data()](../classes/wp_theme_json/get_data) wp-includes/class-wp-theme-json.php | Returns a valid theme.json as provided by a theme. |
| [WP\_Theme\_JSON\_Schema::rename\_settings()](../classes/wp_theme_json_schema/rename_settings) wp-includes/class-wp-theme-json-schema.php | Processes a settings array, renaming or moving properties. |
| [WP\_Theme\_JSON::get\_default\_slugs()](../classes/wp_theme_json/get_default_slugs) wp-includes/class-wp-theme-json.php | Returns the default slugs for all the presets in an associative array whose keys are the preset paths and the leafs is the list of slugs. |
| [WP\_Theme\_JSON::remove\_insecure\_properties()](../classes/wp_theme_json/remove_insecure_properties) wp-includes/class-wp-theme-json.php | Removes insecure data from theme.json. |
| [WP\_Theme\_JSON::remove\_insecure\_settings()](../classes/wp_theme_json/remove_insecure_settings) wp-includes/class-wp-theme-json.php | Processes a setting node and returns the same node without the insecure settings. |
| [WP\_Theme\_JSON::remove\_insecure\_styles()](../classes/wp_theme_json/remove_insecure_styles) wp-includes/class-wp-theme-json.php | Processes a style node and returns the same node without the insecure styles. |
| [WP\_Theme\_JSON::do\_opt\_in\_into\_settings()](../classes/wp_theme_json/do_opt_in_into_settings) wp-includes/class-wp-theme-json.php | Enables some settings. |
| [WP\_Theme\_JSON::merge()](../classes/wp_theme_json/merge) wp-includes/class-wp-theme-json.php | Merges new incoming data. |
| [WP\_Theme\_JSON::\_\_construct()](../classes/wp_theme_json/__construct) wp-includes/class-wp-theme-json.php | Constructor. |
| [wp\_migrate\_old\_typography\_shape()](wp_migrate_old_typography_shape) wp-includes/blocks.php | Converts typography keys declared under `supports.*` to `supports.typography.*`. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress wpmu_validate_user_signup( string $user_name, string $user_email ): array wpmu\_validate\_user\_signup( string $user\_name, string $user\_email ): array
==============================================================================
Sanitizes and validates data required for a user sign-up.
Verifies the validity and uniqueness of user names and user email addresses, and checks email addresses against allowed and disallowed domains provided by administrators.
The [‘wpmu\_validate\_user\_signup’](../hooks/wpmu_validate_user_signup) hook provides an easy way to modify the sign-up process. The value $result, which is passed to the hook, contains both the user-provided info and the error messages created by the function. [‘wpmu\_validate\_user\_signup’](../hooks/wpmu_validate_user_signup) allows you to process the data in any way you’d like, and unset the relevant errors if necessary.
`$user_name` string Required The login name provided by the user. `$user_email` string Required The email provided by the user. array The array of user name, email, and the error messages.
* `user_name`stringSanitized and unique username.
* `orig_username`stringOriginal username.
* `user_email`stringUser email address.
* `errors`[WP\_Error](../classes/wp_error)
[WP\_Error](../classes/wp_error) object containing any errors found.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function wpmu_validate_user_signup( $user_name, $user_email ) {
global $wpdb;
$errors = new WP_Error();
$orig_username = $user_name;
$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
if ( $user_name != $orig_username || preg_match( '/[^a-z0-9]/', $user_name ) ) {
$errors->add( 'user_name', __( 'Usernames can only contain lowercase letters (a-z) and numbers.' ) );
$user_name = $orig_username;
}
$user_email = sanitize_email( $user_email );
if ( empty( $user_name ) ) {
$errors->add( 'user_name', __( 'Please enter a username.' ) );
}
$illegal_names = get_site_option( 'illegal_names' );
if ( ! is_array( $illegal_names ) ) {
$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
add_site_option( 'illegal_names', $illegal_names );
}
if ( in_array( $user_name, $illegal_names, true ) ) {
$errors->add( 'user_name', __( 'Sorry, that username is not allowed.' ) );
}
/** This filter is documented in wp-includes/user.php */
$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
if ( in_array( strtolower( $user_name ), array_map( 'strtolower', $illegal_logins ), true ) ) {
$errors->add( 'user_name', __( 'Sorry, that username is not allowed.' ) );
}
if ( ! is_email( $user_email ) ) {
$errors->add( 'user_email', __( 'Please enter a valid email address.' ) );
} elseif ( is_email_address_unsafe( $user_email ) ) {
$errors->add( 'user_email', __( 'You cannot use that email address to signup. There are problems with them blocking some emails from WordPress. Please use another email provider.' ) );
}
if ( strlen( $user_name ) < 4 ) {
$errors->add( 'user_name', __( 'Username must be at least 4 characters.' ) );
}
if ( strlen( $user_name ) > 60 ) {
$errors->add( 'user_name', __( 'Username may not be longer than 60 characters.' ) );
}
// All numeric?
if ( preg_match( '/^[0-9]*$/', $user_name ) ) {
$errors->add( 'user_name', __( 'Sorry, usernames must have letters too!' ) );
}
$limited_email_domains = get_site_option( 'limited_email_domains' );
if ( is_array( $limited_email_domains ) && ! empty( $limited_email_domains ) ) {
$limited_email_domains = array_map( 'strtolower', $limited_email_domains );
$emaildomain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
if ( ! in_array( $emaildomain, $limited_email_domains, true ) ) {
$errors->add( 'user_email', __( 'Sorry, that email address is not allowed!' ) );
}
}
// Check if the username has been used already.
if ( username_exists( $user_name ) ) {
$errors->add( 'user_name', __( 'Sorry, that username already exists!' ) );
}
// Check if the email address has been used already.
if ( email_exists( $user_email ) ) {
$errors->add(
'user_email',
sprintf(
/* translators: %s: Link to the login page. */
__( '<strong>Error:</strong> This email address is already registered. <a href="%s">Log in</a> with this address or choose another one.' ),
wp_login_url()
)
);
}
// Has someone already signed up for this username?
$signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE user_login = %s", $user_name ) );
if ( $signup instanceof stdClass ) {
$registered_at = mysql2date( 'U', $signup->registered );
$now = time();
$diff = $now - $registered_at;
// If registered more than two days ago, cancel registration and let this signup go through.
if ( $diff > 2 * DAY_IN_SECONDS ) {
$wpdb->delete( $wpdb->signups, array( 'user_login' => $user_name ) );
} else {
$errors->add( 'user_name', __( 'That username is currently reserved but may be available in a couple of days.' ) );
}
}
$signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email ) );
if ( $signup instanceof stdClass ) {
$diff = time() - mysql2date( 'U', $signup->registered );
// If registered more than two days ago, cancel registration and let this signup go through.
if ( $diff > 2 * DAY_IN_SECONDS ) {
$wpdb->delete( $wpdb->signups, array( 'user_email' => $user_email ) );
} else {
$errors->add( 'user_email', __( 'That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.' ) );
}
}
$result = array(
'user_name' => $user_name,
'orig_username' => $orig_username,
'user_email' => $user_email,
'errors' => $errors,
);
/**
* Filters the validated user registration details.
*
* This does not allow you to override the username or email of the user during
* registration. The values are solely used for validation and error handling.
*
* @since MU (3.0.0)
*
* @param array $result {
* The array of user name, email, and the error messages.
*
* @type string $user_name Sanitized and unique username.
* @type string $orig_username Original username.
* @type string $user_email User email address.
* @type WP_Error $errors WP_Error object containing any errors found.
* }
*/
return apply_filters( 'wpmu_validate_user_signup', $result );
}
```
[apply\_filters( 'illegal\_user\_logins', array $usernames )](../hooks/illegal_user_logins)
Filters the list of disallowed usernames.
[apply\_filters( 'wpmu\_validate\_user\_signup', array $result )](../hooks/wpmu_validate_user_signup)
Filters the validated user registration details.
| Uses | Description |
| --- | --- |
| [sanitize\_email()](sanitize_email) wp-includes/formatting.php | Strips out all characters that are not allowable in an email. |
| [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. |
| [sanitize\_user()](sanitize_user) wp-includes/formatting.php | Sanitizes a username, stripping out unsafe characters. |
| [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. |
| [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. |
| [add\_site\_option()](add_site_option) wp-includes/option.php | Adds a new option for the current network. |
| [username\_exists()](username_exists) wp-includes/user.php | Determines whether the given username exists. |
| [email\_exists()](email_exists) wp-includes/user.php | Determines whether the given email exists. |
| [is\_email\_address\_unsafe()](is_email_address_unsafe) wp-includes/ms-functions.php | Checks an email address against a list of banned domains. |
| [wpdb::get\_row()](../classes/wpdb/get_row) wp-includes/class-wpdb.php | Retrieves one row from the database. |
| [wpdb::delete()](../classes/wpdb/delete) wp-includes/class-wpdb.php | Deletes a row in the table. |
| [\_\_()](__) 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. |
| [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 |
| --- | --- |
| [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. |
| [validate\_user\_form()](validate_user_form) wp-signup.php | Validates user sign-up name and email. |
| [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. |
| programming_docs |
wordpress get_current_site(): WP_Network get\_current\_site(): WP\_Network
=================================
Gets the current network.
Returns an object containing the ‘id’, ‘domain’, ‘path’, and ‘site\_name’ properties of the network being viewed.
* [wpmu\_current\_site()](wpmu_current_site)
[WP\_Network](../classes/wp_network)
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function get_current_site() {
global $current_site;
return $current_site;
}
```
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress wp_cache_flush_runtime(): bool wp\_cache\_flush\_runtime(): bool
=================================
Removes all cache items from the in-memory runtime cache.
* [WP\_Object\_Cache::flush()](../classes/wp_object_cache/flush)
bool True on success, false on failure.
File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_flush_runtime() {
return wp_cache_flush();
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_flush()](wp_cache_flush) wp-includes/cache.php | Removes all cache items. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress install_plugin_information() install\_plugin\_information()
==============================
Displays plugin information in dialog box form.
File: `wp-admin/includes/plugin-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin-install.php/)
```
function install_plugin_information() {
global $tab;
if ( empty( $_REQUEST['plugin'] ) ) {
return;
}
$api = plugins_api(
'plugin_information',
array(
'slug' => wp_unslash( $_REQUEST['plugin'] ),
)
);
if ( is_wp_error( $api ) ) {
wp_die( $api );
}
$plugins_allowedtags = array(
'a' => array(
'href' => array(),
'title' => array(),
'target' => array(),
),
'abbr' => array( 'title' => array() ),
'acronym' => array( 'title' => array() ),
'code' => array(),
'pre' => array(),
'em' => array(),
'strong' => array(),
'div' => array( 'class' => array() ),
'span' => array( 'class' => array() ),
'p' => array(),
'br' => array(),
'ul' => array(),
'ol' => array(),
'li' => array(),
'h1' => array(),
'h2' => array(),
'h3' => array(),
'h4' => array(),
'h5' => array(),
'h6' => array(),
'img' => array(
'src' => array(),
'class' => array(),
'alt' => array(),
),
'blockquote' => array( 'cite' => true ),
);
$plugins_section_titles = array(
'description' => _x( 'Description', 'Plugin installer section title' ),
'installation' => _x( 'Installation', 'Plugin installer section title' ),
'faq' => _x( 'FAQ', 'Plugin installer section title' ),
'screenshots' => _x( 'Screenshots', 'Plugin installer section title' ),
'changelog' => _x( 'Changelog', 'Plugin installer section title' ),
'reviews' => _x( 'Reviews', 'Plugin installer section title' ),
'other_notes' => _x( 'Other Notes', 'Plugin installer section title' ),
);
// Sanitize HTML.
foreach ( (array) $api->sections as $section_name => $content ) {
$api->sections[ $section_name ] = wp_kses( $content, $plugins_allowedtags );
}
foreach ( array( 'version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug' ) as $key ) {
if ( isset( $api->$key ) ) {
$api->$key = wp_kses( $api->$key, $plugins_allowedtags );
}
}
$_tab = esc_attr( $tab );
// Default to the Description tab, Do not translate, API returns English.
$section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description';
if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) {
$section_titles = array_keys( (array) $api->sections );
$section = reset( $section_titles );
}
iframe_header( __( 'Plugin Installation' ) );
$_with_banner = '';
if ( ! empty( $api->banners ) && ( ! empty( $api->banners['low'] ) || ! empty( $api->banners['high'] ) ) ) {
$_with_banner = 'with-banner';
$low = empty( $api->banners['low'] ) ? $api->banners['high'] : $api->banners['low'];
$high = empty( $api->banners['high'] ) ? $api->banners['low'] : $api->banners['high'];
?>
<style type="text/css">
#plugin-information-title.with-banner {
background-image: url( <?php echo esc_url( $low ); ?> );
}
@media only screen and ( -webkit-min-device-pixel-ratio: 1.5 ) {
#plugin-information-title.with-banner {
background-image: url( <?php echo esc_url( $high ); ?> );
}
}
</style>
<?php
}
echo '<div id="plugin-information-scrollable">';
echo "<div id='{$_tab}-title' class='{$_with_banner}'><div class='vignette'></div><h2>{$api->name}</h2></div>";
echo "<div id='{$_tab}-tabs' class='{$_with_banner}'>\n";
foreach ( (array) $api->sections as $section_name => $content ) {
if ( 'reviews' === $section_name && ( empty( $api->ratings ) || 0 === array_sum( (array) $api->ratings ) ) ) {
continue;
}
if ( isset( $plugins_section_titles[ $section_name ] ) ) {
$title = $plugins_section_titles[ $section_name ];
} else {
$title = ucwords( str_replace( '_', ' ', $section_name ) );
}
$class = ( $section_name === $section ) ? ' class="current"' : '';
$href = add_query_arg(
array(
'tab' => $tab,
'section' => $section_name,
)
);
$href = esc_url( $href );
$san_section = esc_attr( $section_name );
echo "\t<a name='$san_section' href='$href' $class>$title</a>\n";
}
echo "</div>\n";
?>
<div id="<?php echo $_tab; ?>-content" class='<?php echo $_with_banner; ?>'>
<div class="fyi">
<ul>
<?php if ( ! empty( $api->version ) ) { ?>
<li><strong><?php _e( 'Version:' ); ?></strong> <?php echo $api->version; ?></li>
<?php } if ( ! empty( $api->author ) ) { ?>
<li><strong><?php _e( 'Author:' ); ?></strong> <?php echo links_add_target( $api->author, '_blank' ); ?></li>
<?php } if ( ! empty( $api->last_updated ) ) { ?>
<li><strong><?php _e( 'Last Updated:' ); ?></strong>
<?php
/* translators: %s: Human-readable time difference. */
printf( __( '%s ago' ), human_time_diff( strtotime( $api->last_updated ) ) );
?>
</li>
<?php } if ( ! empty( $api->requires ) ) { ?>
<li>
<strong><?php _e( 'Requires WordPress Version:' ); ?></strong>
<?php
/* translators: %s: Version number. */
printf( __( '%s or higher' ), $api->requires );
?>
</li>
<?php } if ( ! empty( $api->tested ) ) { ?>
<li><strong><?php _e( 'Compatible up to:' ); ?></strong> <?php echo $api->tested; ?></li>
<?php } if ( ! empty( $api->requires_php ) ) { ?>
<li>
<strong><?php _e( 'Requires PHP Version:' ); ?></strong>
<?php
/* translators: %s: Version number. */
printf( __( '%s or higher' ), $api->requires_php );
?>
</li>
<?php } if ( isset( $api->active_installs ) ) { ?>
<li><strong><?php _e( 'Active Installations:' ); ?></strong>
<?php
if ( $api->active_installs >= 1000000 ) {
$active_installs_millions = floor( $api->active_installs / 1000000 );
printf(
/* translators: %s: Number of millions. */
_nx( '%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations' ),
number_format_i18n( $active_installs_millions )
);
} elseif ( $api->active_installs < 10 ) {
_ex( 'Less Than 10', 'Active plugin installations' );
} else {
echo number_format_i18n( $api->active_installs ) . '+';
}
?>
</li>
<?php } if ( ! empty( $api->slug ) && empty( $api->external ) ) { ?>
<li><a target="_blank" href="<?php echo esc_url( __( 'https://wordpress.org/plugins/' ) . $api->slug ); ?>/"><?php _e( 'WordPress.org Plugin Page »' ); ?></a></li>
<?php } if ( ! empty( $api->homepage ) ) { ?>
<li><a target="_blank" href="<?php echo esc_url( $api->homepage ); ?>"><?php _e( 'Plugin Homepage »' ); ?></a></li>
<?php } if ( ! empty( $api->donate_link ) && empty( $api->contributors ) ) { ?>
<li><a target="_blank" href="<?php echo esc_url( $api->donate_link ); ?>"><?php _e( 'Donate to this plugin »' ); ?></a></li>
<?php } ?>
</ul>
<?php if ( ! empty( $api->rating ) ) { ?>
<h3><?php _e( 'Average Rating' ); ?></h3>
<?php
wp_star_rating(
array(
'rating' => $api->rating,
'type' => 'percent',
'number' => $api->num_ratings,
)
);
?>
<p aria-hidden="true" class="fyi-description">
<?php
printf(
/* translators: %s: Number of ratings. */
_n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ),
number_format_i18n( $api->num_ratings )
);
?>
</p>
<?php
}
if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) {
?>
<h3><?php _e( 'Reviews' ); ?></h3>
<p class="fyi-description"><?php _e( 'Read all reviews on WordPress.org or write your own!' ); ?></p>
<?php
foreach ( $api->ratings as $key => $ratecount ) {
// Avoid div-by-zero.
$_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0;
$aria_label = esc_attr(
sprintf(
/* translators: 1: Number of stars (used to determine singular/plural), 2: Number of reviews. */
_n(
'Reviews with %1$d star: %2$s. Opens in a new tab.',
'Reviews with %1$d stars: %2$s. Opens in a new tab.',
$key
),
$key,
number_format_i18n( $ratecount )
)
);
?>
<div class="counter-container">
<span class="counter-label">
<?php
printf(
'<a href="%s" target="_blank" aria-label="%s">%s</a>',
"https://wordpress.org/support/plugin/{$api->slug}/reviews/?filter={$key}",
$aria_label,
/* translators: %s: Number of stars. */
sprintf( _n( '%d star', '%d stars', $key ), $key )
);
?>
</span>
<span class="counter-back">
<span class="counter-bar" style="width: <?php echo 92 * $_rating; ?>px;"></span>
</span>
<span class="counter-count" aria-hidden="true"><?php echo number_format_i18n( $ratecount ); ?></span>
</div>
<?php
}
}
if ( ! empty( $api->contributors ) ) {
?>
<h3><?php _e( 'Contributors' ); ?></h3>
<ul class="contributors">
<?php
foreach ( (array) $api->contributors as $contrib_username => $contrib_details ) {
$contrib_name = $contrib_details['display_name'];
if ( ! $contrib_name ) {
$contrib_name = $contrib_username;
}
$contrib_name = esc_html( $contrib_name );
$contrib_profile = esc_url( $contrib_details['profile'] );
$contrib_avatar = esc_url( add_query_arg( 's', '36', $contrib_details['avatar'] ) );
echo "<li><a href='{$contrib_profile}' target='_blank'><img src='{$contrib_avatar}' width='18' height='18' alt='' />{$contrib_name}</a></li>";
}
?>
</ul>
<?php if ( ! empty( $api->donate_link ) ) { ?>
<a target="_blank" href="<?php echo esc_url( $api->donate_link ); ?>"><?php _e( 'Donate to this plugin »' ); ?></a>
<?php } ?>
<?php } ?>
</div>
<div id="section-holder">
<?php
$requires_php = isset( $api->requires_php ) ? $api->requires_php : null;
$requires_wp = isset( $api->requires ) ? $api->requires : null;
$compatible_php = is_php_version_compatible( $requires_php );
$compatible_wp = is_wp_version_compatible( $requires_wp );
$tested_wp = ( empty( $api->tested ) || version_compare( get_bloginfo( 'version' ), $api->tested, '<=' ) );
if ( ! $compatible_php ) {
echo '<div class="notice notice-error notice-alt"><p>';
_e( '<strong>Error:</strong> This plugin <strong>requires a newer version of PHP</strong>.' );
if ( current_user_can( 'update_php' ) ) {
printf(
/* translators: %s: URL to Update PHP page. */
' ' . __( '<a href="%s" target="_blank">Click here to learn more about updating PHP</a>.' ),
esc_url( wp_get_update_php_url() )
);
wp_update_php_annotation( '</p><p><em>', '</em>' );
} else {
echo '</p>';
}
echo '</div>';
}
if ( ! $tested_wp ) {
echo '<div class="notice notice-warning notice-alt"><p>';
_e( '<strong>Warning:</strong> This plugin <strong>has not been tested</strong> with your current version of WordPress.' );
echo '</p></div>';
} elseif ( ! $compatible_wp ) {
echo '<div class="notice notice-error notice-alt"><p>';
_e( '<strong>Error:</strong> This plugin <strong>requires a newer version of WordPress</strong>.' );
if ( current_user_can( 'update_core' ) ) {
printf(
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( '<a href="%s" target="_parent">Click here to update WordPress</a>.' ),
esc_url( self_admin_url( 'update-core.php' ) )
);
}
echo '</p></div>';
}
foreach ( (array) $api->sections as $section_name => $content ) {
$content = links_add_base_url( $content, 'https://wordpress.org/plugins/' . $api->slug . '/' );
$content = links_add_target( $content, '_blank' );
$san_section = esc_attr( $section_name );
$display = ( $section_name === $section ) ? 'block' : 'none';
echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n";
echo $content;
echo "\t</div>\n";
}
echo "</div>\n";
echo "</div>\n";
echo "</div>\n"; // #plugin-information-scrollable
echo "<div id='$tab-footer'>\n";
if ( ! empty( $api->download_link ) && ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) ) {
$status = install_plugin_install_status( $api );
switch ( $status['status'] ) {
case 'install':
if ( $status['url'] ) {
if ( $compatible_php && $compatible_wp ) {
echo '<a data-slug="' . esc_attr( $api->slug ) . '" id="plugin_install_from_iframe" class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Now' ) . '</a>';
} else {
printf(
'<button type="button" class="button button-primary button-disabled right" disabled="disabled">%s</button>',
_x( 'Cannot Install', 'plugin' )
);
}
}
break;
case 'update_available':
if ( $status['url'] ) {
if ( $compatible_php ) {
echo '<a data-slug="' . esc_attr( $api->slug ) . '" data-plugin="' . esc_attr( $status['file'] ) . '" id="plugin_update_from_iframe" class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Update Now' ) . '</a>';
} else {
printf(
'<button type="button" class="button button-primary button-disabled right" disabled="disabled">%s</button>',
_x( 'Cannot Update', 'plugin' )
);
}
}
break;
case 'newer_installed':
/* translators: %s: Plugin version. */
echo '<a class="button button-primary right disabled">' . sprintf( __( 'Newer Version (%s) Installed' ), esc_html( $status['version'] ) ) . '</a>';
break;
case 'latest_installed':
echo '<a class="button button-primary right disabled">' . __( 'Latest Version Installed' ) . '</a>';
break;
}
}
echo "</div>\n";
iframe_footer();
exit;
}
```
| Uses | Description |
| --- | --- |
| [is\_php\_version\_compatible()](is_php_version_compatible) wp-includes/functions.php | Checks compatibility with the current PHP version. |
| [\_nx()](_nx) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number, with gettext context. |
| [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. |
| [wp\_kses()](wp_kses) wp-includes/kses.php | Filters text content and strips out disallowed HTML. |
| [human\_time\_diff()](human_time_diff) wp-includes/formatting.php | Determines the difference between two timestamps. |
| [links\_add\_base\_url()](links_add_base_url) wp-includes/formatting.php | Adds a base URL to relative links in passed content. |
| [links\_add\_target()](links_add_target) wp-includes/formatting.php | Adds a Target attribute to all links in passed content. |
| [is\_wp\_version\_compatible()](is_wp_version_compatible) wp-includes/functions.php | Checks compatibility with the current WordPress version. |
| [\_ex()](_ex) wp-includes/l10n.php | Displays translated string with gettext context. |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [plugins\_api()](plugins_api) wp-admin/includes/plugin-install.php | Retrieves plugin installer pages from the WordPress.org Plugins API. |
| [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. |
| [iframe\_footer()](iframe_footer) wp-admin/includes/template.php | Generic Iframe footer for use with Thickbox. |
| [iframe\_header()](iframe_header) wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. |
| [wp\_star\_rating()](wp_star_rating) wp-admin/includes/template.php | Outputs a HTML element with a star rating for a given rating. |
| [install\_plugin\_install\_status()](install_plugin_install_status) wp-admin/includes/plugin-install.php | Determines the status we can perform on a plugin. |
| [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. |
| [\_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. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [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. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_update_attachment_metadata( int $attachment_id, array $data ): int|false wp\_update\_attachment\_metadata( int $attachment\_id, array $data ): int|false
===============================================================================
Updates metadata for an attachment.
`$attachment_id` int Required Attachment post ID. `$data` array Required Attachment meta data. int|false False if $post is invalid.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_update_attachment_metadata( $attachment_id, $data ) {
$attachment_id = (int) $attachment_id;
$post = get_post( $attachment_id );
if ( ! $post ) {
return false;
}
/**
* Filters the updated attachment meta data.
*
* @since 2.1.0
*
* @param array $data Array of updated attachment meta data.
* @param int $attachment_id Attachment post ID.
*/
$data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID );
if ( $data ) {
return update_post_meta( $post->ID, '_wp_attachment_metadata', $data );
} else {
return delete_post_meta( $post->ID, '_wp_attachment_metadata' );
}
}
```
[apply\_filters( 'wp\_update\_attachment\_metadata', array $data, int $attachment\_id )](../hooks/wp_update_attachment_metadata)
Filters the updated attachment meta data.
| Uses | Description |
| --- | --- |
| [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. |
| [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\_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\_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\_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\_Customize\_Manager::import\_theme\_starter\_content()](../classes/wp_customize_manager/import_theme_starter_content) wp-includes/class-wp-customize-manager.php | Imports theme starter content into the customized state. |
| [WP\_REST\_Attachments\_Controller::create\_item()](../classes/wp_rest_attachments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Creates a single attachment. |
| [WP\_Site\_Icon::insert\_attachment()](../classes/wp_site_icon/insert_attachment) wp-admin/includes/class-wp-site-icon.php | Inserts an attachment. |
| [wp\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [wp\_restore\_image()](wp_restore_image) wp-admin/includes/image-edit.php | Restores the metadata for a given attachment. |
| [wp\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. |
| [wp\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. |
| [media\_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) . |
| [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. |
| [Custom\_Image\_Header::insert\_attachment()](../classes/custom_image_header/insert_attachment) wp-admin/includes/class-custom-image-header.php | Insert an attachment and its metadata. |
| [Custom\_Image\_Header::step\_2()](../classes/custom_image_header/step_2) wp-admin/includes/class-custom-image-header.php | Display second 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. |
| [wp\_maybe\_generate\_attachment\_metadata()](wp_maybe_generate_attachment_metadata) wp-includes/media.php | Maybe attempts to generate attachment metadata, if missing. |
| [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.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress register_post_status( string $post_status, array|string $args = array() ): object register\_post\_status( string $post\_status, array|string $args = array() ): object
====================================================================================
Registers a post status. Do not use before init.
A simple function for creating or modifying a post status based on the parameters given. The function will accept an array (second optional parameter), along with a string for the post status name.
Arguments prefixed with an \_underscore shouldn’t be used by plugins and themes.
`$post_status` string Required Name of the post status. `$args` array|string Optional Array or string of post status arguments.
* `label`bool|stringA descriptive name for the post status marked for translation. Defaults to value of $post\_status.
* `label_count`array|falseNooped plural text from [\_n\_noop()](_n_noop) to provide the singular and plural forms of the label for counts. Default false which means the `$label` argument will be used for both the singular and plural forms of this label.
* `exclude_from_search`boolWhether to exclude posts with this post status from search results. Default is value of $internal.
* `_builtin`boolWhether the status is built-in. Core-use only.
Default false.
* `public`boolWhether posts of this status should be shown in the front end of the site. Default false.
* `internal`boolWhether the status is for internal use only.
Default false.
* `protected`boolWhether posts with this status should be protected.
Default false.
* `private`boolWhether posts with this status should be private.
Default false.
* `publicly_queryable`boolWhether posts with this status should be publicly- queryable. Default is value of $public.
* `show_in_admin_all_list`boolWhether to include posts in the edit listing for their post type. Default is the opposite value of $internal.
* `show_in_admin_status_list`boolShow in the list of statuses with post counts at the top of the edit listings, e.g. All (12) | Published (9) | My Custom Status (2) Default is the opposite value of $internal.
* `date_floating`boolWhether the post has a floating creation date.
Default to false.
Default: `array()`
object
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function register_post_status( $post_status, $args = array() ) {
global $wp_post_statuses;
if ( ! is_array( $wp_post_statuses ) ) {
$wp_post_statuses = array();
}
// Args prefixed with an underscore are reserved for internal use.
$defaults = array(
'label' => false,
'label_count' => false,
'exclude_from_search' => null,
'_builtin' => false,
'public' => null,
'internal' => null,
'protected' => null,
'private' => null,
'publicly_queryable' => null,
'show_in_admin_status_list' => null,
'show_in_admin_all_list' => null,
'date_floating' => null,
);
$args = wp_parse_args( $args, $defaults );
$args = (object) $args;
$post_status = sanitize_key( $post_status );
$args->name = $post_status;
// Set various defaults.
if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private ) {
$args->internal = true;
}
if ( null === $args->public ) {
$args->public = false;
}
if ( null === $args->private ) {
$args->private = false;
}
if ( null === $args->protected ) {
$args->protected = false;
}
if ( null === $args->internal ) {
$args->internal = false;
}
if ( null === $args->publicly_queryable ) {
$args->publicly_queryable = $args->public;
}
if ( null === $args->exclude_from_search ) {
$args->exclude_from_search = $args->internal;
}
if ( null === $args->show_in_admin_all_list ) {
$args->show_in_admin_all_list = ! $args->internal;
}
if ( null === $args->show_in_admin_status_list ) {
$args->show_in_admin_status_list = ! $args->internal;
}
if ( null === $args->date_floating ) {
$args->date_floating = false;
}
if ( false === $args->label ) {
$args->label = $post_status;
}
if ( false === $args->label_count ) {
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle,WordPress.WP.I18n.NonSingularStringLiteralPlural
$args->label_count = _n_noop( $args->label, $args->label );
}
$wp_post_statuses[ $post_status ] = $args;
return $args;
}
```
| Uses | Description |
| --- | --- |
| [\_n\_noop()](_n_noop) wp-includes/l10n.php | Registers plural strings in POT file, but does not translate them. |
| [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Used By | Description |
| --- | --- |
| [create\_initial\_post\_types()](create_initial_post_types) wp-includes/post.php | Creates the initial post types when ‘init’ action is fired. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_comment_id_fields( int $post_id ): string get\_comment\_id\_fields( int $post\_id ): string
=================================================
Retrieves hidden input HTML for replying to comments.
`$post_id` int Optional Post ID. Defaults to the current post ID. string Hidden input HTML for replying to comments.
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_comment_id_fields( $post_id = 0 ) {
if ( empty( $post_id ) ) {
$post_id = get_the_ID();
}
$reply_to_id = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0;
$result = "<input type='hidden' name='comment_post_ID' value='$post_id' id='comment_post_ID' />\n";
$result .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$reply_to_id' />\n";
/**
* Filters the returned comment ID fields.
*
* @since 3.0.0
*
* @param string $result The HTML-formatted hidden ID field comment elements.
* @param int $post_id The post ID.
* @param int $reply_to_id The ID of the comment being replied to.
*/
return apply_filters( 'comment_id_fields', $result, $post_id, $reply_to_id );
}
```
[apply\_filters( 'comment\_id\_fields', string $result, int $post\_id, int $reply\_to\_id )](../hooks/comment_id_fields)
Filters the returned comment ID fields.
| Uses | Description |
| --- | --- |
| [get\_the\_ID()](get_the_id) wp-includes/post-template.php | Retrieves the ID of the current item in the WordPress Loop. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [comment\_id\_fields()](comment_id_fields) wp-includes/comment-template.php | Outputs hidden input HTML for replying to comments. |
| [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress clean_network_cache( int|array $ids ) clean\_network\_cache( int|array $ids )
=======================================
Removes a network from the object cache.
`$ids` int|array Required Network ID or an array of network IDs to remove from cache. File: `wp-includes/ms-network.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-network.php/)
```
function clean_network_cache( $ids ) {
global $_wp_suspend_cache_invalidation;
if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
return;
}
$network_ids = (array) $ids;
wp_cache_delete_multiple( $network_ids, 'networks' );
foreach ( $network_ids as $id ) {
/**
* Fires immediately after a network has been removed from the object cache.
*
* @since 4.6.0
*
* @param int $id Network ID.
*/
do_action( 'clean_network_cache', $id );
}
wp_cache_set( 'last_changed', microtime(), 'networks' );
}
```
[do\_action( 'clean\_network\_cache', int $id )](../hooks/clean_network_cache)
Fires immediately after a network 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 |
| --- | --- |
| [populate\_network\_meta()](populate_network_meta) wp-admin/includes/schema.php | Creates WordPress network meta and sets the default values. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress register_meta( string $object_type, string $meta_key, array $args, string|array $deprecated = null ): bool register\_meta( string $object\_type, string $meta\_key, array $args, string|array $deprecated = null ): bool
=============================================================================================================
Registers a meta key.
It is recommended to register meta keys for a specific combination of object type and object subtype. If passing an object subtype is omitted, the meta key will be registered for the entire object type, however it can be partly overridden in case a more specific meta key of the same name exists for the same object type and a subtype.
If an object type does not support any subtypes, such as users or comments, you should commonly call this function without passing a subtype.
`$object_type` string Required Type of object metadata is for. Accepts `'post'`, `'comment'`, `'term'`, `'user'`, or any other object type with an associated meta table. `$meta_key` string Required Meta key to register. `$args` array Required Data used to describe the meta key when registered.
* `object_subtype`stringA subtype; e.g. if the object type is "post", the post type. If left empty, the meta key will be registered on the entire object type. Default empty.
* `type`stringThe type of data associated with this meta key.
Valid values are `'string'`, `'boolean'`, `'integer'`, `'number'`, `'array'`, and `'object'`.
* `description`stringA description of the data attached to this meta key.
* `single`boolWhether the meta key has one value per object, or an array of values per object.
* `default`mixedThe default value returned from [get\_metadata()](get_metadata) if no value has been set yet.
When using a non-single meta key, the default value is for the first entry.
In other words, when calling [get\_metadata()](get_metadata) with `$single` set to `false`, the default value given here will be wrapped in an array.
* `sanitize_callback`callableA function or method to call when sanitizing `$meta_key` data.
* `auth_callback`callableOptional. A function or method to call when performing edit\_post\_meta, add\_post\_meta, and delete\_post\_meta capability checks.
* `show_in_rest`bool|arrayWhether data associated with this meta key can be considered public and should be accessible via the REST API. A custom post type must also declare support for custom fields for registered meta to be accessible via REST.
When registering complex meta values this argument may optionally be an array with `'schema'` or `'prepare_callback'` keys instead of a boolean.
`$deprecated` string|array Optional Deprecated. Use `$args` instead. Default: `null`
bool True if the meta key was successfully registered in the global array, false if not.
Registering a meta key with distinct sanitize and auth callbacks will fire those callbacks, but will not add to the global registry.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function register_meta( $object_type, $meta_key, $args, $deprecated = null ) {
global $wp_meta_keys;
if ( ! is_array( $wp_meta_keys ) ) {
$wp_meta_keys = array();
}
$defaults = array(
'object_subtype' => '',
'type' => 'string',
'description' => '',
'default' => '',
'single' => false,
'sanitize_callback' => null,
'auth_callback' => null,
'show_in_rest' => false,
);
// There used to be individual args for sanitize and auth callbacks.
$has_old_sanitize_cb = false;
$has_old_auth_cb = false;
if ( is_callable( $args ) ) {
$args = array(
'sanitize_callback' => $args,
);
$has_old_sanitize_cb = true;
} else {
$args = (array) $args;
}
if ( is_callable( $deprecated ) ) {
$args['auth_callback'] = $deprecated;
$has_old_auth_cb = true;
}
/**
* Filters the registration arguments when registering meta.
*
* @since 4.6.0
*
* @param array $args Array of meta registration arguments.
* @param array $defaults Array of default arguments.
* @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
* or any other object type with an associated meta table.
* @param string $meta_key Meta key.
*/
$args = apply_filters( 'register_meta_args', $args, $defaults, $object_type, $meta_key );
unset( $defaults['default'] );
$args = wp_parse_args( $args, $defaults );
// Require an item schema when registering array meta.
if ( false !== $args['show_in_rest'] && 'array' === $args['type'] ) {
if ( ! is_array( $args['show_in_rest'] ) || ! isset( $args['show_in_rest']['schema']['items'] ) ) {
_doing_it_wrong( __FUNCTION__, __( 'When registering an "array" meta type to show in the REST API, you must specify the schema for each array item in "show_in_rest.schema.items".' ), '5.3.0' );
return false;
}
}
$object_subtype = ! empty( $args['object_subtype'] ) ? $args['object_subtype'] : '';
// If `auth_callback` is not provided, fall back to `is_protected_meta()`.
if ( empty( $args['auth_callback'] ) ) {
if ( is_protected_meta( $meta_key, $object_type ) ) {
$args['auth_callback'] = '__return_false';
} else {
$args['auth_callback'] = '__return_true';
}
}
// Back-compat: old sanitize and auth callbacks are applied to all of an object type.
if ( is_callable( $args['sanitize_callback'] ) ) {
if ( ! empty( $object_subtype ) ) {
add_filter( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['sanitize_callback'], 10, 4 );
} else {
add_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 3 );
}
}
if ( is_callable( $args['auth_callback'] ) ) {
if ( ! empty( $object_subtype ) ) {
add_filter( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['auth_callback'], 10, 6 );
} else {
add_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'], 10, 6 );
}
}
if ( array_key_exists( 'default', $args ) ) {
$schema = $args;
if ( is_array( $args['show_in_rest'] ) && isset( $args['show_in_rest']['schema'] ) ) {
$schema = array_merge( $schema, $args['show_in_rest']['schema'] );
}
$check = rest_validate_value_from_schema( $args['default'], $schema );
if ( is_wp_error( $check ) ) {
_doing_it_wrong( __FUNCTION__, __( 'When registering a default meta value the data must match the type provided.' ), '5.5.0' );
return false;
}
if ( ! has_filter( "default_{$object_type}_metadata", 'filter_default_metadata' ) ) {
add_filter( "default_{$object_type}_metadata", 'filter_default_metadata', 10, 5 );
}
}
// Global registry only contains meta keys registered with the array of arguments added in 4.6.0.
if ( ! $has_old_auth_cb && ! $has_old_sanitize_cb ) {
unset( $args['object_subtype'] );
$wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ] = $args;
return true;
}
return false;
}
```
[apply\_filters( 'register\_meta\_args', array $args, array $defaults, string $object\_type, string $meta\_key )](../hooks/register_meta_args)
Filters the registration arguments when registering meta.
| Uses | Description |
| --- | --- |
| [has\_filter()](has_filter) wp-includes/plugin.php | Checks if any filter has been registered for a hook. |
| [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. |
| [is\_protected\_meta()](is_protected_meta) wp-includes/meta.php | Determines whether a meta key is considered protected. |
| [\_\_()](__) 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. |
| [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. |
| Used By | Description |
| --- | --- |
| [wp\_register\_persisted\_preferences\_meta()](wp_register_persisted_preferences_meta) wp-includes/user.php | Registers the user meta property for persisted preferences. |
| [register\_term\_meta()](register_term_meta) wp-includes/taxonomy.php | Registers a meta key for terms. |
| [register\_post\_meta()](register_post_meta) wp-includes/post.php | Registers a meta key for posts. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | The `$default` argument was added to the arguments array. |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Valid meta types expanded to include "array" and "object". |
| [4.9.8](https://developer.wordpress.org/reference/since/4.9.8/) | The `$object_subtype` argument was added to the arguments array. |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | [Modified to support an array of data to attach to registered meta keys](https://core.trac.wordpress.org/ticket/35658). Previous arguments for `$sanitize_callback` and `$auth_callback` have been folded into this array. |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress add_term_meta( int $term_id, string $meta_key, mixed $meta_value, bool $unique = false ): int|false|WP_Error add\_term\_meta( int $term\_id, string $meta\_key, mixed $meta\_value, bool $unique = false ): int|false|WP\_Error
==================================================================================================================
Adds metadata to a term.
`$term_id` int Required Term ID. `$meta_key` string Required Metadata name. `$meta_value` mixed Required Metadata value. Must be serializable if non-scalar. `$unique` bool Optional Whether the same key should not be added.
Default: `false`
int|false|[WP\_Error](../classes/wp_error) Meta ID on success, false on failure.
[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 add_term_meta( $term_id, $meta_key, $meta_value, $unique = false ) {
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 add_metadata( 'term', $term_id, $meta_key, $meta_value, $unique );
}
```
| Uses | Description |
| --- | --- |
| [wp\_term\_is\_shared()](wp_term_is_shared) wp-includes/taxonomy.php | Determines whether a term is shared between multiple taxonomies. |
| [add\_metadata()](add_metadata) wp-includes/meta.php | Adds metadata for the specified object. |
| [\_\_()](__) 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\_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. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
| programming_docs |
wordpress wp_kses_post_deep( mixed $data ): mixed wp\_kses\_post\_deep( mixed $data ): mixed
==========================================
Navigates through an array, object, or scalar, and sanitizes content for allowed HTML tags for post content.
* [map\_deep()](map_deep)
`$data` mixed Required The array, object, or scalar value to inspect. mixed The filtered content.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_kses_post_deep( $data ) {
return map_deep( $data, 'wp_kses_post' );
}
```
| Uses | Description |
| --- | --- |
| [map\_deep()](map_deep) wp-includes/formatting.php | Maps a function to all non-iterable elements of an array or an object. |
| Used By | Description |
| --- | --- |
| [wp\_read\_image\_metadata()](wp_read_image_metadata) wp-admin/includes/image.php | Gets extended image metadata, exif or iptc as available. |
| Version | Description |
| --- | --- |
| [4.4.2](https://developer.wordpress.org/reference/since/4.4.2/) | Introduced. |
wordpress wp_validate_auth_cookie( string $cookie = '', string $scheme = '' ): int|false wp\_validate\_auth\_cookie( string $cookie = '', string $scheme = '' ): int|false
=================================================================================
Validates authentication cookie.
The checks include making sure that the authentication cookie is set and pulling in the contents (if $cookie is not used).
Makes sure the cookie is not expired. Verifies the hash in cookie is what is should be and compares the two.
`$cookie` string Optional If used, will validate contents instead of cookie's. Default: `''`
`$scheme` string Optional The cookie scheme to use: `'auth'`, `'secure_auth'`, or `'logged_in'`. Default: `''`
int|false User ID if valid cookie, false if invalid.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_validate_auth_cookie( $cookie = '', $scheme = '' ) {
$cookie_elements = wp_parse_auth_cookie( $cookie, $scheme );
if ( ! $cookie_elements ) {
/**
* Fires if an authentication cookie is malformed.
*
* @since 2.7.0
*
* @param string $cookie Malformed auth cookie.
* @param string $scheme Authentication scheme. Values include 'auth', 'secure_auth',
* or 'logged_in'.
*/
do_action( 'auth_cookie_malformed', $cookie, $scheme );
return false;
}
$scheme = $cookie_elements['scheme'];
$username = $cookie_elements['username'];
$hmac = $cookie_elements['hmac'];
$token = $cookie_elements['token'];
$expired = $cookie_elements['expiration'];
$expiration = $cookie_elements['expiration'];
// Allow a grace period for POST and Ajax requests.
if ( wp_doing_ajax() || 'POST' === $_SERVER['REQUEST_METHOD'] ) {
$expired += HOUR_IN_SECONDS;
}
// Quick check to see if an honest cookie has expired.
if ( $expired < time() ) {
/**
* Fires once an authentication cookie has expired.
*
* @since 2.7.0
*
* @param string[] $cookie_elements {
* Authentication cookie components. None of the components should be assumed
* to be valid as they come directly from a client-provided cookie value.
*
* @type string $username User's username.
* @type string $expiration The time the cookie expires as a UNIX timestamp.
* @type string $token User's session token used.
* @type string $hmac The security hash for the cookie.
* @type string $scheme The cookie scheme to use.
* }
*/
do_action( 'auth_cookie_expired', $cookie_elements );
return false;
}
$user = get_user_by( 'login', $username );
if ( ! $user ) {
/**
* Fires if a bad username is entered in the user authentication process.
*
* @since 2.7.0
*
* @param string[] $cookie_elements {
* Authentication cookie components. None of the components should be assumed
* to be valid as they come directly from a client-provided cookie value.
*
* @type string $username User's username.
* @type string $expiration The time the cookie expires as a UNIX timestamp.
* @type string $token User's session token used.
* @type string $hmac The security hash for the cookie.
* @type string $scheme The cookie scheme to use.
* }
*/
do_action( 'auth_cookie_bad_username', $cookie_elements );
return false;
}
$pass_frag = substr( $user->user_pass, 8, 4 );
$key = wp_hash( $username . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme );
// If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
$algo = function_exists( 'hash' ) ? 'sha256' : 'sha1';
$hash = hash_hmac( $algo, $username . '|' . $expiration . '|' . $token, $key );
if ( ! hash_equals( $hash, $hmac ) ) {
/**
* Fires if a bad authentication cookie hash is encountered.
*
* @since 2.7.0
*
* @param string[] $cookie_elements {
* Authentication cookie components. None of the components should be assumed
* to be valid as they come directly from a client-provided cookie value.
*
* @type string $username User's username.
* @type string $expiration The time the cookie expires as a UNIX timestamp.
* @type string $token User's session token used.
* @type string $hmac The security hash for the cookie.
* @type string $scheme The cookie scheme to use.
* }
*/
do_action( 'auth_cookie_bad_hash', $cookie_elements );
return false;
}
$manager = WP_Session_Tokens::get_instance( $user->ID );
if ( ! $manager->verify( $token ) ) {
/**
* Fires if a bad session token is encountered.
*
* @since 4.0.0
*
* @param string[] $cookie_elements {
* Authentication cookie components. None of the components should be assumed
* to be valid as they come directly from a client-provided cookie value.
*
* @type string $username User's username.
* @type string $expiration The time the cookie expires as a UNIX timestamp.
* @type string $token User's session token used.
* @type string $hmac The security hash for the cookie.
* @type string $scheme The cookie scheme to use.
* }
*/
do_action( 'auth_cookie_bad_session_token', $cookie_elements );
return false;
}
// Ajax/POST grace period set above.
if ( $expiration < time() ) {
$GLOBALS['login_grace_period'] = 1;
}
/**
* Fires once an authentication cookie has been validated.
*
* @since 2.7.0
*
* @param string[] $cookie_elements {
* Authentication cookie components.
*
* @type string $username User's username.
* @type string $expiration The time the cookie expires as a UNIX timestamp.
* @type string $token User's session token used.
* @type string $hmac The security hash for the cookie.
* @type string $scheme The cookie scheme to use.
* }
* @param WP_User $user User object.
*/
do_action( 'auth_cookie_valid', $cookie_elements, $user );
return $user->ID;
}
```
[do\_action( 'auth\_cookie\_bad\_hash', string[] $cookie\_elements )](../hooks/auth_cookie_bad_hash)
Fires if a bad authentication cookie hash is encountered.
[do\_action( 'auth\_cookie\_bad\_session\_token', string[] $cookie\_elements )](../hooks/auth_cookie_bad_session_token)
Fires if a bad session token is encountered.
[do\_action( 'auth\_cookie\_bad\_username', string[] $cookie\_elements )](../hooks/auth_cookie_bad_username)
Fires if a bad username is entered in the user authentication process.
[do\_action( 'auth\_cookie\_expired', string[] $cookie\_elements )](../hooks/auth_cookie_expired)
Fires once an authentication cookie has expired.
[do\_action( 'auth\_cookie\_malformed', string $cookie, string $scheme )](../hooks/auth_cookie_malformed)
Fires if an authentication cookie is malformed.
[do\_action( 'auth\_cookie\_valid', string[] $cookie\_elements, WP\_User $user )](../hooks/auth_cookie_valid)
Fires once an authentication cookie has been validated.
| Uses | Description |
| --- | --- |
| [wp\_doing\_ajax()](wp_doing_ajax) wp-includes/load.php | Determines whether the current request is a WordPress Ajax request. |
| [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. |
| [wp\_hash()](wp_hash) wp-includes/pluggable.php | Gets hash of given string. |
| [wp\_parse\_auth\_cookie()](wp_parse_auth_cookie) wp-includes/pluggable.php | Parses a cookie into its components. |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [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\_authenticate\_cookie()](wp_authenticate_cookie) wp-includes/user.php | Authenticates the user using the WordPress auth cookie. |
| [wp\_validate\_logged\_in\_cookie()](wp_validate_logged_in_cookie) wp-includes/user.php | Validates the logged-in cookie. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress get_allowed_block_template_part_areas(): array get\_allowed\_block\_template\_part\_areas(): array
===================================================
Returns a filtered list of allowed area values for template parts.
array The supported template part area values.
File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function get_allowed_block_template_part_areas() {
$default_area_definitions = array(
array(
'area' => WP_TEMPLATE_PART_AREA_UNCATEGORIZED,
'label' => __( 'General' ),
'description' => __(
'General templates often perform a specific role like displaying post content, and are not tied to any particular area.'
),
'icon' => 'layout',
'area_tag' => 'div',
),
array(
'area' => WP_TEMPLATE_PART_AREA_HEADER,
'label' => __( 'Header' ),
'description' => __(
'The Header template defines a page area that typically contains a title, logo, and main navigation.'
),
'icon' => 'header',
'area_tag' => 'header',
),
array(
'area' => WP_TEMPLATE_PART_AREA_FOOTER,
'label' => __( 'Footer' ),
'description' => __(
'The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.'
),
'icon' => 'footer',
'area_tag' => 'footer',
),
);
/**
* Filters the list of allowed template part area values.
*
* @since 5.9.0
*
* @param array $default_area_definitions An array of supported area objects.
*/
return apply_filters( 'default_wp_template_part_areas', $default_area_definitions );
}
```
[apply\_filters( 'default\_wp\_template\_part\_areas', array $default\_area\_definitions )](../hooks/default_wp_template_part_areas)
Filters the list of allowed template part area values.
| 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 |
| --- | --- |
| [\_filter\_block\_template\_part\_area()](_filter_block_template_part_area) wp-includes/block-template-utils.php | Checks whether the input ‘area’ is a supported value. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress get_sidebar( string $name = null, array $args = array() ): void|false get\_sidebar( string $name = null, array $args = array() ): void|false
======================================================================
Loads sidebar template.
Includes the sidebar template for a theme or if a name is specified then a specialised sidebar will be included.
For the parameter, if the file is called "sidebar-special.php" then specify "special".
`$name` string Optional The name of the specialised sidebar. Default: `null`
`$args` array Optional Additional arguments passed to the sidebar template.
Default: `array()`
void|false Void on success, false if the template does not exist.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function get_sidebar( $name = null, $args = array() ) {
/**
* Fires before the sidebar template file is loaded.
*
* @since 2.2.0
* @since 2.8.0 The `$name` parameter was added.
* @since 5.5.0 The `$args` parameter was added.
*
* @param string|null $name Name of the specific sidebar file to use. Null for the default sidebar.
* @param array $args Additional arguments passed to the sidebar template.
*/
do_action( 'get_sidebar', $name, $args );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "sidebar-{$name}.php";
}
$templates[] = 'sidebar.php';
if ( ! locate_template( $templates, true, true, $args ) ) {
return false;
}
}
```
[do\_action( 'get\_sidebar', string|null $name, array $args )](../hooks/get_sidebar)
Fires before the sidebar template file is loaded.
| Uses | Description |
| --- | --- |
| [locate\_template()](locate_template) wp-includes/template.php | Retrieves the name of the highest priority template file that exists. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | The `$args` parameter was added. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress next_posts( int $max_page, bool $echo = true ): string|void next\_posts( int $max\_page, bool $echo = true ): string|void
=============================================================
Displays or retrieves the next posts page link.
`$max_page` int Optional Max pages. Default 0. `$echo` bool Optional Whether to echo the link. Default: `true`
string|void The link URL for next posts page if `$echo = false`.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function next_posts( $max_page = 0, $echo = true ) {
$output = esc_url( get_next_posts_page_link( $max_page ) );
if ( $echo ) {
echo $output;
} else {
return $output;
}
}
```
| Uses | Description |
| --- | --- |
| [get\_next\_posts\_page\_link()](get_next_posts_page_link) wp-includes/link-template.php | Retrieves the next posts page link. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Used By | 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 fix_phpmailer_messageid( PHPMailer $phpmailer ) fix\_phpmailer\_messageid( PHPMailer $phpmailer )
=================================================
Corrects From host on outgoing mail to match the site domain
`$phpmailer` PHPMailer Required The PHPMailer instance (passed by reference). File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function fix_phpmailer_messageid( $phpmailer ) {
$phpmailer->Hostname = 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 wp_is_fatal_error_handler_enabled(): bool wp\_is\_fatal\_error\_handler\_enabled(): bool
==============================================
Checks whether the fatal error handler is enabled.
A constant `WP_DISABLE_FATAL_ERROR_HANDLER` can be set in `wp-config.php` to disable it, or alternatively the [‘wp\_fatal\_error\_handler\_enabled’](../hooks/wp_fatal_error_handler_enabled) filter can be used to modify the return value.
bool True if the fatal error handler is enabled, false otherwise.
File: `wp-includes/error-protection.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/error-protection.php/)
```
function wp_is_fatal_error_handler_enabled() {
$enabled = ! defined( 'WP_DISABLE_FATAL_ERROR_HANDLER' ) || ! WP_DISABLE_FATAL_ERROR_HANDLER;
/**
* Filters whether the fatal error handler is enabled.
*
* **Important:** This filter runs before it can be used by plugins. It cannot
* be used by plugins, mu-plugins, or themes. To use this filter you must define
* a `$wp_filter` global before WordPress loads, usually in `wp-config.php`.
*
* Example:
*
* $GLOBALS['wp_filter'] = array(
* 'wp_fatal_error_handler_enabled' => array(
* 10 => array(
* array(
* 'accepted_args' => 0,
* 'function' => function() {
* return false;
* },
* ),
* ),
* ),
* );
*
* Alternatively you can use the `WP_DISABLE_FATAL_ERROR_HANDLER` constant.
*
* @since 5.2.0
*
* @param bool $enabled True if the fatal error handler is enabled, false otherwise.
*/
return apply_filters( 'wp_fatal_error_handler_enabled', $enabled );
}
```
[apply\_filters( 'wp\_fatal\_error\_handler\_enabled', bool $enabled )](../hooks/wp_fatal_error_handler_enabled)
Filters whether the fatal error handler is enabled.
| 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\_register\_fatal\_error\_handler()](wp_register_fatal_error_handler) wp-includes/error-protection.php | Registers the shutdown handler for fatal errors. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress the_ID() the\_ID()
=========
Displays the ID of the current item in the WordPress Loop.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
echo get_the_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. |
| Used By | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
| programming_docs |
wordpress wp_admin_bar_my_sites_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_my\_sites\_menu( WP\_Admin\_Bar $wp\_admin\_bar )
=================================================================
Adds the “My Sites/[Site Name]” menu and all submenus.
`$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_sites_menu( $wp_admin_bar ) {
// Don't show for logged out users or single site mode.
if ( ! is_user_logged_in() || ! is_multisite() ) {
return;
}
// Show only when the user has at least one site, or they're a super admin.
if ( count( $wp_admin_bar->user->blogs ) < 1 && ! current_user_can( 'manage_network' ) ) {
return;
}
if ( $wp_admin_bar->user->active_blog ) {
$my_sites_url = get_admin_url( $wp_admin_bar->user->active_blog->blog_id, 'my-sites.php' );
} else {
$my_sites_url = admin_url( 'my-sites.php' );
}
$wp_admin_bar->add_node(
array(
'id' => 'my-sites',
'title' => __( 'My Sites' ),
'href' => $my_sites_url,
)
);
if ( current_user_can( 'manage_network' ) ) {
$wp_admin_bar->add_group(
array(
'parent' => 'my-sites',
'id' => 'my-sites-super-admin',
)
);
$wp_admin_bar->add_node(
array(
'parent' => 'my-sites-super-admin',
'id' => 'network-admin',
'title' => __( 'Network Admin' ),
'href' => network_admin_url(),
)
);
$wp_admin_bar->add_node(
array(
'parent' => 'network-admin',
'id' => 'network-admin-d',
'title' => __( 'Dashboard' ),
'href' => network_admin_url(),
)
);
if ( current_user_can( 'manage_sites' ) ) {
$wp_admin_bar->add_node(
array(
'parent' => 'network-admin',
'id' => 'network-admin-s',
'title' => __( 'Sites' ),
'href' => network_admin_url( 'sites.php' ),
)
);
}
if ( current_user_can( 'manage_network_users' ) ) {
$wp_admin_bar->add_node(
array(
'parent' => 'network-admin',
'id' => 'network-admin-u',
'title' => __( 'Users' ),
'href' => network_admin_url( 'users.php' ),
)
);
}
if ( current_user_can( 'manage_network_themes' ) ) {
$wp_admin_bar->add_node(
array(
'parent' => 'network-admin',
'id' => 'network-admin-t',
'title' => __( 'Themes' ),
'href' => network_admin_url( 'themes.php' ),
)
);
}
if ( current_user_can( 'manage_network_plugins' ) ) {
$wp_admin_bar->add_node(
array(
'parent' => 'network-admin',
'id' => 'network-admin-p',
'title' => __( 'Plugins' ),
'href' => network_admin_url( 'plugins.php' ),
)
);
}
if ( current_user_can( 'manage_network_options' ) ) {
$wp_admin_bar->add_node(
array(
'parent' => 'network-admin',
'id' => 'network-admin-o',
'title' => __( 'Settings' ),
'href' => network_admin_url( 'settings.php' ),
)
);
}
}
// Add site links.
$wp_admin_bar->add_group(
array(
'parent' => 'my-sites',
'id' => 'my-sites-list',
'meta' => array(
'class' => current_user_can( 'manage_network' ) ? 'ab-sub-secondary' : '',
),
)
);
/**
* Filters whether to show the site icons in toolbar.
*
* Returning false to this hook is the recommended way to hide site icons in the toolbar.
* A truthy return may have negative performance impact on large multisites.
*
* @since 6.0.0
*
* @param bool $show_site_icons Whether site icons should be shown in the toolbar. Default true.
*/
$show_site_icons = apply_filters( 'wp_admin_bar_show_site_icons', true );
foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {
switch_to_blog( $blog->userblog_id );
if ( true === $show_site_icons && has_site_icon() ) {
$blavatar = sprintf(
'<img class="blavatar" src="%s" srcset="%s 2x" alt="" width="16" height="16"%s />',
esc_url( get_site_icon_url( 16 ) ),
esc_url( get_site_icon_url( 32 ) ),
( wp_lazy_loading_enabled( 'img', 'site_icon_in_toolbar' ) ? ' loading="lazy"' : '' )
);
} else {
$blavatar = '<div class="blavatar"></div>';
}
$blogname = $blog->blogname;
if ( ! $blogname ) {
$blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() );
}
$menu_id = 'blog-' . $blog->userblog_id;
if ( current_user_can( 'read' ) ) {
$wp_admin_bar->add_node(
array(
'parent' => 'my-sites-list',
'id' => $menu_id,
'title' => $blavatar . $blogname,
'href' => admin_url(),
)
);
$wp_admin_bar->add_node(
array(
'parent' => $menu_id,
'id' => $menu_id . '-d',
'title' => __( 'Dashboard' ),
'href' => admin_url(),
)
);
} else {
$wp_admin_bar->add_node(
array(
'parent' => 'my-sites-list',
'id' => $menu_id,
'title' => $blavatar . $blogname,
'href' => home_url(),
)
);
}
if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
$wp_admin_bar->add_node(
array(
'parent' => $menu_id,
'id' => $menu_id . '-n',
'title' => get_post_type_object( 'post' )->labels->new_item,
'href' => admin_url( 'post-new.php' ),
)
);
}
if ( current_user_can( 'edit_posts' ) ) {
$wp_admin_bar->add_node(
array(
'parent' => $menu_id,
'id' => $menu_id . '-c',
'title' => __( 'Manage Comments' ),
'href' => admin_url( 'edit-comments.php' ),
)
);
}
$wp_admin_bar->add_node(
array(
'parent' => $menu_id,
'id' => $menu_id . '-v',
'title' => __( 'Visit Site' ),
'href' => home_url( '/' ),
)
);
restore_current_blog();
}
}
```
[apply\_filters( 'wp\_admin\_bar\_show\_site\_icons', bool $show\_site\_icons )](../hooks/wp_admin_bar_show_site_icons)
Filters whether to show the site icons in toolbar.
| Uses | Description |
| --- | --- |
| [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. |
| [has\_site\_icon()](has_site_icon) wp-includes/general-template.php | Determines whether the site has a Site Icon. |
| [switch\_to\_blog()](switch_to_blog) wp-includes/ms-blogs.php | Switch the current blog. |
| [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. |
| [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. |
| [restore\_current\_blog()](restore_current_blog) wp-includes/ms-blogs.php | Restore the current blog, after calling [switch\_to\_blog()](switch_to_blog) . |
| [get\_admin\_url()](get_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for a given site. |
| [get\_site\_icon\_url()](get_site_icon_url) wp-includes/general-template.php | Returns the Site Icon URL. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [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. |
| [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 update_menu_item_cache( WP_Post[] $menu_items ) update\_menu\_item\_cache( WP\_Post[] $menu\_items )
====================================================
Updates post and term caches for all linked objects for a list of menu items.
`$menu_items` [WP\_Post](../classes/wp_post)[] Required Array of menu item post objects. File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function update_menu_item_cache( $menu_items ) {
$post_ids = array();
$term_ids = array();
foreach ( $menu_items as $menu_item ) {
if ( 'nav_menu_item' !== $menu_item->post_type ) {
continue;
}
$object_id = get_post_meta( $menu_item->ID, '_menu_item_object_id', true );
$type = get_post_meta( $menu_item->ID, '_menu_item_type', true );
if ( 'post_type' === $type ) {
$post_ids[] = (int) $object_id;
} elseif ( 'taxonomy' === $type ) {
$term_ids[] = (int) $object_id;
}
}
if ( ! empty( $post_ids ) ) {
_prime_post_caches( $post_ids, false );
}
if ( ! empty( $term_ids ) ) {
_prime_term_caches( $term_ids );
}
}
```
| Uses | Description |
| --- | --- |
| [\_prime\_term\_caches()](_prime_term_caches) wp-includes/taxonomy.php | Adds any terms from the given IDs to the cache that do not already exist in cache. |
| [\_prime\_post\_caches()](_prime_post_caches) wp-includes/post.php | Adds any posts from the given IDs to the cache that do not already exist in cache. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| Used By | Description |
| --- | --- |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress get_404_template(): string get\_404\_template(): string
============================
Retrieves path of 404 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 ‘404’.
* [get\_query\_template()](get_query_template)
string Full path to 404 template file.
File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
```
function get_404_template() {
return get_query_template( '404' );
}
```
| Uses | Description |
| --- | --- |
| [get\_query\_template()](get_query_template) wp-includes/template.php | Retrieves path to a template. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_timezone_override_offset(): float|false wp\_timezone\_override\_offset(): float|false
=============================================
Modifies gmt\_offset for smart timezone handling.
Overrides the gmt\_offset option if we have a timezone\_string available.
float|false Timezone GMT offset, false otherwise.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_timezone_override_offset() {
$timezone_string = get_option( 'timezone_string' );
if ( ! $timezone_string ) {
return false;
}
$timezone_object = timezone_open( $timezone_string );
$datetime_object = date_create();
if ( false === $timezone_object || false === $datetime_object ) {
return false;
}
return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 );
}
```
| Uses | Description |
| --- | --- |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress add_option_whitelist( array $new_options, string|array $options = '' ): array add\_option\_whitelist( array $new\_options, string|array $options = '' ): array
================================================================================
This function has been deprecated. Use [add\_allowed\_options()](add_allowed_options) instead. Please consider writing more inclusive code.
Adds an array of options to the list of allowed options.
`$new_options` array Required `$options` string|array Optional Default: `''`
array
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function add_option_whitelist( $new_options, $options = '' ) {
_deprecated_function( __FUNCTION__, '5.5.0', 'add_allowed_options()' );
return add_allowed_options( $new_options, $options );
}
```
| Uses | Description |
| --- | --- |
| [add\_allowed\_options()](add_allowed_options) wp-admin/includes/plugin.php | Adds an array of options to the list of allowed options. |
| [\_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 [add\_allowed\_options()](add_allowed_options) instead. Please consider writing more inclusive code. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress plugin_dir_url( string $file ): string plugin\_dir\_url( string $file ): string
========================================
Get the URL directory path (with trailing slash) for the plugin \_\_FILE\_\_ passed in.
`$file` string Required The filename of the plugin (\_\_FILE\_\_). string the URL path of the directory that contains the plugin.
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function plugin_dir_url( $file ) {
return trailingslashit( plugins_url( '', $file ) );
}
```
| Uses | Description |
| --- | --- |
| [plugins\_url()](plugins_url) wp-includes/link-template.php | Retrieves a URL within the plugins or mu-plugins directory. |
| [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 __ngettext( $args ) \_\_ngettext( $args )
=====================
This function has been deprecated. Use [\_n()](_n) instead.
Retrieve the plural or single form based on the amount.
* [\_n()](_n)
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function __ngettext( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
_deprecated_function( __FUNCTION__, '2.8.0', '_n()' );
return _n( ...$args );
}
```
| Uses | Description |
| --- | --- |
| [\_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 |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use [\_n()](_n) |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress delete_metadata_by_mid( string $meta_type, int $meta_id ): bool delete\_metadata\_by\_mid( string $meta\_type, int $meta\_id ): bool
====================================================================
Deletes metadata by meta ID.
`$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. `$meta_id` int Required ID for a specific meta row. bool True on successful delete, false on failure.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function delete_metadata_by_mid( $meta_type, $meta_id ) {
global $wpdb;
// Make sure everything is valid.
if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) {
return false;
}
$meta_id = (int) $meta_id;
if ( $meta_id <= 0 ) {
return false;
}
$table = _get_meta_table( $meta_type );
if ( ! $table ) {
return false;
}
// Object and ID columns.
$column = sanitize_key( $meta_type . '_id' );
$id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id';
/**
* Short-circuits deleting metadata of a specific type by meta ID.
*
* 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:
*
* - `delete_post_metadata_by_mid`
* - `delete_comment_metadata_by_mid`
* - `delete_term_metadata_by_mid`
* - `delete_user_metadata_by_mid`
*
* @since 5.0.0
*
* @param null|bool $delete Whether to allow metadata deletion of the given type.
* @param int $meta_id Meta ID.
*/
$check = apply_filters( "delete_{$meta_type}_metadata_by_mid", null, $meta_id );
if ( null !== $check ) {
return (bool) $check;
}
// Fetch the meta and go on if it's found.
$meta = get_metadata_by_mid( $meta_type, $meta_id );
if ( $meta ) {
$object_id = (int) $meta->{$column};
/** This action is documented in wp-includes/meta.php */
do_action( "delete_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value );
// Old-style action.
if ( 'post' === $meta_type || 'comment' === $meta_type ) {
/**
* Fires immediately before deleting post or comment metadata of a specific type.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta
* object type (post or comment).
*
* Possible hook names include:
*
* - `delete_postmeta`
* - `delete_commentmeta`
* - `delete_termmeta`
* - `delete_usermeta`
*
* @since 3.4.0
*
* @param int $meta_id ID of the metadata entry to delete.
*/
do_action( "delete_{$meta_type}meta", $meta_id );
}
// Run the query, will return true if deleted, false otherwise.
$result = (bool) $wpdb->delete( $table, array( $id_column => $meta_id ) );
// Clear the caches.
wp_cache_delete( $object_id, $meta_type . '_meta' );
/** This action is documented in wp-includes/meta.php */
do_action( "deleted_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value );
// Old-style action.
if ( 'post' === $meta_type || 'comment' === $meta_type ) {
/**
* Fires immediately after deleting post or comment metadata of a specific type.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta
* object type (post or comment).
*
* Possible hook names include:
*
* - `deleted_postmeta`
* - `deleted_commentmeta`
* - `deleted_termmeta`
* - `deleted_usermeta`
*
* @since 3.4.0
*
* @param int $meta_id Deleted metadata entry ID.
*/
do_action( "deleted_{$meta_type}meta", $meta_id );
}
return $result;
}
// Meta ID was not found.
return false;
}
```
[do\_action( "deleted\_{$meta\_type}meta", int $meta\_id )](../hooks/deleted_meta_typemeta)
Fires immediately after deleting post or comment metadata of a specific type.
[do\_action( "deleted\_{$meta\_type}\_meta", string[] $meta\_ids, int $object\_id, string $meta\_key, mixed $\_meta\_value )](../hooks/deleted_meta_type_meta)
Fires immediately after deleting metadata of a specific type.
[do\_action( "delete\_{$meta\_type}meta", int $meta\_id )](../hooks/delete_meta_typemeta)
Fires immediately before deleting post or comment metadata of a specific type.
[do\_action( "delete\_{$meta\_type}\_meta", string[] $meta\_ids, int $object\_id, string $meta\_key, mixed $\_meta\_value )](../hooks/delete_meta_type_meta)
Fires immediately before deleting metadata of a specific type.
[apply\_filters( "delete\_{$meta\_type}\_metadata\_by\_mid", null|bool $delete, int $meta\_id )](../hooks/delete_meta_type_metadata_by_mid)
Short-circuits deleting metadata of a specific type by meta ID.
| Uses | Description |
| --- | --- |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [wpdb::delete()](../classes/wpdb/delete) wp-includes/class-wpdb.php | Deletes 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. |
| [get\_metadata\_by\_mid()](get_metadata_by_mid) wp-includes/meta.php | Retrieves metadata by meta ID. |
| [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. |
| Used By | Description |
| --- | --- |
| [wp\_delete\_site()](wp_delete_site) wp-includes/ms-site.php | Deletes a site from the database. |
| [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. |
| [wpmu\_delete\_user()](wpmu_delete_user) wp-admin/includes/ms.php | Delete a user from the network and remove from all sites. |
| [wp\_delete\_user()](wp_delete_user) wp-admin/includes/user.php | Remove user and optionally reassign posts and links to another user. |
| [delete\_meta()](delete_meta) wp-admin/includes/post.php | Deletes post meta data by meta ID. |
| [do\_enclose()](do_enclose) wp-includes/functions.php | Checks content for video and audio links to add as enclosures. |
| [wp\_delete\_term()](wp_delete_term) wp-includes/taxonomy.php | Removes a term from the database. |
| [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [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\_delete\_comment()](wp_delete_comment) wp-includes/comment.php | Trashes or deletes a comment. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
| programming_docs |
wordpress get_registered_settings(): array get\_registered\_settings(): array
==================================
Retrieves an array of registered settings.
array List of registered settings, keyed by option name.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function get_registered_settings() {
global $wp_registered_settings;
if ( ! is_array( $wp_registered_settings ) ) {
return array();
}
return $wp_registered_settings;
}
```
| Used By | Description |
| --- | --- |
| [WP\_REST\_Settings\_Controller::get\_registered\_options()](../classes/wp_rest_settings_controller/get_registered_options) wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php | Retrieves all of the registered options for the Settings API. |
| [filter\_default\_option()](filter_default_option) wp-includes/option.php | Filters the default value for the option. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress _mce_set_direction( array $mce_init ): array \_mce\_set\_direction( array $mce\_init ): 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.
Sets the localized direction for MCE plugin.
Will only set the direction to ‘rtl’, if the WordPress locale has the text direction set to ‘rtl’.
Fills in the ‘directionality’ setting, enables the ‘directionality’ plugin, and adds the ‘ltr’ button to ‘toolbar1’, formerly ‘theme\_advanced\_buttons1’ array keys. These keys are then returned in the $mce\_init (TinyMCE settings) array.
`$mce_init` array Required MCE settings array. array Direction set for `'rtl'`, if needed by locale.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _mce_set_direction( $mce_init ) {
if ( is_rtl() ) {
$mce_init['directionality'] = 'rtl';
$mce_init['rtl_ui'] = true;
if ( ! empty( $mce_init['plugins'] ) && strpos( $mce_init['plugins'], 'directionality' ) === false ) {
$mce_init['plugins'] .= ',directionality';
}
if ( ! empty( $mce_init['toolbar1'] ) && ! preg_match( '/\bltr\b/', $mce_init['toolbar1'] ) ) {
$mce_init['toolbar1'] .= ',ltr';
}
}
return $mce_init;
}
```
| Uses | Description |
| --- | --- |
| [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress get_dropins(): array[] get\_dropins(): array[]
=======================
Checks the wp-content directory and retrieve all drop-ins with any plugin data.
array[] Array of arrays of dropin plugin data, keyed by plugin file name. See [get\_plugin\_data()](get_plugin_data) .
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function get_dropins() {
$dropins = array();
$plugin_files = array();
$_dropins = _get_dropins();
// Files in wp-content directory.
$plugins_dir = @opendir( WP_CONTENT_DIR );
if ( $plugins_dir ) {
while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
if ( isset( $_dropins[ $file ] ) ) {
$plugin_files[] = $file;
}
}
} else {
return $dropins;
}
closedir( $plugins_dir );
if ( empty( $plugin_files ) ) {
return $dropins;
}
foreach ( $plugin_files as $plugin_file ) {
if ( ! is_readable( WP_CONTENT_DIR . "/$plugin_file" ) ) {
continue;
}
// Do not apply markup/translate as it will be cached.
$plugin_data = get_plugin_data( WP_CONTENT_DIR . "/$plugin_file", false, false );
if ( empty( $plugin_data['Name'] ) ) {
$plugin_data['Name'] = $plugin_file;
}
$dropins[ $plugin_file ] = $plugin_data;
}
uksort( $dropins, 'strnatcasecmp' );
return $dropins;
}
```
| Uses | Description |
| --- | --- |
| [\_get\_dropins()](_get_dropins) wp-admin/includes/plugin.php | Returns drop-ins that WordPress uses. |
| [get\_plugin\_data()](get_plugin_data) wp-admin/includes/plugin.php | Parses the plugin contents to retrieve plugin’s metadata. |
| Used By | Description |
| --- | --- |
| [WP\_Debug\_Data::debug\_data()](../classes/wp_debug_data/debug_data) wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| [WP\_Plugins\_List\_Table::prepare\_items()](../classes/wp_plugins_list_table/prepare_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress is_avatar_comment_type( string $comment_type ): bool is\_avatar\_comment\_type( string $comment\_type ): bool
========================================================
Check if this comment type allows avatars to be retrieved.
`$comment_type` string Required Comment type to check. bool Whether the comment type is allowed for retrieving avatars.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function is_avatar_comment_type( $comment_type ) {
/**
* Filters the list of allowed comment types for retrieving avatars.
*
* @since 3.0.0
*
* @param array $types An array of content types. Default only contains 'comment'.
*/
$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
return in_array( $comment_type, (array) $allowed_comment_types, true );
}
```
[apply\_filters( 'get\_avatar\_comment\_types', array $types )](../hooks/get_avatar_comment_types)
Filters the list of allowed comment types for retrieving avatars.
| 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 |
| --- | --- |
| [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress is_theme_paused( string $theme ): bool is\_theme\_paused( string $theme ): bool
========================================
Determines whether a theme is technically active but was paused while loading.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
`$theme` string Required Path to the theme directory relative to the themes directory. bool True, if in the list of paused themes. False, not in the list.
File: `wp-admin/includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme.php/)
```
function is_theme_paused( $theme ) {
if ( ! isset( $GLOBALS['_paused_themes'] ) ) {
return false;
}
if ( get_stylesheet() !== $theme && get_template() !== $theme ) {
return false;
}
return array_key_exists( $theme, $GLOBALS['_paused_themes'] );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress get_tag_link( int|object $tag ): string get\_tag\_link( int|object $tag ): string
=========================================
Retrieves the link to the tag.
* [get\_term\_link()](get_term_link)
`$tag` int|object Required Tag ID or object. string Link on success, empty string if tag does not exist.
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function get_tag_link( $tag ) {
return get_category_link( $tag );
}
```
| Uses | Description |
| --- | --- |
| [get\_category\_link()](get_category_link) wp-includes/category-template.php | Retrieves category link URL. |
| Used By | Description |
| --- | --- |
| [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. |
wordpress clean_taxonomy_cache( string $taxonomy ) clean\_taxonomy\_cache( string $taxonomy )
==========================================
Cleans the caches for a taxonomy.
`$taxonomy` string Required Taxonomy slug. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function clean_taxonomy_cache( $taxonomy ) {
wp_cache_delete( 'all_ids', $taxonomy );
wp_cache_delete( 'get', $taxonomy );
wp_cache_delete( 'last_changed', 'terms' );
// Regenerate cached hierarchy.
delete_option( "{$taxonomy}_children" );
_get_term_hierarchy( $taxonomy );
/**
* Fires after a taxonomy's caches have been cleaned.
*
* @since 4.9.0
*
* @param string $taxonomy Taxonomy slug.
*/
do_action( 'clean_taxonomy_cache', $taxonomy );
}
```
[do\_action( 'clean\_taxonomy\_cache', string $taxonomy )](../hooks/clean_taxonomy_cache)
Fires after a taxonomy’s caches have been cleaned.
| Uses | Description |
| --- | --- |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [\_get\_term\_hierarchy()](_get_term_hierarchy) wp-includes/taxonomy.php | Retrieves children of taxonomy as term IDs. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [clean\_term\_cache()](clean_term_cache) wp-includes/taxonomy.php | Removes all of the term IDs from the cache. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
wordpress is_post_status_viewable( string|stdClass $post_status ): bool is\_post\_status\_viewable( string|stdClass $post\_status ): bool
=================================================================
Determines whether a post status is considered “viewable”.
For built-in post statuses such as publish and private, the ‘public’ value will be evaluated.
For all others, the ‘publicly\_queryable’ value will be used.
`$post_status` string|stdClass Required Post status name or object. bool Whether the post status 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_status_viewable( $post_status ) {
if ( is_scalar( $post_status ) ) {
$post_status = get_post_status_object( $post_status );
if ( ! $post_status ) {
return false;
}
}
if (
! is_object( $post_status ) ||
$post_status->internal ||
$post_status->protected
) {
return false;
}
$is_viewable = $post_status->publicly_queryable || ( $post_status->_builtin && $post_status->public );
/**
* Filters whether a post status is considered "viewable".
*
* The returned filtered value must be a boolean type to ensure
* `is_post_status_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 status is "viewable" (strict type).
* @param stdClass $post_status Post status object.
*/
return true === apply_filters( 'is_post_status_viewable', $is_viewable, $post_status );
}
```
[apply\_filters( 'is\_post\_status\_viewable', bool $is\_viewable, stdClass $post\_status )](../hooks/is_post_status_viewable)
Filters whether a post status is considered “viewable”.
| Uses | Description |
| --- | --- |
| [get\_post\_status\_object()](get_post_status_object) wp-includes/post.php | Retrieves a post status object by name. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_force\_plain\_post\_permalink()](wp_force_plain_post_permalink) wp-includes/link-template.php | Determine whether post should always use a plain permalink structure. |
| [is\_post\_publicly\_viewable()](is_post_publicly_viewable) wp-includes/post.php | Determines whether a post is publicly viewable. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Added `is_post_status_viewable` hook to filter the result. |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress wp_embed_excerpt_attachment( string $content ): string wp\_embed\_excerpt\_attachment( string $content ): string
=========================================================
Filters the post excerpt for the embed template.
Shows players for video and audio attachments.
`$content` string Required The current post excerpt. string The modified post excerpt.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function wp_embed_excerpt_attachment( $content ) {
if ( is_attachment() ) {
return prepend_attachment( '' );
}
return $content;
}
```
| Uses | Description |
| --- | --- |
| [is\_attachment()](is_attachment) wp-includes/query.php | Determines whether the query is for an existing attachment page. |
| [prepend\_attachment()](prepend_attachment) wp-includes/post-template.php | Wraps attachment in paragraph tag before content. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress is_sticky( int $post_id ): bool is\_sticky( int $post\_id ): bool
=================================
Determines whether a post is sticky.
Sticky posts should remain at the top of The Loop. If the post ID is not given, then The Loop ID for the current post will be used.
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_id` int Optional Post ID. Default is the ID of the global `$post`. bool Whether post is sticky.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function is_sticky( $post_id = 0 ) {
$post_id = absint( $post_id );
if ( ! $post_id ) {
$post_id = get_the_ID();
}
$stickies = get_option( 'sticky_posts' );
if ( is_array( $stickies ) ) {
$stickies = array_map( 'intval', $stickies );
$is_sticky = in_array( $post_id, $stickies, true );
} else {
$is_sticky = false;
}
/**
* Filters whether a post is sticky.
*
* @since 5.3.0
*
* @param bool $is_sticky Whether a post is sticky.
* @param int $post_id Post ID.
*/
return apply_filters( 'is_sticky', $is_sticky, $post_id );
}
```
[apply\_filters( 'is\_sticky', bool $is\_sticky, int $post\_id )](../hooks/is_sticky)
Filters whether a post is sticky.
| 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. |
| [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\_post\_states()](get_post_states) wp-admin/includes/template.php | Retrieves an array of post states from a 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. |
| [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. |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [get\_inline\_data()](get_inline_data) wp-admin/includes/template.php | Adds hidden fields with the data for use in the inline editor for posts and pages. |
| [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| [sticky\_class()](sticky_class) wp-includes/deprecated.php | Display “sticky” CSS class, if a post is sticky. |
| [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::mw\_getPost()](../classes/wp_xmlrpc_server/mw_getpost) wp-includes/class-wp-xmlrpc-server.php | Retrieve post. |
| [wp\_xmlrpc\_server::mw\_getRecentPosts()](../classes/wp_xmlrpc_server/mw_getrecentposts) wp-includes/class-wp-xmlrpc-server.php | Retrieve list of recent posts. |
| [wp\_xmlrpc\_server::\_prepare\_post()](../classes/wp_xmlrpc_server/_prepare_post) wp-includes/class-wp-xmlrpc-server.php | Prepares post data for return in an XML-RPC object. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress is_site_admin( string $user_login = '' ) is\_site\_admin( string $user\_login = '' )
===========================================
This function has been deprecated. Use [is\_super\_admin()](is_super_admin) instead.
Determine if user is a site admin.
Plugins should use [is\_multisite()](is_multisite) instead of checking if this function exists to determine if multisite is enabled.
This function must reside in a file included only if [is\_multisite()](is_multisite) due to legacy function\_exists() checks to determine if multisite is enabled.
* [is\_super\_admin()](is_super_admin)
`$user_login` string Optional Username for the user to check. Default: `''`
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function is_site_admin( $user_login = '' ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'is_super_admin()' );
if ( empty( $user_login ) ) {
$user_id = get_current_user_id();
if ( !$user_id )
return false;
} else {
$user = get_user_by( 'login', $user_login );
if ( ! $user->exists() )
return false;
$user_id = $user->ID;
}
return is_super_admin( $user_id );
}
```
| Uses | Description |
| --- | --- |
| [is\_super\_admin()](is_super_admin) wp-includes/capabilities.php | Determines whether user is a site admin. |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [\_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.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [is\_super\_admin()](is_super_admin) |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
| programming_docs |
wordpress current_filter(): string current\_filter(): string
=========================
Retrieves the name of the current filter hook.
string Hook name of the current filter.
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function current_filter() {
global $wp_current_filter;
return end( $wp_current_filter );
}
```
| 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. |
| [Language\_Pack\_Upgrader::bulk\_upgrade()](../classes/language_pack_upgrader/bulk_upgrade) wp-admin/includes/class-language-pack-upgrader.php | Bulk upgrade language packs. |
| [display\_plugins\_table()](display_plugins_table) wp-admin/includes/plugin-install.php | Displays plugin content based on plugin list. |
| [capital\_P\_dangit()](capital_p_dangit) wp-includes/formatting.php | Forever eliminate “Wordpress” from the planet (or at least the little bit we can influence). |
| [\_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. |
| [get\_the\_generator()](get_the_generator) wp-includes/general-template.php | Creates the generator XML or Comment for RSS, ATOM, etc. |
| [wp\_kses\_data()](wp_kses_data) wp-includes/kses.php | Sanitize content with allowed HTML KSES rules. |
| [wp\_filter\_kses()](wp_filter_kses) wp-includes/kses.php | Sanitize content with allowed HTML KSES rules. |
| [is\_main\_query()](is_main_query) wp-includes/query.php | Determines whether the query is the main query. |
| [wp\_deregister\_script()](wp_deregister_script) wp-includes/functions.wp-scripts.php | Remove a registered script. |
| [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. |
| [current\_action()](current_action) wp-includes/plugin.php | Retrieves the name of the current action hook. |
| [WP\_Customize\_Widgets::capture\_filter\_pre\_get\_option()](../classes/wp_customize_widgets/capture_filter_pre_get_option) wp-includes/class-wp-customize-widgets.php | Pre-filters captured option values before retrieving. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wxr_nav_menu_terms() wxr\_nav\_menu\_terms()
=======================
Outputs all navigation menu terms.
File: `wp-admin/includes/export.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/export.php/)
```
function wxr_nav_menu_terms() {
$nav_menus = wp_get_nav_menus();
if ( empty( $nav_menus ) || ! is_array( $nav_menus ) ) {
return;
}
foreach ( $nav_menus as $menu ) {
echo "\t<wp:term>";
echo '<wp:term_id>' . (int) $menu->term_id . '</wp:term_id>';
echo '<wp:term_taxonomy>nav_menu</wp:term_taxonomy>';
echo '<wp:term_slug>' . wxr_cdata( $menu->slug ) . '</wp:term_slug>';
wxr_term_name( $menu );
echo "</wp:term>\n";
}
}
```
| Uses | Description |
| --- | --- |
| [wxr\_cdata()](wxr_cdata) wp-admin/includes/export.php | Wraps given string in XML CDATA tag. |
| [wxr\_term\_name()](wxr_term_name) wp-admin/includes/export.php | Outputs a term\_name XML tag from a given term object. |
| [wp\_get\_nav\_menus()](wp_get_nav_menus) wp-includes/nav-menu.php | Returns all navigation menu objects. |
| 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. |
wordpress wp_kses_normalize_entities( string $string, string $context = 'html' ): string wp\_kses\_normalize\_entities( string $string, string $context = 'html' ): string
=================================================================================
Converts and fixes HTML entities.
This function normalizes HTML entities. It will convert `AT&T` to the correct `AT&T`, `:` to `:`, `&#XYZZY;` to `&#XYZZY;` and so on.
When `$context` is set to ‘xml’, HTML entities are converted to their code points. For example, `AT&T…&#XYZZY;` is converted to `AT&T…&#XYZZY;`.
`$string` string Required Content to normalize entities. `$context` string Optional Context for normalization. Can be either `'html'` or `'xml'`.
Default `'html'`. Default: `'html'`
string Content with normalized entities.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_kses_normalize_entities( $string, $context = 'html' ) {
// Disarm all entities by converting & to &
$string = str_replace( '&', '&', $string );
// Change back the allowed entities in our list of allowed entities.
if ( 'xml' === $context ) {
$string = preg_replace_callback( '/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_xml_named_entities', $string );
} else {
$string = preg_replace_callback( '/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_named_entities', $string );
}
$string = preg_replace_callback( '/&#(0*[0-9]{1,7});/', 'wp_kses_normalize_entities2', $string );
$string = preg_replace_callback( '/&#[Xx](0*[0-9A-Fa-f]{1,6});/', 'wp_kses_normalize_entities3', $string );
return $string;
}
```
| Used By | Description |
| --- | --- |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [\_wp\_specialchars()](_wp_specialchars) wp-includes/formatting.php | Converts a number of special characters into their HTML entities. |
| [wp\_kses()](wp_kses) wp-includes/kses.php | Filters text content and strips out disallowed HTML. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Added `$context` parameter. |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress _prime_comment_caches( int[] $comment_ids, bool $update_meta_cache = true ) \_prime\_comment\_caches( int[] $comment\_ids, bool $update\_meta\_cache = true )
=================================================================================
Adds any comments from the given IDs to the cache that do not already exist in cache.
* [update\_comment\_cache()](update_comment_cache)
`$comment_ids` int[] Required Array of comment IDs. `$update_meta_cache` bool Optional Whether to update the meta cache. Default: `true`
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function _prime_comment_caches( $comment_ids, $update_meta_cache = true ) {
global $wpdb;
$non_cached_ids = _get_non_cached_ids( $comment_ids, 'comment' );
if ( ! empty( $non_cached_ids ) ) {
$fresh_comments = $wpdb->get_results( sprintf( "SELECT $wpdb->comments.* FROM $wpdb->comments WHERE comment_ID IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) );
update_comment_cache( $fresh_comments, $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\_comment\_cache()](update_comment_cache) wp-includes/comment.php | Updates the comment cache of given comments. |
| [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\_Comment\_Query::fill\_descendants()](../classes/wp_comment_query/fill_descendants) wp-includes/class-wp-comment-query.php | Fetch descendants for located comments. |
| [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\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | This function is no longer marked as "private". |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress the_post_navigation( array $args = array() ) the\_post\_navigation( array $args = array() )
==============================================
Displays the navigation to next/previous post, when applicable.
`$args` array Optional See [get\_the\_post\_navigation()](get_the_post_navigation) for available arguments.
More Arguments from get\_the\_post\_navigation( ... $args ) Default post navigation arguments.
* `prev_text`stringAnchor text to display in the previous post link. Default `'%title'`.
* `next_text`stringAnchor text to display in the next post link. Default `'%title'`.
* `in_same_term`boolWhether link should be in a same taxonomy term. Default false.
* `excluded_terms`int[]|stringArray or comma-separated list of excluded term IDs.
* `taxonomy`stringTaxonomy, if `$in_same_term` is true. Default `'category'`.
* `screen_reader_text`stringScreen reader text for the nav element. Default 'Post navigation'.
* `aria_label`stringARIA label text for the nav element. Default `'Posts'`.
* `class`stringCustom class for the nav element. Default `'post-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_post_navigation( $args = array() ) {
echo get_the_post_navigation( $args );
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_post\_navigation()](get_the_post_navigation) wp-includes/link-template.php | Retrieves the navigation to next/previous post, when applicable. |
| Version | Description |
| --- | --- |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Introduced. |
wordpress wp_set_wpdb_vars() wp\_set\_wpdb\_vars()
=====================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Set the database table prefix and the format specifiers for database table columns.
Columns not listed here default to `%s`.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_set_wpdb_vars() {
global $wpdb, $table_prefix;
if ( ! empty( $wpdb->error ) ) {
dead_db();
}
$wpdb->field_types = array(
'post_author' => '%d',
'post_parent' => '%d',
'menu_order' => '%d',
'term_id' => '%d',
'term_group' => '%d',
'term_taxonomy_id' => '%d',
'parent' => '%d',
'count' => '%d',
'object_id' => '%d',
'term_order' => '%d',
'ID' => '%d',
'comment_ID' => '%d',
'comment_post_ID' => '%d',
'comment_parent' => '%d',
'user_id' => '%d',
'link_id' => '%d',
'link_owner' => '%d',
'link_rating' => '%d',
'option_id' => '%d',
'blog_id' => '%d',
'meta_id' => '%d',
'post_id' => '%d',
'user_status' => '%d',
'umeta_id' => '%d',
'comment_karma' => '%d',
'comment_count' => '%d',
// Multisite:
'active' => '%d',
'cat_id' => '%d',
'deleted' => '%d',
'lang_id' => '%d',
'mature' => '%d',
'public' => '%d',
'site_id' => '%d',
'spam' => '%d',
);
$prefix = $wpdb->set_prefix( $table_prefix );
if ( is_wp_error( $prefix ) ) {
wp_load_translations_early();
wp_die(
sprintf(
/* translators: 1: $table_prefix, 2: wp-config.php */
__( '<strong>Error:</strong> %1$s in %2$s can only contain numbers, letters, and underscores.' ),
'<code>$table_prefix</code>',
'<code>wp-config.php</code>'
)
);
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_load\_translations\_early()](wp_load_translations_early) wp-includes/load.php | Attempt an early load of translations. |
| [dead\_db()](dead_db) wp-includes/functions.php | Loads custom DB error or display WordPress DB error. |
| [wpdb::set\_prefix()](../classes/wpdb/set_prefix) wp-includes/class-wpdb.php | Sets the table prefix for the WordPress tables. |
| [\_\_()](__) 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. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_preferred_from_update_core(): object|array|false get\_preferred\_from\_update\_core(): object|array|false
========================================================
Selects the first update version from the update\_core option.
object|array|false The response from the API on success, false on failure.
File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
```
function get_preferred_from_update_core() {
$updates = get_core_updates();
if ( ! is_array( $updates ) ) {
return false;
}
if ( empty( $updates ) ) {
return (object) array( 'response' => 'latest' );
}
return $updates[0];
}
```
| Uses | Description |
| --- | --- |
| [get\_core\_updates()](get_core_updates) wp-admin/includes/update.php | Gets available core updates. |
| Used By | Description |
| --- | --- |
| [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. |
| [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. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress _filter_query_attachment_filenames( array $clauses ): array \_filter\_query\_attachment\_filenames( array $clauses ): array
===============================================================
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.
Filter the SQL clauses of an attachment query to include filenames.
`$clauses` array Required An array including WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT, fields (SELECT), and LIMITS clauses. array The unmodified clauses.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function _filter_query_attachment_filenames( $clauses ) {
_deprecated_function( __FUNCTION__, '4.9.9', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )' );
remove_filter( 'posts_clauses', __FUNCTION__ );
return $clauses;
}
```
| Uses | Description |
| --- | --- |
| [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [6.0.3](https://developer.wordpress.org/reference/since/6.0.3/) | This function has been deprecated. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress get_last_updated( mixed $deprecated = '', int $start, int $quantity = 40 ): array get\_last\_updated( mixed $deprecated = '', int $start, int $quantity = 40 ): array
===================================================================================
Get a list of most recently updated blogs.
`$deprecated` mixed Optional Not used. Default: `''`
`$start` int Optional Number of blogs to offset the query. Used to build LIMIT clause.
Can be used for pagination. Default 0. `$quantity` int Optional The maximum number of blogs to retrieve. Default: `40`
array The list of blogs.
File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) {
global $wpdb;
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, 'MU' ); // Never used.
}
return $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", get_current_network_id(), $start, $quantity ), ARRAY_A );
}
```
| Uses | Description |
| --- | --- |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument 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 |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress term_exists( int|string $term, string $taxonomy = '', int $parent = null ): mixed term\_exists( int|string $term, string $taxonomy = '', int $parent = null ): mixed
==================================================================================
Determines whether a taxonomy term exists.
Formerly [is\_term()](is_term) , introduced in 2.3.0.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
`$term` int|string Required The term to check. Accepts term ID, slug, or name. `$taxonomy` string Optional The taxonomy name to use. Default: `''`
`$parent` int Optional ID of parent term under which to confine the exists search. Default: `null`
mixed Returns null if the term does not exist.
Returns the term ID if no taxonomy is specified and the term ID exists.
Returns an array of the term ID and the term taxonomy ID if the taxonomy is specified and the pairing exists.
Returns 0 if term ID 0 is passed to the function.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function term_exists( $term, $taxonomy = '', $parent = null ) {
global $_wp_suspend_cache_invalidation;
if ( null === $term ) {
return null;
}
$defaults = array(
'get' => 'all',
'fields' => 'ids',
'number' => 1,
'update_term_meta_cache' => false,
'order' => 'ASC',
'orderby' => 'term_id',
'suppress_filter' => true,
);
// Ensure that while importing, queries are not cached.
if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
// @todo Disable caching once #52710 is merged.
$defaults['cache_domain'] = microtime();
}
if ( ! empty( $taxonomy ) ) {
$defaults['taxonomy'] = $taxonomy;
$defaults['fields'] = 'all';
}
/**
* Filters default query arguments for checking if a term exists.
*
* @since 6.0.0
*
* @param array $defaults An array of arguments passed to get_terms().
* @param int|string $term The term to check. Accepts term ID, slug, or name.
* @param string $taxonomy The taxonomy name to use. An empty string indicates
* the search is against all taxonomies.
* @param int|null $parent ID of parent term under which to confine the exists search.
* Null indicates the search is unconfined.
*/
$defaults = apply_filters( 'term_exists_default_query_args', $defaults, $term, $taxonomy, $parent );
if ( is_int( $term ) ) {
if ( 0 === $term ) {
return 0;
}
$args = wp_parse_args( array( 'include' => array( $term ) ), $defaults );
$terms = get_terms( $args );
} else {
$term = trim( wp_unslash( $term ) );
if ( '' === $term ) {
return null;
}
if ( ! empty( $taxonomy ) && is_numeric( $parent ) ) {
$defaults['parent'] = (int) $parent;
}
$args = wp_parse_args( array( 'slug' => sanitize_title( $term ) ), $defaults );
$terms = get_terms( $args );
if ( empty( $terms ) || is_wp_error( $terms ) ) {
$args = wp_parse_args( array( 'name' => $term ), $defaults );
$terms = get_terms( $args );
}
}
if ( empty( $terms ) || is_wp_error( $terms ) ) {
return null;
}
$_term = array_shift( $terms );
if ( ! empty( $taxonomy ) ) {
return array(
'term_id' => (string) $_term->term_id,
'term_taxonomy_id' => (string) $_term->term_taxonomy_id,
);
}
return (string) $_term;
}
```
[apply\_filters( 'term\_exists\_default\_query\_args', array $defaults, int|string $term, string $taxonomy, int|null $parent )](../hooks/term_exists_default_query_args)
Filters default query arguments for checking if a term exists.
| 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. |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [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. |
| [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 |
| --- | --- |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [category\_exists()](category_exists) wp-admin/includes/taxonomy.php | Checks whether a category exists. |
| [wp\_insert\_category()](wp_insert_category) wp-admin/includes/taxonomy.php | Updates an existing Category or creates a new Category. |
| [tag\_exists()](tag_exists) wp-admin/includes/taxonomy.php | Checks whether a post tag with a given name exists. |
| [wp\_create\_term()](wp_create_term) wp-admin/includes/taxonomy.php | Adds a new term to the database if it does not already exist. |
| [is\_term()](is_term) wp-includes/deprecated.php | Check if Term exists. |
| [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\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. |
| [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. |
| [wp\_remove\_object\_terms()](wp_remove_object_terms) wp-includes/taxonomy.php | Removes term(s) associated with a given object. |
| [wp\_delete\_term()](wp_delete_term) wp-includes/taxonomy.php | Removes a term from the database. |
| [register\_taxonomy()](register_taxonomy) wp-includes/taxonomy.php | Creates or modifies a taxonomy object. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Converted to use `get_terms()`. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress get_taxonomies( array $args = array(), string $output = 'names', string $operator = 'and' ): string[]|WP_Taxonomy[] get\_taxonomies( array $args = array(), string $output = 'names', string $operator = 'and' ): string[]|WP\_Taxonomy[]
=====================================================================================================================
Retrieves a list of registered taxonomy names or objects.
`$args` array Optional An array of `key => value` arguments to match against the taxonomy objects.
Default: `array()`
`$output` string Optional The type of output to return in the array. Accepts either taxonomy `'names'` or `'objects'`. Default `'names'`. Default: `'names'`
`$operator` string Optional The logical operation to perform. Accepts `'and'` or `'or'`. `'or'` means only one element from the array needs to match; `'and'` means all elements must match.
Default `'and'`. Default: `'and'`
string[]|[WP\_Taxonomy](../classes/wp_taxonomy)[] An array of taxonomy names or objects.
Parameter `$args` is an array of key -> value arguments to match against the taxonomies. Only taxonomies having attributes that match all arguments are returned.
* name
* object\_type (array)
* label
* singular\_label
* show\_ui
* show\_tagcloud
* show\_in\_rest
* public
* update\_count\_callback
* rewrite
* query\_var
* manage\_cap
* edit\_cap
* delete\_cap
* assign\_cap
* \_builtin
Returned value is an array, a list of taxonomy names or objects. If returning names, you will get an array of the taxonomy names such as
```
Array ( [special_taxonomy] => special_taxonomy [custom_taxonomy] => custom_taxonomy )
```
If returning objects, you will get an array of objects such as:
```
Array ( [special_taxonomy] => stdClass Object [custom_taxonomy] => stdClass Object )
```
wherein each object will contain the following fields:
```
stdClass Object (
[hierarchical] =>
[update_count_callback] =>
[rewrite] =>
[query_var] =>
[public] =>
[show_ui] =>
[show_tagcloud] =>
[_builtin] =>
[labels] => stdClass Object (
[name] =>
[singular_name] =>
[search_items] =>
[popular_items] =>
[all_items] =>
[parent_item] =>
[parent_item_colon] =>
[edit_item] =>
[view_item] =>
[update_item] =>
[add_new_item] =>
[new_item_name] =>
[separate_items_with_commas] =>
[add_or_remove_items] =>
[choose_from_most_used] =>
[menu_name] =>
[name_admin_bar] => )
[show_in_nav_menus] =>
[cap] => stdClass Object (
[manage_terms] =>
[edit_terms] =>
[delete_terms] =>
[assign_terms] => )
[name] =>
[object_type] => Array ()
[label] )
```
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' ) {
global $wp_taxonomies;
$field = ( 'names' === $output ) ? 'name' : false;
return wp_filter_object_list( $wp_taxonomies, $args, $operator, $field );
}
```
| Uses | Description |
| --- | --- |
| [wp\_filter\_object\_list()](wp_filter_object_list) wp-includes/functions.php | Filters a list of objects, based on a set of key => value arguments. |
| Used By | Description |
| --- | --- |
| [\_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\_Term\_Search\_Handler::\_\_construct()](../classes/wp_rest_term_search_handler/__construct) wp-includes/rest-api/search/class-wp-rest-term-search-handler.php | Constructor. |
| [WP\_Sitemaps\_Taxonomies::get\_object\_subtypes()](../classes/wp_sitemaps_taxonomies/get_object_subtypes) wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php | Returns all public, registered taxonomies. |
| [create\_initial\_rest\_routes()](create_initial_rest_routes) wp-includes/rest-api.php | Registers default REST API routes. |
| [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\_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::available\_item\_types()](../classes/wp_customize_nav_menus/available_item_types) wp-includes/class-wp-customize-nav-menus.php | Returns an array of all the available item types. |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [set\_screen\_options()](set_screen_options) wp-admin/includes/misc.php | Saves option for number of rows when listing posts, pages, comments, etc. |
| [wp\_ajax\_menu\_get\_metabox()](wp_ajax_menu_get_metabox) wp-admin/includes/ajax-actions.php | Ajax handler for retrieving menu meta boxes. |
| [wp\_nav\_menu\_taxonomy\_meta\_boxes()](wp_nav_menu_taxonomy_meta_boxes) wp-admin/includes/nav-menu.php | Creates meta boxes for any taxonomy menu item. |
| [WP::parse\_request()](../classes/wp/parse_request) wp-includes/class-wp.php | Parses the request to find the correct WordPress query. |
| [WP\_Query::parse\_tax\_query()](../classes/wp_query/parse_tax_query) wp-includes/class-wp-query.php | Parses various taxonomy related query vars. |
| [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. |
| [get\_post\_class()](get_post_class) wp-includes/post-template.php | Retrieves an array of the class names for the post container element. |
| [get\_taxonomies\_for\_attachments()](get_taxonomies_for_attachments) wp-includes/media.php | Retrieves all of the taxonomies that are registered for attachments. |
| [wp\_xmlrpc\_server::wp\_getTaxonomies()](../classes/wp_xmlrpc_server/wp_gettaxonomies) wp-includes/class-wp-xmlrpc-server.php | Retrieve all taxonomies. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress is_upload_space_available(): bool is\_upload\_space\_available(): bool
====================================
Determines if there is any upload space left in the current blog’s quota.
bool True if space is available, false otherwise.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function is_upload_space_available() {
if ( get_site_option( 'upload_space_check_disabled' ) ) {
return true;
}
return (bool) 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. |
| Used By | Description |
| --- | --- |
| [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\_plupload\_default\_settings()](wp_plupload_default_settings) wp-includes/media.php | Prints default Plupload arguments. |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress script_concat_settings() script\_concat\_settings()
==========================
Determines the concatenation and compression settings for scripts and styles.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function script_concat_settings() {
global $concatenate_scripts, $compress_scripts, $compress_css;
$compressed_output = ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) );
$can_compress_scripts = ! wp_installing() && get_site_option( 'can_compress_scripts' );
if ( ! isset( $concatenate_scripts ) ) {
$concatenate_scripts = defined( 'CONCATENATE_SCRIPTS' ) ? CONCATENATE_SCRIPTS : true;
if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) {
$concatenate_scripts = false;
}
}
if ( ! isset( $compress_scripts ) ) {
$compress_scripts = defined( 'COMPRESS_SCRIPTS' ) ? COMPRESS_SCRIPTS : true;
if ( $compress_scripts && ( ! $can_compress_scripts || $compressed_output ) ) {
$compress_scripts = false;
}
}
if ( ! isset( $compress_css ) ) {
$compress_css = defined( 'COMPRESS_CSS' ) ? COMPRESS_CSS : true;
if ( $compress_css && ( ! $can_compress_scripts || $compressed_output ) ) {
$compress_css = false;
}
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [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\_register\_tinymce\_scripts()](wp_register_tinymce_scripts) wp-includes/script-loader.php | Registers TinyMCE scripts. |
| [\_WP\_Editors::print\_tinymce\_scripts()](../classes/_wp_editors/print_tinymce_scripts) wp-includes/class-wp-editor.php | Print (output) the main TinyMCE scripts. |
| [print\_head\_scripts()](print_head_scripts) wp-includes/script-loader.php | Prints the script queue in the HTML head on admin pages. |
| [print\_footer\_scripts()](print_footer_scripts) wp-includes/script-loader.php | Prints the scripts that were queued for the footer or too late for the HTML head. |
| [print\_admin\_styles()](print_admin_styles) wp-includes/script-loader.php | Prints the styles queue in the HTML head on admin pages. |
| [print\_late\_styles()](print_late_styles) wp-includes/script-loader.php | Prints the styles that were queued too late for the HTML head. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress get_block_wrapper_attributes( string[] $extra_attributes = array() ): string get\_block\_wrapper\_attributes( string[] $extra\_attributes = array() ): string
================================================================================
Generates a string of attributes by applying to the current block being rendered all of the features that the block supports.
`$extra_attributes` string[] Optional Array of extra attributes to render on the block wrapper. Default: `array()`
string String of HTML attributes.
File: `wp-includes/class-wp-block-supports.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-block-supports.php/)
```
function get_block_wrapper_attributes( $extra_attributes = array() ) {
$new_attributes = WP_Block_Supports::get_instance()->apply_block_supports();
if ( empty( $new_attributes ) && empty( $extra_attributes ) ) {
return '';
}
// This is hardcoded on purpose.
// We only support a fixed list of attributes.
$attributes_to_merge = array( 'style', 'class' );
$attributes = array();
foreach ( $attributes_to_merge as $attribute_name ) {
if ( empty( $new_attributes[ $attribute_name ] ) && empty( $extra_attributes[ $attribute_name ] ) ) {
continue;
}
if ( empty( $new_attributes[ $attribute_name ] ) ) {
$attributes[ $attribute_name ] = $extra_attributes[ $attribute_name ];
continue;
}
if ( empty( $extra_attributes[ $attribute_name ] ) ) {
$attributes[ $attribute_name ] = $new_attributes[ $attribute_name ];
continue;
}
$attributes[ $attribute_name ] = $extra_attributes[ $attribute_name ] . ' ' . $new_attributes[ $attribute_name ];
}
foreach ( $extra_attributes as $attribute_name => $value ) {
if ( ! in_array( $attribute_name, $attributes_to_merge, true ) ) {
$attributes[ $attribute_name ] = $value;
}
}
if ( empty( $attributes ) ) {
return '';
}
$normalized_attributes = array();
foreach ( $attributes as $key => $value ) {
$normalized_attributes[] = $key . '="' . esc_attr( $value ) . '"';
}
return implode( ' ', $normalized_attributes );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Block\_Supports::get\_instance()](../classes/wp_block_supports/get_instance) wp-includes/class-wp-block-supports.php | Utility method to retrieve the main instance of the class. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress confirm_user_signup( string $user_name, string $user_email ) confirm\_user\_signup( string $user\_name, string $user\_email )
================================================================
Shows a message confirming that the new user has been registered and is awaiting activation.
`$user_name` string Required The username. `$user_email` string Required The user's email address. File: `wp-signup.php`. [View all references](https://developer.wordpress.org/reference/files/wp-signup.php/)
```
function confirm_user_signup( $user_name, $user_email ) {
?>
<h2>
<?php
/* translators: %s: Username. */
printf( __( '%s is your new username' ), $user_name )
?>
</h2>
<p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ); ?></p>
<p>
<?php
/* translators: %s: Email address. */
printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' );
?>
</p>
<p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
<?php
/** This action is documented in wp-signup.php */
do_action( 'signup_finished' );
}
```
[do\_action( 'signup\_finished' )](../hooks/signup_finished)
Fires when the site or user sign-up process is complete.
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [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 _wp_array_get( array $array, array $path, mixed $default = null ): mixed \_wp\_array\_get( array $array, array $path, mixed $default = null ): mixed
===========================================================================
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.
Accesses an array in depth based on a path of keys.
It is the PHP equivalent of JavaScript’s `lodash.get()` and mirroring it may help other components retain some symmetry between client and server implementations.
Example usage:
```
$array = array(
'a' => array(
'b' => array(
'c' => 1,
),
),
);
_wp_array_get( $array, array( 'a', 'b', 'c' ) );
```
`$array` array Required An array from which we want to retrieve some information. `$path` array Required An array of keys describing the path with which to retrieve information. `$default` mixed Optional The return value if the path does not exist within the array, or if `$array` or `$path` are not arrays. Default: `null`
mixed The value from the path specified.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _wp_array_get( $array, $path, $default = null ) {
// Confirm $path is valid.
if ( ! is_array( $path ) || 0 === count( $path ) ) {
return $default;
}
foreach ( $path as $path_element ) {
if (
! is_array( $array ) ||
( ! is_string( $path_element ) && ! is_integer( $path_element ) && ! is_null( $path_element ) ) ||
! array_key_exists( $path_element, $array )
) {
return $default;
}
$array = $array[ $path_element ];
}
return $array;
}
```
| 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\_Theme\_JSON::set\_spacing\_sizes()](../classes/wp_theme_json/set_spacing_sizes) wp-includes/class-wp-theme-json.php | Sets the spacingSizes array based on the spacingScale values from theme.json. |
| [WP\_Theme\_JSON::get\_styles\_for\_block()](../classes/wp_theme_json/get_styles_for_block) wp-includes/class-wp-theme-json.php | Gets the CSS rules for a particular block from theme.json. |
| [WP\_Theme\_JSON::get\_root\_layout\_rules()](../classes/wp_theme_json/get_root_layout_rules) wp-includes/class-wp-theme-json.php | Outputs the CSS for layout rules on the root. |
| [WP\_Theme\_JSON::get\_layout\_styles()](../classes/wp_theme_json/get_layout_styles) wp-includes/class-wp-theme-json.php | Gets the CSS layout rules for a particular block from theme.json layout definitions. |
| [WP\_Style\_Engine::parse\_block\_styles()](../classes/wp_style_engine/parse_block_styles) wp-includes/style-engine/class-wp-style-engine.php | Returns classnames and CSS based on the values in a styles object. |
| [WP\_Style\_Engine::get\_individual\_property\_css\_declarations()](../classes/wp_style_engine/get_individual_property_css_declarations) wp-includes/style-engine/class-wp-style-engine.php | Style value parser that returns a CSS definition array comprising style properties that have keys representing individual style properties, otherwise known as longhand CSS properties. |
| [WP\_Theme\_JSON\_Resolver::get\_block\_data()](../classes/wp_theme_json_resolver/get_block_data) wp-includes/class-wp-theme-json-resolver.php | Gets the styles for blocks from the block.json file. |
| [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\_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::get\_data()](../classes/wp_theme_json/get_data) wp-includes/class-wp-theme-json.php | Returns a valid theme.json as provided by a theme. |
| [WP\_Theme\_JSON::get\_metadata\_boolean()](../classes/wp_theme_json/get_metadata_boolean) wp-includes/class-wp-theme-json.php | For metadata values that can either be booleans or paths to booleans, gets the value. |
| [WP\_Theme\_JSON::get\_svg\_filters()](../classes/wp_theme_json/get_svg_filters) wp-includes/class-wp-theme-json.php | Converts all filter (duotone) presets into SVGs. |
| [wp\_get\_global\_settings()](wp_get_global_settings) wp-includes/global-styles-and-settings.php | Gets the settings resulting of merging core, theme, and user data. |
| [wp\_get\_global\_styles()](wp_get_global_styles) wp-includes/global-styles-and-settings.php | Gets the styles resulting of merging core, theme, and user data. |
| [WP\_Theme\_JSON\_Schema::rename\_settings()](../classes/wp_theme_json_schema/rename_settings) wp-includes/class-wp-theme-json-schema.php | Processes a settings array, renaming or moving properties. |
| [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\_Theme\_JSON::get\_default\_slugs()](../classes/wp_theme_json/get_default_slugs) wp-includes/class-wp-theme-json.php | Returns the default slugs for all the presets in an associative array whose keys are the preset paths and the leafs is the list of slugs. |
| [WP\_Theme\_JSON::get\_name\_from\_defaults()](../classes/wp_theme_json/get_name_from_defaults) wp-includes/class-wp-theme-json.php | Gets a `default`‘s preset name by a provided slug. |
| [WP\_Theme\_JSON::remove\_insecure\_properties()](../classes/wp_theme_json/remove_insecure_properties) wp-includes/class-wp-theme-json.php | Removes insecure data from theme.json. |
| [WP\_Theme\_JSON::remove\_insecure\_settings()](../classes/wp_theme_json/remove_insecure_settings) wp-includes/class-wp-theme-json.php | Processes a setting node and returns the same node without the insecure settings. |
| [WP\_Theme\_JSON::remove\_insecure\_styles()](../classes/wp_theme_json/remove_insecure_styles) wp-includes/class-wp-theme-json.php | Processes a style node and returns the same node without the insecure styles. |
| [WP\_Theme\_JSON::get\_preset\_classes()](../classes/wp_theme_json/get_preset_classes) wp-includes/class-wp-theme-json.php | Creates new rulesets as classes for each preset value such as: |
| [WP\_Theme\_JSON::get\_settings\_values\_by\_slug()](../classes/wp_theme_json/get_settings_values_by_slug) wp-includes/class-wp-theme-json.php | Gets preset values keyed by slugs based on settings and metadata. |
| [WP\_Theme\_JSON::get\_settings\_slugs()](../classes/wp_theme_json/get_settings_slugs) wp-includes/class-wp-theme-json.php | Similar to get\_settings\_values\_by\_slug, but doesn’t compute the value. |
| [WP\_Theme\_JSON::do\_opt\_in\_into\_settings()](../classes/wp_theme_json/do_opt_in_into_settings) wp-includes/class-wp-theme-json.php | Enables some settings. |
| [WP\_Theme\_JSON::compute\_theme\_vars()](../classes/wp_theme_json/compute_theme_vars) wp-includes/class-wp-theme-json.php | Given an array of settings, extracts the CSS Custom Properties for the custom values and adds them to the $declarations array following the format: |
| [WP\_Theme\_JSON::compute\_style\_properties()](../classes/wp_theme_json/compute_style_properties) wp-includes/class-wp-theme-json.php | Given a styles array, it extracts the style properties and adds them to the $declarations array following the format: |
| [WP\_Theme\_JSON::get\_property\_value()](../classes/wp_theme_json/get_property_value) wp-includes/class-wp-theme-json.php | Returns the style property for the given path. |
| [WP\_Theme\_JSON::merge()](../classes/wp_theme_json/merge) wp-includes/class-wp-theme-json.php | Merges new incoming data. |
| [WP\_Theme\_JSON::\_\_construct()](../classes/wp_theme_json/__construct) wp-includes/class-wp-theme-json.php | Constructor. |
| [WP\_Theme\_JSON::get\_css\_variables()](../classes/wp_theme_json/get_css_variables) wp-includes/class-wp-theme-json.php | Converts each styles section into a list of rulesets to be appended to the stylesheet. |
| [block\_has\_support()](block_has_support) wp-includes/blocks.php | Checks whether the current block type supports the feature requested. |
| [wp\_migrate\_old\_typography\_shape()](wp_migrate_old_typography_shape) wp-includes/blocks.php | Converts typography keys declared under `supports.*` to `supports.typography.*`. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
| programming_docs |
wordpress post_tags_meta_box( WP_Post $post, array $box ) post\_tags\_meta\_box( WP\_Post $post, array $box )
===================================================
Displays post tags form fields.
`$post` [WP\_Post](../classes/wp_post) Required Current post object. `$box` array Required Tags meta box arguments.
* `id`stringMeta box `'id'` attribute.
* `title`stringMeta box title.
* `callback`callableMeta box display callback.
* `args`array Extra meta box arguments.
+ `taxonomy`stringTaxonomy. Default `'post_tag'`. File: `wp-admin/includes/meta-boxes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/meta-boxes.php/)
```
function post_tags_meta_box( $post, $box ) {
$defaults = array( 'taxonomy' => 'post_tag' );
if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) {
$args = array();
} else {
$args = $box['args'];
}
$parsed_args = wp_parse_args( $args, $defaults );
$tax_name = esc_attr( $parsed_args['taxonomy'] );
$taxonomy = get_taxonomy( $parsed_args['taxonomy'] );
$user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms );
$comma = _x( ',', 'tag delimiter' );
$terms_to_edit = get_terms_to_edit( $post->ID, $tax_name );
if ( ! is_string( $terms_to_edit ) ) {
$terms_to_edit = '';
}
?>
<div class="tagsdiv" id="<?php echo $tax_name; ?>">
<div class="jaxtag">
<div class="nojs-tags hide-if-js">
<label for="tax-input-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_or_remove_items; ?></label>
<p><textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms ); ?> aria-describedby="new-tag-<?php echo $tax_name; ?>-desc"><?php echo str_replace( ',', $comma . ' ', $terms_to_edit ); // textarea_escaped by esc_attr() ?></textarea></p>
</div>
<?php if ( $user_can_assign_terms ) : ?>
<div class="ajaxtag hide-if-no-js">
<label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label>
<input data-wp-taxonomy="<?php echo $tax_name; ?>" type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" aria-describedby="new-tag-<?php echo $tax_name; ?>-desc" value="" />
<input type="button" class="button tagadd" value="<?php esc_attr_e( 'Add' ); ?>" />
</div>
<p class="howto" id="new-tag-<?php echo $tax_name; ?>-desc"><?php echo $taxonomy->labels->separate_items_with_commas; ?></p>
<?php elseif ( empty( $terms_to_edit ) ) : ?>
<p><?php echo $taxonomy->labels->no_terms; ?></p>
<?php endif; ?>
</div>
<ul class="tagchecklist" role="list"></ul>
</div>
<?php if ( $user_can_assign_terms ) : ?>
<p class="hide-if-no-js"><button type="button" class="button-link tagcloud-link" id="link-<?php echo $tax_name; ?>" aria-expanded="false"><?php echo $taxonomy->labels->choose_from_most_used; ?></button></p>
<?php endif; ?>
<?php
}
```
| Uses | Description |
| --- | --- |
| [get\_terms\_to\_edit()](get_terms_to_edit) wp-admin/includes/taxonomy.php | Gets comma-separated list of terms available to edit for the given post ID. |
| [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. |
| [disabled()](disabled) wp-includes/general-template.php | Outputs the HTML disabled attribute. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress site_admin_notice(): void|false site\_admin\_notice(): void|false
=================================
Displays an admin notice to upgrade all sites after a core upgrade.
void|false Void on success. False if the current user is not a super admin.
File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function site_admin_notice() {
global $wp_db_version, $pagenow;
if ( ! current_user_can( 'upgrade_network' ) ) {
return false;
}
if ( 'upgrade.php' === $pagenow ) {
return;
}
if ( (int) get_site_option( 'wpmu_upgrade_site' ) !== $wp_db_version ) {
echo "<div class='update-nag notice notice-warning inline'>" . sprintf(
/* translators: %s: URL to Upgrade Network screen. */
__( 'Thank you for Updating! Please visit the <a href="%s">Upgrade Network</a> page to update all your sites.' ),
esc_url( network_admin_url( 'upgrade.php' ) )
) . '</div>';
}
}
```
| Uses | Description |
| --- | --- |
| [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-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_get_theme( string $stylesheet = '', string $theme_root = '' ): WP_Theme wp\_get\_theme( string $stylesheet = '', string $theme\_root = '' ): WP\_Theme
==============================================================================
Gets a [WP\_Theme](../classes/wp_theme) object for a theme.
`$stylesheet` string Optional Directory name for the theme. Defaults to active theme. Default: `''`
`$theme_root` string Optional Absolute path of the theme root to look in.
If not specified, [get\_raw\_theme\_root()](get_raw_theme_root) is used to calculate the theme root for the $stylesheet provided (or active theme). Default: `''`
[WP\_Theme](../classes/wp_theme) Theme object. Be sure to check the object's exists() method if you need to confirm the theme's existence.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function wp_get_theme( $stylesheet = '', $theme_root = '' ) {
global $wp_theme_directories;
if ( empty( $stylesheet ) ) {
$stylesheet = get_stylesheet();
}
if ( empty( $theme_root ) ) {
$theme_root = get_raw_theme_root( $stylesheet );
if ( false === $theme_root ) {
$theme_root = WP_CONTENT_DIR . '/themes';
} elseif ( ! in_array( $theme_root, (array) $wp_theme_directories, true ) ) {
$theme_root = WP_CONTENT_DIR . $theme_root;
}
}
return new WP_Theme( $stylesheet, $theme_root );
}
```
| Uses | Description |
| --- | --- |
| [get\_raw\_theme\_root()](get_raw_theme_root) wp-includes/theme.php | Gets the raw theme root relative to the content directory with no filters applied. |
| [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. |
| [WP\_Theme::\_\_construct()](../classes/wp_theme/__construct) wp-includes/class-wp-theme.php | Constructor for [WP\_Theme](../classes/wp_theme). |
| 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: |
| [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\_REST\_Global\_Styles\_Controller::get\_theme\_items()](../classes/wp_rest_global_styles_controller/get_theme_items) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Returns the given theme global styles variations. |
| [WP\_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\_Theme\_JSON\_Resolver::get\_user\_data()](../classes/wp_theme_json_resolver/get_user_data) wp-includes/class-wp-theme-json-resolver.php | Returns the user’s origin config. |
| [WP\_Theme\_JSON\_Resolver::get\_user\_global\_styles\_post\_id()](../classes/wp_theme_json_resolver/get_user_global_styles_post_id) wp-includes/class-wp-theme-json-resolver.php | Returns the ID of the custom post type that stores user data. |
| [WP\_REST\_Global\_Styles\_Controller::get\_theme\_item()](../classes/wp_rest_global_styles_controller/get_theme_item) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Returns the given theme global styles config. |
| [wp\_is\_block\_theme()](wp_is_block_theme) wp-includes/theme.php | Returns whether the active theme is a block-based theme or not. |
| [wp\_set\_unique\_slug\_on\_create\_template\_part()](wp_set_unique_slug_on_create_template_part) wp-includes/theme-templates.php | Sets a custom slug when creating auto-draft template parts. |
| [get\_block\_file\_template()](get_block_file_template) wp-includes/block-template-utils.php | Retrieves a unified template object based on a theme file. |
| [\_inject\_theme\_attribute\_in\_block\_template\_content()](_inject_theme_attribute_in_block_template_content) wp-includes/block-template-utils.php | Parses wp\_template content and injects the active theme’s stylesheet as a theme attribute into each wp\_template\_part |
| [\_build\_block\_template\_result\_from\_file()](_build_block_template_result_from_file) wp-includes/block-template-utils.php | Builds a unified template object based on a theme file. |
| [\_build\_block\_template\_result\_from\_post()](_build_block_template_result_from_post) wp-includes/block-template-utils.php | Builds a unified template object based a post Object. |
| [WP\_Theme\_JSON\_Resolver::get\_theme\_data()](../classes/wp_theme_json_resolver/get_theme_data) wp-includes/class-wp-theme-json-resolver.php | Returns the theme’s data. |
| [WP\_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\_filter\_wp\_template\_unique\_post\_slug()](wp_filter_wp_template_unique_post_slug) wp-includes/theme-templates.php | Generates a unique slug for templates. |
| [resolve\_block\_template()](resolve_block_template) wp-includes/block-template.php | Returns the correct ‘wp\_template’ to render for the request template type. |
| [get\_block\_templates()](get_block_templates) wp-includes/block-template-utils.php | Retrieves a list of unified template objects based on a query. |
| [WP\_REST\_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::get\_item()](../classes/wp_rest_themes_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Retrieves a single theme. |
| [WP\_REST\_Themes\_Controller::prepare\_links()](../classes/wp_rest_themes_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Prepares links for the request. |
| [validate\_theme\_requirements()](validate_theme_requirements) wp-includes/theme.php | Validates the theme requirements for WordPress version and PHP version. |
| [WP\_Recovery\_Mode\_Email\_Service::get\_debug()](../classes/wp_recovery_mode_email_service/get_debug) wp-includes/class-wp-recovery-mode-email-service.php | Return debug information in an easy to manipulate format. |
| [WP\_Recovery\_Mode\_Email\_Service::get\_cause()](../classes/wp_recovery_mode_email_service/get_cause) wp-includes/class-wp-recovery-mode-email-service.php | Gets the description indicating the possible cause for the error. |
| [WP\_Debug\_Data::debug\_data()](../classes/wp_debug_data/debug_data) wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| [WP\_Site\_Health::get\_test\_theme\_version()](../classes/wp_site_health/get_test_theme_version) wp-admin/includes/class-wp-site-health.php | Tests if themes are outdated, or unnecessary. |
| [populate\_network\_meta()](populate_network_meta) wp-admin/includes/schema.php | Creates WordPress network meta and sets the default values. |
| [WP\_REST\_Themes\_Controller::get\_items()](../classes/wp_rest_themes_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Retrieves a collection of themes. |
| [WP\_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\_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\_edit\_theme\_plugin\_file()](wp_edit_theme_plugin_file) wp-admin/includes/file.php | Attempts to edit a file for a theme or plugin. |
| [WP\_REST\_Posts\_Controller::handle\_template()](../classes/wp_rest_posts_controller/handle_template) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Sets the template for a post. |
| [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\_Theme::get\_core\_default\_theme()](../classes/wp_theme/get_core_default_theme) wp-includes/class-wp-theme.php | Determines the latest WordPress default theme that is installed. |
| [WP\_Automatic\_Updater::update()](../classes/wp_automatic_updater/update) wp-admin/includes/class-wp-automatic-updater.php | Updates an item, if appropriate. |
| [Theme\_Upgrader::theme\_info()](../classes/theme_upgrader/theme_info) wp-admin/includes/class-theme-upgrader.php | Get the [WP\_Theme](../classes/wp_theme) object for a theme. |
| [Language\_Pack\_Upgrader::get\_name\_for\_update()](../classes/language_pack_upgrader/get_name_for_update) wp-admin/includes/class-language-pack-upgrader.php | Get the name of an item being updated. |
| [wp\_prepare\_themes\_for\_js()](wp_prepare_themes_for_js) wp-admin/includes/theme.php | Prepares themes for JavaScript. |
| [get\_page\_templates()](get_page_templates) wp-admin/includes/theme.php | Gets the page templates available in this theme. |
| [current\_theme\_info()](current_theme_info) wp-admin/includes/deprecated.php | Retrieves information on the current active theme. |
| [WP\_Theme\_Install\_List\_Table::\_get\_theme\_status()](../classes/wp_theme_install_list_table/_get_theme_status) wp-admin/includes/class-wp-theme-install-list-table.php | Check to see if the theme is already installed. |
| [populate\_options()](populate_options) wp-admin/includes/schema.php | Create WordPress options and set the default values. |
| [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. |
| [get\_theme\_updates()](get_theme_updates) wp-admin/includes/update.php | Retrieves themes with updates available. |
| [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\_Customize\_Manager::theme()](../classes/wp_customize_manager/theme) wp-includes/class-wp-customize-manager.php | Gets the theme being customized. |
| [WP\_Customize\_Manager::\_\_construct()](../classes/wp_customize_manager/__construct) wp-includes/class-wp-customize-manager.php | Constructor. |
| [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. |
| [remove\_theme\_mods()](remove_theme_mods) wp-includes/theme.php | Removes theme modifications option for the active theme. |
| [switch\_theme()](switch_theme) wp-includes/theme.php | Switches the theme. |
| [validate\_current\_theme()](validate_current_theme) wp-includes/theme.php | Checks that the active theme has the required files. |
| [get\_theme\_mods()](get_theme_mods) wp-includes/theme.php | Retrieves all theme modifications. |
| [get\_current\_theme()](get_current_theme) wp-includes/deprecated.php | Retrieve current theme name. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress wp_set_password( string $password, int $user_id ) wp\_set\_password( string $password, int $user\_id )
====================================================
Updates the user’s password with a new encrypted one.
For integration with other applications, this function can be overwritten to instead use the other package password checking algorithm.
Please note: This function should be used sparingly and is really only meant for single-time application. Leveraging this improperly in a plugin or theme could result in an endless loop of password resets if precautions are not taken to ensure it does not execute on every page load.
`$password` string Required The plaintext new user password. `$user_id` int Required User ID. File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_set_password( $password, $user_id ) {
global $wpdb;
$hash = wp_hash_password( $password );
$wpdb->update(
$wpdb->users,
array(
'user_pass' => $hash,
'user_activation_key' => '',
),
array( 'ID' => $user_id )
);
clean_user_cache( $user_id );
}
```
| Uses | Description |
| --- | --- |
| [wp\_hash\_password()](wp_hash_password) wp-includes/pluggable.php | Creates a hash (encrypt) of a plain text password. |
| [clean\_user\_cache()](clean_user_cache) wp-includes/user.php | Cleans all user caches. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| Used By | Description |
| --- | --- |
| [wp\_check\_password()](wp_check_password) wp-includes/pluggable.php | Checks the plaintext password against the encrypted Password. |
| [reset\_password()](reset_password) wp-includes/user.php | Handles resetting the user’s password. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
| programming_docs |
wordpress print_embed_scripts() print\_embed\_scripts()
=======================
Prints the JavaScript 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_scripts() {
wp_print_inline_script_tag(
file_get_contents( ABSPATH . WPINC . '/js/wp-embed-template' . wp_scripts_get_suffix() . '.js' )
);
}
```
| Uses | Description |
| --- | --- |
| [wp\_print\_inline\_script\_tag()](wp_print_inline_script_tag) wp-includes/script-loader.php | Prints inline JavaScript wrapped in tag. |
| [wp\_scripts\_get\_suffix()](wp_scripts_get_suffix) wp-includes/script-loader.php | Returns the suffix that can be used for the scripts. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_update_comment_count( int|null $post_id, bool $do_deferred = false ): bool|void wp\_update\_comment\_count( int|null $post\_id, bool $do\_deferred = false ): bool|void
=======================================================================================
Updates the comment count for post(s).
When $do\_deferred is false (is by default) and the comments have been set to be deferred, the post\_id will be added to a queue, which will be updated at a later date and only updated once per post ID.
If the comments have not be set up to be deferred, then the post will be updated. When $do\_deferred is set to true, then all previous deferred post IDs will be updated along with the current $post\_id.
* [wp\_update\_comment\_count\_now()](wp_update_comment_count_now) : For what could cause a false return value
`$post_id` int|null Required Post ID. `$do_deferred` bool Optional Whether to process previously deferred post comment counts. Default: `false`
bool|void True on success, false on failure or if post with ID does not exist.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_update_comment_count( $post_id, $do_deferred = false ) {
static $_deferred = array();
if ( empty( $post_id ) && ! $do_deferred ) {
return false;
}
if ( $do_deferred ) {
$_deferred = array_unique( $_deferred );
foreach ( $_deferred as $i => $_post_id ) {
wp_update_comment_count_now( $_post_id );
unset( $_deferred[ $i ] );
/** @todo Move this outside of the foreach and reset $_deferred to an array instead */
}
}
if ( wp_defer_comment_counting() ) {
$_deferred[] = $post_id;
return true;
} elseif ( $post_id ) {
return wp_update_comment_count_now( $post_id );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_update\_comment\_count\_now()](wp_update_comment_count_now) wp-includes/comment.php | Updates the comment count for the post. |
| [wp\_defer\_comment\_counting()](wp_defer_comment_counting) wp-includes/comment.php | Determines whether to defer comment counting. |
| Used By | Description |
| --- | --- |
| [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\_defer\_comment\_counting()](wp_defer_comment_counting) wp-includes/comment.php | Determines whether to defer comment counting. |
| [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.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress next_comments_link( string $label = '', int $max_page ) next\_comments\_link( string $label = '', int $max\_page )
==========================================================
Displays the link to the next comments page.
`$label` string Optional Label for link text. Default: `''`
`$max_page` int Optional Max page. Default 0. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function next_comments_link( $label = '', $max_page = 0 ) {
echo get_next_comments_link( $label, $max_page );
}
```
| Uses | Description |
| --- | --- |
| [get\_next\_comments\_link()](get_next_comments_link) wp-includes/link-template.php | Retrieves the link to the next comments page. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress _wp_keep_alive_customize_changeset_dependent_auto_drafts( string $new_status, string $old_status, WP_Post $post ) \_wp\_keep\_alive\_customize\_changeset\_dependent\_auto\_drafts( 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\_delete\_auto\_drafts()](wp_delete_auto_drafts) instead.
Makes sure that auto-draft posts get their post\_date bumped or status changed to draft to prevent premature garbage-collection.
When a changeset is updated but remains an auto-draft, ensure the post\_date for the auto-draft posts remains the same so that it will be garbage-collected at the same time by `wp_delete_auto_drafts()`. Otherwise, if the changeset is updated to be a draft then update the posts to have a far-future post\_date so that they will never be garbage collected unless the changeset post itself is deleted.
When a changeset is updated to be a persistent draft or to be scheduled for publishing, then transition any dependent auto-drafts to a draft status so that they likewise will not be garbage-collected but also so that they can be edited in the admin before publishing since there is not yet a post/page editing flow in the Customizer. See #39752.
* [wp\_delete\_auto\_drafts()](wp_delete_auto_drafts)
`$new_status` string Required Transition to this post status. `$old_status` string Required Previous post status. `$post` [WP\_Post](../classes/wp_post) Required Post data. File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function _wp_keep_alive_customize_changeset_dependent_auto_drafts( $new_status, $old_status, $post ) {
global $wpdb;
unset( $old_status );
// Short-circuit if not a changeset or if the changeset was published.
if ( 'customize_changeset' !== $post->post_type || 'publish' === $new_status ) {
return;
}
$data = json_decode( $post->post_content, true );
if ( empty( $data['nav_menus_created_posts']['value'] ) ) {
return;
}
/*
* Actually, in lieu of keeping alive, trash any customization drafts here if the changeset itself is
* getting trashed. This is needed because when a changeset transitions to a draft, then any of the
* dependent auto-draft post/page stubs will also get transitioned to customization drafts which
* are then visible in the WP Admin. We cannot wait for the deletion of the changeset in which
* _wp_delete_customize_changeset_dependent_auto_drafts() will be called, since they need to be
* trashed to remove from visibility immediately.
*/
if ( 'trash' === $new_status ) {
foreach ( $data['nav_menus_created_posts']['value'] as $post_id ) {
if ( ! empty( $post_id ) && 'draft' === get_post_status( $post_id ) ) {
wp_trash_post( $post_id );
}
}
return;
}
$post_args = array();
if ( 'auto-draft' === $new_status ) {
/*
* Keep the post date for the post matching the changeset
* so that it will not be garbage-collected before the changeset.
*/
$post_args['post_date'] = $post->post_date; // Note wp_delete_auto_drafts() only looks at this date.
} else {
/*
* Since the changeset no longer has an auto-draft (and it is not published)
* it is now a persistent changeset, a long-lived draft, and so any
* associated auto-draft posts should likewise transition into having a draft
* status. These drafts will be treated differently than regular drafts in
* that they will be tied to the given changeset. The publish meta box is
* replaced with a notice about how the post is part of a set of customized changes
* which will be published when the changeset is published.
*/
$post_args['post_status'] = 'draft';
}
foreach ( $data['nav_menus_created_posts']['value'] as $post_id ) {
if ( empty( $post_id ) || 'auto-draft' !== get_post_status( $post_id ) ) {
continue;
}
$wpdb->update(
$wpdb->posts,
$post_args,
array( 'ID' => $post_id )
);
clean_post_cache( $post_id );
}
}
```
| Uses | Description |
| --- | --- |
| [clean\_post\_cache()](clean_post_cache) wp-includes/post.php | Will clean the post in the cache. |
| [wp\_trash\_post()](wp_trash_post) wp-includes/post.php | Moves a post or page to the Trash |
| [get\_post\_status()](get_post_status) wp-includes/post.php | Retrieves the post status based on the post ID. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Introduced. |
wordpress home_url( string $path = '', string|null $scheme = null ): string home\_url( string $path = '', string|null $scheme = null ): string
==================================================================
Retrieves the URL for the current site where the front end is accessible.
Returns the ‘home’ option with the appropriate protocol. The protocol will be ‘https’ if [is\_ssl()](is_ssl) evaluates to true; otherwise, it will be the same as the ‘home’ option.
If `$scheme` is ‘http’ or ‘https’, [is\_ssl()](is_ssl) is overridden.
`$path` string Optional Path relative to the home URL. Default: `''`
`$scheme` string|null Optional Scheme to give the home URL context. Accepts `'http'`, `'https'`, `'relative'`, `'rest'`, or null. Default: `null`
string Home URL link with optional path appended.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function home_url( $path = '', $scheme = null ) {
return get_home_url( null, $path, $scheme );
}
```
| 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. |
| 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\_theme\_json\_webfonts\_handler()](_wp_theme_json_webfonts_handler) wp-includes/script-loader.php | Runs the theme.json webfonts handler. |
| [wp\_update\_https\_detection\_errors()](wp_update_https_detection_errors) wp-includes/https-detection.php | Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors. |
| [wp\_is\_home\_url\_using\_https()](wp_is_home_url_using_https) wp-includes/https-detection.php | Checks whether the current site URL is using HTTPS. |
| [wp\_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\_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. |
| [WP\_Sitemaps\_Provider::get\_sitemap\_url()](../classes/wp_sitemaps_provider/get_sitemap_url) wp-includes/sitemaps/class-wp-sitemaps-provider.php | Gets the URL of a sitemap entry. |
| [WP\_Sitemaps\_Index::get\_index\_url()](../classes/wp_sitemaps_index/get_index_url) wp-includes/sitemaps/class-wp-sitemaps-index.php | Builds the URL for the sitemap index. |
| [WP\_Sitemaps\_Renderer::get\_sitemap\_index\_stylesheet\_url()](../classes/wp_sitemaps_renderer/get_sitemap_index_stylesheet_url) wp-includes/sitemaps/class-wp-sitemaps-renderer.php | Gets the URL for the sitemap index stylesheet. |
| [WP\_Sitemaps\_Renderer::get\_sitemap\_stylesheet\_url()](../classes/wp_sitemaps_renderer/get_sitemap_stylesheet_url) wp-includes/sitemaps/class-wp-sitemaps-renderer.php | Gets the URL for the sitemap stylesheet. |
| [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\_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\_rel\_callback()](wp_rel_callback) wp-includes/formatting.php | Callback to add a rel attribute to HTML A element. |
| [get\_self\_link()](get_self_link) wp-includes/feed.php | Returns the link for the currently displayed feed. |
| [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\_Recovery\_Mode\_Email\_Service::send\_recovery\_mode\_email()](../classes/wp_recovery_mode_email_service/send_recovery_mode_email) wp-includes/class-wp-recovery-mode-email-service.php | Sends the Recovery Mode email to the site admin email address. |
| [\_wp\_privacy\_send\_request\_confirmation\_notification()](_wp_privacy_send_request_confirmation_notification) wp-includes/user.php | Notifies the site administrator via email when a request is confirmed. |
| [\_wp\_privacy\_send\_erasure\_fulfillment\_notification()](_wp_privacy_send_erasure_fulfillment_notification) wp-includes/user.php | Notifies the user when their erasure request is fulfilled. |
| [wp\_send\_user\_request()](wp_send_user_request) wp-includes/user.php | Send a confirmation request email to confirm an action. |
| [wp\_privacy\_send\_personal\_data\_export\_email()](wp_privacy_send_personal_data_export_email) wp-admin/includes/privacy-tools.php | Send an email to the user with a link to the personal data export file |
| [wp\_site\_admin\_email\_change\_notification()](wp_site_admin_email_change_notification) wp-includes/functions.php | Sends an email to the old site admin email address when the site admin email address changes. |
| [wp\_network\_admin\_email\_change\_notification()](wp_network_admin_email_change_notification) wp-includes/ms-functions.php | Sends an email to the old network admin email address when the network admin email address changes. |
| [wp\_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\_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. |
| [WP\_Customize\_Manager::is\_cross\_domain()](../classes/wp_customize_manager/is_cross_domain) wp-includes/class-wp-customize-manager.php | Determines whether the admin and the frontend are on different domains. |
| [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. |
| [get\_theme\_starter\_content()](get_theme_starter_content) wp-includes/theme.php | Expands a theme’s starter content configuration using core-provided data. |
| [the\_embed\_site\_title()](the_embed_site_title) wp-includes/embed.php | Prints the necessary markup for the site title in an embed template. |
| [get\_custom\_logo()](get_custom_logo) wp-includes/general-template.php | Returns a custom logo, linked to home unless the theme supports removing the link on the home page. |
| [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::get\_preview\_url()](../classes/wp_customize_manager/get_preview_url) wp-includes/class-wp-customize-manager.php | Gets the initial URL to be previewed. |
| [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\_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::get\_index()](../classes/wp_rest_server/get_index) wp-includes/rest-api/class-wp-rest-server.php | Retrieves the site index. |
| [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. |
| [login\_footer()](login_footer) wp-login.php | Outputs the footer for the login page. |
| [confirm\_another\_blog\_signup()](confirm_another_blog_signup) wp-signup.php | Shows a message confirming that the new site has been created. |
| [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. |
| [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. |
| [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\_check\_browser\_version()](wp_check_browser_version) wp-admin/includes/dashboard.php | Checks if the user needs a browser update. |
| [plugins\_api()](plugins_api) wp-admin/includes/plugin-install.php | Retrieves plugin installer pages from the WordPress.org Plugins API. |
| [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\_get\_popular\_importers()](wp_get_popular_importers) wp-admin/includes/import.php | Returns a list from WordPress.org of popular importer plugins. |
| [admin\_created\_user\_email()](admin_created_user_email) wp-admin/includes/user.php | |
| [wp\_credits()](wp_credits) wp-admin/includes/credits.php | Retrieve the contributor credits. |
| [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\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| [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\_support\_script()](wp_customize_support_script) wp-includes/theme.php | Prints a script to check whether or not the Customizer is supported, and apply either the no-customize-support or customize-support class to the body. |
| [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| [\_wp\_customize\_loader\_settings()](_wp_customize_loader_settings) wp-includes/theme.php | Adds settings for the customize-loader script. |
| [wp\_validate\_redirect()](wp_validate_redirect) wp-includes/pluggable.php | Validates a URL for use in a redirect. |
| [wp\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [get\_search\_form()](get_search_form) wp-includes/general-template.php | Displays search form. |
| [wp\_admin\_bar\_dashboard\_view\_site\_menu()](wp_admin_bar_dashboard_view_site_menu) wp-includes/deprecated.php | Add the “Dashboard”/”Visit Site” menu. |
| [WP::parse\_request()](../classes/wp/parse_request) wp-includes/class-wp.php | Parses the request to find the correct WordPress query. |
| [wp\_get\_referer()](wp_get_referer) wp-includes/functions.php | Retrieves referer from ‘\_wp\_http\_referer’ or HTTP referer. |
| [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\_Categories::widget()](../classes/wp_widget_categories/widget) wp-includes/widgets/class-wp-widget-categories.php | Outputs the content for the current Categories widget instance. |
| [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| [wp\_get\_shortlink()](wp_get_shortlink) wp-includes/link-template.php | Returns a shortlink for a post, page, attachment, or site. |
| [network\_home\_url()](network_home_url) wp-includes/link-template.php | Retrieves the home URL for the current network. |
| [get\_pagenum\_link()](get_pagenum_link) wp-includes/link-template.php | Retrieves the link for a page number. |
| [get\_post\_type\_archive\_link()](get_post_type_archive_link) wp-includes/link-template.php | Retrieves the permalink for a post type archive. |
| [get\_term\_feed\_link()](get_term_feed_link) wp-includes/link-template.php | Retrieves the feed link for a term. |
| [get\_search\_link()](get_search_link) wp-includes/link-template.php | Retrieves the permalink for a search. |
| [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\_feed\_link()](get_feed_link) wp-includes/link-template.php | Retrieves the permalink for the feed type. |
| [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\_post\_permalink()](get_post_permalink) wp-includes/link-template.php | Retrieves the permalink for a post of a custom post type. |
| [get\_page\_link()](get_page_link) wp-includes/link-template.php | Retrieves the permalink for the current page or page ID. |
| [\_get\_page\_link()](_get_page_link) wp-includes/link-template.php | Retrieves the page permalink. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [get\_year\_link()](get_year_link) wp-includes/link-template.php | Retrieves the permalink for the year archives. |
| [WP\_Admin\_Bar::initialize()](../classes/wp_admin_bar/initialize) wp-includes/class-wp-admin-bar.php | Initializes the admin bar. |
| [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. |
| [get\_allowed\_http\_origins()](get_allowed_http_origins) wp-includes/http.php | Retrieve list of allowed HTTP origins. |
| [WP\_oEmbed::\_\_construct()](../classes/wp_oembed/__construct) wp-includes/class-wp-oembed.php | Constructor. |
| [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\_search\_menu()](wp_admin_bar_search_menu) wp-includes/admin-bar.php | Adds search form. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [\_wp\_menu\_item\_classes\_by\_context()](_wp_menu_item_classes_by_context) wp-includes/nav-menu-template.php | Adds the class property classes for the current context, if applicable. |
| [wp\_page\_menu()](wp_page_menu) wp-includes/post-template.php | Displays or retrieves a list of pages with an optional home link. |
| [is\_local\_attachment()](is_local_attachment) wp-includes/post.php | Determines whether an attachment URI is local and really 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. |
| [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. |
| [WP\_Rewrite::rewrite\_rules()](../classes/wp_rewrite/rewrite_rules) wp-includes/class-wp-rewrite.php | Constructs rewrite matches and queries from 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\_redirect\_admin\_locations()](wp_redirect_admin_locations) wp-includes/canonical.php | Redirects a variety of shorthand URLs to the admin. |
| [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}/. |
| [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\_xmlrpc\_server::wp\_getUsersBlogs()](../classes/wp_xmlrpc_server/wp_getusersblogs) wp-includes/class-wp-xmlrpc-server.php | Retrieve the blogs of the user. |
| [weblog\_ping()](weblog_ping) wp-includes/comment.php | Sends a pingback. |
| [wp\_set\_comment\_cookies()](wp_set_comment_cookies) wp-includes/comment.php | Sets the cookies used to store an unauthenticated commentator’s identity. Typically used to recall previous comments by this commentator that are still held in moderation. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress the_comments_pagination( array $args = array() ) the\_comments\_pagination( array $args = array() )
==================================================
Displays a paginated navigation to next/previous set of comments, when applicable.
`$args` array Optional See [get\_the\_comments\_pagination()](get_the_comments_pagination) for available arguments. More Arguments from get\_the\_comments\_pagination( ... $args ) Default pagination arguments.
* `screen_reader_text`stringScreen reader text for the nav element. Default 'Comments navigation'.
* `aria_label`stringARIA label text for the nav element. Default `'Comments'`.
* `class`stringCustom class for the nav element. Default `'comments-pagination'`.
Default: `array()`
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function the_comments_pagination( $args = array() ) {
echo get_the_comments_pagination( $args );
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_comments\_pagination()](get_the_comments_pagination) wp-includes/link-template.php | Retrieves a paginated navigation to next/previous set of comments, when applicable. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress automatic_feed_links( bool $add = true ) automatic\_feed\_links( bool $add = true )
==========================================
This function has been deprecated. Use [add\_theme\_support()](add_theme_support) instead.
Enable/disable automatic general feed link outputting.
* [add\_theme\_support()](add_theme_support)
`$add` bool Optional Add or remove links. Default: `true`
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function automatic_feed_links( $add = true ) {
_deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" );
if ( $add )
add_theme_support( 'automatic-feed-links' );
else
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+.
}
```
| Uses | Description |
| --- | --- |
| [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. |
| [remove\_action()](remove_action) wp-includes/plugin.php | Removes a callback function from an action hook. |
| [\_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 [add\_theme\_support()](add_theme_support) |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress is_page( int|string|int[]|string[] $page = '' ): bool is\_page( int|string|int[]|string[] $page = '' ): bool
======================================================
Determines whether the query is for an existing single page.
If the $page parameter is specified, this function will additionally check if the query is for one of the pages 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\_single()](is_single)
* [is\_singular()](is_singular)
`$page` int|string|int[]|string[] Optional Page ID, title, slug, or array of such to check against. Default: `''`
bool Whether the query is for an existing single page.
* Will return true if an empty value is passed
* Due to certain global variables being overwritten during The Loop, [is\_page()](is_page) will not work. In order to call it after The Loop, you must call [wp\_reset\_query()](wp_reset_query) first.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_page( $page = '' ) {
global $wp_query;
if ( ! isset( $wp_query ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
return false;
}
return $wp_query->is_page( $page );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_page()](../classes/wp_query/is_page) wp-includes/class-wp-query.php | Is the query for an existing single 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\_title()](wp_title) wp-includes/general-template.php | Displays or retrieves page title for all areas of blog. |
| [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. |
| [comments\_template()](comments_template) wp-includes/comment-template.php | Loads the comment template specified in $file. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress media_sideload_image( string $file, int $post_id, string $desc = null, string $return_type = 'html' ): string|int|WP_Error media\_sideload\_image( string $file, int $post\_id, string $desc = null, string $return\_type = 'html' ): string|int|WP\_Error
===============================================================================================================================
Downloads an image from the specified URL, saves it as an attachment, and optionally attaches it to a post.
`$file` string Required The URL of the image to download. `$post_id` int Optional The post ID the media is to be associated with. `$desc` string Optional Description of the image. Default: `null`
`$return_type` string Optional Accepts `'html'` (image tag html) or `'src'` (URL), or `'id'` (attachment ID). Default `'html'`. Default: `'html'`
string|int|[WP\_Error](../classes/wp_error) Populated HTML img tag, attachment ID, or attachment source on success, [WP\_Error](../classes/wp_error) object otherwise.
If you want to use this function outside of the context of /wp-admin/ (typically if you are writing a more advanced custom importer script) you need to include media.php and depending includes:
```
require_once(ABSPATH . 'wp-admin/includes/media.php');
require_once(ABSPATH . 'wp-admin/includes/file.php');
require_once(ABSPATH . 'wp-admin/includes/image.php');
```
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function media_sideload_image( $file, $post_id = 0, $desc = null, $return_type = 'html' ) {
if ( ! empty( $file ) ) {
$allowed_extensions = array( 'jpg', 'jpeg', 'jpe', 'png', 'gif', 'webp' );
/**
* Filters the list of allowed file extensions when sideloading an image from a URL.
*
* The default allowed extensions are:
*
* - `jpg`
* - `jpeg`
* - `jpe`
* - `png`
* - `gif`
*
* @since 5.6.0
*
* @param string[] $allowed_extensions Array of allowed file extensions.
* @param string $file The URL of the image to download.
*/
$allowed_extensions = apply_filters( 'image_sideload_extensions', $allowed_extensions, $file );
$allowed_extensions = array_map( 'preg_quote', $allowed_extensions );
// Set variables for storage, fix file filename for query strings.
preg_match( '/[^\?]+\.(' . implode( '|', $allowed_extensions ) . ')\b/i', $file, $matches );
if ( ! $matches ) {
return new WP_Error( 'image_sideload_failed', __( 'Invalid image URL.' ) );
}
$file_array = array();
$file_array['name'] = wp_basename( $matches[0] );
// Download file to temp location.
$file_array['tmp_name'] = download_url( $file );
// If error storing temporarily, return the error.
if ( is_wp_error( $file_array['tmp_name'] ) ) {
return $file_array['tmp_name'];
}
// Do the validation and storage stuff.
$id = media_handle_sideload( $file_array, $post_id, $desc );
// If error storing permanently, unlink.
if ( is_wp_error( $id ) ) {
@unlink( $file_array['tmp_name'] );
return $id;
}
// Store the original attachment source in meta.
add_post_meta( $id, '_source_url', $file );
// If attachment ID was requested, return it.
if ( 'id' === $return_type ) {
return $id;
}
$src = wp_get_attachment_url( $id );
}
// Finally, check to make sure the file has been saved, then return the HTML.
if ( ! empty( $src ) ) {
if ( 'src' === $return_type ) {
return $src;
}
$alt = isset( $desc ) ? esc_attr( $desc ) : '';
$html = "<img src='$src' alt='$alt' />";
return $html;
} else {
return new WP_Error( 'image_sideload_failed' );
}
}
```
[apply\_filters( 'image\_sideload\_extensions', string[] $allowed\_extensions, string $file )](../hooks/image_sideload_extensions)
Filters the list of allowed file extensions when sideloading an image from a URL.
| Uses | Description |
| --- | --- |
| [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) . |
| [download\_url()](download_url) wp-admin/includes/file.php | Downloads a URL to a local temporary file using the WordPress HTTP API. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [add\_post\_meta()](add_post_meta) wp-includes/post.php | Adds a meta field to the given post. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [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.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | The original URL of the attachment is stored in the `_source_url` post meta value. |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | The `$post_id` parameter was made optional. |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Introduced the `'id'` option for the `$return_type` parameter. |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced the `$return_type` parameter. |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress _n_noop( string $singular, string $plural, string $domain = null ): array \_n\_noop( string $singular, string $plural, string $domain = null ): array
===========================================================================
Registers plural strings in POT file, but does not translate them.
Used when you want to keep structures with translatable plural strings and use them later when the number is known.
Example:
```
$message = _n_noop( '%s post', '%s posts', 'text-domain' );
...
printf( translate_nooped_plural( $message, $count, 'text-domain' ), number_format_i18n( $count ) );
```
`$singular` string Required Singular form to be localized. `$plural` string Required Plural form to be localized. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings.
Default: `null`
array Array of translation information for the strings.
* stringSingular form to be localized. No longer used.
* `1`stringPlural form to be localized. No longer used.
* `singular`stringSingular form to be localized.
* `plural`stringPlural form to be localized.
* `context`nullContext information for the translators.
* `domain`string|nullText domain.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function _n_noop( $singular, $plural, $domain = null ) {
return array(
0 => $singular,
1 => $plural,
'singular' => $singular,
'plural' => $plural,
'context' => null,
'domain' => $domain,
);
}
```
| Used By | Description |
| --- | --- |
| [WP\_Widget\_Media::get\_l10n\_defaults()](../classes/wp_widget_media/get_l10n_defaults) wp-includes/widgets/class-wp-widget-media.php | Returns the default localized strings used by the widget. |
| [WP\_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\_Widget\_Media\_Audio::\_\_construct()](../classes/wp_widget_media_audio/__construct) wp-includes/widgets/class-wp-widget-media-audio.php | Constructor. |
| [WP\_Widget\_Media\_Video::\_\_construct()](../classes/wp_widget_media_video/__construct) wp-includes/widgets/class-wp-widget-media-video.php | Constructor. |
| [WP\_Widget\_Media\_Image::\_\_construct()](../classes/wp_widget_media_image/__construct) wp-includes/widgets/class-wp-widget-media-image.php | Constructor. |
| [wp\_generate\_tag\_cloud()](wp_generate_tag_cloud) wp-includes/category-template.php | Generates a tag cloud (heatmap) from provided data. |
| [\_\_ngettext\_noop()](__ngettext_noop) wp-includes/deprecated.php | Register plural strings in POT file, but don’t translate them. |
| [get\_post\_mime\_types()](get_post_mime_types) wp-includes/post.php | Gets default post mime types. |
| [register\_post\_status()](register_post_status) wp-includes/post.php | Registers a post status. Do not use before init. |
| [create\_initial\_post\_types()](create_initial_post_types) wp-includes/post.php | Creates the initial post types when ‘init’ action is fired. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_set_sidebars_widgets( array $sidebars_widgets ) wp\_set\_sidebars\_widgets( array $sidebars\_widgets )
======================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Set the sidebar widget option to update sidebars.
`$sidebars_widgets` array Required Sidebar widgets and their settings. File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function wp_set_sidebars_widgets( $sidebars_widgets ) {
global $_wp_sidebars_widgets;
// Clear cached value used in wp_get_sidebars_widgets().
$_wp_sidebars_widgets = null;
if ( ! isset( $sidebars_widgets['array_version'] ) ) {
$sidebars_widgets['array_version'] = 3;
}
update_option( 'sidebars_widgets', $sidebars_widgets );
}
```
| Uses | Description |
| --- | --- |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| Used By | Description |
| --- | --- |
| [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\_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\_ajax\_widgets\_order()](wp_ajax_widgets_order) wp-admin/includes/ajax-actions.php | Ajax handler for saving the widgets order. |
| [retrieve\_widgets()](retrieve_widgets) wp-includes/widgets.php | 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. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress wp_create_term( string $tag_name, string $taxonomy = 'post_tag' ): array|WP_Error wp\_create\_term( string $tag\_name, string $taxonomy = 'post\_tag' ): array|WP\_Error
======================================================================================
Adds a new term to the database if it does not already exist.
`$tag_name` string Required The term name. `$taxonomy` string Optional The taxonomy within which to create the term. Default `'post_tag'`. Default: `'post_tag'`
array|[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 wp_create_term( $tag_name, $taxonomy = 'post_tag' ) {
$id = term_exists( $tag_name, $taxonomy );
if ( $id ) {
return $id;
}
return wp_insert_term( $tag_name, $taxonomy );
}
```
| Uses | Description |
| --- | --- |
| [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. |
| [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. |
| Used By | Description |
| --- | --- |
| [wp\_create\_tag()](wp_create_tag) wp-admin/includes/taxonomy.php | Adds a new tag to the database if it does not already exist. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress rest_validate_request_arg( mixed $value, WP_REST_Request $request, string $param ): true|WP_Error rest\_validate\_request\_arg( mixed $value, WP\_REST\_Request $request, string $param ): true|WP\_Error
=======================================================================================================
Validate a request argument based on details registered to the route.
`$value` mixed Required `$request` [WP\_REST\_Request](../classes/wp_rest_request) Required `$param` string Required 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_request_arg( $value, $request, $param ) {
$attributes = $request->get_attributes();
if ( ! isset( $attributes['args'][ $param ] ) || ! is_array( $attributes['args'][ $param ] ) ) {
return true;
}
$args = $attributes['args'][ $param ];
return rest_validate_value_from_schema( $value, $args, $param );
}
```
| Uses | Description |
| --- | --- |
| [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Menus\_Controller::get\_item\_schema()](../classes/wp_rest_menus_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Retrieves the term’s schema, conforming to JSON Schema. |
| [WP\_REST\_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. |
| [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\_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\_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. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
| programming_docs |
wordpress translate_nooped_plural( array $nooped_plural, int $count, string $domain = 'default' ): string translate\_nooped\_plural( array $nooped\_plural, int $count, string $domain = 'default' ): string
==================================================================================================
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) .
Used when you want to use a translatable plural string once the number is known.
Example:
```
$message = _n_noop( '%s post', '%s posts', 'text-domain' );
...
printf( translate_nooped_plural( $message, $count, 'text-domain' ), number_format_i18n( $count ) );
```
`$nooped_plural` array Required Array that is usually a return value from [\_n\_noop()](_n_noop) or [\_nx\_noop()](_nx_noop) .
* `singular`stringSingular form to be localized.
* `plural`stringPlural form to be localized.
* `context`string|nullContext information for the translators.
* `domain`string|nullText domain.
`$count` int Required Number of objects. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings. If $nooped\_plural contains a text domain passed to [\_n\_noop()](_n_noop) or [\_nx\_noop()](_nx_noop) , it will override this value. Default `'default'`. More Arguments from \_n\_noop( ... $domain ) Text domain. Unique identifier for retrieving translated strings.
Default: `'default'`
string Either $singular or $plural translated text.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) {
if ( $nooped_plural['domain'] ) {
$domain = $nooped_plural['domain'];
}
if ( $nooped_plural['context'] ) {
return _nx( $nooped_plural['singular'], $nooped_plural['plural'], $count, $nooped_plural['context'], $domain );
} else {
return _n( $nooped_plural['singular'], $nooped_plural['plural'], $count, $domain );
}
}
```
| Uses | Description |
| --- | --- |
| [\_nx()](_nx) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number, with gettext context. |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| Used By | Description |
| --- | --- |
| [WP\_MS\_Sites\_List\_Table::get\_views()](../classes/wp_ms_sites_list_table/get_views) wp-admin/includes/class-wp-ms-sites-list-table.php | Gets links to filter sites by status. |
| [WP\_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\_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. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| [WP\_Comments\_List\_Table::get\_views()](../classes/wp_comments_list_table/get_views) wp-admin/includes/class-wp-comments-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 | |
| [wp\_generate\_tag\_cloud()](wp_generate_tag_cloud) wp-includes/category-template.php | Generates a tag cloud (heatmap) from provided data. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress debug_fclose( mixed $fp ) debug\_fclose( mixed $fp )
==========================
This function has been deprecated. Use [error\_log()](https://www.php.net/manual/en/function.error-log.php) instead.
Close the debugging file handle.
* [error\_log()](https://www.php.net/manual/en/function.error-log.php)
`$fp` mixed Required Unused. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function debug_fclose( $fp ) {
_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
}
```
| 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/) | Use error\_log() |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_read_video_metadata( string $file ): array|false wp\_read\_video\_metadata( string $file ): array|false
======================================================
Retrieves metadata from a video file’s ID3 tags.
`$file` string Required Path to file. array|false Returns array of metadata, if found.
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function wp_read_video_metadata( $file ) {
if ( ! file_exists( $file ) ) {
return false;
}
$metadata = array();
if ( ! defined( 'GETID3_TEMP_DIR' ) ) {
define( 'GETID3_TEMP_DIR', get_temp_dir() );
}
if ( ! class_exists( 'getID3', false ) ) {
require ABSPATH . WPINC . '/ID3/getid3.php';
}
$id3 = new getID3();
// Required to get the `created_timestamp` value.
$id3->options_audiovideo_quicktime_ReturnAtomData = true; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
$data = $id3->analyze( $file );
if ( isset( $data['video']['lossless'] ) ) {
$metadata['lossless'] = $data['video']['lossless'];
}
if ( ! empty( $data['video']['bitrate'] ) ) {
$metadata['bitrate'] = (int) $data['video']['bitrate'];
}
if ( ! empty( $data['video']['bitrate_mode'] ) ) {
$metadata['bitrate_mode'] = $data['video']['bitrate_mode'];
}
if ( ! empty( $data['filesize'] ) ) {
$metadata['filesize'] = (int) $data['filesize'];
}
if ( ! empty( $data['mime_type'] ) ) {
$metadata['mime_type'] = $data['mime_type'];
}
if ( ! empty( $data['playtime_seconds'] ) ) {
$metadata['length'] = (int) round( $data['playtime_seconds'] );
}
if ( ! empty( $data['playtime_string'] ) ) {
$metadata['length_formatted'] = $data['playtime_string'];
}
if ( ! empty( $data['video']['resolution_x'] ) ) {
$metadata['width'] = (int) $data['video']['resolution_x'];
}
if ( ! empty( $data['video']['resolution_y'] ) ) {
$metadata['height'] = (int) $data['video']['resolution_y'];
}
if ( ! empty( $data['fileformat'] ) ) {
$metadata['fileformat'] = $data['fileformat'];
}
if ( ! empty( $data['video']['dataformat'] ) ) {
$metadata['dataformat'] = $data['video']['dataformat'];
}
if ( ! empty( $data['video']['encoder'] ) ) {
$metadata['encoder'] = $data['video']['encoder'];
}
if ( ! empty( $data['video']['codec'] ) ) {
$metadata['codec'] = $data['video']['codec'];
}
if ( ! empty( $data['audio'] ) ) {
unset( $data['audio']['streams'] );
$metadata['audio'] = $data['audio'];
}
if ( empty( $metadata['created_timestamp'] ) ) {
$created_timestamp = wp_get_media_creation_timestamp( $data );
if ( false !== $created_timestamp ) {
$metadata['created_timestamp'] = $created_timestamp;
}
}
wp_add_id3_tag_data( $metadata, $data );
$file_format = isset( $metadata['fileformat'] ) ? $metadata['fileformat'] : null;
/**
* Filters the array of metadata retrieved from a video.
*
* In core, usually this selection is what is stored.
* More complete data can be parsed from the `$data` parameter.
*
* @since 4.9.0
*
* @param array $metadata Filtered video metadata.
* @param string $file Path to video file.
* @param string|null $file_format File format of video, as analyzed by getID3.
* Null if unknown.
* @param array $data Raw metadata from getID3.
*/
return apply_filters( 'wp_read_video_metadata', $metadata, $file, $file_format, $data );
}
```
[apply\_filters( 'wp\_read\_video\_metadata', array $metadata, string $file, string|null $file\_format, array $data )](../hooks/wp_read_video_metadata)
Filters the array of metadata retrieved from a video.
| Uses | Description |
| --- | --- |
| [wp\_get\_media\_creation\_timestamp()](wp_get_media_creation_timestamp) wp-admin/includes/media.php | Parses creation date from media metadata. |
| [wp\_add\_id3\_tag\_data()](wp_add_id3_tag_data) wp-admin/includes/media.php | Parses ID3v2, ID3v1, and getID3 comments to extract usable data. |
| [get\_temp\_dir()](get_temp_dir) wp-includes/functions.php | Determines a writable directory for temporary files. |
| [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 |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress _post_states( WP_Post $post, bool $display = true ): string \_post\_states( WP\_Post $post, bool $display = true ): string
==============================================================
Echoes or returns the post states as HTML.
* [get\_post\_states()](get_post_states)
`$post` [WP\_Post](../classes/wp_post) Required The post to retrieve states for. `$display` bool Optional Whether to display the post states as an HTML string.
Default: `true`
string Post states string.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function _post_states( $post, $display = true ) {
$post_states = get_post_states( $post );
$post_states_string = '';
if ( ! empty( $post_states ) ) {
$state_count = count( $post_states );
$i = 0;
$post_states_string .= ' — ';
foreach ( $post_states as $state ) {
++$i;
$separator = ( $i < $state_count ) ? ', ' : '';
$post_states_string .= "<span class='post-state'>{$state}{$separator}</span>";
}
}
if ( $display ) {
echo $post_states_string;
}
return $post_states_string;
}
```
| Uses | Description |
| --- | --- |
| [get\_post\_states()](get_post_states) wp-admin/includes/template.php | Retrieves an array of post states from a post. |
| Used By | Description |
| --- | --- |
| [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. |
| [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. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added the `$display` parameter and a return value. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress get_block_file_template( string $id, string $template_type = 'wp_template' ): WP_Block_Template|null get\_block\_file\_template( string $id, string $template\_type = 'wp\_template' ): WP\_Block\_Template|null
===========================================================================================================
Retrieves a unified template object based on a theme file.
This is a fallback of [get\_block\_template()](get_block_template) , used when no templates are found in the database.
`$id` string Required Template unique identifier (example: theme\_slug//template\_slug). `$template_type` string Optional Template type: `'wp_template'` or '`wp_template_part'`.
Default `'wp_template'`. Default: `'wp_template'`
[WP\_Block\_Template](../classes/wp_block_template)|null The found block template, or null if there isn't one.
File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function get_block_file_template( $id, $template_type = 'wp_template' ) {
/**
* Filters the block template object before the theme file discovery takes place.
*
* Return a non-null value to bypass the WordPress theme file discovery.
*
* @since 5.9.0
*
* @param WP_Block_Template|null $block_template Return block template object to short-circuit the default query,
* or null to allow WP to run its normal queries.
* @param string $id Template unique identifier (example: theme_slug//template_slug).
* @param string $template_type Template type: `'wp_template'` or '`wp_template_part'`.
*/
$block_template = apply_filters( 'pre_get_block_file_template', null, $id, $template_type );
if ( ! is_null( $block_template ) ) {
return $block_template;
}
$parts = explode( '//', $id, 2 );
if ( count( $parts ) < 2 ) {
/** This filter is documented in wp-includes/block-template-utils.php */
return apply_filters( 'get_block_file_template', null, $id, $template_type );
}
list( $theme, $slug ) = $parts;
if ( wp_get_theme()->get_stylesheet() !== $theme ) {
/** This filter is documented in wp-includes/block-template-utils.php */
return apply_filters( 'get_block_file_template', null, $id, $template_type );
}
$template_file = _get_block_template_file( $template_type, $slug );
if ( null === $template_file ) {
/** This filter is documented in wp-includes/block-template-utils.php */
return apply_filters( 'get_block_file_template', null, $id, $template_type );
}
$block_template = _build_block_template_result_from_file( $template_file, $template_type );
/**
* Filters the block template object after it has been (potentially) fetched from the theme file.
*
* @since 5.9.0
*
* @param WP_Block_Template|null $block_template The found block template, or null if there is none.
* @param string $id Template unique identifier (example: theme_slug//template_slug).
* @param string $template_type Template type: `'wp_template'` or '`wp_template_part'`.
*/
return apply_filters( 'get_block_file_template', $block_template, $id, $template_type );
}
```
[apply\_filters( 'get\_block\_file\_template', WP\_Block\_Template|null $block\_template, string $id, string $template\_type )](../hooks/get_block_file_template)
Filters the block template object after it has been (potentially) fetched from the theme file.
[apply\_filters( 'pre\_get\_block\_file\_template', WP\_Block\_Template|null $block\_template, string $id, string $template\_type )](../hooks/pre_get_block_file_template)
Filters the block template object before the theme file discovery takes place.
| Uses | Description |
| --- | --- |
| [\_build\_block\_template\_result\_from\_file()](_build_block_template_result_from_file) wp-includes/block-template-utils.php | Builds a unified template object based on a theme file. |
| [\_get\_block\_template\_file()](_get_block_template_file) wp-includes/block-template-utils.php | Retrieves the template file from the theme for a given slug. |
| [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\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Templates\_Controller::get\_item()](../classes/wp_rest_templates_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Returns the given template |
| [get\_block\_template()](get_block_template) wp-includes/block-template-utils.php | Retrieves a single unified template object using its id. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress auth_redirect() auth\_redirect()
================
Checks if a user is logged in, if not it redirects them to the login page.
When this code is called from a page, it checks to see if the user viewing the page is logged in.
If the user is not logged in, they are redirected to the login page. The user is redirected in such a way that, upon logging in, they will be sent directly to the page they were originally trying to access.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function auth_redirect() {
$secure = ( is_ssl() || force_ssl_admin() );
/**
* Filters whether to use a secure authentication redirect.
*
* @since 3.1.0
*
* @param bool $secure Whether to use a secure authentication redirect. Default false.
*/
$secure = apply_filters( 'secure_auth_redirect', $secure );
// If https is required and request is http, redirect.
if ( $secure && ! is_ssl() && false !== strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) ) {
if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
exit;
} else {
wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
exit;
}
}
/**
* Filters the authentication redirect scheme.
*
* @since 2.9.0
*
* @param string $scheme Authentication redirect scheme. Default empty.
*/
$scheme = apply_filters( 'auth_redirect_scheme', '' );
$user_id = wp_validate_auth_cookie( '', $scheme );
if ( $user_id ) {
/**
* Fires before the authentication redirect.
*
* @since 2.8.0
*
* @param int $user_id User ID.
*/
do_action( 'auth_redirect', $user_id );
// If the user wants ssl but the session is not ssl, redirect.
if ( ! $secure && get_user_option( 'use_ssl', $user_id ) && false !== strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) ) {
if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
exit;
} else {
wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
exit;
}
}
return; // The cookie is good, so we're done.
}
// The cookie is no good, so force login.
nocache_headers();
$redirect = ( strpos( $_SERVER['REQUEST_URI'], '/options.php' ) && wp_get_referer() ) ? wp_get_referer() : set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$login_url = wp_login_url( $redirect, true );
wp_redirect( $login_url );
exit;
}
```
[do\_action( 'auth\_redirect', int $user\_id )](../hooks/auth_redirect)
Fires before the authentication redirect.
[apply\_filters( 'auth\_redirect\_scheme', string $scheme )](../hooks/auth_redirect_scheme)
Filters the authentication redirect scheme.
[apply\_filters( 'secure\_auth\_redirect', bool $secure )](../hooks/secure_auth_redirect)
Filters whether to use a secure authentication redirect.
| Uses | Description |
| --- | --- |
| [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. |
| [wp\_validate\_auth\_cookie()](wp_validate_auth_cookie) wp-includes/pluggable.php | Validates authentication cookie. |
| [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. |
| [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. |
| [wp\_get\_referer()](wp_get_referer) wp-includes/functions.php | Retrieves referer from ‘\_wp\_http\_referer’ or HTTP referer. |
| [nocache\_headers()](nocache_headers) wp-includes/functions.php | Sets the headers to prevent caching for the different browsers. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [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\_Customize\_Manager::setup\_theme()](../classes/wp_customize_manager/setup_theme) wp-includes/class-wp-customize-manager.php | Starts preview and customize theme. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress get_previous_posts_link( string $label = null ): string|void get\_previous\_posts\_link( string $label = null ): string|void
===============================================================
Retrieves the previous posts page link.
`$label` string Optional Previous page link text. Default: `null`
string|void HTML-formatted previous page link.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_previous_posts_link( $label = null ) {
global $paged;
if ( null === $label ) {
$label = __( '« Previous Page' );
}
if ( ! is_single() && $paged > 1 ) {
/**
* Filters the anchor tag attributes for the previous posts page link.
*
* @since 2.7.0
*
* @param string $attributes Attributes for the anchor tag.
*/
$attr = apply_filters( 'previous_posts_link_attributes', '' );
return '<a href="' . previous_posts( false ) . "\" $attr>" . preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) . '</a>';
}
}
```
[apply\_filters( 'previous\_posts\_link\_attributes', string $attributes )](../hooks/previous_posts_link_attributes)
Filters the anchor tag attributes for the previous posts page link.
| Uses | Description |
| --- | --- |
| [previous\_posts()](previous_posts) wp-includes/link-template.php | Displays or retrieves the previous 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. |
| [previous\_posts\_link()](previous_posts_link) wp-includes/link-template.php | Displays the previous posts page link. |
| [get\_posts\_nav\_link()](get_posts_nav_link) wp-includes/link-template.php | Retrieves the post pages link navigation for previous and next pages. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress type_url_form_audio(): string type\_url\_form\_audio(): string
================================
This function has been deprecated. Use [wp\_media\_insert\_url\_form()](wp_media_insert_url_form) instead.
Handles retrieving the insert-from-URL form for an audio file.
* [wp\_media\_insert\_url\_form()](wp_media_insert_url_form)
string
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function type_url_form_audio() {
_deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('audio')" );
return wp_media_insert_url_form( 'audio' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_media\_insert\_url\_form()](wp_media_insert_url_form) wp-admin/includes/media.php | Creates the form for external url. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress site_url( string $path = '', string|null $scheme = null ): string site\_url( string $path = '', string|null $scheme = null ): string
==================================================================
Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible.
Returns the ‘site\_url’ option with the appropriate protocol, ‘https’ if [is\_ssl()](is_ssl) and ‘http’ otherwise. If $scheme is ‘http’ or ‘https’, [is\_ssl()](is_ssl) is overridden.
`$path` string Optional Path relative to the site URL. Default: `''`
`$scheme` string|null Optional Scheme to give the site URL context. See [set\_url\_scheme()](set_url_scheme) . More Arguments from set\_url\_scheme( ... $scheme ) Scheme to give $url. Currently `'http'`, `'https'`, `'login'`, `'login_post'`, `'admin'`, `'relative'`, `'rest'`, `'rpc'`, or null. Default: `null`
string Site URL link with optional path appended.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function site_url( $path = '', $scheme = null ) {
return get_site_url( null, $path, $scheme );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| 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\_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\_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\_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. |
| [load\_script\_textdomain()](load_script_textdomain) wp-includes/l10n.php | Loads the script translated strings. |
| [wp\_print\_request\_filesystem\_credentials\_modal()](wp_print_request_filesystem_credentials_modal) wp-admin/includes/file.php | Prints the filesystem credentials modal when needed. |
| [spawn\_cron()](spawn_cron) wp-includes/cron.php | Sends a request to run cron through HTTP request that doesn’t halt page loading. |
| [get\_theme\_root\_uri()](get_theme_root_uri) wp-includes/theme.php | Retrieves URI for themes directory. |
| [translate\_smiley()](translate_smiley) wp-includes/formatting.php | Converts one smiley code to the icon graphic file equivalent. |
| [rsd\_link()](rsd_link) wp-includes/general-template.php | Displays the link to the Really Simple Discovery service endpoint. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [wp\_logout\_url()](wp_logout_url) wp-includes/general-template.php | Retrieves the logout URL. |
| [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. |
| [wp\_registration\_url()](wp_registration_url) wp-includes/general-template.php | Returns the URL that allows the user to register on the site. |
| [wp\_login\_form()](wp_login_form) wp-includes/general-template.php | Provides a simple login form for use anywhere within WordPress. |
| [do\_robots()](do_robots) wp-includes/functions.php | Displays the default robots.txt file content. |
| [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. |
| [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. |
| [network\_site\_url()](network_site_url) wp-includes/link-template.php | Retrieves the site URL for the current network. |
| [get\_the\_password\_form()](get_the_password_form) wp-includes/post-template.php | Retrieves protected post password form content. |
| [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\_redirect\_admin\_locations()](wp_redirect_admin_locations) wp-includes/canonical.php | Redirects a variety of shorthand URLs to the admin. |
| [newblog\_notify\_siteadmin()](newblog_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new site has been activated. |
| [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\_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\_getUsersBlogs()](../classes/wp_xmlrpc_server/wp_getusersblogs) wp-includes/class-wp-xmlrpc-server.php | Retrieve the blogs of the user. |
| [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. |
| [wp\_default\_styles()](wp_default_styles) wp-includes/script-loader.php | Assigns default styles to $styles object. |
| [wp\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_ajax_logged_in() wp\_ajax\_logged\_in()
======================
Ajax handler for Customizer preview logged-in 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_logged_in() {
wp_die( 1 );
}
```
| Uses | Description |
| --- | --- |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress _add_post_type_submenus() \_add\_post\_type\_submenus()
=============================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Adds submenus for post types.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function _add_post_type_submenus() {
foreach ( get_post_types( array( 'show_ui' => true ) ) as $ptype ) {
$ptype_obj = get_post_type_object( $ptype );
// Sub-menus only.
if ( ! $ptype_obj->show_in_menu || true === $ptype_obj->show_in_menu ) {
continue;
}
add_submenu_page( $ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype" );
}
}
```
| Uses | Description |
| --- | --- |
| [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. |
| [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_ajax_media_create_image_subsizes() wp\_ajax\_media\_create\_image\_subsizes()
==========================================
Ajax handler for creating missing image sub-sizes for just uploaded images.
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_media_create_image_subsizes() {
check_ajax_referer( 'media-form' );
if ( ! current_user_can( 'upload_files' ) ) {
wp_send_json_error( array( 'message' => __( 'Sorry, you are not allowed to upload files.' ) ) );
}
if ( empty( $_POST['attachment_id'] ) ) {
wp_send_json_error( array( 'message' => __( 'Upload failed. Please reload and try again.' ) ) );
}
$attachment_id = (int) $_POST['attachment_id'];
if ( ! empty( $_POST['_wp_upload_failed_cleanup'] ) ) {
// Upload failed. Cleanup.
if ( wp_attachment_is_image( $attachment_id ) && current_user_can( 'delete_post', $attachment_id ) ) {
$attachment = get_post( $attachment_id );
// Created at most 10 min ago.
if ( $attachment && ( time() - strtotime( $attachment->post_date_gmt ) < 600 ) ) {
wp_delete_attachment( $attachment_id, true );
wp_send_json_success();
}
}
}
// Set a custom header with the attachment_id.
// Used by the browser/client to resume creating image sub-sizes after a PHP fatal error.
if ( ! headers_sent() ) {
header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id );
}
// This can still be pretty slow and cause timeout or out of memory errors.
// The js that handles the response would need to also handle HTTP 500 errors.
wp_update_image_subsizes( $attachment_id );
if ( ! empty( $_POST['_legacy_support'] ) ) {
// The old (inline) uploader. Only needs the attachment_id.
$response = array( 'id' => $attachment_id );
} else {
// Media modal and Media Library grid view.
$response = wp_prepare_attachment_for_js( $attachment_id );
if ( ! $response ) {
wp_send_json_error( array( 'message' => __( 'Upload failed.' ) ) );
}
}
// At this point the image has been uploaded successfully.
wp_send_json_success( $response );
}
```
| Uses | Description |
| --- | --- |
| [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\_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\_attachment\_is\_image()](wp_attachment_is_image) wp-includes/post.php | Determines whether an attachment is an image. |
| [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. |
| [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\_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 |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress wp_privacy_exports_dir(): string wp\_privacy\_exports\_dir(): string
===================================
Returns the directory used to store personal data export files.
* <wp_privacy_exports_url>
string Exports directory.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_privacy_exports_dir() {
$upload_dir = wp_upload_dir();
$exports_dir = trailingslashit( $upload_dir['basedir'] ) . 'wp-personal-data-exports/';
/**
* Filters 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
* via this filter should be reflected on the server.
*
* @param string $exports_dir Exports directory.
*/
return apply_filters( 'wp_privacy_exports_dir', $exports_dir );
}
```
[apply\_filters( 'wp\_privacy\_exports\_dir', string $exports\_dir )](../hooks/wp_privacy_exports_dir)
Filters 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\_delete\_old\_export\_files()](wp_privacy_delete_old_export_files) wp-includes/functions.php | Cleans up export files older than three days old. |
| [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. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
wordpress have_comments(): bool have\_comments(): bool
======================
Determines whether current WordPress query has comments to loop over.
bool True if comments are available, false if no more comments.
This function relies upon the global `$wp_query` object to be set – this is usually the case from within [The Loop](https://developer.wordpress.org/themes/basics/the-loop/).
Warning: this function will always return “false” until after [comments\_template()](comments_template) has been called. If you need to check for comments before calling [comments\_template()](comments_template) , use [get\_comments\_number()](get_comments_number) instead.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function have_comments() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
return false;
}
return $wp_query->have_comments();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::have\_comments()](../classes/wp_query/have_comments) wp-includes/class-wp-query.php | Whether there are more comments available. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress delete_user_meta( int $user_id, string $meta_key, mixed $meta_value = '' ): bool delete\_user\_meta( int $user\_id, string $meta\_key, mixed $meta\_value = '' ): bool
=====================================================================================
Removes metadata matching criteria from a user.
You can match based on the key, or key and value. Removing based on key and value, will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed.
`$user_id` int Required User ID `$meta_key` string Required Metadata name. `$meta_value` mixed Optional Metadata value. If provided, rows will only be removed that match the value.
Must be serializable if non-scalar. Default: `''`
bool True on success, false on failure.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function delete_user_meta( $user_id, $meta_key, $meta_value = '' ) {
return delete_metadata( 'user', $user_id, $meta_key, $meta_value );
}
```
| Uses | Description |
| --- | --- |
| [delete\_metadata()](delete_metadata) wp-includes/meta.php | Deletes metadata for the specified object. |
| Used By | Description |
| --- | --- |
| [WP\_User\_Meta\_Session\_Tokens::update\_sessions()](../classes/wp_user_meta_session_tokens/update_sessions) wp-includes/class-wp-user-meta-session-tokens.php | Updates the user’s sessions in the usermeta table. |
| [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\_User::remove\_all\_caps()](../classes/wp_user/remove_all_caps) wp-includes/class-wp-user.php | Removes all of the capabilities of the user. |
| [delete\_user\_option()](delete_user_option) wp-includes/user.php | Deletes user option with global blog capability. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress _wp_add_additional_image_sizes() \_wp\_add\_additional\_image\_sizes()
=====================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Adds additional default image sub-sizes.
These sizes are meant to enhance the way WordPress displays images on the front-end on larger, high-density devices. They make it possible to generate more suitable `srcset` and `sizes` attributes when the users upload large images.
The sizes can be changed or removed by themes and plugins but that is not recommended.
The size "names" reflect the image dimensions, so changing the sizes would be quite misleading.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function _wp_add_additional_image_sizes() {
// 2x medium_large size.
add_image_size( '1536x1536', 1536, 1536 );
// 2x large size.
add_image_size( '2048x2048', 2048, 2048 );
}
```
| Uses | Description |
| --- | --- |
| [add\_image\_size()](add_image_size) wp-includes/media.php | Registers a new image size. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress wp_ajax_sample_permalink() wp\_ajax\_sample\_permalink()
=============================
Ajax handler to retrieve a sample permalink.
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_sample_permalink() {
check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' );
$post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
$title = isset( $_POST['new_title'] ) ? $_POST['new_title'] : '';
$slug = isset( $_POST['new_slug'] ) ? $_POST['new_slug'] : null;
wp_die( get_sample_permalink_html( $post_id, $title, $slug ) );
}
```
| Uses | Description |
| --- | --- |
| [get\_sample\_permalink\_html()](get_sample_permalink_html) wp-admin/includes/post.php | Returns the HTML of the sample permalink slug editor. |
| [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 preview_theme() preview\_theme()
================
This function has been deprecated.
Start preview theme output buffer.
Will only perform task if the user has permissions and template and preview query variables exist.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function preview_theme() {
_deprecated_function( __FUNCTION__, '4.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 |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | This function has been deprecated. |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress get_search_feed_link( string $search_query = '', string $feed = '' ): string get\_search\_feed\_link( string $search\_query = '', string $feed = '' ): string
================================================================================
Retrieves the permalink for the search results 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 search results feed permalink.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_search_feed_link( $search_query = '', $feed = '' ) {
global $wp_rewrite;
$link = get_search_link( $search_query );
if ( empty( $feed ) ) {
$feed = get_default_feed();
}
$permastruct = $wp_rewrite->get_search_permastruct();
if ( empty( $permastruct ) ) {
$link = add_query_arg( 'feed', $feed, $link );
} else {
$link = trailingslashit( $link );
$link .= "feed/$feed/";
}
/**
* Filters the search feed link.
*
* @since 2.5.0
*
* @param string $link Search feed link.
* @param string $feed Feed type. Possible values include 'rss2', 'atom'.
* @param string $type The search type. One of 'posts' or 'comments'.
*/
return apply_filters( 'search_feed_link', $link, $feed, 'posts' );
}
```
[apply\_filters( 'search\_feed\_link', string $link, string $feed, string $type )](../hooks/search_feed_link)
Filters the search feed link.
| Uses | Description |
| --- | --- |
| [get\_search\_link()](get_search_link) wp-includes/link-template.php | Retrieves the permalink for a search. |
| [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. |
| [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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. |
| [get\_search\_comments\_feed\_link()](get_search_comments_feed_link) wp-includes/link-template.php | Retrieves the permalink for the search results comments feed. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress _block_template_render_title_tag() \_block\_template\_render\_title\_tag()
=======================================
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\_render\_title\_tag()](_wp_render_title_tag) instead.
Displays title tag with content, regardless of whether theme has title-tag support.
* [\_wp\_render\_title\_tag()](_wp_render_title_tag)
File: `wp-includes/block-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template.php/)
```
function _block_template_render_title_tag() {
echo '<title>' . wp_get_document_title() . '</title>' . "\n";
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress comment_link( int|WP_Comment $comment = null ) comment\_link( int|WP\_Comment $comment = null )
================================================
Displays the link to the comments.
`$comment` 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_link( $comment = null ) {
/**
* Filters the current comment's permalink.
*
* @since 3.6.0
*
* @see get_comment_link()
*
* @param string $comment_permalink The current comment permalink.
*/
echo esc_url( apply_filters( 'comment_link', get_comment_link( $comment ) ) );
}
```
[apply\_filters( 'comment\_link', string $comment\_permalink )](../hooks/comment_link)
Filters the current comment’s permalink.
| Uses | Description |
| --- | --- |
| [get\_comment\_link()](get_comment_link) wp-includes/comment-template.php | Retrieves the link to a given comment. |
| [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 |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced the `$comment` argument. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_attached_media( string $type, int|WP_Post $post ): WP_Post[] get\_attached\_media( string $type, int|WP\_Post $post ): WP\_Post[]
====================================================================
Retrieves media attached to the passed post.
`$type` string Required Mime type. `$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global $post. [WP\_Post](../classes/wp_post)[] Array of media attached to the given post.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function get_attached_media( $type, $post = 0 ) {
$post = get_post( $post );
if ( ! $post ) {
return array();
}
$args = array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => $type,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
);
/**
* Filters arguments used to retrieve media attached to the given post.
*
* @since 3.6.0
*
* @param array $args Post query arguments.
* @param string $type Mime type of the desired media.
* @param WP_Post $post Post object.
*/
$args = apply_filters( 'get_attached_media_args', $args, $type, $post );
$children = get_children( $args );
/**
* Filters the list of media attached to the given post.
*
* @since 3.6.0
*
* @param WP_Post[] $children Array of media attached to the given post.
* @param string $type Mime type of the media desired.
* @param WP_Post $post Post object.
*/
return (array) apply_filters( 'get_attached_media', $children, $type, $post );
}
```
[apply\_filters( 'get\_attached\_media', WP\_Post[] $children, string $type, WP\_Post $post )](../hooks/get_attached_media)
Filters the list of media attached to the given post.
[apply\_filters( 'get\_attached\_media\_args', array $args, string $type, WP\_Post $post )](../hooks/get_attached_media_args)
Filters arguments used to retrieve media attached to the given post.
| Uses | Description |
| --- | --- |
| [get\_children()](get_children) wp-includes/post.php | Retrieves all children of the post parent 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. |
| Used By | Description |
| --- | --- |
| [wp\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. |
| [wp\_audio\_shortcode()](wp_audio_shortcode) wp-includes/media.php | Builds the Audio shortcode output. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress _get_custom_object_labels( object $object, array $nohier_vs_hier_defaults ): object \_get\_custom\_object\_labels( object $object, array $nohier\_vs\_hier\_defaults ): object
==========================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Builds an object with custom-something object (post type, taxonomy) labels out of a custom-something object
`$object` object Required A custom-something object. `$nohier_vs_hier_defaults` array Required Hierarchical vs non-hierarchical default labels. object Object containing labels for the given custom-something object.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) {
$object->labels = (array) $object->labels;
if ( isset( $object->label ) && empty( $object->labels['name'] ) ) {
$object->labels['name'] = $object->label;
}
if ( ! isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) ) {
$object->labels['singular_name'] = $object->labels['name'];
}
if ( ! isset( $object->labels['name_admin_bar'] ) ) {
$object->labels['name_admin_bar'] = isset( $object->labels['singular_name'] ) ? $object->labels['singular_name'] : $object->name;
}
if ( ! isset( $object->labels['menu_name'] ) && isset( $object->labels['name'] ) ) {
$object->labels['menu_name'] = $object->labels['name'];
}
if ( ! isset( $object->labels['all_items'] ) && isset( $object->labels['menu_name'] ) ) {
$object->labels['all_items'] = $object->labels['menu_name'];
}
if ( ! isset( $object->labels['archives'] ) && isset( $object->labels['all_items'] ) ) {
$object->labels['archives'] = $object->labels['all_items'];
}
$defaults = array();
foreach ( $nohier_vs_hier_defaults as $key => $value ) {
$defaults[ $key ] = $object->hierarchical ? $value[1] : $value[0];
}
$labels = array_merge( $defaults, $object->labels );
$object->labels = (object) $object->labels;
return (object) $labels;
}
```
| Used By | Description |
| --- | --- |
| [get\_taxonomy\_labels()](get_taxonomy_labels) wp-includes/taxonomy.php | Builds an object with all taxonomy labels out of a taxonomy object. |
| [get\_post\_type\_labels()](get_post_type_labels) wp-includes/post.php | Builds an object with all post type labels out of a post type object. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_available_post_mime_types( string $type = 'attachment' ): string[] get\_available\_post\_mime\_types( string $type = 'attachment' ): string[]
==========================================================================
Gets all available post MIME types for a given post type.
`$type` string Optional Default: `'attachment'`
string[] An array of MIME types.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_available_post_mime_types( $type = 'attachment' ) {
global $wpdb;
$types = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s", $type ) );
return $types;
}
```
| Uses | Description |
| --- | --- |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [wp\_edit\_attachments\_query()](wp_edit_attachments_query) wp-admin/includes/post.php | Executes a query for attachments. An array of [WP\_Query](../classes/wp_query) arguments can be passed in, which will override the arguments set by this function. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress get_shortcut_link() get\_shortcut\_link()
=====================
This function has been deprecated.
Retrieves the Press This bookmarklet link.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_shortcut_link() {
_deprecated_function( __FUNCTION__, '4.9.0' );
$link = '';
/**
* Filters the Press This bookmarklet link.
*
* @since 2.6.0
* @deprecated 4.9.0
*
* @param string $link The Press This bookmarklet link.
*/
return apply_filters( 'shortcut_link', $link );
}
```
[apply\_filters( 'shortcut\_link', string $link )](../hooks/shortcut_link)
Filters the Press This bookmarklet link.
| Uses | Description |
| --- | --- |
| [\_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 |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | This function has been deprecated. |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress get_edit_user_link( int $user_id = null ): string get\_edit\_user\_link( int $user\_id = null ): string
=====================================================
Retrieves the edit user link.
`$user_id` int Optional User ID. Defaults to the current user. Default: `null`
string URL to edit user page or empty string.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_edit_user_link( $user_id = null ) {
if ( ! $user_id ) {
$user_id = get_current_user_id();
}
if ( empty( $user_id ) || ! current_user_can( 'edit_user', $user_id ) ) {
return '';
}
$user = get_userdata( $user_id );
if ( ! $user ) {
return '';
}
if ( get_current_user_id() == $user->ID ) {
$link = get_edit_profile_url( $user->ID );
} else {
$link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) );
}
/**
* Filters the user edit link.
*
* @since 3.5.0
*
* @param string $link The edit link.
* @param int $user_id User ID.
*/
return apply_filters( 'get_edit_user_link', $link, $user->ID );
}
```
[apply\_filters( 'get\_edit\_user\_link', string $link, int $user\_id )](../hooks/get_edit_user_link)
Filters the user edit link.
| Uses | Description |
| --- | --- |
| [get\_edit\_profile\_url()](get_edit_profile_url) wp-includes/link-template.php | Retrieves the URL to the user’s profile editor. |
| [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. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [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\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Used By | Description |
| --- | --- |
| [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\_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. |
| [attachment\_submitbox\_metadata()](attachment_submitbox_metadata) wp-admin/includes/media.php | Displays non-editable attachment metadata in the publish meta box. |
| [wp\_admin\_bar\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. |
| [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. |
| [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
| programming_docs |
wordpress is_plugin_active( string $plugin ): bool is\_plugin\_active( string $plugin ): bool
==========================================
Determines whether a plugin is active.
Only plugins installed in the plugins/ folder can be active.
Plugins in the mu-plugins/ folder can’t be "activated," so this function will return false for those plugins.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
`$plugin` string Required Path to the plugin file relative to the plugins directory. bool True, if in the active plugins list. False, not in the list.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function is_plugin_active( $plugin ) {
return in_array( $plugin, (array) get_option( 'active_plugins', array() ), true ) || is_plugin_active_for_network( $plugin );
}
```
| Uses | Description |
| --- | --- |
| [is\_plugin\_active\_for\_network()](is_plugin_active_for_network) wp-admin/includes/plugin.php | Determines whether the plugin is active for the entire network. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Plugins\_Controller::get\_plugin\_status()](../classes/wp_rest_plugins_controller/get_plugin_status) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Get’s the activation status for a 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::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. |
| [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\_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\_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. |
| [is\_plugin\_paused()](is_plugin_paused) wp-admin/includes/plugin.php | Determines whether a plugin is technically active but was paused while loading. |
| [wp\_load\_press\_this()](wp_load_press_this) wp-admin/press-this.php | |
| [wp\_ajax\_delete\_plugin()](wp_ajax_delete_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a plugin. |
| [wp\_ajax\_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. |
| [Plugin\_Upgrader::bulk\_upgrade()](../classes/plugin_upgrader/bulk_upgrade) wp-admin/includes/class-plugin-upgrader.php | Bulk upgrade several plugins at once. |
| [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. |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Plugins\_List\_Table::prepare\_items()](../classes/wp_plugins_list_table/prepare_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| [Plugin\_Installer\_Skin::after()](../classes/plugin_installer_skin/after) wp-admin/includes/class-plugin-installer-skin.php | Action to perform following a plugin install. |
| [Plugin\_Upgrader\_Skin::\_\_construct()](../classes/plugin_upgrader_skin/__construct) wp-admin/includes/class-plugin-upgrader-skin.php | Constructor. |
| [wp\_plugin\_update\_row()](wp_plugin_update_row) wp-admin/includes/update.php | Displays update information for a plugin. |
| [is\_plugin\_inactive()](is_plugin_inactive) wp-admin/includes/plugin.php | Determines whether the plugin is inactive. |
| [deactivate\_plugins()](deactivate_plugins) wp-admin/includes/plugin.php | Deactivates a single plugin or multiple 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 | |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress cache_users( int[] $user_ids ) cache\_users( int[] $user\_ids )
================================
Retrieves info for user lists to prevent multiple queries by [get\_userdata()](get_userdata) .
`$user_ids` int[] Required User ID numbers list File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function cache_users( $user_ids ) {
global $wpdb;
update_meta_cache( 'user', $user_ids );
$clean = _get_non_cached_ids( $user_ids, 'users' );
if ( empty( $clean ) ) {
return;
}
$list = implode( ',', $clean );
$users = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($list)" );
foreach ( $users as $user ) {
update_user_caches( $user );
}
}
```
| 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\_user\_caches()](update_user_caches) wp-includes/user.php | Updates all user caches. |
| [update\_meta\_cache()](update_meta_cache) wp-includes/meta.php | Updates the metadata cache for the specified 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\_post\_author\_caches()](update_post_author_caches) wp-includes/post.php | Updates post author user caches for a list of post objects. |
| [wp\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
| [WP\_User\_Query::query()](../classes/wp_user_query/query) wp-includes/class-wp-user-query.php | Executes the query, with the current variables. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_alloptions(): array get\_alloptions(): array
========================
This function has been deprecated. Use [wp\_load\_alloptions()](wp_load_alloptions) instead.
Retrieve all autoload options, or all options if no autoloaded ones exist.
* [wp\_load\_alloptions()](wp_load_alloptions)
array List of all options.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_alloptions() {
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_load_alloptions()' );
return wp_load_alloptions();
}
```
| Uses | Description |
| --- | --- |
| [wp\_load\_alloptions()](wp_load_alloptions) wp-includes/option.php | Loads and caches all autoloaded options, if available or all options. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [wp\_load\_alloptions()](wp_load_alloptions) ) |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress is_dynamic_sidebar(): bool is\_dynamic\_sidebar(): bool
============================
Determines whether the dynamic sidebar is enabled and used by the theme.
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 using widgets, false otherwise.
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function is_dynamic_sidebar() {
global $wp_registered_widgets, $wp_registered_sidebars;
$sidebars_widgets = get_option( 'sidebars_widgets' );
foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) {
if ( ! empty( $sidebars_widgets[ $index ] ) ) {
foreach ( (array) $sidebars_widgets[ $index ] as $widget ) {
if ( array_key_exists( $widget, $wp_registered_widgets ) ) {
return true;
}
}
}
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress wp_ajax_install_theme() wp\_ajax\_install\_theme()
==========================
Ajax handler for installing 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_install_theme() {
check_ajax_referer( 'updates' );
if ( empty( $_POST['slug'] ) ) {
wp_send_json_error(
array(
'slug' => '',
'errorCode' => 'no_theme_specified',
'errorMessage' => __( 'No theme specified.' ),
)
);
}
$slug = sanitize_key( wp_unslash( $_POST['slug'] ) );
$status = array(
'install' => 'theme',
'slug' => $slug,
);
if ( ! current_user_can( 'install_themes' ) ) {
$status['errorMessage'] = __( 'Sorry, you are not allowed to install themes on this site.' );
wp_send_json_error( $status );
}
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
include_once ABSPATH . 'wp-admin/includes/theme.php';
$api = themes_api(
'theme_information',
array(
'slug' => $slug,
'fields' => array( 'sections' => false ),
)
);
if ( is_wp_error( $api ) ) {
$status['errorMessage'] = $api->get_error_message();
wp_send_json_error( $status );
}
$skin = new WP_Ajax_Upgrader_Skin();
$upgrader = new Theme_Upgrader( $skin );
$result = $upgrader->install( $api->download_link );
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
$status['debug'] = $skin->get_upgrade_messages();
}
if ( is_wp_error( $result ) ) {
$status['errorCode'] = $result->get_error_code();
$status['errorMessage'] = $result->get_error_message();
wp_send_json_error( $status );
} elseif ( 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_null( $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 );
}
$status['themeName'] = wp_get_theme( $slug )->get( 'Name' );
if ( current_user_can( 'switch_themes' ) ) {
if ( is_multisite() ) {
$status['activateUrl'] = add_query_arg(
array(
'action' => 'enable',
'_wpnonce' => wp_create_nonce( 'enable-theme_' . $slug ),
'theme' => $slug,
),
network_admin_url( 'themes.php' )
);
} else {
$status['activateUrl'] = add_query_arg(
array(
'action' => 'activate',
'_wpnonce' => wp_create_nonce( 'switch-theme_' . $slug ),
'stylesheet' => $slug,
),
admin_url( 'themes.php' )
);
}
}
$theme = wp_get_theme( $slug );
$status['blockTheme'] = $theme->is_block_theme();
if ( ! is_multisite() && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
$status['customizeUrl'] = add_query_arg(
array(
'return' => urlencode( network_admin_url( 'theme-install.php', 'relative' ) ),
),
wp_customize_url( $slug )
);
}
/*
* See WP_Theme_Install_List_Table::_get_theme_status() if we wanted to check
* on post-installation status.
*/
wp_send_json_success( $status );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Ajax\_Upgrader\_Skin::\_\_construct()](../classes/wp_ajax_upgrader_skin/__construct) wp-admin/includes/class-wp-ajax-upgrader-skin.php | Constructor. |
| [themes\_api()](themes_api) wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. |
| [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the network. |
| [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\_customize\_url()](wp_customize_url) wp-includes/theme.php | Returns a URL to load the Customizer. |
| [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. |
| [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. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [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. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [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. |
| [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 wp_removable_query_args(): string[] wp\_removable\_query\_args(): string[]
======================================
Returns an array of single-use query variable names that can be removed from a URL.
string[] An array of query variable names to remove from the URL.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_removable_query_args() {
$removable_query_args = array(
'activate',
'activated',
'admin_email_remind_later',
'approved',
'core-major-auto-updates-saved',
'deactivate',
'delete_count',
'deleted',
'disabled',
'doing_wp_cron',
'enabled',
'error',
'hotkeys_highlight_first',
'hotkeys_highlight_last',
'ids',
'locked',
'message',
'same',
'saved',
'settings-updated',
'skipped',
'spammed',
'trashed',
'unspammed',
'untrashed',
'update',
'updated',
'wp-post-new-reload',
);
/**
* Filters the list of query variable names to remove.
*
* @since 4.2.0
*
* @param string[] $removable_query_args An array of query variable names to remove from a URL.
*/
return apply_filters( 'removable_query_args', $removable_query_args );
}
```
[apply\_filters( 'removable\_query\_args', string[] $removable\_query\_args )](../hooks/removable_query_args)
Filters the list of query variable names to remove.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_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\_admin\_canonical\_url()](wp_admin_canonical_url) wp-admin/includes/misc.php | Removes single-use URL parameters and create canonical link based on new URL. |
| [wp\_prepare\_themes\_for\_js()](wp_prepare_themes_for_js) wp-admin/includes/theme.php | Prepares themes for JavaScript. |
| [WP\_List\_Table::pagination()](../classes/wp_list_table/pagination) wp-admin/includes/class-wp-list-table.php | Displays the pagination. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress get_all_post_type_supports( string $post_type ): array get\_all\_post\_type\_supports( string $post\_type ): array
===========================================================
Gets all the post type features
`$post_type` string Required The post type. array Post type supports list.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_all_post_type_supports( $post_type ) {
global $_wp_post_type_features;
if ( isset( $_wp_post_type_features[ $post_type ] ) ) {
return $_wp_post_type_features[ $post_type ];
}
return array();
}
```
| Used By | Description |
| --- | --- |
| [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\_xmlrpc\_server::\_prepare\_post\_type()](../classes/wp_xmlrpc_server/_prepare_post_type) wp-includes/class-wp-xmlrpc-server.php | Prepares post data for return in an XML-RPC object. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress gd_edit_image_support( string $mime_type ): bool gd\_edit\_image\_support( string $mime\_type ): bool
====================================================
This function has been deprecated. Use [wp\_image\_editor\_supports()](wp_image_editor_supports) instead.
Check if the installed version of GD supports particular image type
* [wp\_image\_editor\_supports()](wp_image_editor_supports)
`$mime_type` string Required bool
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function gd_edit_image_support($mime_type) {
_deprecated_function( __FUNCTION__, '3.5.0', 'wp_image_editor_supports()' );
if ( function_exists('imagetypes') ) {
switch( $mime_type ) {
case 'image/jpeg':
return (imagetypes() & IMG_JPG) != 0;
case 'image/png':
return (imagetypes() & IMG_PNG) != 0;
case 'image/gif':
return (imagetypes() & IMG_GIF) != 0;
case 'image/webp':
return (imagetypes() & IMG_WEBP) != 0;
}
} else {
switch( $mime_type ) {
case 'image/jpeg':
return function_exists('imagecreatefromjpeg');
case 'image/png':
return function_exists('imagecreatefrompng');
case 'image/gif':
return function_exists('imagecreatefromgif');
case 'image/webp':
return function_exists('imagecreatefromwebp');
}
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Use [wp\_image\_editor\_supports()](wp_image_editor_supports) |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
| programming_docs |
wordpress delete_metadata( string $meta_type, int $object_id, string $meta_key, mixed $meta_value = '', bool $delete_all = false ): bool delete\_metadata( string $meta\_type, int $object\_id, string $meta\_key, mixed $meta\_value = '', bool $delete\_all = false ): bool
====================================================================================================================================
Deletes metadata for the specified object.
`$meta_type` string Required Type of object metadata is for. Accepts `'post'`, `'comment'`, `'term'`, `'user'`, or any other object type with an associated meta table. `$object_id` int Required ID of the object metadata is for. `$meta_key` string Required Metadata key. `$meta_value` mixed Optional Metadata value. Must be serializable if non-scalar.
If specified, only delete metadata entries with this value.
Otherwise, delete all entries with the specified meta\_key.
Pass `null`, `false`, or an empty string to skip this check.
(For backward compatibility, it is not possible to pass an empty string to delete those entries with an empty string for a value.) Default: `''`
`$delete_all` bool Optional If true, delete matching metadata entries for all objects, ignoring the specified object\_id. Otherwise, only delete matching metadata entries for the specified object\_id. Default: `false`
bool True on successful delete, false on failure.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function delete_metadata( $meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false ) {
global $wpdb;
if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) && ! $delete_all ) {
return false;
}
$object_id = absint( $object_id );
if ( ! $object_id && ! $delete_all ) {
return false;
}
$table = _get_meta_table( $meta_type );
if ( ! $table ) {
return false;
}
$type_column = sanitize_key( $meta_type . '_id' );
$id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id';
// expected_slashed ($meta_key)
$meta_key = wp_unslash( $meta_key );
$meta_value = wp_unslash( $meta_value );
/**
* Short-circuits deleting 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:
*
* - `delete_post_metadata`
* - `delete_comment_metadata`
* - `delete_term_metadata`
* - `delete_user_metadata`
*
* @since 3.1.0
*
* @param null|bool $delete Whether to allow metadata deletion of the given type.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
* @param bool $delete_all Whether to delete the matching metadata entries
* for all objects, ignoring the specified $object_id.
* Default false.
*/
$check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all );
if ( null !== $check ) {
return (bool) $check;
}
$_meta_value = $meta_value;
$meta_value = maybe_serialize( $meta_value );
$query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key );
if ( ! $delete_all ) {
$query .= $wpdb->prepare( " AND $type_column = %d", $object_id );
}
if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value ) {
$query .= $wpdb->prepare( ' AND meta_value = %s', $meta_value );
}
$meta_ids = $wpdb->get_col( $query );
if ( ! count( $meta_ids ) ) {
return false;
}
if ( $delete_all ) {
if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value ) {
$object_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $type_column FROM $table WHERE meta_key = %s AND meta_value = %s", $meta_key, $meta_value ) );
} else {
$object_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $type_column FROM $table WHERE meta_key = %s", $meta_key ) );
}
}
/**
* Fires immediately before deleting 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:
*
* - `delete_post_meta`
* - `delete_comment_meta`
* - `delete_term_meta`
* - `delete_user_meta`
*
* @since 3.1.0
*
* @param string[] $meta_ids An array of metadata entry IDs to delete.
* @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( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
// Old-style action.
if ( 'post' === $meta_type ) {
/**
* Fires immediately before deleting metadata for a post.
*
* @since 2.9.0
*
* @param string[] $meta_ids An array of metadata entry IDs to delete.
*/
do_action( 'delete_postmeta', $meta_ids );
}
$query = "DELETE FROM $table WHERE $id_column IN( " . implode( ',', $meta_ids ) . ' )';
$count = $wpdb->query( $query );
if ( ! $count ) {
return false;
}
if ( $delete_all ) {
$data = (array) $object_ids;
} else {
$data = array( $object_id );
}
wp_cache_delete_multiple( $data, $meta_type . '_meta' );
/**
* Fires immediately after deleting 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:
*
* - `deleted_post_meta`
* - `deleted_comment_meta`
* - `deleted_term_meta`
* - `deleted_user_meta`
*
* @since 2.9.0
*
* @param string[] $meta_ids An array of metadata entry IDs to delete.
* @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( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
// Old-style action.
if ( 'post' === $meta_type ) {
/**
* Fires immediately after deleting metadata for a post.
*
* @since 2.9.0
*
* @param string[] $meta_ids An array of metadata entry IDs to delete.
*/
do_action( 'deleted_postmeta', $meta_ids );
}
return true;
}
```
[do\_action( 'deleted\_postmeta', string[] $meta\_ids )](../hooks/deleted_postmeta)
Fires immediately after deleting metadata for a post.
[do\_action( "deleted\_{$meta\_type}\_meta", string[] $meta\_ids, int $object\_id, string $meta\_key, mixed $\_meta\_value )](../hooks/deleted_meta_type_meta)
Fires immediately after deleting metadata of a specific type.
[do\_action( 'delete\_postmeta', string[] $meta\_ids )](../hooks/delete_postmeta)
Fires immediately before deleting metadata for a post.
[do\_action( "delete\_{$meta\_type}\_meta", string[] $meta\_ids, int $object\_id, string $meta\_key, mixed $\_meta\_value )](../hooks/delete_meta_type_meta)
Fires immediately before deleting metadata of a specific type.
[apply\_filters( "delete\_{$meta\_type}\_metadata", null|bool $delete, int $object\_id, string $meta\_key, mixed $meta\_value, bool $delete\_all )](../hooks/delete_meta_type_metadata)
Short-circuits deleting metadata of a specific type.
| Uses | Description |
| --- | --- |
| [wp\_cache\_delete\_multiple()](wp_cache_delete_multiple) wp-includes/cache.php | Deletes multiple values from the cache in one call. |
| [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::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [\_get\_meta\_table()](_get_meta_table) wp-includes/meta.php | Retrieves the name of the metadata table for the specified object type. |
| [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 |
| --- | --- |
| [delete\_site\_meta()](delete_site_meta) wp-includes/ms-site.php | Removes metadata matching criteria from a site. |
| [delete\_site\_meta\_by\_key()](delete_site_meta_by_key) wp-includes/ms-site.php | Deletes everything from site meta matching meta key. |
| [wp\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. |
| [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. |
| [delete\_term\_meta()](delete_term_meta) wp-includes/taxonomy.php | Removes metadata matching criteria from a term. |
| [WP\_User\_Meta\_Session\_Tokens::drop\_sessions()](../classes/wp_user_meta_session_tokens/drop_sessions) wp-includes/class-wp-user-meta-session-tokens.php | Destroys all sessions for all users. |
| [delete\_user\_meta()](delete_user_meta) wp-includes/user.php | Removes metadata matching criteria from a user. |
| [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. |
| [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. |
| [delete\_post\_meta\_by\_key()](delete_post_meta_by_key) wp-includes/post.php | Deletes everything from post meta matching the given meta key. |
| [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. |
| [delete\_comment\_meta()](delete_comment_meta) wp-includes/comment.php | Removes metadata matching criteria from a comment. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress add_rewrite_endpoint( string $name, int $places, string|bool $query_var = true ) add\_rewrite\_endpoint( string $name, int $places, string|bool $query\_var = true )
===================================================================================
Adds an endpoint, like /trackback/.
Adding an endpoint creates extra rewrite rules for each of the matching places specified by the provided bitmask. For example:
```
add_rewrite_endpoint( 'json', EP_PERMALINK | EP_PAGES );
```
will add a new rewrite rule ending with "json(/(.\*))?/?$" for every permastruct that describes a permalink (post) or page. This is rewritten to "json=$match" where $match is the part of the URL matched by the endpoint regex (e.g. "foo" in "[permalink]/json/foo/").
A new query var with the same name as the endpoint will also be created.
When specifying $places ensure that you are using the EP\_\* constants (or a combination of them using the bitwise OR operator) as their values are not guaranteed to remain static (especially `EP_ALL`).
Be sure to flush the rewrite rules – see [flush\_rewrite\_rules()](flush_rewrite_rules) – when your plugin gets activated and deactivated.
`$name` string Required Name of the endpoint. `$places` int Required Endpoint mask describing the places the endpoint should be added.
Accepts a mask of:
* `EP_ALL`
* `EP_NONE`
* `EP_ALL_ARCHIVES`
* `EP_ATTACHMENT`
* `EP_AUTHORS`
* `EP_CATEGORIES`
* `EP_COMMENTS`
* `EP_DATE`
* `EP_DAY`
* `EP_MONTH`
* `EP_PAGES`
* `EP_PERMALINK`
* `EP_ROOT`
* `EP_SEARCH`
* `EP_TAGS`
* `EP_YEAR`
`$query_var` string|bool Optional Name of the corresponding query variable. Pass `false` to skip registering a query\_var for this endpoint. Defaults to the value of `$name`. Default: `true`
This adds the endpoint to all link types indicated (e.g. posts, pages, category, author, search) and then template-loader.php includes the relevant handler file. The name of the endpoint is added as query variable and this gets as value any text present after the endpoint name, separated from the name with a ‘/’. The [`template_redirect`](../hooks/template_redirect "Plugin API/Action Reference/template redirect") action hook should test this query variable. This can be used for all sorts of things: * ajax handler
* form submission handler
* alternative notification handler
File: `wp-includes/rewrite.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rewrite.php/)
```
function add_rewrite_endpoint( $name, $places, $query_var = true ) {
global $wp_rewrite;
$wp_rewrite->add_endpoint( $name, $places, $query_var );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Rewrite::add\_endpoint()](../classes/wp_rewrite/add_endpoint) wp-includes/class-wp-rewrite.php | Adds an endpoint, like /trackback/. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Added support for skipping query var registration by passing `false` to `$query_var`. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_get_direct_update_https_url(): string wp\_get\_direct\_update\_https\_url(): string
=============================================
Gets the URL for directly updating the site to use HTTPS.
A URL will only be returned if the `WP_DIRECT_UPDATE_HTTPS_URL` environment variable is specified or by using the [‘wp\_direct\_update\_https\_url’](../hooks/wp_direct_update_https_url) filter. This allows hosts to send users directly to the page where they can update their site to use HTTPS.
string URL for directly updating to HTTPS or empty string.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_get_direct_update_https_url() {
$direct_update_url = '';
if ( false !== getenv( 'WP_DIRECT_UPDATE_HTTPS_URL' ) ) {
$direct_update_url = getenv( 'WP_DIRECT_UPDATE_HTTPS_URL' );
}
/**
* Filters the URL for directly updating the PHP version the site is running on from the host.
*
* @since 5.7.0
*
* @param string $direct_update_url URL for directly updating PHP.
*/
$direct_update_url = apply_filters( 'wp_direct_update_https_url', $direct_update_url );
return $direct_update_url;
}
```
[apply\_filters( 'wp\_direct\_update\_https\_url', string $direct\_update\_url )](../hooks/wp_direct_update_https_url)
Filters the URL for directly updating the PHP version the site is running on from the host.
| 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::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 get_theme_root_uri( string $stylesheet_or_template = '', string $theme_root = '' ): string get\_theme\_root\_uri( string $stylesheet\_or\_template = '', string $theme\_root = '' ): string
================================================================================================
Retrieves URI for themes directory.
Does not have trailing slash.
`$stylesheet_or_template` string Optional The stylesheet or template name of the theme.
Default is to leverage the main theme root. Default: `''`
`$theme_root` string Optional The theme root for which calculations will be based, preventing the need for a [get\_raw\_theme\_root()](get_raw_theme_root) call. Default: `''`
string Themes directory URI.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_theme_root_uri( $stylesheet_or_template = '', $theme_root = '' ) {
global $wp_theme_directories;
if ( $stylesheet_or_template && ! $theme_root ) {
$theme_root = get_raw_theme_root( $stylesheet_or_template );
}
if ( $stylesheet_or_template && $theme_root ) {
if ( in_array( $theme_root, (array) $wp_theme_directories, true ) ) {
// Absolute path. Make an educated guess. YMMV -- but note the filter below.
if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) ) {
$theme_root_uri = content_url( str_replace( WP_CONTENT_DIR, '', $theme_root ) );
} elseif ( 0 === strpos( $theme_root, ABSPATH ) ) {
$theme_root_uri = site_url( str_replace( ABSPATH, '', $theme_root ) );
} elseif ( 0 === strpos( $theme_root, WP_PLUGIN_DIR ) || 0 === strpos( $theme_root, WPMU_PLUGIN_DIR ) ) {
$theme_root_uri = plugins_url( basename( $theme_root ), $theme_root );
} else {
$theme_root_uri = $theme_root;
}
} else {
$theme_root_uri = content_url( $theme_root );
}
} else {
$theme_root_uri = content_url( 'themes' );
}
/**
* Filters the URI for themes directory.
*
* @since 1.5.0
*
* @param string $theme_root_uri The URI for themes directory.
* @param string $siteurl WordPress web address which is set in General Options.
* @param string $stylesheet_or_template The stylesheet or template name of the theme.
*/
return apply_filters( 'theme_root_uri', $theme_root_uri, get_option( 'siteurl' ), $stylesheet_or_template );
}
```
[apply\_filters( 'theme\_root\_uri', string $theme\_root\_uri, string $siteurl, string $stylesheet\_or\_template )](../hooks/theme_root_uri)
Filters the URI for themes directory.
| Uses | Description |
| --- | --- |
| [get\_raw\_theme\_root()](get_raw_theme_root) wp-includes/theme.php | Gets the raw theme root relative to the content directory with no filters applied. |
| [content\_url()](content_url) wp-includes/link-template.php | Retrieves the URL to the content directory. |
| [plugins\_url()](plugins_url) wp-includes/link-template.php | Retrieves a URL within the plugins or mu-plugins 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. |
| [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\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) wp-includes/theme.php | Retrieves stylesheet directory URI for the active theme. |
| [get\_template\_directory\_uri()](get_template_directory_uri) wp-includes/theme.php | Retrieves template directory URI for the active theme. |
| [WP\_Theme::get\_theme\_root\_uri()](../classes/wp_theme/get_theme_root_uri) wp-includes/class-wp-theme.php | Returns the URL to the directory of the theme root. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress rest_preload_api_request( array $memo, string $path ): array rest\_preload\_api\_request( array $memo, string $path ): array
===============================================================
Append result of internal request to REST API for purpose of preloading data to be attached to a page.
Expected to be called in the context of `array_reduce`.
`$memo` array Required Reduce accumulator. `$path` string Required REST API path to preload. array Modified reduce accumulator.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_preload_api_request( $memo, $path ) {
// array_reduce() doesn't support passing an array in PHP 5.2,
// so we need to make sure we start with one.
if ( ! is_array( $memo ) ) {
$memo = array();
}
if ( empty( $path ) ) {
return $memo;
}
$method = 'GET';
if ( is_array( $path ) && 2 === count( $path ) ) {
$method = end( $path );
$path = reset( $path );
if ( ! in_array( $method, array( 'GET', 'OPTIONS' ), true ) ) {
$method = 'GET';
}
}
$path = untrailingslashit( $path );
if ( empty( $path ) ) {
$path = '/';
}
$path_parts = parse_url( $path );
if ( false === $path_parts ) {
return $memo;
}
$request = new WP_REST_Request( $method, $path_parts['path'] );
if ( ! empty( $path_parts['query'] ) ) {
parse_str( $path_parts['query'], $query_params );
$request->set_query_params( $query_params );
}
$response = rest_do_request( $request );
if ( 200 === $response->status ) {
$server = rest_get_server();
/** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */
$response = apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), $server, $request );
$embed = $request->has_param( '_embed' ) ? rest_parse_embed_param( $request['_embed'] ) : false;
$data = (array) $server->response_to_data( $response, $embed );
if ( 'OPTIONS' === $method ) {
$memo[ $method ][ $path ] = array(
'body' => $data,
'headers' => $response->headers,
);
} else {
$memo[ $path ] = array(
'body' => $data,
'headers' => $response->headers,
);
}
}
return $memo;
}
```
[apply\_filters( 'rest\_post\_dispatch', WP\_HTTP\_Response $result, WP\_REST\_Server $server, WP\_REST\_Request $request )](../hooks/rest_post_dispatch)
Filters the REST API response.
| Uses | Description |
| --- | --- |
| [rest\_parse\_embed\_param()](rest_parse_embed_param) wp-includes/rest-api.php | Parses the “\_embed” parameter into the list of resources to embed. |
| [rest\_get\_server()](rest_get_server) wp-includes/rest-api.php | Retrieves the current REST server instance. |
| [rest\_do\_request()](rest_do_request) wp-includes/rest-api.php | Do a REST request. |
| [WP\_REST\_Request::\_\_construct()](../classes/wp_rest_request/__construct) wp-includes/rest-api/class-wp-rest-request.php | Constructor. |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [rest\_ensure\_response()](rest_ensure_response) wp-includes/rest-api.php | Ensures a REST response is a response object (for consistency). |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress _access_denied_splash() \_access\_denied\_splash()
==========================
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 an access denied message when a user tries to view a site’s dashboard they do not have access to.
File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function _access_denied_splash() {
if ( ! is_user_logged_in() || is_network_admin() ) {
return;
}
$blogs = get_blogs_of_user( get_current_user_id() );
if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) ) {
return;
}
$blog_name = get_bloginfo( 'name' );
if ( empty( $blogs ) ) {
wp_die(
sprintf(
/* translators: 1: Site title. */
__( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ),
$blog_name
),
403
);
}
$output = '<p>' . sprintf(
/* translators: 1: Site title. */
__( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ),
$blog_name
) . '</p>';
$output .= '<p>' . __( 'If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.' ) . '</p>';
$output .= '<h3>' . __( 'Your Sites' ) . '</h3>';
$output .= '<table>';
foreach ( $blogs as $blog ) {
$output .= '<tr>';
$output .= "<td>{$blog->blogname}</td>";
$output .= '<td><a href="' . esc_url( get_admin_url( $blog->userblog_id ) ) . '">' . __( 'Visit Dashboard' ) . '</a> | ' .
'<a href="' . esc_url( get_home_url( $blog->userblog_id ) ) . '">' . __( 'View Site' ) . '</a></td>';
$output .= '</tr>';
}
$output .= '</table>';
wp_die( $output, 403 );
}
```
| Uses | Description |
| --- | --- |
| [wp\_list\_filter()](wp_list_filter) wp-includes/functions.php | Filters a list of objects, based on a set of key => value arguments. |
| [is\_network\_admin()](is_network_admin) wp-includes/load.php | Determines whether the current request is for the network administrative interface. |
| [get\_admin\_url()](get_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for a given site. |
| [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. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Version | Description |
| --- | --- |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
wordpress get_super_admins(): string[] get\_super\_admins(): string[]
==============================
Retrieves a list of super admins.
string[] List of super admin logins.
File: `wp-includes/capabilities.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/capabilities.php/)
```
function get_super_admins() {
global $super_admins;
if ( isset( $super_admins ) ) {
return $super_admins;
} else {
return get_site_option( 'site_admins', array( 'admin' ) );
}
}
```
| 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. |
| Used By | Description |
| --- | --- |
| [WP\_MS\_Users\_List\_Table::handle\_row\_actions()](../classes/wp_ms_users_list_table/handle_row_actions) wp-admin/includes/class-wp-ms-users-list-table.php | Generates and displays row action links. |
| [WP\_MS\_Users\_List\_Table::column\_username()](../classes/wp_ms_users_list_table/column_username) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the username column output. |
| [WP\_MS\_Users\_List\_Table::prepare\_items()](../classes/wp_ms_users_list_table/prepare_items) wp-admin/includes/class-wp-ms-users-list-table.php | |
| [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 | |
| [wpmu\_delete\_user()](wpmu_delete_user) wp-admin/includes/ms.php | Delete a user from the network and remove from all sites. |
| [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. |
| [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.php | |
| [is\_super\_admin()](is_super_admin) wp-includes/capabilities.php | Determines whether user is a site admin. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_imagecreatetruecolor( int $width, int $height ): resource|GdImage|false wp\_imagecreatetruecolor( int $width, int $height ): resource|GdImage|false
===========================================================================
Creates new GD image resource with transparency support.
`$width` int Required Image width in pixels. `$height` int Required Image height in pixels. resource|GdImage|false The GD image resource or GdImage instance on success.
False on failure.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_imagecreatetruecolor( $width, $height ) {
$img = imagecreatetruecolor( $width, $height );
if ( is_gd_image( $img )
&& function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' )
) {
imagealphablending( $img, false );
imagesavealpha( $img, true );
}
return $img;
}
```
| Uses | Description |
| --- | --- |
| [is\_gd\_image()](is_gd_image) wp-includes/media.php | Determines whether the value is an acceptable type for GD image functions. |
| Used By | Description |
| --- | --- |
| [WP\_Image\_Editor\_GD::\_resize()](../classes/wp_image_editor_gd/_resize) wp-includes/class-wp-image-editor-gd.php | |
| [WP\_Image\_Editor\_GD::crop()](../classes/wp_image_editor_gd/crop) wp-includes/class-wp-image-editor-gd.php | Crops Image. |
| [WP\_Image\_Editor\_GD::flip()](../classes/wp_image_editor_gd/flip) wp-includes/class-wp-image-editor-gd.php | Flips current image. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress delete_post_thumbnail( int|WP_Post $post ): bool delete\_post\_thumbnail( int|WP\_Post $post ): bool
===================================================
Removes the thumbnail (featured image) from the given post.
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object from which the thumbnail should be removed. bool True on success, false on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function delete_post_thumbnail( $post ) {
$post = get_post( $post );
if ( $post ) {
return delete_post_meta( $post->ID, '_thumbnail_id' );
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes 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::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\_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::\_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.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress get_self_link(): string get\_self\_link(): string
=========================
Returns the link for the currently displayed feed.
string Correct link for the atom:self element.
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function get_self_link() {
$host = parse_url( home_url() );
return set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) );
}
```
| Uses | Description |
| --- | --- |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| Used By | Description |
| --- | --- |
| [self\_link()](self_link) wp-includes/feed.php | Displays the link for the currently displayed feed in a XSS safe way. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress wp_get_attachment_thumb_file( int $post_id ): string|false wp\_get\_attachment\_thumb\_file( int $post\_id ): string|false
===============================================================
This function has been deprecated.
Retrieves thumbnail for an attachment.
Note that this works only for the (very) old image metadata style where ‘thumb’ was set, and the ‘sizes’ array did not exist. This function returns false for the newer image metadata style despite that ‘thumbnail’ is present in the ‘sizes’ array.
`$post_id` int Optional Attachment ID. Default is the ID of the global `$post`. string|false Thumbnail file path on success, false on failure.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_get_attachment_thumb_file( $post_id = 0 ) {
_deprecated_function( __FUNCTION__, '6.1.0' );
$post_id = (int) $post_id;
$post = get_post( $post_id );
if ( ! $post ) {
return false;
}
// Use $post->ID rather than $post_id as get_post() may have used the global $post object.
$imagedata = wp_get_attachment_metadata( $post->ID );
if ( ! is_array( $imagedata ) ) {
return false;
}
$file = get_attached_file( $post->ID );
if ( ! empty( $imagedata['thumb'] ) ) {
$thumbfile = str_replace( wp_basename( $file ), $imagedata['thumb'], $file );
if ( file_exists( $thumbfile ) ) {
/**
* Filters the attachment thumbnail file path.
*
* @since 2.1.0
*
* @param string $thumbfile File path to the attachment thumbnail.
* @param int $post_id Attachment ID.
*/
return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );
}
}
return false;
}
```
[apply\_filters( 'wp\_get\_attachment\_thumb\_file', string $thumbfile, int $post\_id )](../hooks/wp_get_attachment_thumb_file)
Filters the attachment thumbnail file path.
| Uses | Description |
| --- | --- |
| [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(). |
| [\_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. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | This function has been deprecated. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress get_home_path(): string get\_home\_path(): string
=========================
Gets the absolute filesystem path to the root of the WordPress installation.
string Full filesystem path to the root of the WordPress installation.
File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/)
```
function get_home_path() {
$home = set_url_scheme( get_option( 'home' ), 'http' );
$siteurl = set_url_scheme( get_option( 'siteurl' ), 'http' );
if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) {
$wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); /* $siteurl - $home */
$pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) );
$home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
$home_path = trailingslashit( $home_path );
} else {
$home_path = ABSPATH;
}
return str_replace( '\\', '/', $home_path );
}
```
| Uses | Description |
| --- | --- |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. |
| [save\_mod\_rewrite\_rules()](save_mod_rewrite_rules) wp-admin/includes/misc.php | Updates the htaccess file with the current rules if it is writable. |
| [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. |
| [make\_site\_theme\_from\_oldschool()](make_site_theme_from_oldschool) wp-admin/includes/upgrade.php | Creates a site theme from an existing theme. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress _usort_terms_by_name( object $a, object $b ): int \_usort\_terms\_by\_name( object $a, object $b ): int
=====================================================
This function has been deprecated. Use [wp\_list\_sort()](wp_list_sort) instead.
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Sort categories by name.
Used by usort() as a callback, should not be used directly. Can actually be used to sort any term object.
`$a` object Required `$b` object Required int
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function _usort_terms_by_name( $a, $b ) {
_deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' );
return strcmp( $a->name, $b->name );
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Use [wp\_list\_sort()](wp_list_sort) |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
| programming_docs |
wordpress wp_site_icon() wp\_site\_icon()
================
Displays site icon meta tags.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_site_icon() {
if ( ! has_site_icon() && ! is_customize_preview() ) {
return;
}
$meta_tags = array();
$icon_32 = get_site_icon_url( 32 );
if ( empty( $icon_32 ) && is_customize_preview() ) {
$icon_32 = '/favicon.ico'; // Serve default favicon URL in customizer so element can be updated for preview.
}
if ( $icon_32 ) {
$meta_tags[] = sprintf( '<link rel="icon" href="%s" sizes="32x32" />', esc_url( $icon_32 ) );
}
$icon_192 = get_site_icon_url( 192 );
if ( $icon_192 ) {
$meta_tags[] = sprintf( '<link rel="icon" href="%s" sizes="192x192" />', esc_url( $icon_192 ) );
}
$icon_180 = get_site_icon_url( 180 );
if ( $icon_180 ) {
$meta_tags[] = sprintf( '<link rel="apple-touch-icon" href="%s" />', esc_url( $icon_180 ) );
}
$icon_270 = get_site_icon_url( 270 );
if ( $icon_270 ) {
$meta_tags[] = sprintf( '<meta name="msapplication-TileImage" content="%s" />', esc_url( $icon_270 ) );
}
/**
* Filters the site icon meta tags, so plugins can add their own.
*
* @since 4.3.0
*
* @param string[] $meta_tags Array of Site Icon meta tags.
*/
$meta_tags = apply_filters( 'site_icon_meta_tags', $meta_tags );
$meta_tags = array_filter( $meta_tags );
foreach ( $meta_tags as $meta_tag ) {
echo "$meta_tag\n";
}
}
```
[apply\_filters( 'site\_icon\_meta\_tags', string[] $meta\_tags )](../hooks/site_icon_meta_tags)
Filters the site icon meta tags, so plugins can add their own.
| Uses | Description |
| --- | --- |
| [has\_site\_icon()](has_site_icon) wp-includes/general-template.php | Determines whether the site has a Site Icon. |
| [get\_site\_icon\_url()](get_site_icon_url) wp-includes/general-template.php | Returns the Site Icon URL. |
| [is\_customize\_preview()](is_customize_preview) wp-includes/theme.php | Whether the site is being previewed in the Customizer. |
| [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 |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
wordpress wp_parse_id_list( array|string $list ): int[] wp\_parse\_id\_list( array|string $list ): int[]
================================================
Cleans up an array, comma- or space-separated list of IDs.
`$list` array|string Required List of IDs. int[] Sanitized array of IDs.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_parse_id_list( $list ) {
$list = wp_parse_list( $list );
return array_unique( array_map( 'absint', $list ) );
}
```
| Uses | Description |
| --- | --- |
| [wp\_parse\_list()](wp_parse_list) wp-includes/functions.php | Converts a comma- or space-separated list of scalar values to an array. |
| Used By | Description |
| --- | --- |
| [WP\_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\_Media\_Gallery::has\_content()](../classes/wp_widget_media_gallery/has_content) wp-includes/widgets/class-wp-widget-media-gallery.php | Whether the widget has content to show. |
| [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\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. |
| [WP\_Term\_Query::parse\_orderby()](../classes/wp_term_query/parse_orderby) wp-includes/class-wp-term-query.php | Parse and sanitize ‘orderby’ keys passed to the term query. |
| [WP\_Network\_Query::get\_network\_ids()](../classes/wp_network_query/get_network_ids) wp-includes/class-wp-network-query.php | Used internally to get a list of network IDs matching the query vars. |
| [WP\_Site\_Query::get\_site\_ids()](../classes/wp_site_query/get_site_ids) wp-includes/class-wp-site-query.php | Used internally to get a list of site IDs matching the query vars. |
| [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\_User\_Query::parse\_orderby()](../classes/wp_user_query/parse_orderby) wp-includes/class-wp-user-query.php | Parses and sanitizes ‘orderby’ keys passed to the user query. |
| [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| [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\_User\_Query::prepare\_query()](../classes/wp_user_query/prepare_query) wp-includes/class-wp-user-query.php | Prepares the query variables. |
| [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. |
| [get\_bookmarks()](get_bookmarks) wp-includes/bookmark.php | Retrieves the list of bookmarks. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Refactored to use [wp\_parse\_list()](wp_parse_list) . |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress add_permastruct( string $name, string $struct, array $args = array() ) add\_permastruct( string $name, string $struct, array $args = array() )
=======================================================================
Adds a permalink structure.
* [WP\_Rewrite::add\_permastruct()](../classes/wp_rewrite/add_permastruct)
`$name` string Required Name for permalink structure. `$struct` string Required Permalink structure. `$args` array Optional Arguments for building the rules from the permalink structure, see [WP\_Rewrite::add\_permastruct()](../classes/wp_rewrite/add_permastruct) for full details. More Arguments from WP\_Rewrite::add\_permastruct( ... $args ) Arguments for building rewrite rules based on the permalink structure.
* `with_front`boolWhether the structure should be prepended with `WP_Rewrite::$front`.
Default true.
* `ep_mask`intThe endpoint mask defining which endpoints are added to the structure.
Accepts a mask of:
+ `EP_ALL`
+ `EP_NONE`
+ `EP_ALL_ARCHIVES`
+ `EP_ATTACHMENT`
+ `EP_AUTHORS`
+ `EP_CATEGORIES`
+ `EP_COMMENTS`
+ `EP_DATE`
+ `EP_DAY`
+ `EP_MONTH`
+ `EP_PAGES`
+ `EP_PERMALINK`
+ `EP_ROOT`
+ `EP_SEARCH`
+ `EP_TAGS`
+ `EP_YEAR` Default `EP_NONE`.
* `paged`boolWhether archive pagination rules should be added for the structure.
Default true.
* `feed`boolWhether feed rewrite rules should be added for the structure. Default true.
* `forcomments`boolWhether the feed rules should be a query for a comments feed. Default false.
* `walk_dirs`boolWhether the `'directories'` making up the structure should be walked over and rewrite rules built for each in-turn. Default true.
* `endpoints`boolWhether endpoints should be applied to the generated rules. Default true.
Default: `array()`
File: `wp-includes/rewrite.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rewrite.php/)
```
function add_permastruct( $name, $struct, $args = array() ) {
global $wp_rewrite;
// Back-compat for the old parameters: $with_front and $ep_mask.
if ( ! is_array( $args ) ) {
$args = array( 'with_front' => $args );
}
if ( func_num_args() == 4 ) {
$args['ep_mask'] = func_get_arg( 3 );
}
$wp_rewrite->add_permastruct( $name, $struct, $args );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Rewrite::add\_permastruct()](../classes/wp_rewrite/add_permastruct) wp-includes/class-wp-rewrite.php | Adds a new permalink structure. |
| Used By | Description |
| --- | --- |
| [WP\_Taxonomy::add\_rewrite\_rules()](../classes/wp_taxonomy/add_rewrite_rules) wp-includes/class-wp-taxonomy.php | Adds the necessary rewrite rules for the taxonomy. |
| [WP\_Post\_Type::add\_rewrite\_rules()](../classes/wp_post_type/add_rewrite_rules) wp-includes/class-wp-post-type.php | Adds the necessary rewrite rules for the post type. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress the_comment() the\_comment()
==============
Iterate comment index in the comment loop.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function the_comment() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
return;
}
$wp_query->the_comment();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::the\_comment()](../classes/wp_query/the_comment) wp-includes/class-wp-query.php | Sets up the current comment. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress image_size_input_fields( WP_Post $post, bool|string $check = '' ): array image\_size\_input\_fields( WP\_Post $post, bool|string $check = '' ): array
============================================================================
Retrieves HTML for the size radio buttons with the specified one checked.
`$post` [WP\_Post](../classes/wp_post) Required `$check` bool|string Optional Default: `''`
array
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function image_size_input_fields( $post, $check = '' ) {
/**
* Filters the names and labels of the default image sizes.
*
* @since 3.3.0
*
* @param string[] $size_names Array of image size labels keyed by their name. Default values
* include 'Thumbnail', 'Medium', 'Large', and 'Full Size'.
*/
$size_names = apply_filters(
'image_size_names_choose',
array(
'thumbnail' => __( 'Thumbnail' ),
'medium' => __( 'Medium' ),
'large' => __( 'Large' ),
'full' => __( 'Full Size' ),
)
);
if ( empty( $check ) ) {
$check = get_user_setting( 'imgsize', 'medium' );
}
$output = array();
foreach ( $size_names as $size => $label ) {
$downsize = image_downsize( $post->ID, $size );
$checked = '';
// Is this size selectable?
$enabled = ( $downsize[3] || 'full' === $size );
$css_id = "image-size-{$size}-{$post->ID}";
// If this size is the default but that's not available, don't select it.
if ( $size == $check ) {
if ( $enabled ) {
$checked = " checked='checked'";
} else {
$check = '';
}
} elseif ( ! $check && $enabled && 'thumbnail' !== $size ) {
/*
* If $check is not enabled, default to the first available size
* that's bigger than a thumbnail.
*/
$check = $size;
$checked = " checked='checked'";
}
$html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
$html .= "<label for='{$css_id}'>$label</label>";
// Only show the dimensions if that choice is available.
if ( $enabled ) {
$html .= " <label for='{$css_id}' class='help'>" . sprintf( '(%d × %d)', $downsize[1], $downsize[2] ) . '</label>';
}
$html .= '</div>';
$output[] = $html;
}
return array(
'label' => __( 'Size' ),
'input' => 'html',
'html' => implode( "\n", $output ),
);
}
```
[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 |
| --- | --- |
| [disabled()](disabled) wp-includes/general-template.php | Outputs the HTML disabled attribute. |
| [get\_user\_setting()](get_user_setting) wp-includes/option.php | Retrieves user interface setting value based on setting name. |
| [image\_downsize()](image_downsize) wp-includes/media.php | Scales an image to fit a particular size (such as ‘thumb’ or ‘medium’). |
| [\_\_()](__) 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\_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 get_block_editor_theme_styles(): array get\_block\_editor\_theme\_styles(): array
==========================================
Creates an array of theme styles to load into the block editor.
array An array of theme styles for the block editor.
File: `wp-includes/block-editor.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-editor.php/)
```
function get_block_editor_theme_styles() {
global $editor_styles;
$styles = array();
if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
foreach ( $editor_styles as $style ) {
if ( preg_match( '~^(https?:)?//~', $style ) ) {
$response = wp_remote_get( $style );
if ( ! is_wp_error( $response ) ) {
$styles[] = array(
'css' => wp_remote_retrieve_body( $response ),
'__unstableType' => 'theme',
'isGlobalStyles' => false,
);
}
} else {
$file = get_theme_file_path( $style );
if ( is_file( $file ) ) {
$styles[] = array(
'css' => file_get_contents( $file ),
'baseURL' => get_theme_file_uri( $style ),
'__unstableType' => 'theme',
'isGlobalStyles' => false,
);
}
}
}
}
return $styles;
}
```
| Uses | Description |
| --- | --- |
| [get\_theme\_file\_path()](get_theme_file_path) wp-includes/link-template.php | Retrieves the path of a file in the theme. |
| [get\_theme\_file\_uri()](get_theme_file_uri) wp-includes/link-template.php | Retrieves the URL of a file in the theme. |
| [wp\_remote\_get()](wp_remote_get) wp-includes/http.php | Performs an HTTP request using the GET method and returns its response. |
| [wp\_remote\_retrieve\_body()](wp_remote_retrieve_body) wp-includes/http.php | Retrieve only the body from the raw response. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| 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.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress is_login(): bool is\_login(): bool
=================
Determines whether the current request is for the login screen.
* [wp\_login\_url()](wp_login_url)
bool True if inside WordPress login screen, false otherwise.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function is_login() {
return false !== stripos( wp_login_url(), $_SERVER['SCRIPT_NAME'] );
}
```
| Uses | Description |
| --- | --- |
| [stripos()](stripos) wp-includes/class-pop3.php | |
| [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress get_oembed_endpoint_url( string $permalink = '', string $format = 'json' ): string get\_oembed\_endpoint\_url( string $permalink = '', string $format = 'json' ): string
=====================================================================================
Retrieves the oEmbed endpoint URL for a given permalink.
Pass an empty string as the first argument to get the endpoint base URL.
`$permalink` string Optional The permalink used for the `url` query arg. Default: `''`
`$format` string Optional The requested response format. Default `'json'`. Default: `'json'`
string The oEmbed endpoint URL.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function get_oembed_endpoint_url( $permalink = '', $format = 'json' ) {
$url = rest_url( 'oembed/1.0/embed' );
if ( '' !== $permalink ) {
$url = add_query_arg(
array(
'url' => urlencode( $permalink ),
'format' => ( 'json' !== $format ) ? $format : false,
),
$url
);
}
/**
* Filters the oEmbed endpoint URL.
*
* @since 4.4.0
*
* @param string $url The URL to the oEmbed endpoint.
* @param string $permalink The permalink used for the `url` query arg.
* @param string $format The requested response format.
*/
return apply_filters( 'oembed_endpoint_url', $url, $permalink, $format );
}
```
[apply\_filters( 'oembed\_endpoint\_url', string $url, string $permalink, string $format )](../hooks/oembed_endpoint_url)
Filters the oEmbed endpoint URL.
| Uses | Description |
| --- | --- |
| [rest\_url()](rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_convert_hr_to_bytes( string $value ): int wp\_convert\_hr\_to\_bytes( string $value ): int
================================================
Converts a shorthand byte value to an integer byte value.
`$value` string Required A (PHP ini) byte value, either shorthand or ordinary. int An integer byte value.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_convert_hr_to_bytes( $value ) {
$value = strtolower( trim( $value ) );
$bytes = (int) $value;
if ( false !== strpos( $value, 'g' ) ) {
$bytes *= GB_IN_BYTES;
} elseif ( false !== strpos( $value, 'm' ) ) {
$bytes *= MB_IN_BYTES;
} elseif ( false !== strpos( $value, 'k' ) ) {
$bytes *= KB_IN_BYTES;
}
// Deal with large (float) values which run into the maximum integer size.
return min( $bytes, PHP_INT_MAX );
}
```
| Used By | Description |
| --- | --- |
| [WP\_Site\_Health::get\_test\_file\_uploads()](../classes/wp_site_health/get_test_file_uploads) wp-admin/includes/class-wp-site-health.php | Tests if ‘file\_uploads’ directive in PHP.ini is turned off. |
| [WP\_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\_raise\_memory\_limit()](wp_raise_memory_limit) wp-includes/functions.php | Attempts to raise the PHP memory limit for memory intensive processes. |
| [wp\_initial\_constants()](wp_initial_constants) wp-includes/default-constants.php | Defines initial WordPress constants. |
| [wp\_max\_upload\_size()](wp_max_upload_size) wp-includes/media.php | Determines the maximum upload size allowed in php.ini. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Moved from media.php to load.php. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
| programming_docs |
wordpress wp_extract_urls( string $content ): string[] wp\_extract\_urls( string $content ): string[]
==============================================
Uses RegEx to extract URLs from arbitrary content.
`$content` string Required Content to extract URLs from. string[] Array of URLs found in passed string.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_extract_urls( $content ) {
preg_match_all(
"#([\"']?)("
. '(?:([\w-]+:)?//?)'
. '[^\s()<>]+'
. '[.]'
. '(?:'
. '\([\w\d]+\)|'
. '(?:'
. "[^`!()\[\]{}:'\".,<>«»“”‘’\s]|"
. '(?:[:]\d+)?/?'
. ')+'
. ')'
. ")\\1#",
$content,
$post_links
);
$post_links = array_unique(
array_map(
static function( $link ) {
// Decode to replace valid entities, like &.
$link = html_entity_decode( $link );
// Maintain backward compatibility by removing extraneous semi-colons (`;`).
return str_replace( ';', '', $link );
},
$post_links[2]
)
);
return array_values( $post_links );
}
```
| Used By | Description |
| --- | --- |
| [do\_enclose()](do_enclose) wp-includes/functions.php | Checks content for video and audio links to add as enclosures. |
| [pingback()](pingback) wp-includes/comment.php | Pings back the links found in a post. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Fixes support for HTML entities (Trac 30580). |
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |
wordpress update_user_caches( object|WP_User $user ): void|false update\_user\_caches( object|WP\_User $user ): void|false
=========================================================
Updates all user caches.
`$user` object|[WP\_User](../classes/wp_user) Required User object or database row to be cached void|false Void on success, false on failure.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function update_user_caches( $user ) {
if ( $user instanceof WP_User ) {
if ( ! $user->exists() ) {
return false;
}
$user = $user->data;
}
wp_cache_add( $user->ID, $user, 'users' );
wp_cache_add( $user->user_login, $user->ID, 'userlogins' );
wp_cache_add( $user->user_nicename, $user->ID, 'userslugs' );
if ( ! empty( $user->user_email ) ) {
wp_cache_add( $user->user_email, $user->ID, 'useremail' );
}
}
```
| 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. |
| Used By | Description |
| --- | --- |
| [WP\_User::get\_data\_by()](../classes/wp_user/get_data_by) wp-includes/class-wp-user.php | Returns only the main user fields. |
| [cache\_users()](cache_users) wp-includes/pluggable.php | Retrieves info for user lists to prevent multiple queries by [get\_userdata()](get_userdata) . |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_stream_image( WP_Image_Editor $image, string $mime_type, int $attachment_id ): bool wp\_stream\_image( WP\_Image\_Editor $image, string $mime\_type, int $attachment\_id ): bool
============================================================================================
Streams image in [WP\_Image\_Editor](../classes/wp_image_editor) to browser.
`$image` [WP\_Image\_Editor](../classes/wp_image_editor) Required The image editor instance. `$mime_type` string Required The mime type of the image. `$attachment_id` int Required The image's attachment post ID. bool True on success, false on failure.
File: `wp-admin/includes/image-edit.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image-edit.php/)
```
function wp_stream_image( $image, $mime_type, $attachment_id ) {
if ( $image instanceof WP_Image_Editor ) {
/**
* Filters the WP_Image_Editor instance for the image to be streamed to the browser.
*
* @since 3.5.0
*
* @param WP_Image_Editor $image The image editor instance.
* @param int $attachment_id The attachment post ID.
*/
$image = apply_filters( 'image_editor_save_pre', $image, $attachment_id );
if ( is_wp_error( $image->stream( $mime_type ) ) ) {
return false;
}
return true;
} else {
/* translators: 1: $image, 2: WP_Image_Editor */
_deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( '%1$s needs to be a %2$s object.' ), '$image', 'WP_Image_Editor' ) );
/**
* Filters the GD image resource to be streamed to the browser.
*
* @since 2.9.0
* @deprecated 3.5.0 Use {@see 'image_editor_save_pre'} instead.
*
* @param resource|GdImage $image Image resource to be streamed.
* @param int $attachment_id The attachment post ID.
*/
$image = apply_filters_deprecated( 'image_save_pre', array( $image, $attachment_id ), '3.5.0', 'image_editor_save_pre' );
switch ( $mime_type ) {
case 'image/jpeg':
header( 'Content-Type: image/jpeg' );
return imagejpeg( $image, null, 90 );
case 'image/png':
header( 'Content-Type: image/png' );
return imagepng( $image );
case 'image/gif':
header( 'Content-Type: image/gif' );
return imagegif( $image );
case 'image/webp':
if ( function_exists( 'imagewebp' ) ) {
header( 'Content-Type: image/webp' );
return imagewebp( $image, null, 90 );
}
return false;
default:
return false;
}
}
}
```
[apply\_filters( 'image\_editor\_save\_pre', WP\_Image\_Editor $image, int $attachment\_id )](../hooks/image_editor_save_pre)
Filters the [WP\_Image\_Editor](../classes/wp_image_editor) instance for the image to be streamed to the browser.
[apply\_filters\_deprecated( 'image\_save\_pre', resource|GdImage $image, int $attachment\_id )](../hooks/image_save_pre)
Filters the GD image resource to be streamed to the browser.
| Uses | Description |
| --- | --- |
| [apply\_filters\_deprecated()](apply_filters_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated filter hook. |
| [\_\_()](__) 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. |
| Used By | Description |
| --- | --- |
| [stream\_preview\_image()](stream_preview_image) wp-admin/includes/image-edit.php | Streams image in post to browser, along with enqueued changes in `$_REQUEST['history']`. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress get_current_network_id(): int get\_current\_network\_id(): int
================================
Retrieves the current network ID.
int The ID of the current network.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function get_current_network_id() {
if ( ! is_multisite() ) {
return 1;
}
$current_network = get_network();
if ( ! isset( $current_network->id ) ) {
return get_main_network_id();
}
return absint( $current_network->id );
}
```
| Uses | Description |
| --- | --- |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [get\_main\_network\_id()](get_main_network_id) wp-includes/functions.php | Gets the main network ID. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| Used By | Description |
| --- | --- |
| [wp\_count\_sites()](wp_count_sites) wp-includes/ms-blogs.php | Count number of sites grouped by site status. |
| [wp\_insert\_site()](wp_insert_site) wp-includes/ms-site.php | Inserts a new site into the database. |
| [wp\_load\_press\_this()](wp_load_press_this) wp-admin/press-this.php | |
| [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. |
| [delete\_network\_option()](delete_network_option) wp-includes/option.php | Removes a network option by name. |
| [get\_network\_option()](get_network_option) wp-includes/option.php | Retrieves a network’s option value based on the option name. |
| [validate\_another\_blog\_signup()](validate_another_blog_signup) wp-signup.php | Validates a new site sign-up for an existing user. |
| [can\_edit\_network()](can_edit_network) wp-admin/includes/ms.php | Whether or not we can edit this network from this page. |
| [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. |
| [is\_main\_network()](is_main_network) wp-includes/functions.php | Determines whether a network is the main network of the Multisite installation. |
| [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. |
| [wp\_get\_sites()](wp_get_sites) wp-includes/ms-deprecated.php | Return an array of sites for a network or networks. |
| [wp\_update\_network\_site\_counts()](wp_update_network_site_counts) wp-includes/ms-functions.php | Updates the network-wide site count. |
| [wp\_is\_large\_network()](wp_is_large_network) wp-includes/ms-functions.php | Determines whether or not we have a large network. |
| [wpmu\_activate\_signup()](wpmu_activate_signup) wp-includes/ms-functions.php | Activates a signup. |
| [wpmu\_signup\_blog\_notification()](wpmu_signup_blog_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
| [get\_admin\_users\_for\_domain()](get_admin_users_for_domain) wp-includes/ms-deprecated.php | Get the admin for a domain/path combination. |
| [get\_active\_blog\_for\_user()](get_active_blog_for_user) wp-includes/ms-functions.php | Gets one of a user’s active blogs. |
| [get\_blog\_list()](get_blog_list) wp-includes/ms-deprecated.php | Deprecated functionality to retrieve a list of all sites. |
| [get\_last\_updated()](get_last_updated) wp-includes/ms-blogs.php | Get a list of most recently updated blogs. |
| [wp\_xmlrpc\_server::wp\_getUsersBlogs()](../classes/wp_xmlrpc_server/wp_getusersblogs) wp-includes/class-wp-xmlrpc-server.php | Retrieve the blogs of the user. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress unregister_taxonomy( string $taxonomy ): true|WP_Error unregister\_taxonomy( string $taxonomy ): true|WP\_Error
========================================================
Unregisters a taxonomy.
Can not be used to unregister built-in taxonomies.
`$taxonomy` string Required Taxonomy name. true|[WP\_Error](../classes/wp_error) True on success, [WP\_Error](../classes/wp_error) on failure or if the taxonomy doesn't exist.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function unregister_taxonomy( $taxonomy ) {
if ( ! taxonomy_exists( $taxonomy ) ) {
return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
}
$taxonomy_object = get_taxonomy( $taxonomy );
// Do not allow unregistering internal taxonomies.
if ( $taxonomy_object->_builtin ) {
return new WP_Error( 'invalid_taxonomy', __( 'Unregistering a built-in taxonomy is not allowed.' ) );
}
global $wp_taxonomies;
$taxonomy_object->remove_rewrite_rules();
$taxonomy_object->remove_hooks();
// Remove the taxonomy.
unset( $wp_taxonomies[ $taxonomy ] );
/**
* Fires after a taxonomy is unregistered.
*
* @since 4.5.0
*
* @param string $taxonomy Taxonomy name.
*/
do_action( 'unregistered_taxonomy', $taxonomy );
return true;
}
```
[do\_action( 'unregistered\_taxonomy', string $taxonomy )](../hooks/unregistered_taxonomy)
Fires after a taxonomy is unregistered.
| Uses | Description |
| --- | --- |
| [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [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 |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. |
wordpress get_site_by_path( string $domain, string $path, int|null $segments = null ): WP_Site|false get\_site\_by\_path( string $domain, string $path, int|null $segments = null ): WP\_Site|false
==============================================================================================
Retrieves the closest matching site object by its domain and path.
This will not necessarily return an exact match for a domain and path. Instead, it breaks the domain and path into pieces that are then used to match the closest possibility from a query.
The intent of this method is to match a site object during bootstrap for a requested site address
`$domain` string Required Domain to check. `$path` string Required Path to check. `$segments` int|null Optional Path segments to use. Defaults to null, or the full path. Default: `null`
[WP\_Site](../classes/wp_site)|false Site object if successful. False when no site is found.
File: `wp-includes/ms-load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-load.php/)
```
function get_site_by_path( $domain, $path, $segments = null ) {
$path_segments = array_filter( explode( '/', trim( $path, '/' ) ) );
/**
* Filters the number of path segments to consider when searching for a site.
*
* @since 3.9.0
*
* @param int|null $segments The number of path segments to consider. WordPress by default looks at
* one path segment following the network path. The function default of
* null only makes sense when you know the requested path should match a site.
* @param string $domain The requested domain.
* @param string $path The requested path, in full.
*/
$segments = apply_filters( 'site_by_path_segments_count', $segments, $domain, $path );
if ( null !== $segments && count( $path_segments ) > $segments ) {
$path_segments = array_slice( $path_segments, 0, $segments );
}
$paths = array();
while ( count( $path_segments ) ) {
$paths[] = '/' . implode( '/', $path_segments ) . '/';
array_pop( $path_segments );
}
$paths[] = '/';
/**
* Determines a site by its domain and path.
*
* This allows one to short-circuit the default logic, perhaps by
* replacing it with a routine that is more optimal for your setup.
*
* Return null to avoid the short-circuit. Return false if no site
* can be found at the requested domain and path. Otherwise, return
* a site object.
*
* @since 3.9.0
*
* @param null|false|WP_Site $site Site value to return by path. Default null
* to continue retrieving the site.
* @param string $domain The requested domain.
* @param string $path The requested path, in full.
* @param int|null $segments The suggested number of paths to consult.
* Default null, meaning the entire path was to be consulted.
* @param string[] $paths The paths to search for, based on $path and $segments.
*/
$pre = apply_filters( 'pre_get_site_by_path', null, $domain, $path, $segments, $paths );
if ( null !== $pre ) {
if ( false !== $pre && ! $pre instanceof WP_Site ) {
$pre = new WP_Site( $pre );
}
return $pre;
}
/*
* @todo
* Caching, etc. Consider alternative optimization routes,
* perhaps as an opt-in for plugins, rather than using the pre_* filter.
* For example: The segments filter can expand or ignore paths.
* If persistent caching is enabled, we could query the DB for a path <> '/'
* then cache whether we can just always ignore paths.
*/
// Either www or non-www is supported, not both. If a www domain is requested,
// query for both to provide the proper redirect.
$domains = array( $domain );
if ( 'www.' === substr( $domain, 0, 4 ) ) {
$domains[] = substr( $domain, 4 );
}
$args = array(
'number' => 1,
'update_site_meta_cache' => false,
);
if ( count( $domains ) > 1 ) {
$args['domain__in'] = $domains;
$args['orderby']['domain_length'] = 'DESC';
} else {
$args['domain'] = array_shift( $domains );
}
if ( count( $paths ) > 1 ) {
$args['path__in'] = $paths;
$args['orderby']['path_length'] = 'DESC';
} else {
$args['path'] = array_shift( $paths );
}
$result = get_sites( $args );
$site = array_shift( $result );
if ( $site ) {
return $site;
}
return false;
}
```
[apply\_filters( 'pre\_get\_site\_by\_path', null|false|WP\_Site $site, string $domain, string $path, int|null $segments, string[] $paths )](../hooks/pre_get_site_by_path)
Determines a site by its domain and path.
[apply\_filters( 'site\_by\_path\_segments\_count', int|null $segments, string $domain, string $path )](../hooks/site_by_path_segments_count)
Filters the number of path segments to consider when searching for a site.
| Uses | Description |
| --- | --- |
| [get\_sites()](get_sites) wp-includes/ms-site.php | Retrieves a list of sites matching requested arguments. |
| [WP\_Site::\_\_construct()](../classes/wp_site/__construct) wp-includes/class-wp-site.php | Creates a new [WP\_Site](../classes/wp_site) object. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| 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. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Updated to always return a `WP_Site` object. |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
wordpress feed_links( array $args = array() ) feed\_links( array $args = array() )
====================================
Displays the links to the general feeds.
`$args` array Optional arguments. Default: `array()`
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function feed_links( $args = array() ) {
if ( ! current_theme_supports( 'automatic-feed-links' ) ) {
return;
}
$defaults = array(
/* translators: Separator between blog name and feed type in feed links. */
'separator' => _x( '»', 'feed link' ),
/* translators: 1: Blog title, 2: Separator (raquo). */
'feedtitle' => __( '%1$s %2$s Feed' ),
/* translators: 1: Blog title, 2: Separator (raquo). */
'comstitle' => __( '%1$s %2$s Comments Feed' ),
);
$args = wp_parse_args( $args, $defaults );
/**
* Filters whether to display the posts feed link.
*
* @since 4.4.0
*
* @param bool $show Whether to display the posts feed link. Default true.
*/
if ( apply_filters( 'feed_links_show_posts_feed', true ) ) {
printf(
'<link rel="alternate" type="%s" title="%s" href="%s" />' . "\n",
feed_content_type(),
esc_attr( sprintf( $args['feedtitle'], get_bloginfo( 'name' ), $args['separator'] ) ),
esc_url( get_feed_link() )
);
}
/**
* Filters whether to display the comments feed link.
*
* @since 4.4.0
*
* @param bool $show Whether to display the comments feed link. Default true.
*/
if ( apply_filters( 'feed_links_show_comments_feed', true ) ) {
printf(
'<link rel="alternate" type="%s" title="%s" href="%s" />' . "\n",
feed_content_type(),
esc_attr( sprintf( $args['comstitle'], get_bloginfo( 'name' ), $args['separator'] ) ),
esc_url( get_feed_link( 'comments_' . get_default_feed() ) )
);
}
}
```
[apply\_filters( 'feed\_links\_show\_comments\_feed', bool $show )](../hooks/feed_links_show_comments_feed)
Filters whether to display the comments feed link.
[apply\_filters( 'feed\_links\_show\_posts\_feed', bool $show )](../hooks/feed_links_show_posts_feed)
Filters whether to display the posts feed link.
| Uses | Description |
| --- | --- |
| [get\_feed\_link()](get_feed_link) wp-includes/link-template.php | Retrieves the permalink for the feed type. |
| [feed\_content\_type()](feed_content_type) wp-includes/feed.php | Returns the content type for specified feed type. |
| [get\_default\_feed()](get_default_feed) wp-includes/feed.php | Retrieves the default feed. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [\_\_()](__) 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. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [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 |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
| programming_docs |
wordpress get_the_title( int|WP_Post $post ): string get\_the\_title( int|WP\_Post $post ): string
=============================================
Retrieves the post title.
If the post is protected and the visitor is not an admin, then "Protected" will be inserted before the post title. If the post is private, then "Private" will be inserted before the post title.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_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_title( $post = 0 ) {
$post = get_post( $post );
$post_title = isset( $post->post_title ) ? $post->post_title : '';
$post_id = isset( $post->ID ) ? $post->ID : 0;
if ( ! is_admin() ) {
if ( ! empty( $post->post_password ) ) {
/* translators: %s: Protected post title. */
$prepend = __( 'Protected: %s' );
/**
* Filters the text prepended to the post title for protected posts.
*
* The filter is only applied on the front end.
*
* @since 2.8.0
*
* @param string $prepend Text displayed before the post title.
* Default 'Protected: %s'.
* @param WP_Post $post Current post object.
*/
$protected_title_format = apply_filters( 'protected_title_format', $prepend, $post );
$post_title = sprintf( $protected_title_format, $post_title );
} elseif ( isset( $post->post_status ) && 'private' === $post->post_status ) {
/* translators: %s: Private post title. */
$prepend = __( 'Private: %s' );
/**
* Filters the text prepended to the post title of private posts.
*
* The filter is only applied on the front end.
*
* @since 2.8.0
*
* @param string $prepend Text displayed before the post title.
* Default 'Private: %s'.
* @param WP_Post $post Current post object.
*/
$private_title_format = apply_filters( 'private_title_format', $prepend, $post );
$post_title = sprintf( $private_title_format, $post_title );
}
}
/**
* Filters the post title.
*
* @since 0.71
*
* @param string $post_title The post title.
* @param int $post_id The post ID.
*/
return apply_filters( 'the_title', $post_title, $post_id );
}
```
[apply\_filters( 'private\_title\_format', string $prepend, WP\_Post $post )](../hooks/private_title_format)
Filters the text prepended to the post title of private posts.
[apply\_filters( 'protected\_title\_format', string $prepend, WP\_Post $post )](../hooks/protected_title_format)
Filters the text prepended to the post title for protected posts.
[apply\_filters( 'the\_title', string $post\_title, int $post\_id )](../hooks/the_title)
Filters the post title.
| Uses | Description |
| --- | --- |
| [\_\_()](__) 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. |
| [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\_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. |
| [get\_adjacent\_image\_link()](get_adjacent_image_link) wp-includes/media.php | Gets the next or previous image link that has the same post parent. |
| [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\_the\_privacy\_policy\_link()](get_the_privacy_policy_link) wp-includes/link-template.php | Returns the privacy policy link with formatting, when applicable. |
| [WP\_REST\_Revisions\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_revisions_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Prepares the revision for the REST response. |
| [WP\_REST\_Posts\_Controller::prepare\_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\_embed\_excerpt\_more()](wp_embed_excerpt_more) wp-includes/embed.php | Filters the string in the ‘more’ link displayed after a trimmed excerpt. |
| [get\_post\_embed\_html()](get_post_embed_html) wp-includes/embed.php | Retrieves the embed code for a specific post. |
| [get\_oembed\_response\_data()](get_oembed_response_data) wp-includes/embed.php | Retrieves the oEmbed response data for a given post. |
| [\_draft\_or\_post\_title()](_draft_or_post_title) wp-admin/includes/template.php | Gets the post title. |
| [wp\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
| [WP\_Comments\_List\_Table::column\_response()](../classes/wp_comments_list_table/column_response) wp-admin/includes/class-wp-comments-list-table.php | |
| [Walker\_Nav\_Menu\_Edit::start\_el()](../classes/walker_nav_menu_edit/start_el) wp-admin/includes/class-walker-nav-menu-edit.php | Start the element output. |
| [\_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\_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. |
| [get\_the\_title\_rss()](get_the_title_rss) wp-includes/feed.php | Retrieves the current post title for the feed. |
| [the\_title()](the_title) wp-includes/post-template.php | Displays or retrieves the current post title with optional markup. |
| [the\_title\_attribute()](the_title_attribute) wp-includes/post-template.php | Sanitizes the current title when retrieving or displaying. |
| [wp\_xmlrpc\_server::\_prepare\_comment()](../classes/wp_xmlrpc_server/_prepare_comment) wp-includes/class-wp-xmlrpc-server.php | Prepares comment data for return in an XML-RPC object. |
| [trackback\_rdf()](trackback_rdf) wp-includes/comment-template.php | Generates and displays the RDF for the trackback information of current post. |
| [comments\_popup\_link()](comments_popup_link) wp-includes/comment-template.php | Displays the link to the comments for the current post ID. |
| [\_WP\_Editors::wp\_link\_query()](../classes/_wp_editors/wp_link_query) wp-includes/class-wp-editor.php | Performs post queries for internal linking. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_create_categories( string[] $categories, int $post_id = '' ): int[] wp\_create\_categories( string[] $categories, int $post\_id = '' ): int[]
=========================================================================
Creates categories for the given post.
`$categories` string[] Required Array of category names to create. `$post_id` int Optional The post ID. Default: `''`
int[] Array of IDs of categories assigned to the given post.
File: `wp-admin/includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/taxonomy.php/)
```
function wp_create_categories( $categories, $post_id = '' ) {
$cat_ids = array();
foreach ( $categories as $category ) {
$id = category_exists( $category );
if ( $id ) {
$cat_ids[] = $id;
} else {
$id = wp_create_category( $category );
if ( $id ) {
$cat_ids[] = $id;
}
}
}
if ( $post_id ) {
wp_set_post_categories( $post_id, $cat_ids );
}
return $cat_ids;
}
```
| Uses | Description |
| --- | --- |
| [category\_exists()](category_exists) wp-admin/includes/taxonomy.php | Checks whether a category exists. |
| [wp\_create\_category()](wp_create_category) wp-admin/includes/taxonomy.php | Adds a new category to the database if it does not already exist. |
| [wp\_set\_post\_categories()](wp_set_post_categories) wp-includes/post.php | Sets categories for a post. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_popular_terms_checklist( string $taxonomy, int $default_term, int $number = 10, bool $display = true ): int[] wp\_popular\_terms\_checklist( string $taxonomy, int $default\_term, int $number = 10, bool $display = true ): int[]
====================================================================================================================
Retrieves a list of the most popular terms from the specified taxonomy.
If the `$display` argument is true then the elements for a list of checkbox `<input>` elements labelled with the names of the selected terms is output.
If the `$post_ID` global is not empty then the terms associated with that post will be marked as checked.
`$taxonomy` string Required Taxonomy to retrieve terms from. `$default_term` int Optional Not used. `$number` int Optional Number of terms to retrieve. Default: `10`
`$display` bool Optional Whether to display the list as well. Default: `true`
int[] Array of popular term IDs.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function wp_popular_terms_checklist( $taxonomy, $default_term = 0, $number = 10, $display = true ) {
$post = get_post();
if ( $post && $post->ID ) {
$checked_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
} else {
$checked_terms = array();
}
$terms = get_terms(
array(
'taxonomy' => $taxonomy,
'orderby' => 'count',
'order' => 'DESC',
'number' => $number,
'hierarchical' => false,
)
);
$tax = get_taxonomy( $taxonomy );
$popular_ids = array();
foreach ( (array) $terms as $term ) {
$popular_ids[] = $term->term_id;
if ( ! $display ) { // Hack for Ajax use.
continue;
}
$id = "popular-$taxonomy-$term->term_id";
$checked = in_array( $term->term_id, $checked_terms, true ) ? 'checked="checked"' : '';
?>
<li id="<?php echo $id; ?>" class="popular-category">
<label class="selectit">
<input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php disabled( ! current_user_can( $tax->cap->assign_terms ) ); ?> />
<?php
/** This filter is documented in wp-includes/category-template.php */
echo esc_html( apply_filters( 'the_category', $term->name, '', '' ) );
?>
</label>
</li>
<?php
}
return $popular_ids;
}
```
[apply\_filters( 'the\_category', string $thelist, string $separator, string $parents )](../hooks/the_category)
Filters the category or list of categories.
| Uses | Description |
| --- | --- |
| [disabled()](disabled) wp-includes/general-template.php | Outputs the HTML disabled attribute. |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [\_wp\_ajax\_add\_hierarchical\_term()](_wp_ajax_add_hierarchical_term) wp-admin/includes/ajax-actions.php | Ajax handler for adding a hierarchical term. |
| [link\_categories\_meta\_box()](link_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays link categories form fields. |
| [post\_categories\_meta\_box()](post_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays post categories form fields. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress load_plugin_textdomain( string $domain, string|false $deprecated = false, string|false $plugin_rel_path = false ): bool load\_plugin\_textdomain( string $domain, string|false $deprecated = false, string|false $plugin\_rel\_path = false ): bool
===========================================================================================================================
Loads a plugin’s translated strings.
If the path is not given then it will be the root of the plugin directory.
The .mo file should be named based on the text domain with a dash, and then the locale exactly.
`$domain` string Required Unique identifier for retrieving translated strings `$deprecated` string|false Optional Deprecated. Use the $plugin\_rel\_path parameter instead.
Default: `false`
`$plugin_rel_path` string|false Optional Relative path to WP\_PLUGIN\_DIR where the .mo file resides.
Default: `false`
bool True when textdomain is successfully loaded, false otherwise.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path = false ) {
/** @var WP_Textdomain_Registry $wp_textdomain_registry */
global $wp_textdomain_registry;
/**
* Filters a plugin's locale.
*
* @since 3.0.0
*
* @param string $locale The plugin's current locale.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
*/
$locale = apply_filters( 'plugin_locale', determine_locale(), $domain );
$mofile = $domain . '-' . $locale . '.mo';
// Try to load from the languages directory first.
if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile, $locale ) ) {
return true;
}
if ( false !== $plugin_rel_path ) {
$path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' );
} elseif ( false !== $deprecated ) {
_deprecated_argument( __FUNCTION__, '2.7.0' );
$path = ABSPATH . trim( $deprecated, '/' );
} else {
$path = WP_PLUGIN_DIR;
}
$wp_textdomain_registry->set_custom_path( $domain, $path );
return load_textdomain( $domain, $path . '/' . $mofile, $locale );
}
```
[apply\_filters( 'plugin\_locale', string $locale, string $domain )](../hooks/plugin_locale)
Filters a plugin’s locale.
| Uses | Description |
| --- | --- |
| [WP\_Textdomain\_Registry::set\_custom\_path()](../classes/wp_textdomain_registry/set_custom_path) wp-includes/class-wp-textdomain-registry.php | Sets the custom path to the plugin’s/theme’s languages directory. |
| [determine\_locale()](determine_locale) wp-includes/l10n.php | Determines the current locale desired for the request. |
| [load\_textdomain()](load_textdomain) wp-includes/l10n.php | Loads a .mo file into the text domain $domain. |
| [\_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 |
| --- | --- |
| [\_get\_plugin\_data\_markup\_translate()](_get_plugin_data_markup_translate) wp-admin/includes/plugin.php | Sanitizes plugin data, optionally adds markup, optionally translates. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | The function now tries to load the .mo file from the languages directory first. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_comment( WP_Comment|string|int $comment = null, string $output = OBJECT ): WP_Comment|array|null get\_comment( WP\_Comment|string|int $comment = null, string $output = OBJECT ): WP\_Comment|array|null
=======================================================================================================
Retrieves comment data given a comment ID or comment object.
If an object is passed then the comment data will be cached and then returned after being passed through a filter. If the comment is empty, then the global comment variable will be used, if it is set.
`$comment` [WP\_Comment](../classes/wp_comment)|string|int Optional Comment to retrieve. Default: `null`
`$output` string Optional The required return type. One of OBJECT, ARRAY\_A, or ARRAY\_N, which correspond to a [WP\_Comment](../classes/wp_comment) object, an associative array, or a numeric array, respectively. Default: `OBJECT`
[WP\_Comment](../classes/wp_comment)|array|null Depends on $output value.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function get_comment( $comment = null, $output = OBJECT ) {
if ( empty( $comment ) && isset( $GLOBALS['comment'] ) ) {
$comment = $GLOBALS['comment'];
}
if ( $comment instanceof WP_Comment ) {
$_comment = $comment;
} elseif ( is_object( $comment ) ) {
$_comment = new WP_Comment( $comment );
} else {
$_comment = WP_Comment::get_instance( $comment );
}
if ( ! $_comment ) {
return null;
}
/**
* Fires after a comment is retrieved.
*
* @since 2.3.0
*
* @param WP_Comment $_comment Comment data.
*/
$_comment = apply_filters( 'get_comment', $_comment );
if ( OBJECT === $output ) {
return $_comment;
} elseif ( ARRAY_A === $output ) {
return $_comment->to_array();
} elseif ( ARRAY_N === $output ) {
return array_values( $_comment->to_array() );
}
return $_comment;
}
```
[apply\_filters( 'get\_comment', WP\_Comment $\_comment )](../hooks/get_comment)
Fires after a comment is retrieved.
| Uses | Description |
| --- | --- |
| [WP\_Comment::\_\_construct()](../classes/wp_comment/__construct) wp-includes/class-wp-comment.php | Constructor. |
| [WP\_Comment::get\_instance()](../classes/wp_comment/get_instance) wp-includes/class-wp-comment.php | Retrieves a [WP\_Comment](../classes/wp_comment) instance. |
| [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\_unapproved\_comment\_author\_email()](wp_get_unapproved_comment_author_email) wp-includes/comment.php | Gets unapproved comment author’s email. |
| [get\_object\_subtype()](get_object_subtype) wp-includes/meta.php | Returns the object subtype for a given object ID of a specific type. |
| [WP\_REST\_Comments\_Controller::get\_comment()](../classes/wp_rest_comments_controller/get_comment) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Get the comment, if the ID is valid. |
| [WP\_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()](../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::create\_item()](../classes/wp_rest_comments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Creates 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\_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\_moderator()](wp_new_comment_notify_moderator) wp-includes/comment.php | Sends a comment moderation notification to the comment moderator. |
| [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. |
| [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\_Comment\_Query::get\_comments()](../classes/wp_comment_query/get_comments) wp-includes/class-wp-comment-query.php | Get a list of comments matching the query vars. |
| [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. |
| [touch\_time()](touch_time) wp-admin/includes/template.php | Prints out HTML form date elements for editing post or comment publish date. |
| [\_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\_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\_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\_Comments\_List\_Table::column\_comment()](../classes/wp_comments_list_table/column_comment) wp-admin/includes/class-wp-comments-list-table.php | |
| [get\_comment\_to\_edit()](get_comment_to_edit) wp-admin/includes/comment.php | Returns a [WP\_Comment](../classes/wp_comment) object based on comment ID. |
| [floated\_admin\_avatar()](floated_admin_avatar) wp-admin/includes/comment.php | Adds avatars to relevant places in admin. |
| [map\_meta\_cap()](map_meta_cap) wp-includes/capabilities.php | Maps a capability to the primitive capabilities required of the given user to satisfy the capability being checked. |
| [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. |
| [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. |
| [get\_commentdata()](get_commentdata) wp-includes/deprecated.php | Retrieve an array of comment data about comment $comment\_ID. |
| [wp\_scheduled\_delete()](wp_scheduled_delete) wp-includes/functions.php | Permanently deletes comments or posts of any type that have held a status of ‘trash’ for the number of days defined in EMPTY\_TRASH\_DAYS. |
| [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\_comment\_guid()](get_comment_guid) wp-includes/feed.php | Retrieves the feed GUID for the current comment. |
| [wp\_xmlrpc\_server::wp\_deleteComment()](../classes/wp_xmlrpc_server/wp_deletecomment) wp-includes/class-wp-xmlrpc-server.php | Delete a comment. |
| [wp\_xmlrpc\_server::wp\_editComment()](../classes/wp_xmlrpc_server/wp_editcomment) wp-includes/class-wp-xmlrpc-server.php | Edit comment. |
| [wp\_xmlrpc\_server::wp\_getComment()](../classes/wp_xmlrpc_server/wp_getcomment) wp-includes/class-wp-xmlrpc-server.php | Retrieve comment. |
| [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\_link()](get_comment_link) wp-includes/comment-template.php | Retrieves the link to a given comment. |
| [get\_comment\_text()](get_comment_text) wp-includes/comment-template.php | Retrieves the text of the current comment. |
| [comment\_text()](comment_text) wp-includes/comment-template.php | Displays the text of the current comment. |
| [get\_comment\_time()](get_comment_time) wp-includes/comment-template.php | Retrieves the comment time of the current comment. |
| [get\_comment\_type()](get_comment_type) wp-includes/comment-template.php | Retrieves the comment type of the current comment. |
| [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\_class()](get_comment_class) wp-includes/comment-template.php | Returns the classes for the comment div as an array. |
| [get\_comment\_date()](get_comment_date) wp-includes/comment-template.php | Retrieves the comment date of the current comment. |
| [get\_comment\_excerpt()](get_comment_excerpt) wp-includes/comment-template.php | Retrieves the excerpt of the given comment. |
| [comment\_excerpt()](comment_excerpt) wp-includes/comment-template.php | Displays the excerpt of the current comment. |
| [get\_comment\_ID()](get_comment_id) wp-includes/comment-template.php | Retrieves the comment ID of the current comment. |
| [get\_comment\_author()](get_comment_author) wp-includes/comment-template.php | Retrieves the author of the current comment. |
| [comment\_author()](comment_author) wp-includes/comment-template.php | Displays the author of the current comment. |
| [get\_comment\_author\_email()](get_comment_author_email) wp-includes/comment-template.php | Retrieves the email of the author of the current comment. |
| [comment\_author\_email()](comment_author_email) wp-includes/comment-template.php | Displays the email of the author of the current global $comment. |
| [get\_comment\_author\_email\_link()](get_comment_author_email_link) wp-includes/comment-template.php | Returns the HTML email link to the author of the current comment. |
| [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. |
| [get\_comment\_author\_IP()](get_comment_author_ip) wp-includes/comment-template.php | Retrieves the IP address of the author of the current comment. |
| [get\_comment\_author\_url()](get_comment_author_url) wp-includes/comment-template.php | Retrieves the URL of the author of the current comment, not linked. |
| [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\_spam\_comment()](wp_spam_comment) wp-includes/comment.php | Marks a comment as Spam. |
| [wp\_unspam\_comment()](wp_unspam_comment) wp-includes/comment.php | Removes a comment from the Spam. |
| [wp\_get\_comment\_status()](wp_get_comment_status) wp-includes/comment.php | Retrieves the status of a comment by comment ID. |
| [wp\_insert\_comment()](wp_insert_comment) wp-includes/comment.php | Inserts a comment into the database. |
| [get\_page\_of\_comment()](get_page_of_comment) wp-includes/comment.php | Calculates what page number a comment will appear on for comment paging. |
| [wp\_delete\_comment()](wp_delete_comment) wp-includes/comment.php | Trashes or deletes a comment. |
| [wp\_trash\_comment()](wp_trash_comment) wp-includes/comment.php | Moves a comment to the Trash |
| [wp\_untrash\_comment()](wp_untrash_comment) wp-includes/comment.php | Removes a comment from the Trash |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress core_update_footer( string $msg = '' ): string core\_update\_footer( string $msg = '' ): string
================================================
Returns core update footer message.
`$msg` string Optional Default: `''`
string
File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
```
function core_update_footer( $msg = '' ) {
if ( ! current_user_can( 'update_core' ) ) {
/* translators: %s: WordPress version. */
return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
}
$cur = get_preferred_from_update_core();
if ( ! is_object( $cur ) ) {
$cur = new stdClass;
}
if ( ! isset( $cur->current ) ) {
$cur->current = '';
}
if ( ! isset( $cur->response ) ) {
$cur->response = '';
}
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$is_development_version = preg_match( '/alpha|beta|RC/', $wp_version );
if ( $is_development_version ) {
return sprintf(
/* translators: 1: WordPress version number, 2: URL to WordPress Updates screen. */
__( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ),
get_bloginfo( 'version', 'display' ),
network_admin_url( 'update-core.php' )
);
}
switch ( $cur->response ) {
case 'upgrade':
return sprintf(
'<strong><a href="%s">%s</a></strong>',
network_admin_url( 'update-core.php' ),
/* translators: %s: WordPress version. */
sprintf( __( 'Get Version %s' ), $cur->current )
);
case 'latest':
default:
/* translators: %s: WordPress version. */
return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
}
}
```
| 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-includes/l10n.php | Retrieves the translation of $text. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_audio_shortcode( array $attr, string $content = '' ): string|void wp\_audio\_shortcode( array $attr, string $content = '' ): string|void
======================================================================
Builds the Audio shortcode output.
This implements the functionality of the Audio Shortcode for displaying WordPress mp3s in a post.
`$attr` array Required Attributes of the audio shortcode.
* `src`stringURL to the source of the audio file. Default empty.
* `loop`stringThe `'loop'` attribute for the `<audio>` element. Default empty.
* `autoplay`stringThe `'autoplay'` attribute for the `<audio>` element. Default empty.
* `preload`stringThe `'preload'` attribute for the `<audio>` element. Default `'none'`.
* `class`stringThe `'class'` attribute for the `<audio>` element. Default `'wp-audio-shortcode'`.
* `style`stringThe `'style'` attribute for the `<audio>` element. Default 'width: 100%;'.
`$content` string Optional Shortcode content. Default: `''`
string|void HTML content to display audio.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_audio_shortcode( $attr, $content = '' ) {
$post_id = get_post() ? get_the_ID() : 0;
static $instance = 0;
$instance++;
/**
* Filters the default audio shortcode output.
*
* If the filtered output isn't empty, it will be used instead of generating the default audio template.
*
* @since 3.6.0
*
* @param string $html Empty variable to be replaced with shortcode markup.
* @param array $attr Attributes of the shortcode. @see wp_audio_shortcode()
* @param string $content Shortcode content.
* @param int $instance Unique numeric ID of this audio shortcode instance.
*/
$override = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instance );
if ( '' !== $override ) {
return $override;
}
$audio = null;
$default_types = wp_get_audio_extensions();
$defaults_atts = array(
'src' => '',
'loop' => '',
'autoplay' => '',
'preload' => 'none',
'class' => 'wp-audio-shortcode',
'style' => 'width: 100%;',
);
foreach ( $default_types as $type ) {
$defaults_atts[ $type ] = '';
}
$atts = shortcode_atts( $defaults_atts, $attr, 'audio' );
$primary = false;
if ( ! empty( $atts['src'] ) ) {
$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-audio" href="%s">%s</a>', esc_url( $atts['src'] ), esc_html( $atts['src'] ) );
}
$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 ) {
$audios = get_attached_media( 'audio', $post_id );
if ( empty( $audios ) ) {
return;
}
$audio = reset( $audios );
$atts['src'] = wp_get_attachment_url( $audio->ID );
if ( empty( $atts['src'] ) ) {
return;
}
array_unshift( $default_types, 'src' );
}
/**
* Filters the media library used for the audio shortcode.
*
* @since 3.6.0
*
* @param string $library Media library used for the audio shortcode.
*/
$library = apply_filters( 'wp_audio_shortcode_library', 'mediaelement' );
if ( 'mediaelement' === $library && did_action( 'init' ) ) {
wp_enqueue_style( 'wp-mediaelement' );
wp_enqueue_script( 'wp-mediaelement' );
}
/**
* Filters the class attribute for the audio 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 audio shortcode attributes.
*/
$atts['class'] = apply_filters( 'wp_audio_shortcode_class', $atts['class'], $atts );
$html_atts = array(
'class' => $atts['class'],
'id' => sprintf( 'audio-%d-%d', $post_id, $instance ),
'loop' => wp_validate_boolean( $atts['loop'] ),
'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
'preload' => $atts['preload'],
'style' => $atts['style'],
);
// These ones should just be omitted altogether if they are blank.
foreach ( array( 'loop', 'autoplay', 'preload' ) 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('audio');</script><![endif]-->\n";
}
$html .= sprintf( '<audio %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 ];
}
$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 ( 'mediaelement' === $library ) {
$html .= wp_mediaelement_fallback( $fileurl );
}
$html .= '</audio>';
/**
* Filters the audio shortcode output.
*
* @since 3.6.0
*
* @param string $html Audio shortcode HTML output.
* @param array $atts Array of audio shortcode attributes.
* @param string $audio Audio file.
* @param int $post_id Post ID.
* @param string $library Media library used for the audio shortcode.
*/
return apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id, $library );
}
```
[apply\_filters( 'wp\_audio\_shortcode', string $html, array $atts, string $audio, int $post\_id, string $library )](../hooks/wp_audio_shortcode)
Filters the audio shortcode output.
[apply\_filters( 'wp\_audio\_shortcode\_class', string $class, array $atts )](../hooks/wp_audio_shortcode_class)
Filters the class attribute for the audio shortcode output container.
[apply\_filters( 'wp\_audio\_shortcode\_library', string $library )](../hooks/wp_audio_shortcode_library)
Filters the media library used for the audio shortcode.
[apply\_filters( 'wp\_audio\_shortcode\_override', string $html, array $attr, string $content, int $instance )](../hooks/wp_audio_shortcode_override)
Filters the default audio shortcode output.
| Uses | Description |
| --- | --- |
| [wp\_validate\_boolean()](wp_validate_boolean) wp-includes/functions.php | Filters/validates a variable as a boolean. |
| [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\_audio\_extensions()](wp_get_audio_extensions) wp-includes/media.php | Returns a filtered list of supported audio formats. |
| [get\_attached\_media()](get_attached_media) wp-includes/media.php | Retrieves media attached to the passed post. |
| [get\_the\_ID()](get_the_id) wp-includes/post-template.php | Retrieves the ID of the current item in the WordPress Loop. |
| [shortcode\_atts()](shortcode_atts) wp-includes/shortcodes.php | Combines user attributes with known attributes and fill in defaults when needed. |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| [wp\_get\_mime\_types()](wp_get_mime_types) wp-includes/functions.php | Retrieves the list of mime types and file extensions. |
| [wp\_check\_filetype()](wp_check_filetype) wp-includes/functions.php | Retrieves the file type from the file name. |
| [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. |
| [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. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [WP\_Widget\_Media\_Audio::render\_media()](../classes/wp_widget_media_audio/render_media) wp-includes/widgets/class-wp-widget-media-audio.php | Render the media on the frontend. |
| [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. |
wordpress wp_is_stream( string $path ): bool wp\_is\_stream( string $path ): bool
====================================
Tests if a given path is a stream URL
`$path` string Required The resource path or URL. bool True if the path is a stream URL.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_is_stream( $path ) {
$scheme_separator = strpos( $path, '://' );
if ( false === $scheme_separator ) {
// $path isn't a stream.
return false;
}
$stream = substr( $path, 0, $scheme_separator );
return in_array( $stream, stream_get_wrappers(), true );
}
```
| Used By | Description |
| --- | --- |
| [WP\_Image\_Editor\_Imagick::write\_image()](../classes/wp_image_editor_imagick/write_image) wp-includes/class-wp-image-editor-imagick.php | Writes an image to a file or stream. |
| [wp\_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\_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\_mkdir\_p()](wp_mkdir_p) wp-includes/functions.php | Recursive directory creation based on full path. |
| [path\_is\_absolute()](path_is_absolute) wp-includes/functions.php | Tests if a given filesystem path is absolute. |
| [wp\_normalize\_path()](wp_normalize_path) wp-includes/functions.php | Normalizes a filesystem path. |
| [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::make\_image()](../classes/wp_image_editor/make_image) wp-includes/class-wp-image-editor.php | Either calls editor’s save function or handles file as a stream. |
| [WP\_Image\_Editor\_GD::make\_image()](../classes/wp_image_editor_gd/make_image) wp-includes/class-wp-image-editor-gd.php | Either calls editor’s save function or handles file as a stream. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress wp_register_user_personal_data_exporter( array[] $exporters ): array[] wp\_register\_user\_personal\_data\_exporter( array[] $exporters ): array[]
===========================================================================
Registers the personal data exporter for users.
`$exporters` array[] Required An array of personal data exporters. array[] An array of personal data exporters.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_register_user_personal_data_exporter( $exporters ) {
$exporters['wordpress-user'] = array(
'exporter_friendly_name' => __( 'WordPress User' ),
'callback' => 'wp_user_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 _register_widget_update_callback( string $id_base, callable $update_callback, array $options = array(), mixed $params ) \_register\_widget\_update\_callback( string $id\_base, callable $update\_callback, array $options = array(), mixed $params )
=============================================================================================================================
Registers the update callback for a widget.
`$id_base` string Required The base ID of a widget created by extending [WP\_Widget](../classes/wp_widget). `$update_callback` callable Required Update callback method for the widget. `$options` array Optional Widget control options. See [wp\_register\_widget\_control()](wp_register_widget_control) .
More Arguments from wp\_register\_widget\_control( ... $options ) Array or string of control options.
* `height`intNever used. Default 200.
* `width`intWidth of the fully expanded control form (but try hard to use the default width).
Default 250.
* `id_base`int|stringRequired for multi-widgets, i.e widgets that allow multiple instances such as the text widget. The widget ID will end up looking like `{$id_base}-{$unique_number}`.
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 _register_widget_update_callback( $id_base, $update_callback, $options = array(), ...$params ) {
global $wp_registered_widget_updates;
if ( isset( $wp_registered_widget_updates[ $id_base ] ) ) {
if ( empty( $update_callback ) ) {
unset( $wp_registered_widget_updates[ $id_base ] );
}
return;
}
$widget = array(
'callback' => $update_callback,
'params' => $params,
);
$widget = array_merge( $widget, $options );
$wp_registered_widget_updates[ $id_base ] = $widget;
}
```
| Used By | Description |
| --- | --- |
| [WP\_Widget::\_register\_one()](../classes/wp_widget/_register_one) wp-includes/class-wp-widget.php | Registers an instance of the widget class. |
| Version | Description |
| --- | --- |
| [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.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress get_theme_data( string $theme_file ): array get\_theme\_data( string $theme\_file ): array
==============================================
This function has been deprecated. Use [wp\_get\_theme()](wp_get_theme) instead.
Retrieve theme data from parsed theme file.
* [wp\_get\_theme()](wp_get_theme)
`$theme_file` string Required Theme file path. array Theme data.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_theme_data( $theme_file ) {
_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
$theme = new WP_Theme( wp_basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
$theme_data = array(
'Name' => $theme->get('Name'),
'URI' => $theme->display('ThemeURI', true, false),
'Description' => $theme->display('Description', true, false),
'Author' => $theme->display('Author', true, false),
'AuthorURI' => $theme->display('AuthorURI', true, false),
'Version' => $theme->get('Version'),
'Template' => $theme->get('Template'),
'Status' => $theme->get('Status'),
'Tags' => $theme->get('Tags'),
'Title' => $theme->get('Name'),
'AuthorName' => $theme->get('Author'),
);
foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) {
if ( ! isset( $theme_data[ $extra_header ] ) )
$theme_data[ $extra_header ] = $theme->get( $extra_header );
}
return $theme_data;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Theme::\_\_construct()](../classes/wp_theme/__construct) wp-includes/class-wp-theme.php | Constructor for [WP\_Theme](../classes/wp_theme). |
| [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. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Use [wp\_get\_theme()](wp_get_theme) |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress get_user_id_from_string( string $string ): int get\_user\_id\_from\_string( string $string ): int
==================================================
This function has been deprecated. Use [get\_user\_by()](get_user_by) instead.
Get a numeric user ID from either an email address or a login.
A numeric string is considered to be an existing user ID and is simply returned as such.
* [get\_user\_by()](get_user_by)
`$string` string Required Either an email address or a login. int
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function get_user_id_from_string( $string ) {
_deprecated_function( __FUNCTION__, '3.6.0', 'get_user_by()' );
if ( is_email( $string ) )
$user = get_user_by( 'email', $string );
elseif ( is_numeric( $string ) )
return $string;
else
$user = get_user_by( 'login', $string );
if ( $user )
return $user->ID;
return 0;
}
```
| Uses | Description |
| --- | --- |
| [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Use [get\_user\_by()](get_user_by) |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress wp_tiny_mce( $teeny = false, $settings = false ) wp\_tiny\_mce( $teeny = false, $settings = false )
==================================================
This function has been deprecated. Use [wp\_editor()](wp_editor) instead.
Outputs the TinyMCE editor.
* [wp\_editor()](wp_editor)
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function wp_tiny_mce( $teeny = false, $settings = false ) {
_deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
static $num = 1;
if ( ! class_exists( '_WP_Editors', false ) )
require_once ABSPATH . WPINC . '/class-wp-editor.php';
$editor_id = 'content' . $num++;
$set = array(
'teeny' => $teeny,
'tinymce' => $settings ? $settings : true,
'quicktags' => false
);
$set = _WP_Editors::parse_settings($editor_id, $set);
_WP_Editors::editor_settings($editor_id, $set);
}
```
| Uses | Description |
| --- | --- |
| [\_WP\_Editors::parse\_settings()](../classes/_wp_editors/parse_settings) wp-includes/class-wp-editor.php | Parse default arguments for the editor instance. |
| [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Used By | Description |
| --- | --- |
| [tinymce\_include()](tinymce_include) wp-admin/includes/deprecated.php | |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Use [wp\_editor()](wp_editor) |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress is_protected_ajax_action(): bool is\_protected\_ajax\_action(): bool
===================================
Determines whether we are currently handling an Ajax action that should be protected against WSODs.
bool True if the current Ajax action should be protected.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function is_protected_ajax_action() {
if ( ! wp_doing_ajax() ) {
return false;
}
if ( ! isset( $_REQUEST['action'] ) ) {
return false;
}
$actions_to_protect = array(
'edit-theme-plugin-file', // Saving changes in the core code editor.
'heartbeat', // Keep the heart beating.
'install-plugin', // Installing a new plugin.
'install-theme', // Installing a new theme.
'search-plugins', // Searching in the list of plugins.
'search-install-plugins', // Searching for a plugin in the plugin install screen.
'update-plugin', // Update an existing plugin.
'update-theme', // Update an existing theme.
);
/**
* Filters the array of protected Ajax actions.
*
* This filter is only fired when doing Ajax and the Ajax request has an 'action' property.
*
* @since 5.2.0
*
* @param string[] $actions_to_protect Array of strings with Ajax actions to protect.
*/
$actions_to_protect = (array) apply_filters( 'wp_protected_ajax_actions', $actions_to_protect );
if ( ! in_array( $_REQUEST['action'], $actions_to_protect, true ) ) {
return false;
}
return true;
}
```
[apply\_filters( 'wp\_protected\_ajax\_actions', string[] $actions\_to\_protect )](../hooks/wp_protected_ajax_actions)
Filters the array of protected Ajax actions.
| Uses | Description |
| --- | --- |
| [wp\_doing\_ajax()](wp_doing_ajax) wp-includes/load.php | Determines whether the current request is a WordPress Ajax request. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [is\_protected\_endpoint()](is_protected_endpoint) wp-includes/load.php | Determines whether we are currently on an endpoint that should be protected against WSODs. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress wp_auth_check_html() wp\_auth\_check\_html()
=======================
Outputs the HTML that shows the wp-login dialog when the user is no longer logged in.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_auth_check_html() {
$login_url = wp_login_url();
$current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'];
$same_domain = ( strpos( $login_url, $current_domain ) === 0 );
/**
* Filters whether the authentication check originated at the same domain.
*
* @since 3.6.0
*
* @param bool $same_domain Whether the authentication check originated at the same domain.
*/
$same_domain = apply_filters( 'wp_auth_check_same_domain', $same_domain );
$wrap_class = $same_domain ? 'hidden' : 'hidden fallback';
?>
<div id="wp-auth-check-wrap" class="<?php echo $wrap_class; ?>">
<div id="wp-auth-check-bg"></div>
<div id="wp-auth-check">
<button type="button" class="wp-auth-check-close button-link"><span class="screen-reader-text"><?php _e( 'Close dialog' ); ?></span></button>
<?php
if ( $same_domain ) {
$login_src = add_query_arg(
array(
'interim-login' => '1',
'wp_lang' => get_user_locale(),
),
$login_url
);
?>
<div id="wp-auth-check-form" class="loading" data-src="<?php echo esc_url( $login_src ); ?>"></div>
<?php
}
?>
<div class="wp-auth-fallback">
<p><b class="wp-auth-fallback-expired" tabindex="0"><?php _e( 'Session expired' ); ?></b></p>
<p><a href="<?php echo esc_url( $login_url ); ?>" target="_blank"><?php _e( 'Please log in again.' ); ?></a>
<?php _e( 'The login page will open in a new tab. After logging in you can close it and return to this page.' ); ?></p>
</div>
</div>
</div>
<?php
}
```
[apply\_filters( 'wp\_auth\_check\_same\_domain', bool $same\_domain )](../hooks/wp_auth_check_same_domain)
Filters whether the authentication check originated at the same domain.
| Uses | Description |
| --- | --- |
| [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. |
| [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. |
| [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [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 get_admin_page_parent( string $parent_page = '' ): string get\_admin\_page\_parent( string $parent\_page = '' ): string
=============================================================
Gets the parent file of the current admin page.
`$parent_page` string Optional The slug name for the parent menu (or the file name of a standard WordPress admin page). Default: `''`
string The parent file of the current admin page.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function get_admin_page_parent( $parent_page = '' ) {
global $parent_file, $menu, $submenu, $pagenow, $typenow,
$plugin_page, $_wp_real_parent_file, $_wp_menu_nopriv, $_wp_submenu_nopriv;
if ( ! empty( $parent_page ) && 'admin.php' !== $parent_page ) {
if ( isset( $_wp_real_parent_file[ $parent_page ] ) ) {
$parent_page = $_wp_real_parent_file[ $parent_page ];
}
return $parent_page;
}
if ( 'admin.php' === $pagenow && isset( $plugin_page ) ) {
foreach ( (array) $menu as $parent_menu ) {
if ( $parent_menu[2] === $plugin_page ) {
$parent_file = $plugin_page;
if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) {
$parent_file = $_wp_real_parent_file[ $parent_file ];
}
return $parent_file;
}
}
if ( isset( $_wp_menu_nopriv[ $plugin_page ] ) ) {
$parent_file = $plugin_page;
if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) {
$parent_file = $_wp_real_parent_file[ $parent_file ];
}
return $parent_file;
}
}
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $pagenow ][ $plugin_page ] ) ) {
$parent_file = $pagenow;
if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) {
$parent_file = $_wp_real_parent_file[ $parent_file ];
}
return $parent_file;
}
foreach ( array_keys( (array) $submenu ) as $parent_page ) {
foreach ( $submenu[ $parent_page ] as $submenu_array ) {
if ( isset( $_wp_real_parent_file[ $parent_page ] ) ) {
$parent_page = $_wp_real_parent_file[ $parent_page ];
}
if ( ! empty( $typenow ) && "$pagenow?post_type=$typenow" === $submenu_array[2] ) {
$parent_file = $parent_page;
return $parent_page;
} elseif ( empty( $typenow ) && $pagenow === $submenu_array[2]
&& ( empty( $parent_file ) || false === strpos( $parent_file, '?' ) )
) {
$parent_file = $parent_page;
return $parent_page;
} elseif ( isset( $plugin_page ) && $plugin_page === $submenu_array[2] ) {
$parent_file = $parent_page;
return $parent_page;
}
}
}
if ( empty( $parent_file ) ) {
$parent_file = '';
}
return '';
}
```
| Used By | Description |
| --- | --- |
| [get\_admin\_page\_title()](get_admin_page_title) wp-admin/includes/plugin.php | Gets the title of the current admin page. |
| [get\_plugin\_page\_hookname()](get_plugin_page_hookname) wp-admin/includes/plugin.php | Gets the hook name for 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. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_home_url( int|null $blog_id = null, string $path = '', string|null $scheme = null ): string get\_home\_url( int|null $blog\_id = null, string $path = '', string|null $scheme = null ): string
==================================================================================================
Retrieves the URL for a given site where the front end is accessible.
Returns the ‘home’ option with the appropriate protocol. The protocol will be ‘https’ if [is\_ssl()](is_ssl) evaluates to true; otherwise, it will be the same as the ‘home’ option.
If `$scheme` is ‘http’ or ‘https’, [is\_ssl()](is_ssl) is overridden.
`$blog_id` int|null Optional Site ID. Default null (current site). Default: `null`
`$path` string Optional Path relative to the home URL. Default: `''`
`$scheme` string|null Optional Scheme to give the home URL context. Accepts `'http'`, `'https'`, `'relative'`, `'rest'`, or null. Default: `null`
string Home URL link with optional path appended.
**Basic Usage**
```
<?php echo get_home_url(); ?>
```
Will output: `https://www.example.com` With the domain and the schema matching your settings.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_home_url( $blog_id = null, $path = '', $scheme = null ) {
$orig_scheme = $scheme;
if ( empty( $blog_id ) || ! is_multisite() ) {
$url = get_option( 'home' );
} else {
switch_to_blog( $blog_id );
$url = get_option( 'home' );
restore_current_blog();
}
if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ), true ) ) {
if ( is_ssl() ) {
$scheme = 'https';
} else {
$scheme = parse_url( $url, PHP_URL_SCHEME );
}
}
$url = set_url_scheme( $url, $scheme );
if ( $path && is_string( $path ) ) {
$url .= '/' . ltrim( $path, '/' );
}
/**
* Filters the home URL.
*
* @since 3.0.0
*
* @param string $url The complete home URL including scheme and path.
* @param string $path Path relative to the home URL. Blank string if no path is specified.
* @param string|null $orig_scheme Scheme to give the home URL context. Accepts 'http', 'https',
* 'relative', 'rest', or null.
* @param int|null $blog_id Site ID, or null for the current site.
*/
return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id );
}
```
[apply\_filters( 'home\_url', string $url, string $path, string|null $orig\_scheme, int|null $blog\_id )](../hooks/home_url)
Filters the home URL.
| Uses | Description |
| --- | --- |
| [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. |
| [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. |
| [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\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. |
| [get\_rest\_url()](get_rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint on a site. |
| [get\_oembed\_response\_data()](get_oembed_response_data) wp-includes/embed.php | Retrieves the oEmbed response data for a given post. |
| [WP\_MS\_Sites\_List\_Table::handle\_row\_actions()](../classes/wp_ms_sites_list_table/handle_row_actions) wp-admin/includes/class-wp-ms-sites-list-table.php | Generates and displays row action links. |
| [WP\_MS\_Users\_List\_Table::column\_blogs()](../classes/wp_ms_users_list_table/column_blogs) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the sites column output. |
| [signup\_another\_blog()](signup_another_blog) wp-signup.php | Shows a form for returning users to sign up for another site. |
| [\_access\_denied\_splash()](_access_denied_splash) wp-admin/includes/ms.php | Displays an access denied message when a user tries to view a site’s dashboard they do not have access to. |
| [choose\_primary\_blog()](choose_primary_blog) wp-admin/includes/ms.php | Handles the display of choosing a user’s primary site. |
| [options\_general\_add\_js()](options_general_add_js) wp-admin/includes/options.php | Display JavaScript on the page. |
| [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.php | |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [get\_post\_type\_archive\_link()](get_post_type_archive_link) wp-includes/link-template.php | Retrieves the permalink for a post type archive. |
| [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. |
| [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_ajax_wp_privacy_export_personal_data() wp\_ajax\_wp\_privacy\_export\_personal\_data()
===============================================
Ajax handler for exporting a user’s personal data.
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_privacy_export_personal_data() {
if ( empty( $_POST['id'] ) ) {
wp_send_json_error( __( 'Missing request ID.' ) );
}
$request_id = (int) $_POST['id'];
if ( $request_id < 1 ) {
wp_send_json_error( __( 'Invalid request ID.' ) );
}
if ( ! current_user_can( 'export_others_personal_data' ) ) {
wp_send_json_error( __( 'Sorry, you are not allowed to perform this action.' ) );
}
check_ajax_referer( 'wp-privacy-export-personal-data-' . $request_id, 'security' );
// Get the request.
$request = wp_get_user_request( $request_id );
if ( ! $request || 'export_personal_data' !== $request->action_name ) {
wp_send_json_error( __( 'Invalid request type.' ) );
}
$email_address = $request->email;
if ( ! is_email( $email_address ) ) {
wp_send_json_error( __( 'A valid email address must be given.' ) );
}
if ( ! isset( $_POST['exporter'] ) ) {
wp_send_json_error( __( 'Missing exporter index.' ) );
}
$exporter_index = (int) $_POST['exporter'];
if ( ! isset( $_POST['page'] ) ) {
wp_send_json_error( __( 'Missing page index.' ) );
}
$page = (int) $_POST['page'];
$send_as_email = isset( $_POST['sendAsEmail'] ) ? ( 'true' === $_POST['sendAsEmail'] ) : false;
/**
* Filters the array of exporter callbacks.
*
* @since 4.9.6
*
* @param array $args {
* An array of callable exporters of personal data. Default empty array.
*
* @type array ...$0 {
* Array of personal data exporters.
*
* @type callable $callback Callable exporter function that accepts an
* email address and a page and returns an array
* of name => value pairs of personal data.
* @type string $exporter_friendly_name Translated user facing friendly name for the
* exporter.
* }
* }
*/
$exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
if ( ! is_array( $exporters ) ) {
wp_send_json_error( __( 'An exporter has improperly used the registration filter.' ) );
}
// Do we have any registered exporters?
if ( 0 < count( $exporters ) ) {
if ( $exporter_index < 1 ) {
wp_send_json_error( __( 'Exporter index cannot be negative.' ) );
}
if ( $exporter_index > count( $exporters ) ) {
wp_send_json_error( __( 'Exporter index is out of range.' ) );
}
if ( $page < 1 ) {
wp_send_json_error( __( 'Page index cannot be less than one.' ) );
}
$exporter_keys = array_keys( $exporters );
$exporter_key = $exporter_keys[ $exporter_index - 1 ];
$exporter = $exporters[ $exporter_key ];
if ( ! is_array( $exporter ) ) {
wp_send_json_error(
/* translators: %s: Exporter array index. */
sprintf( __( 'Expected an array describing the exporter at index %s.' ), $exporter_key )
);
}
if ( ! array_key_exists( 'exporter_friendly_name', $exporter ) ) {
wp_send_json_error(
/* translators: %s: Exporter array index. */
sprintf( __( 'Exporter array at index %s does not include a friendly name.' ), $exporter_key )
);
}
$exporter_friendly_name = $exporter['exporter_friendly_name'];
if ( ! array_key_exists( 'callback', $exporter ) ) {
wp_send_json_error(
/* translators: %s: Exporter friendly name. */
sprintf( __( 'Exporter does not include a callback: %s.' ), esc_html( $exporter_friendly_name ) )
);
}
if ( ! is_callable( $exporter['callback'] ) ) {
wp_send_json_error(
/* translators: %s: Exporter friendly name. */
sprintf( __( 'Exporter callback is not a valid callback: %s.' ), esc_html( $exporter_friendly_name ) )
);
}
$callback = $exporter['callback'];
$response = call_user_func( $callback, $email_address, $page );
if ( is_wp_error( $response ) ) {
wp_send_json_error( $response );
}
if ( ! is_array( $response ) ) {
wp_send_json_error(
/* translators: %s: Exporter friendly name. */
sprintf( __( 'Expected response as an array from exporter: %s.' ), esc_html( $exporter_friendly_name ) )
);
}
if ( ! array_key_exists( 'data', $response ) ) {
wp_send_json_error(
/* translators: %s: Exporter friendly name. */
sprintf( __( 'Expected data in response array from exporter: %s.' ), esc_html( $exporter_friendly_name ) )
);
}
if ( ! is_array( $response['data'] ) ) {
wp_send_json_error(
/* translators: %s: Exporter friendly name. */
sprintf( __( 'Expected data array in response array from exporter: %s.' ), esc_html( $exporter_friendly_name ) )
);
}
if ( ! array_key_exists( 'done', $response ) ) {
wp_send_json_error(
/* translators: %s: Exporter friendly name. */
sprintf( __( 'Expected done (boolean) in response array from exporter: %s.' ), esc_html( $exporter_friendly_name ) )
);
}
} else {
// No exporters, so we're done.
$exporter_key = '';
$response = array(
'data' => array(),
'done' => true,
);
}
/**
* Filters a page of personal data exporter data. Used to build the export report.
*
* Allows the export response to be consumed by destinations in addition to Ajax.
*
* @since 4.9.6
*
* @param array $response The personal data for the given exporter and page.
* @param int $exporter_index The index of the exporter that provided this data.
* @param string $email_address The email address associated with this personal data.
* @param int $page The page for this response.
* @param int $request_id The privacy request post ID associated with this request.
* @param bool $send_as_email Whether the final results of the export should be emailed to the user.
* @param string $exporter_key The key (slug) of the exporter that provided this data.
*/
$response = apply_filters( 'wp_privacy_personal_data_export_page', $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key );
if ( is_wp_error( $response ) ) {
wp_send_json_error( $response );
}
wp_send_json_success( $response );
}
```
[apply\_filters( 'wp\_privacy\_personal\_data\_exporters', array $args )](../hooks/wp_privacy_personal_data_exporters)
Filters the array of exporter callbacks.
[apply\_filters( 'wp\_privacy\_personal\_data\_export\_page', array $response, int $exporter\_index, string $email\_address, int $page, int $request\_id, bool $send\_as\_email, string $exporter\_key )](../hooks/wp_privacy_personal_data_export_page)
Filters a page of personal data exporter data. Used to build the export report.
| 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. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_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. |
| [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. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
| programming_docs |
wordpress debug_fopen( string $filename, string $mode ): false debug\_fopen( string $filename, string $mode ): false
=====================================================
This function has been deprecated. Use [error\_log()](https://www.php.net/manual/en/function.error-log.php) instead.
Open the file handle for debugging.
* [error\_log()](https://www.php.net/manual/en/function.error-log.php)
`$filename` string Required File name. `$mode` string Required Type of access you required to the stream. false Always false.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function debug_fopen( $filename, $mode ) {
_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
return false;
}
```
| 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/) | Use error\_log() |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress get_previous_comments_link( string $label = '' ): string|void get\_previous\_comments\_link( string $label = '' ): string|void
================================================================
Retrieves the link to the previous comments page.
`$label` string Optional Label for comments link text. Default: `''`
string|void HTML-formatted link for the previous page of comments.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_previous_comments_link( $label = '' ) {
if ( ! is_singular() ) {
return;
}
$page = get_query_var( 'cpage' );
if ( (int) $page <= 1 ) {
return;
}
$prevpage = (int) $page - 1;
if ( empty( $label ) ) {
$label = __( '« Older Comments' );
}
/**
* Filters the anchor tag attributes for the previous comments page link.
*
* @since 2.7.0
*
* @param string $attributes Attributes for the anchor tag.
*/
return '<a href="' . esc_url( get_comments_pagenum_link( $prevpage ) ) . '" ' . apply_filters( 'previous_comments_link_attributes', '' ) . '>' . preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) . '</a>';
}
```
[apply\_filters( 'previous\_comments\_link\_attributes', string $attributes )](../hooks/previous_comments_link_attributes)
Filters the anchor tag attributes for the previous comments page link.
| Uses | Description |
| --- | --- |
| [is\_singular()](is_singular) wp-includes/query.php | Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types). |
| [get\_query\_var()](get_query_var) wp-includes/query.php | Retrieves the value of a query variable in the [WP\_Query](../classes/wp_query) class. |
| [get\_comments\_pagenum\_link()](get_comments_pagenum_link) wp-includes/link-template.php | Retrieves the comments page number link. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [get\_the\_comments\_navigation()](get_the_comments_navigation) wp-includes/link-template.php | Retrieves navigation to next/previous set of comments, when applicable. |
| [previous\_comments\_link()](previous_comments_link) wp-includes/link-template.php | Displays the link to the previous comments page. |
| Version | Description |
| --- | --- |
| [2.7.1](https://developer.wordpress.org/reference/since/2.7.1/) | Introduced. |
wordpress postbox_classes( string $box_id, string $screen_id ): string postbox\_classes( string $box\_id, string $screen\_id ): string
===============================================================
Returns the list of classes to be used by a meta box.
`$box_id` string Required Meta box ID (used in the `'id'` attribute for the meta box). `$screen_id` string Required The screen on which the meta box is shown. string Space-separated string of class names.
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function postbox_classes( $box_id, $screen_id ) {
if ( isset( $_GET['edit'] ) && $_GET['edit'] == $box_id ) {
$classes = array( '' );
} elseif ( get_user_option( 'closedpostboxes_' . $screen_id ) ) {
$closed = get_user_option( 'closedpostboxes_' . $screen_id );
if ( ! is_array( $closed ) ) {
$classes = array( '' );
} else {
$classes = in_array( $box_id, $closed, true ) ? array( 'closed' ) : array( '' );
}
} else {
$classes = array( '' );
}
/**
* Filters the postbox classes for a specific screen and box ID combo.
*
* The dynamic portions of the hook name, `$screen_id` and `$box_id`, refer to
* the screen ID and meta box ID, respectively.
*
* @since 3.2.0
*
* @param string[] $classes An array of postbox classes.
*/
$classes = apply_filters( "postbox_classes_{$screen_id}_{$box_id}", $classes );
return implode( ' ', $classes );
}
```
[apply\_filters( "postbox\_classes\_{$screen\_id}\_{$box\_id}", string[] $classes )](../hooks/postbox_classes_screen_id_box_id)
Filters the postbox classes for a specific screen and box ID combo.
| Uses | Description |
| --- | --- |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress file_is_valid_image( string $path ): bool file\_is\_valid\_image( string $path ): bool
============================================
Validates that file is an image.
`$path` string Required File path to test if valid image. bool True if valid image, false if not valid image.
File: `wp-admin/includes/image.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image.php/)
```
function file_is_valid_image( $path ) {
$size = wp_getimagesize( $path );
return ! empty( $size );
}
```
| Uses | Description |
| --- | --- |
| [wp\_getimagesize()](wp_getimagesize) wp-includes/media.php | Allows PHP’s getimagesize() to be debuggable when necessary. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress _wp_link_page( int $i ): string \_wp\_link\_page( int $i ): 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.
Helper function for [wp\_link\_pages()](wp_link_pages) .
`$i` int Required Page number. string Link.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function _wp_link_page( $i ) {
global $wp_rewrite;
$post = get_post();
$query_args = array();
if ( 1 == $i ) {
$url = get_permalink();
} else {
if ( ! get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ), true ) ) {
$url = add_query_arg( 'page', $i, get_permalink() );
} elseif ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) {
$url = trailingslashit( get_permalink() ) . user_trailingslashit( "$wp_rewrite->pagination_base/" . $i, 'single_paged' );
} else {
$url = trailingslashit( get_permalink() ) . user_trailingslashit( $i, 'single_paged' );
}
}
if ( is_preview() ) {
if ( ( 'draft' !== $post->post_status ) && isset( $_GET['preview_id'], $_GET['preview_nonce'] ) ) {
$query_args['preview_id'] = wp_unslash( $_GET['preview_id'] );
$query_args['preview_nonce'] = wp_unslash( $_GET['preview_nonce'] );
}
$url = get_preview_post_link( $post, $query_args, $url );
}
return '<a href="' . esc_url( $url ) . '" class="post-page-numbers">';
}
```
| Uses | Description |
| --- | --- |
| [get\_preview\_post\_link()](get_preview_post_link) wp-includes/link-template.php | Retrieves the URL used for the post preview. |
| [is\_preview()](is_preview) wp-includes/query.php | Determines whether the query is for a post or page preview. |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [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. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [wp\_link\_pages()](wp_link_pages) wp-includes/post-template.php | The formatted output of a list of pages. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_iframe_tag_add_loading_attr( string $iframe, string $context ): string wp\_iframe\_tag\_add\_loading\_attr( string $iframe, string $context ): string
==============================================================================
Adds `loading` attribute to an `iframe` HTML tag.
`$iframe` string Required The HTML `iframe` tag where the attribute should be added. `$context` string Required Additional context to pass to the filters. string Converted `iframe` tag with `loading` attribute added.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_iframe_tag_add_loading_attr( $iframe, $context ) {
// Iframes with fallback content (see `wp_filter_oembed_result()`) should not be lazy-loaded because they are
// visually hidden initially.
if ( false !== strpos( $iframe, ' data-secret="' ) ) {
return $iframe;
}
// Get loading attribute value to use. This must occur before the conditional check below so that even iframes that
// are ineligible for being lazy-loaded are considered.
$value = wp_get_loading_attr_default( $context );
// Iframes should have source and dimension attributes for the `loading` attribute to be added.
if ( false === strpos( $iframe, ' src="' ) || false === strpos( $iframe, ' width="' ) || false === strpos( $iframe, ' height="' ) ) {
return $iframe;
}
/**
* Filters the `loading` attribute value to add to an iframe. Default `lazy`.
*
* Returning `false` or an empty string will not add the attribute.
* Returning `true` will add the default value.
*
* @since 5.7.0
*
* @param string|bool $value The `loading` attribute value. Returning a falsey value will result in
* the attribute being omitted for the iframe.
* @param string $iframe The HTML `iframe` tag to be filtered.
* @param string $context Additional context about how the function was called or where the iframe tag is.
*/
$value = apply_filters( 'wp_iframe_tag_add_loading_attr', $value, $iframe, $context );
if ( $value ) {
if ( ! in_array( $value, array( 'lazy', 'eager' ), true ) ) {
$value = 'lazy';
}
return str_replace( '<iframe', '<iframe loading="' . esc_attr( $value ) . '"', $iframe );
}
return $iframe;
}
```
[apply\_filters( 'wp\_iframe\_tag\_add\_loading\_attr', string|bool $value, string $iframe, string $context )](../hooks/wp_iframe_tag_add_loading_attr)
Filters the `loading` attribute value to add to an iframe. Default `lazy`.
| 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. |
| [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\_filter\_content\_tags()](wp_filter_content_tags) wp-includes/media.php | Filters specific tags in post content and modifies their markup. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress get_categories( string|array $args = '' ): array get\_categories( string|array $args = '' ): array
=================================================
Retrieves a list of category objects.
If you set the ‘taxonomy’ argument to ‘link\_category’, the link categories will be returned instead.
* [get\_terms()](get_terms) : Type of arguments that can be changed.
`$args` string|array Optional Arguments to retrieve categories. See [get\_terms()](get_terms) for additional options.
* `taxonomy`stringTaxonomy to retrieve terms for. Default `'category'`.
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: `''`
array List of category objects.
File: `wp-includes/category.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category.php/)
```
function get_categories( $args = '' ) {
$defaults = array( 'taxonomy' => 'category' );
$args = wp_parse_args( $args, $defaults );
/**
* Filters the taxonomy used to retrieve terms when calling get_categories().
*
* @since 2.7.0
*
* @param string $taxonomy Taxonomy to retrieve terms from.
* @param array $args An array of arguments. See get_terms().
*/
$args['taxonomy'] = apply_filters( 'get_categories_taxonomy', $args['taxonomy'], $args );
// 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';
}
$categories = get_terms( $args );
if ( is_wp_error( $categories ) ) {
$categories = array();
} else {
$categories = (array) $categories;
foreach ( array_keys( $categories ) as $k ) {
_make_cat_compat( $categories[ $k ] );
}
}
return $categories;
}
```
[apply\_filters( 'get\_categories\_taxonomy', string $taxonomy, array $args )](../hooks/get_categories_taxonomy)
Filters the taxonomy used to retrieve terms when calling [get\_categories()](get_categories) .
| Uses | Description |
| --- | --- |
| [\_make\_cat\_compat()](_make_cat_compat) wp-includes/category.php | Updates category structure to old pre-2.3 from new taxonomy structure. |
| [get\_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. |
| [\_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. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [wp\_dropdown\_cats()](wp_dropdown_cats) wp-admin/includes/deprecated.php | Legacy function used for generating a categories drop-down control. |
| [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| [get\_links\_list()](get_links_list) wp-includes/deprecated.php | Output entire list of links by category. |
| [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::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::wp\_suggestCategories()](../classes/wp_xmlrpc_server/wp_suggestcategories) wp-includes/class-wp-xmlrpc-server.php | Retrieve category list. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress wp_dashboard_recent_comments( int $total_items = 5 ): bool wp\_dashboard\_recent\_comments( int $total\_items = 5 ): bool
==============================================================
Show Comments section.
`$total_items` int Optional Number of comments to query. Default: `5`
bool False if no comments were found. True otherwise.
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_dashboard_recent_comments( $total_items = 5 ) {
// Select all comment types and filter out spam later for better query performance.
$comments = array();
$comments_query = array(
'number' => $total_items * 5,
'offset' => 0,
);
if ( ! current_user_can( 'edit_posts' ) ) {
$comments_query['status'] = 'approve';
}
while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) {
if ( ! is_array( $possible ) ) {
break;
}
foreach ( $possible as $comment ) {
if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) {
continue;
}
$comments[] = $comment;
if ( count( $comments ) === $total_items ) {
break 2;
}
}
$comments_query['offset'] += $comments_query['number'];
$comments_query['number'] = $total_items * 10;
}
if ( $comments ) {
echo '<div id="latest-comments" class="activity-block table-view-list">';
echo '<h3>' . __( 'Recent Comments' ) . '</h3>';
echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
foreach ( $comments as $comment ) {
_wp_dashboard_recent_comments_row( $comment );
}
echo '</ul>';
if ( current_user_can( 'edit_posts' ) ) {
echo '<h3 class="screen-reader-text">' . __( 'View more comments' ) . '</h3>';
_get_list_table( 'WP_Comments_List_Table' )->views();
}
wp_comment_reply( -1, false, 'dashboard', false );
wp_comment_trashnotice();
echo '</div>';
} else {
return false;
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. |
| [\_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\_comment\_reply()](wp_comment_reply) wp-admin/includes/template.php | Outputs the in-line comment reply-to form in the Comments list table. |
| [wp\_comment\_trashnotice()](wp_comment_trashnotice) wp-admin/includes/template.php | Outputs ‘undo move to Trash’ text for comments. |
| [get\_comments()](get_comments) wp-includes/comment.php | Retrieves a list of comments. |
| [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. |
| Used By | Description |
| --- | --- |
| [wp\_dashboard\_site\_activity()](wp_dashboard_site_activity) wp-admin/includes/dashboard.php | Callback function for Activity widget. |
| Version | Description |
| --- | --- |
| [3.8.0](https://developer.wordpress.org/reference/since/3.8.0/) | Introduced. |
wordpress wp_normalize_site_data( array $data ): array wp\_normalize\_site\_data( array $data ): array
===============================================
Normalizes data for a site prior to inserting or updating in the database.
`$data` array Required Associative array of site data passed to the respective function.
See [wp\_insert\_site()](wp_insert_site) for the possibly included data. More Arguments from wp\_insert\_site( ... $data ) Data for the new site that should be inserted.
* `domain`stringSite domain. Default empty string.
* `path`stringSite path. Default `'/'`.
* `network_id`intThe site's network ID. Default is the current network ID.
* `registered`stringWhen the site was registered, in SQL datetime format. Default is the current time.
* `last_updated`stringWhen the site was last updated, in SQL datetime format. Default is the value of $registered.
* `public`intWhether the site is public. Default 1.
* `archived`intWhether the site is archived. Default 0.
* `mature`intWhether the site is mature. Default 0.
* `spam`intWhether the site is spam. Default 0.
* `deleted`intWhether the site is deleted. Default 0.
* `lang_id`intThe site's language ID. Currently unused. Default 0.
* `user_id`intUser ID for the site administrator. Passed to the `wp_initialize_site` hook.
* `title`stringSite title. Default is 'Site %d' where %d is the site ID. Passed to the `wp_initialize_site` hook.
* `options`arrayCustom option $key => $value pairs to use. Default empty array. Passed to the `wp_initialize_site` hook.
* `meta`arrayCustom site metadata $key => $value pairs to use. Default empty array.
Passed to the `wp_initialize_site` hook.
array Normalized site data.
File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function wp_normalize_site_data( $data ) {
// Sanitize domain if passed.
if ( array_key_exists( 'domain', $data ) ) {
$data['domain'] = trim( $data['domain'] );
$data['domain'] = preg_replace( '/\s+/', '', sanitize_user( $data['domain'], true ) );
if ( is_subdomain_install() ) {
$data['domain'] = str_replace( '@', '', $data['domain'] );
}
}
// Sanitize path if passed.
if ( array_key_exists( 'path', $data ) ) {
$data['path'] = trailingslashit( '/' . trim( $data['path'], '/' ) );
}
// Sanitize network ID if passed.
if ( array_key_exists( 'network_id', $data ) ) {
$data['network_id'] = (int) $data['network_id'];
}
// Sanitize status fields if passed.
$status_fields = array( 'public', 'archived', 'mature', 'spam', 'deleted' );
foreach ( $status_fields as $status_field ) {
if ( array_key_exists( $status_field, $data ) ) {
$data[ $status_field ] = (int) $data[ $status_field ];
}
}
// Strip date fields if empty.
$date_fields = array( 'registered', 'last_updated' );
foreach ( $date_fields as $date_field ) {
if ( ! array_key_exists( $date_field, $data ) ) {
continue;
}
if ( empty( $data[ $date_field ] ) || '0000-00-00 00:00:00' === $data[ $date_field ] ) {
unset( $data[ $date_field ] );
}
}
return $data;
}
```
| Uses | Description |
| --- | --- |
| [is\_subdomain\_install()](is_subdomain_install) wp-includes/ms-load.php | Whether a subdomain configuration is enabled. |
| [sanitize\_user()](sanitize_user) wp-includes/formatting.php | Sanitizes a username, stripping out unsafe characters. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress _media_button( $title, $icon, $type, $id ) \_media\_button( $title, $icon, $type, $id )
============================================
This function has been deprecated.
This was once used to display a media button.
Now it is deprecated and stubbed.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function _media_button($title, $icon, $type, $id) {
_deprecated_function( __FUNCTION__, '3.5.0' );
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress pre_schema_upgrade() pre\_schema\_upgrade()
======================
Runs before the schema is upgraded.
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function pre_schema_upgrade() {
global $wp_current_db_version, $wpdb;
// Upgrade versions prior to 2.9.
if ( $wp_current_db_version < 11557 ) {
// Delete duplicate options. Keep the option with the highest option_id.
$wpdb->query( "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id" );
// Drop the old primary key and add the new.
$wpdb->query( "ALTER TABLE $wpdb->options DROP PRIMARY KEY, ADD PRIMARY KEY(option_id)" );
// Drop the old option_name index. dbDelta() doesn't do the drop.
$wpdb->query( "ALTER TABLE $wpdb->options DROP INDEX option_name" );
}
// Multisite schema upgrades.
if ( $wp_current_db_version < 25448 && is_multisite() && wp_should_upgrade_global_tables() ) {
// Upgrade versions prior to 3.7.
if ( $wp_current_db_version < 25179 ) {
// New primary key for signups.
$wpdb->query( "ALTER TABLE $wpdb->signups ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST" );
$wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain" );
}
if ( $wp_current_db_version < 25448 ) {
// Convert archived from enum to tinyint.
$wpdb->query( "ALTER TABLE $wpdb->blogs CHANGE COLUMN archived archived varchar(1) NOT NULL default '0'" );
$wpdb->query( "ALTER TABLE $wpdb->blogs CHANGE COLUMN archived archived tinyint(2) NOT NULL default 0" );
}
}
// Upgrade versions prior to 4.2.
if ( $wp_current_db_version < 31351 ) {
if ( ! is_multisite() && wp_should_upgrade_global_tables() ) {
$wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
}
$wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX slug, ADD INDEX slug(slug(191))" );
$wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX name, ADD INDEX name(name(191))" );
$wpdb->query( "ALTER TABLE $wpdb->commentmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
$wpdb->query( "ALTER TABLE $wpdb->postmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
$wpdb->query( "ALTER TABLE $wpdb->posts DROP INDEX post_name, ADD INDEX post_name(post_name(191))" );
}
// Upgrade versions prior to 4.4.
if ( $wp_current_db_version < 34978 ) {
// If compatible termmeta table is found, use it, but enforce a proper index and update collation.
if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->termmeta}'" ) && $wpdb->get_results( "SHOW INDEX FROM {$wpdb->termmeta} WHERE Column_name = 'meta_key'" ) ) {
$wpdb->query( "ALTER TABLE $wpdb->termmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
maybe_convert_table_to_utf8mb4( $wpdb->termmeta );
}
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_should\_upgrade\_global\_tables()](wp_should_upgrade_global_tables) wp-admin/includes/upgrade.php | Determine if global tables should be upgraded. |
| [maybe\_convert\_table\_to\_utf8mb4()](maybe_convert_table_to_utf8mb4) wp-admin/includes/upgrade.php | If a table only contains utf8 or utf8mb4 columns, convert it to utf8mb4. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [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). |
| Used By | Description |
| --- | --- |
| [wp\_upgrade()](wp_upgrade) wp-admin/includes/upgrade.php | Runs WordPress Upgrade functions. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress wp_safe_remote_request( string $url, array $args = array() ): array|WP_Error wp\_safe\_remote\_request( string $url, array $args = array() ): array|WP\_Error
================================================================================
Retrieve the raw response from a safe HTTP request.
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_request( $url, $args = array() ) {
$args['reject_unsafe_urls'] = true;
$http = _wp_http_get_object();
return $http->request( $url, $args );
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_http\_get\_object()](_wp_http_get_object) wp-includes/http.php | Returns the initialized [WP\_Http](../classes/wp_http) Object |
| Used By | Description |
| --- | --- |
| [WP\_Importer::get\_page()](../classes/wp_importer/get_page) wp-admin/includes/class-wp-importer.php | GET URL |
| [wp\_get\_http()](wp_get_http) wp-includes/deprecated.php | Perform a HTTP HEAD or GET request. |
| [WP\_SimplePie\_File::\_\_construct()](../classes/wp_simplepie_file/__construct) wp-includes/class-wp-simplepie-file.php | Constructor. |
| [\_fetch\_remote\_file()](_fetch_remote_file) wp-includes/rss.php | Retrieve URL headers and content using WP HTTP Request API. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress wxr_post_taxonomy() wxr\_post\_taxonomy()
=====================
Outputs list of taxonomy terms, in XML tag format, associated with a post.
File: `wp-admin/includes/export.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/export.php/)
```
function wxr_post_taxonomy() {
$post = get_post();
$taxonomies = get_object_taxonomies( $post->post_type );
if ( empty( $taxonomies ) ) {
return;
}
$terms = wp_get_object_terms( $post->ID, $taxonomies );
foreach ( (array) $terms as $term ) {
echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "</category>\n";
}
}
```
| Uses | Description |
| --- | --- |
| [wxr\_cdata()](wxr_cdata) wp-admin/includes/export.php | Wraps given string in XML CDATA tag. |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [get\_object\_taxonomies()](get_object_taxonomies) wp-includes/taxonomy.php | Returns the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name. |
| [get\_post()](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 |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress set_screen_options() set\_screen\_options()
======================
Saves option for number of rows when listing posts, pages, comments, etc.
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function set_screen_options() {
if ( ! isset( $_POST['wp_screen_options'] ) || ! is_array( $_POST['wp_screen_options'] ) ) {
return;
}
check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
$user = wp_get_current_user();
if ( ! $user ) {
return;
}
$option = $_POST['wp_screen_options']['option'];
$value = $_POST['wp_screen_options']['value'];
if ( sanitize_key( $option ) !== $option ) {
return;
}
$map_option = $option;
$type = str_replace( 'edit_', '', $map_option );
$type = str_replace( '_per_page', '', $type );
if ( in_array( $type, get_taxonomies(), true ) ) {
$map_option = 'edit_tags_per_page';
} elseif ( in_array( $type, get_post_types(), true ) ) {
$map_option = 'edit_per_page';
} else {
$option = str_replace( '-', '_', $option );
}
switch ( $map_option ) {
case 'edit_per_page':
case 'users_per_page':
case 'edit_comments_per_page':
case 'upload_per_page':
case 'edit_tags_per_page':
case 'plugins_per_page':
case 'export_personal_data_requests_per_page':
case 'remove_personal_data_requests_per_page':
// Network admin.
case 'sites_network_per_page':
case 'users_network_per_page':
case 'site_users_network_per_page':
case 'plugins_network_per_page':
case 'themes_network_per_page':
case 'site_themes_network_per_page':
$value = (int) $value;
if ( $value < 1 || $value > 999 ) {
return;
}
break;
default:
$screen_option = false;
if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
/**
* Filters a screen option value before it is set.
*
* The filter can also be used to modify non-standard [items]_per_page
* settings. See the parent function for a full list of standard options.
*
* Returning false from the filter will skip saving the current option.
*
* @since 2.8.0
* @since 5.4.2 Only applied to options ending with '_page',
* or the 'layout_columns' option.
*
* @see set_screen_options()
*
* @param mixed $screen_option The value to save instead of the option value.
* Default false (to skip saving the current option).
* @param string $option The option name.
* @param int $value The option value.
*/
$screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
/**
* Filters a screen option value before it is set.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* Returning false from the filter will skip saving the current option.
*
* @since 5.4.2
*
* @see set_screen_options()
*
* @param mixed $screen_option The value to save instead of the option value.
* Default false (to skip saving the current option).
* @param string $option The option name.
* @param int $value The option value.
*/
$value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
if ( false === $value ) {
return;
}
break;
}
update_user_meta( $user->ID, $option, $value );
$url = remove_query_arg( array( 'pagenum', 'apage', 'paged' ), wp_get_referer() );
if ( isset( $_POST['mode'] ) ) {
$url = add_query_arg( array( 'mode' => $_POST['mode'] ), $url );
}
wp_safe_redirect( $url );
exit;
}
```
[apply\_filters( 'set-screen-option', mixed $screen\_option, string $option, int $value )](../hooks/set-screen-option)
Filters a screen option value before it is set.
[apply\_filters( "set\_screen\_option\_{$option}", mixed $screen\_option, string $option, int $value )](../hooks/set_screen_option_option)
Filters a screen option value before it is set.
| Uses | Description |
| --- | --- |
| [wp\_safe\_redirect()](wp_safe_redirect) wp-includes/pluggable.php | Performs a safe (local) redirect, using [wp\_redirect()](wp_redirect) . |
| [check\_admin\_referer()](check_admin_referer) wp-includes/pluggable.php | Ensures intent by verifying that a user was referred from another admin page with the correct security nonce. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [wp\_get\_referer()](wp_get_referer) wp-includes/functions.php | Retrieves referer from ‘\_wp\_http\_referer’ or HTTP referer. |
| [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. |
| [get\_taxonomies()](get_taxonomies) wp-includes/taxonomy.php | Retrieves a list of registered taxonomy names or objects. |
| [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. |
| [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\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
| programming_docs |
wordpress sync_category_tag_slugs( WP_Term|array $term, string $taxonomy ): WP_Term|array sync\_category\_tag\_slugs( WP\_Term|array $term, string $taxonomy ): WP\_Term|array
====================================================================================
This function has been deprecated.
Synchronizes category and post tag slugs when global terms are enabled.
`$term` [WP\_Term](../classes/wp_term)|array Required The term. `$taxonomy` string Required The taxonomy for `$term`. [WP\_Term](../classes/wp_term)|array Always returns `$term`.
File: `wp-admin/includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms-deprecated.php/)
```
function sync_category_tag_slugs( $term, $taxonomy ) {
_deprecated_function( __FUNCTION__, '6.1.0' );
return $term;
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | This function has been deprecated. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress redirect_post( int $post_id = '' ) redirect\_post( int $post\_id = '' )
====================================
Redirects to previous page.
`$post_id` int Optional Post ID. Default: `''`
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function redirect_post( $post_id = '' ) {
if ( isset( $_POST['save'] ) || isset( $_POST['publish'] ) ) {
$status = get_post_status( $post_id );
if ( isset( $_POST['publish'] ) ) {
switch ( $status ) {
case 'pending':
$message = 8;
break;
case 'future':
$message = 9;
break;
default:
$message = 6;
}
} else {
$message = 'draft' === $status ? 10 : 1;
}
$location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) );
} elseif ( isset( $_POST['addmeta'] ) && $_POST['addmeta'] ) {
$location = add_query_arg( 'message', 2, wp_get_referer() );
$location = explode( '#', $location );
$location = $location[0] . '#postcustom';
} elseif ( isset( $_POST['deletemeta'] ) && $_POST['deletemeta'] ) {
$location = add_query_arg( 'message', 3, wp_get_referer() );
$location = explode( '#', $location );
$location = $location[0] . '#postcustom';
} else {
$location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) );
}
/**
* Filters the post redirect destination URL.
*
* @since 2.9.0
*
* @param string $location The destination URL.
* @param int $post_id The post ID.
*/
wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
exit;
}
```
[apply\_filters( 'redirect\_post\_location', string $location, int $post\_id )](../hooks/redirect_post_location)
Filters the post redirect destination URL.
| Uses | Description |
| --- | --- |
| [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. |
| [wp\_get\_referer()](wp_get_referer) wp-includes/functions.php | Retrieves referer from ‘\_wp\_http\_referer’ or HTTP referer. |
| [get\_edit\_post\_link()](get_edit_post_link) wp-includes/link-template.php | Retrieves the edit post link for post. |
| [get\_post\_status()](get_post_status) wp-includes/post.php | Retrieves the post status based on the post ID. |
| [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.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress favorite_actions() favorite\_actions()
===================
This function has been deprecated. Use [WP\_Admin\_Bar](../classes/wp_admin_bar)() instead.
Favorite actions were deprecated in version 3.2. Use the admin bar instead.
* [WP\_Admin\_Bar](../classes/wp_admin_bar)
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function favorite_actions() {
_deprecated_function( __FUNCTION__, '3.2.0', 'WP_Admin_Bar' );
}
```
| 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/) | Use [WP\_Admin\_Bar](../classes/wp_admin_bar) |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress stripslashes_deep( mixed $value ): mixed stripslashes\_deep( mixed $value ): mixed
=========================================
Navigates through an array, object, or scalar, and removes slashes from the values.
`$value` mixed Required The value to be stripped. mixed Stripped value.
If an array is passed, the [array\_map()](http://www.php.net/manual/en/function.array-map.php) function causes a callback to pass the value back to the function. The slashes from each value will be removed using the [stripslashes()](http://www.php.net/manual/en/function.stripslashes.php) function.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function stripslashes_deep( $value ) {
return map_deep( $value, 'stripslashes_from_strings_only' );
}
```
| Uses | Description |
| --- | --- |
| [map\_deep()](map_deep) wp-includes/formatting.php | Maps a function to all non-iterable elements of an array or an object. |
| Used By | Description |
| --- | --- |
| [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\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [WP\_Widget::update\_callback()](../classes/wp_widget/update_callback) wp-includes/class-wp-widget.php | Handles changed settings (Do NOT override). |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress get_parent_theme_file_uri( string $file = '' ): string get\_parent\_theme\_file\_uri( string $file = '' ): string
==========================================================
Retrieves the URL of a file in the parent theme.
`$file` string Optional File to return the URL for in the template directory. Default: `''`
string The URL 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_parent_theme_file_uri( $file = '' ) {
$file = ltrim( $file, '/' );
if ( empty( $file ) ) {
$url = get_template_directory_uri();
} else {
$url = get_template_directory_uri() . '/' . $file;
}
/**
* Filters the URL to a file in the parent theme.
*
* @since 4.7.0
*
* @param string $url The file URL.
* @param string $file The requested file to search for.
*/
return apply_filters( 'parent_theme_file_uri', $url, $file );
}
```
[apply\_filters( 'parent\_theme\_file\_uri', string $url, string $file )](../hooks/parent_theme_file_uri)
Filters the URL to a file in the parent theme.
| Uses | Description |
| --- | --- |
| [get\_template\_directory\_uri()](get_template_directory_uri) wp-includes/theme.php | Retrieves template directory URI for the active theme. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress get_raw_theme_root( string $stylesheet_or_template, bool $skip_cache = false ): string get\_raw\_theme\_root( string $stylesheet\_or\_template, bool $skip\_cache = false ): string
============================================================================================
Gets the raw theme root relative to the content directory with no filters applied.
`$stylesheet_or_template` string Required The stylesheet or template name of the theme. `$skip_cache` bool Optional Whether to skip the cache.
Defaults to false, meaning the cache is used. Default: `false`
string Theme root.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_raw_theme_root( $stylesheet_or_template, $skip_cache = false ) {
global $wp_theme_directories;
if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) {
return '/themes';
}
$theme_root = false;
// If requesting the root for the active theme, consult options to avoid calling get_theme_roots().
if ( ! $skip_cache ) {
if ( get_option( 'stylesheet' ) == $stylesheet_or_template ) {
$theme_root = get_option( 'stylesheet_root' );
} elseif ( get_option( 'template' ) == $stylesheet_or_template ) {
$theme_root = get_option( 'template_root' );
}
}
if ( empty( $theme_root ) ) {
$theme_roots = get_theme_roots();
if ( ! empty( $theme_roots[ $stylesheet_or_template ] ) ) {
$theme_root = $theme_roots[ $stylesheet_or_template ];
}
}
return $theme_root;
}
```
| Uses | Description |
| --- | --- |
| [get\_theme\_roots()](get_theme_roots) wp-includes/theme.php | Retrieves theme roots. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Manager::get\_template\_root()](../classes/wp_customize_manager/get_template_root) wp-includes/class-wp-customize-manager.php | Retrieves the template root of the previewed theme. |
| [WP\_Customize\_Manager::get\_stylesheet\_root()](../classes/wp_customize_manager/get_stylesheet_root) wp-includes/class-wp-customize-manager.php | Retrieves the stylesheet root of the previewed theme. |
| [get\_theme\_root()](get_theme_root) wp-includes/theme.php | Retrieves path to themes directory. |
| [get\_theme\_root\_uri()](get_theme_root_uri) wp-includes/theme.php | Retrieves URI for themes directory. |
| [switch\_theme()](switch_theme) wp-includes/theme.php | Switches the theme. |
| [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\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress get_all_user_settings(): array get\_all\_user\_settings(): array
=================================
Retrieves all user interface settings.
array The last saved user settings or empty array.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function get_all_user_settings() {
global $_updated_user_settings;
$user_id = get_current_user_id();
if ( ! $user_id ) {
return array();
}
if ( isset( $_updated_user_settings ) && is_array( $_updated_user_settings ) ) {
return $_updated_user_settings;
}
$user_settings = array();
if ( isset( $_COOKIE[ 'wp-settings-' . $user_id ] ) ) {
$cookie = preg_replace( '/[^A-Za-z0-9=&_-]/', '', $_COOKIE[ 'wp-settings-' . $user_id ] );
if ( strpos( $cookie, '=' ) ) { // '=' cannot be 1st char.
parse_str( $cookie, $user_settings );
}
} else {
$option = get_user_option( 'user-settings', $user_id );
if ( $option && is_string( $option ) ) {
parse_str( $option, $user_settings );
}
}
$_updated_user_settings = $user_settings;
return $user_settings;
}
```
| Uses | Description |
| --- | --- |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Used By | Description |
| --- | --- |
| [get\_user\_setting()](get_user_setting) wp-includes/option.php | Retrieves user interface setting value based on setting name. |
| [set\_user\_setting()](set_user_setting) wp-includes/option.php | Adds or updates user interface setting. |
| [delete\_user\_setting()](delete_user_setting) wp-includes/option.php | Deletes user interface settings. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress single_post_title( string $prefix = '', bool $display = true ): string|void single\_post\_title( string $prefix = '', bool $display = true ): string|void
=============================================================================
Displays or retrieves page title for post.
This is optimized for single.php template file for displaying the post title.
It does not support placing the separator after the title, but by leaving the prefix parameter empty, you can set the title separator manually. 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|void Title when retrieving.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function single_post_title( $prefix = '', $display = true ) {
$_post = get_queried_object();
if ( ! isset( $_post->post_title ) ) {
return;
}
/**
* Filters the page title for a single post.
*
* @since 0.71
*
* @param string $_post_title The single post page title.
* @param WP_Post $_post The current post.
*/
$title = apply_filters( 'single_post_title', $_post->post_title, $_post );
if ( $display ) {
echo $prefix . $title;
} else {
return $prefix . $title;
}
}
```
[apply\_filters( 'single\_post\_title', string $\_post\_title, WP\_Post $\_post )](../hooks/single_post_title)
Filters the page title for a single post.
| Uses | Description |
| --- | --- |
| [get\_queried\_object()](get_queried_object) wp-includes/query.php | Retrieves the currently queried object. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_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. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress is_new_day(): int is\_new\_day(): int
===================
Determines whether the publish date of the current post in the loop is different from the publish date of the previous post in the loop.
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.
int 1 when new day, 0 if not a new day.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function is_new_day() {
global $currentday, $previousday;
if ( $currentday !== $previousday ) {
return 1;
} else {
return 0;
}
}
```
| Used By | Description |
| --- | --- |
| [the\_date()](the_date) wp-includes/general-template.php | Displays or retrieves the date the current post was written (once per date) |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_cache_flush_group( string $group ): bool wp\_cache\_flush\_group( string $group ): bool
==============================================
Removes all cache items in a group, if the object cache implementation supports it.
Before calling this function, always check for group flushing support using the `wp_cache_supports( 'flush_group' )` function.
* [WP\_Object\_Cache::flush\_group()](../classes/wp_object_cache/flush_group)
`$group` string Required Name of group to remove from cache. bool True if group was flushed, 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_flush_group( $group ) {
global $wp_object_cache;
if ( ! wp_cache_supports( 'flush_group' ) ) {
_doing_it_wrong(
__FUNCTION__,
__( 'Your object cache implementation does not support flushing individual groups.' ),
'6.1.0'
);
return false;
}
return $wp_object_cache->flush_group( $group );
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_supports()](wp_cache_supports) wp-includes/cache-compat.php | Determines whether the object cache implementation supports a particular feature. |
| [WP\_Object\_Cache::flush\_group()](../classes/wp_object_cache/flush_group) wp-includes/class-wp-object-cache.php | Removes all cache items in a group. |
| [\_\_()](__) 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 |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress unregister_nav_menu( string $location ): bool unregister\_nav\_menu( string $location ): bool
===============================================
Unregisters a navigation menu location for a theme.
`$location` string Required The menu location identifier. bool True on success, false on failure.
##### Usage:
```
unregister_nav_menu( 'primary' );
```
File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function unregister_nav_menu( $location ) {
global $_wp_registered_nav_menus;
if ( is_array( $_wp_registered_nav_menus ) && isset( $_wp_registered_nav_menus[ $location ] ) ) {
unset( $_wp_registered_nav_menus[ $location ] );
if ( empty( $_wp_registered_nav_menus ) ) {
_remove_theme_support( 'menus' );
}
return true;
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [\_remove\_theme\_support()](_remove_theme_support) wp-includes/theme.php | Do not use. Removes theme support internally without knowledge of those not used by themes directly. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress get_bookmarks( string|array $args = '' ): object[] get\_bookmarks( string|array $args = '' ): object[]
===================================================
Retrieves the list of bookmarks.
Attempts to retrieve from the cache first based on MD5 hash of arguments. If that fails, then the query will be built from the arguments and executed. The results will be stored to the cache.
`$args` string|array Optional String or array of arguments to retrieve bookmarks.
* `orderby`stringHow to order the links by. Accepts `'id'`, `'link_id'`, `'name'`, `'link_name'`, `'url'`, `'link_url'`, `'visible'`, `'link_visible'`, `'rating'`, `'link_rating'`, `'owner'`, `'link_owner'`, `'updated'`, `'link_updated'`, `'notes'`, `'link_notes'`, `'description'`, `'link_description'`, `'length'` and `'rand'`.
When `$orderby` is `'length'`, orders by the character length of `'link_name'`. Default `'name'`.
* `order`stringWhether to order bookmarks in ascending or descending order.
Accepts `'ASC'` (ascending) or `'DESC'` (descending). Default `'ASC'`.
* `limit`intAmount of bookmarks to display. Accepts any positive number or -1 for all. Default -1.
* `category`stringComma-separated list of category IDs to include links from.
* `category_name`stringCategory to retrieve links for by name.
* `hide_invisible`int|boolWhether to show or hide links marked as `'invisible'`. Accepts `1|true` or `0|false`. Default `1|true`.
* `show_updated`int|boolWhether to display the time the bookmark was last updated.
Accepts `1|true` or `0|false`. Default `0|false`.
* `include`stringComma-separated list of bookmark IDs to include.
* `exclude`stringComma-separated list of bookmark IDs to exclude.
* `search`stringSearch terms. Will be SQL-formatted with wildcards before and after and searched in `'link_url'`, `'link_name'` and `'link_description'`.
Default: `''`
object[] List of bookmark row objects.
File: `wp-includes/bookmark.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/bookmark.php/)
```
function get_bookmarks( $args = '' ) {
global $wpdb;
$defaults = array(
'orderby' => 'name',
'order' => 'ASC',
'limit' => -1,
'category' => '',
'category_name' => '',
'hide_invisible' => 1,
'show_updated' => 0,
'include' => '',
'exclude' => '',
'search' => '',
);
$parsed_args = wp_parse_args( $args, $defaults );
$key = md5( serialize( $parsed_args ) );
$cache = wp_cache_get( 'get_bookmarks', 'bookmark' );
if ( 'rand' !== $parsed_args['orderby'] && $cache ) {
if ( is_array( $cache ) && isset( $cache[ $key ] ) ) {
$bookmarks = $cache[ $key ];
/**
* Filters the returned list of bookmarks.
*
* The first time the hook is evaluated in this file, it returns the cached
* bookmarks list. The second evaluation returns a cached bookmarks list if the
* link category is passed but does not exist. The third evaluation returns
* the full cached results.
*
* @since 2.1.0
*
* @see get_bookmarks()
*
* @param array $bookmarks List of the cached bookmarks.
* @param array $parsed_args An array of bookmark query arguments.
*/
return apply_filters( 'get_bookmarks', $bookmarks, $parsed_args );
}
}
if ( ! is_array( $cache ) ) {
$cache = array();
}
$inclusions = '';
if ( ! empty( $parsed_args['include'] ) ) {
$parsed_args['exclude'] = ''; // Ignore exclude, category, and category_name params if using include.
$parsed_args['category'] = '';
$parsed_args['category_name'] = '';
$inclinks = wp_parse_id_list( $parsed_args['include'] );
if ( count( $inclinks ) ) {
foreach ( $inclinks as $inclink ) {
if ( empty( $inclusions ) ) {
$inclusions = ' AND ( link_id = ' . $inclink . ' ';
} else {
$inclusions .= ' OR link_id = ' . $inclink . ' ';
}
}
}
}
if ( ! empty( $inclusions ) ) {
$inclusions .= ')';
}
$exclusions = '';
if ( ! empty( $parsed_args['exclude'] ) ) {
$exlinks = wp_parse_id_list( $parsed_args['exclude'] );
if ( count( $exlinks ) ) {
foreach ( $exlinks as $exlink ) {
if ( empty( $exclusions ) ) {
$exclusions = ' AND ( link_id <> ' . $exlink . ' ';
} else {
$exclusions .= ' AND link_id <> ' . $exlink . ' ';
}
}
}
}
if ( ! empty( $exclusions ) ) {
$exclusions .= ')';
}
if ( ! empty( $parsed_args['category_name'] ) ) {
$parsed_args['category'] = get_term_by( 'name', $parsed_args['category_name'], 'link_category' );
if ( $parsed_args['category'] ) {
$parsed_args['category'] = $parsed_args['category']->term_id;
} else {
$cache[ $key ] = array();
wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
/** This filter is documented in wp-includes/bookmark.php */
return apply_filters( 'get_bookmarks', array(), $parsed_args );
}
}
$search = '';
if ( ! empty( $parsed_args['search'] ) ) {
$like = '%' . $wpdb->esc_like( $parsed_args['search'] ) . '%';
$search = $wpdb->prepare( ' AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ', $like, $like, $like );
}
$category_query = '';
$join = '';
if ( ! empty( $parsed_args['category'] ) ) {
$incategories = wp_parse_id_list( $parsed_args['category'] );
if ( count( $incategories ) ) {
foreach ( $incategories as $incat ) {
if ( empty( $category_query ) ) {
$category_query = ' AND ( tt.term_id = ' . $incat . ' ';
} else {
$category_query .= ' OR tt.term_id = ' . $incat . ' ';
}
}
}
}
if ( ! empty( $category_query ) ) {
$category_query .= ") AND taxonomy = 'link_category'";
$join = " INNER JOIN $wpdb->term_relationships AS tr ON ($wpdb->links.link_id = tr.object_id) INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id";
}
if ( $parsed_args['show_updated'] ) {
$recently_updated_test = ', IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated ';
} else {
$recently_updated_test = '';
}
$get_updated = ( $parsed_args['show_updated'] ) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : '';
$orderby = strtolower( $parsed_args['orderby'] );
$length = '';
switch ( $orderby ) {
case 'length':
$length = ', CHAR_LENGTH(link_name) AS length';
break;
case 'rand':
$orderby = 'rand()';
break;
case 'link_id':
$orderby = "$wpdb->links.link_id";
break;
default:
$orderparams = array();
$keys = array( 'link_id', 'link_name', 'link_url', 'link_visible', 'link_rating', 'link_owner', 'link_updated', 'link_notes', 'link_description' );
foreach ( explode( ',', $orderby ) as $ordparam ) {
$ordparam = trim( $ordparam );
if ( in_array( 'link_' . $ordparam, $keys, true ) ) {
$orderparams[] = 'link_' . $ordparam;
} elseif ( in_array( $ordparam, $keys, true ) ) {
$orderparams[] = $ordparam;
}
}
$orderby = implode( ',', $orderparams );
}
if ( empty( $orderby ) ) {
$orderby = 'link_name';
}
$order = strtoupper( $parsed_args['order'] );
if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ), true ) ) {
$order = 'ASC';
}
$visible = '';
if ( $parsed_args['hide_invisible'] ) {
$visible = "AND link_visible = 'Y'";
}
$query = "SELECT * $length $recently_updated_test $get_updated FROM $wpdb->links $join WHERE 1=1 $visible $category_query";
$query .= " $exclusions $inclusions $search";
$query .= " ORDER BY $orderby $order";
if ( -1 != $parsed_args['limit'] ) {
$query .= ' LIMIT ' . absint( $parsed_args['limit'] );
}
$results = $wpdb->get_results( $query );
if ( 'rand()' !== $orderby ) {
$cache[ $key ] = $results;
wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
}
/** This filter is documented in wp-includes/bookmark.php */
return apply_filters( 'get_bookmarks', $results, $parsed_args );
}
```
[apply\_filters( 'get\_bookmarks', array $bookmarks, array $parsed\_args )](../hooks/get_bookmarks)
Filters the returned list of bookmarks.
| Uses | Description |
| --- | --- |
| [wpdb::esc\_like()](../classes/wpdb/esc_like) wp-includes/class-wpdb.php | First half of escaping for `LIKE` special characters `%` and `_` before preparing for SQL. |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [wp\_parse\_id\_list()](wp_parse_id_list) wp-includes/functions.php | Cleans up an array, comma- or space-separated list of IDs. |
| [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [WP\_Links\_List\_Table::prepare\_items()](../classes/wp_links_list_table/prepare_items) wp-admin/includes/class-wp-links-list-table.php | |
| [get\_links()](get_links) wp-includes/deprecated.php | Gets the links associated with category by ID. |
| [get\_linkobjects()](get_linkobjects) wp-includes/deprecated.php | Gets an array of link objects associated with category n. |
| [wp\_list\_bookmarks()](wp_list_bookmarks) wp-includes/bookmark-template.php | Retrieves or echoes all of the bookmarks. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress get_post_parent( int|WP_Post|null $post = null ): WP_Post|null get\_post\_parent( int|WP\_Post|null $post = null ): WP\_Post|null
==================================================================
Retrieves the parent post object for the given post.
`$post` int|[WP\_Post](../classes/wp_post)|null Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global $post. Default: `null`
[WP\_Post](../classes/wp_post)|null Parent post object, or null if there isn't one.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function get_post_parent( $post = null ) {
$wp_post = get_post( $post );
return ! empty( $wp_post->post_parent ) ? get_post( $wp_post->post_parent ) : null;
}
```
| Uses | Description |
| --- | --- |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [has\_post\_parent()](has_post_parent) wp-includes/post-template.php | Returns whether the given post has a parent post. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress wp_is_mobile(): bool wp\_is\_mobile(): bool
======================
Test if the current browser runs on a mobile device (smart phone, tablet, etc.)
bool
This Conditional Tag checks if the user is visiting using a mobile device. This is a boolean function, meaning it returns either TRUE or FALSE. It works through the detection of the browser user agent string ($\_SERVER[‘HTTP\_USER\_AGENT’])
Do not think of this function as a way of detecting phones. Its purpose is not detecting screen width, but rather adjusting for the potentially limited resources of mobile devices. A mobile device may have less CPU power, memory and/or bandwidth available. This function will return true for a tablet, as it too is considered a mobile device. It is **not** a substitute for CSS media queries or styling per platform.
One way that this function could be used in a theme is to produce a very light version of the site that does not have the large payload of the desktop site. Note that both the desktop and the mobile versions of the page will still need to be responsive, as an older portrait phone will have a significantly different width than a modern iPad in landscape. [wp\_is\_mobile()](wp_is_mobile) will be true for both. Similarly a desktop browser window may not be displayed at full width. Essentially this approach may double the amount of work you will need to put into the theme. Yet for a tightly optimized theme or a unique mobile experience, it may be essential. It also means that a proper theme may have at least three different responsive design specs: Desktop, Mobile and AMP.
Additionally, care must be taken when using this function in a public theme. If your theme works differently for mobile devices and desktop devices, any page caching solution used MUST keep separate mobile/non-mobile buckets. Many caching solutions do not do this or charge for this feature. Even the most detailed read me file may not be able to adequately explain these details
File: `wp-includes/vars.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/vars.php/)
```
function wp_is_mobile() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
$is_mobile = false;
} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Mobile' ) !== false // Many mobile devices (all iPhone, iPad, etc.)
|| strpos( $_SERVER['HTTP_USER_AGENT'], 'Android' ) !== false
|| strpos( $_SERVER['HTTP_USER_AGENT'], 'Silk/' ) !== false
|| strpos( $_SERVER['HTTP_USER_AGENT'], 'Kindle' ) !== false
|| strpos( $_SERVER['HTTP_USER_AGENT'], 'BlackBerry' ) !== false
|| strpos( $_SERVER['HTTP_USER_AGENT'], 'Opera Mini' ) !== false
|| strpos( $_SERVER['HTTP_USER_AGENT'], 'Opera Mobi' ) !== false ) {
$is_mobile = true;
} else {
$is_mobile = false;
}
/**
* Filters whether the request should be treated as coming from a mobile device or not.
*
* @since 4.9.0
*
* @param bool $is_mobile Whether the request is from a mobile device or not.
*/
return apply_filters( 'wp_is_mobile', $is_mobile );
}
```
[apply\_filters( 'wp\_is\_mobile', bool $is\_mobile )](../hooks/wp_is_mobile)
Filters whether the request should be treated as coming from a mobile device or not.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_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::is\_ios()](../classes/wp_customize_manager/is_ios) wp-includes/class-wp-customize-manager.php | Determines whether the user agent is iOS. |
| [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. |
| [\_wp\_customize\_loader\_settings()](_wp_customize_loader_settings) wp-includes/theme.php | Adds settings for the customize-loader script. |
| [user\_can\_richedit()](user_can_richedit) wp-includes/general-template.php | Determines whether the user can access the visual editor. |
| [\_device\_can\_upload()](_device_can_upload) wp-includes/functions.php | Tests if the current device has the capability to upload files. |
| [WP\_Admin\_Bar::\_render()](../classes/wp_admin_bar/_render) wp-includes/class-wp-admin-bar.php | |
| [wp\_plupload\_default\_settings()](wp_plupload_default_settings) wp-includes/media.php | Prints default Plupload arguments. |
| [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress get_registered_theme_features(): array[] get\_registered\_theme\_features(): array[]
===========================================
Gets the list of registered theme features.
array[] List of theme features, keyed by their name.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_registered_theme_features() {
global $_wp_registered_theme_features;
if ( ! is_array( $_wp_registered_theme_features ) ) {
return array();
}
return $_wp_registered_theme_features;
}
```
| Used By | Description |
| --- | --- |
| [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::get\_item\_schema()](../classes/wp_rest_themes_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Retrieves the theme’s schema, conforming to JSON Schema. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress wp_unique_term_slug( string $slug, object $term ): string wp\_unique\_term\_slug( string $slug, object $term ): string
============================================================
Makes term slug unique, if it isn’t already.
The `$slug` has to be unique global to every taxonomy, meaning that one taxonomy term can’t have a matching slug with another taxonomy term. Each slug has to be globally unique for every taxonomy.
The way this works is that if the taxonomy that the term belongs to is hierarchical and has a parent, it will append that parent to the $slug.
If that still doesn’t return a unique slug, then it tries to append a number until it finds a number that is truly unique.
The only purpose for `$term` is for appending a parent, if one exists.
`$slug` string Required The string that will be tried for a unique slug. `$term` object Required The term object that the `$slug` will belong to. string Will return a true unique slug.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function wp_unique_term_slug( $slug, $term ) {
global $wpdb;
$needs_suffix = true;
$original_slug = $slug;
// As of 4.1, duplicate slugs are allowed as long as they're in different taxonomies.
if ( ! term_exists( $slug ) || get_option( 'db_version' ) >= 30133 && ! get_term_by( 'slug', $slug, $term->taxonomy ) ) {
$needs_suffix = false;
}
/*
* If the taxonomy supports hierarchy and the term has a parent, make the slug unique
* by incorporating parent slugs.
*/
$parent_suffix = '';
if ( $needs_suffix && is_taxonomy_hierarchical( $term->taxonomy ) && ! empty( $term->parent ) ) {
$the_parent = $term->parent;
while ( ! empty( $the_parent ) ) {
$parent_term = get_term( $the_parent, $term->taxonomy );
if ( is_wp_error( $parent_term ) || empty( $parent_term ) ) {
break;
}
$parent_suffix .= '-' . $parent_term->slug;
if ( ! term_exists( $slug . $parent_suffix ) ) {
break;
}
if ( empty( $parent_term->parent ) ) {
break;
}
$the_parent = $parent_term->parent;
}
}
// If we didn't get a unique slug, try appending a number to make it unique.
/**
* Filters whether the proposed unique term slug is bad.
*
* @since 4.3.0
*
* @param bool $needs_suffix Whether the slug needs to be made unique with a suffix.
* @param string $slug The slug.
* @param object $term Term object.
*/
if ( apply_filters( 'wp_unique_term_slug_is_bad_slug', $needs_suffix, $slug, $term ) ) {
if ( $parent_suffix ) {
$slug .= $parent_suffix;
}
if ( ! empty( $term->term_id ) ) {
$query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $term->term_id );
} else {
$query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $slug );
}
if ( $wpdb->get_var( $query ) ) { // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
$num = 2;
do {
$alt_slug = $slug . "-$num";
$num++;
$slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug ) );
} while ( $slug_check );
$slug = $alt_slug;
}
}
/**
* Filters the unique term slug.
*
* @since 4.3.0
*
* @param string $slug Unique term slug.
* @param object $term Term object.
* @param string $original_slug Slug originally passed to the function for testing.
*/
return apply_filters( 'wp_unique_term_slug', $slug, $term, $original_slug );
}
```
[apply\_filters( 'wp\_unique\_term\_slug', string $slug, object $term, string $original\_slug )](../hooks/wp_unique_term_slug)
Filters the unique term slug.
[apply\_filters( 'wp\_unique\_term\_slug\_is\_bad\_slug', bool $needs\_suffix, string $slug, object $term )](../hooks/wp_unique_term_slug_is_bad_slug)
Filters whether the proposed unique term slug is bad.
| Uses | Description |
| --- | --- |
| [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. |
| [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. |
| [is\_taxonomy\_hierarchical()](is_taxonomy_hierarchical) wp-includes/taxonomy.php | Determines whether the taxonomy object is hierarchical. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_update\_term()](wp_update_term) wp-includes/taxonomy.php | Updates term based on arguments provided. |
| [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress _set_cron_array( array[] $cron, bool $wp_error = false ): bool|WP_Error \_set\_cron\_array( array[] $cron, bool $wp\_error = false ): bool|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.
Updates the cron option with the new cron array.
`$cron` array[] Required Array of cron info arrays from [\_get\_cron\_array()](_get_cron_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 cron array updated. 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 _set_cron_array( $cron, $wp_error = false ) {
if ( ! is_array( $cron ) ) {
$cron = array();
}
$cron['version'] = 2;
$result = update_option( 'cron', $cron );
if ( $wp_error && ! $result ) {
return new WP_Error(
'could_not_set',
__( 'The cron event list could not be saved.' )
);
}
return $result;
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [wp\_unschedule\_hook()](wp_unschedule_hook) wp-includes/cron.php | Unschedules all events attached to the hook. |
| [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\_schedule\_single\_event()](wp_schedule_single_event) wp-includes/cron.php | Schedules an event to run only once. |
| 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 outcome of [update\_option()](update_option) . |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress get_site_url( int|null $blog_id = null, string $path = '', string|null $scheme = null ): string get\_site\_url( int|null $blog\_id = null, string $path = '', string|null $scheme = null ): string
==================================================================================================
Retrieves the URL for a given site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible.
Returns the ‘site\_url’ option with the appropriate protocol, ‘https’ if [is\_ssl()](is_ssl) and ‘http’ otherwise. If `$scheme` is ‘http’ or ‘https’, `is_ssl()` is overridden.
`$blog_id` int|null Optional Site ID. Default null (current site). Default: `null`
`$path` string Optional Path relative to the site URL. Default: `''`
`$scheme` string|null Optional Scheme to give the site URL context. Accepts `'http'`, `'https'`, `'login'`, `'login_post'`, `'admin'`, or `'relative'`. Default: `null`
string Site URL link with optional path appended.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_site_url( $blog_id = null, $path = '', $scheme = null ) {
if ( empty( $blog_id ) || ! is_multisite() ) {
$url = get_option( 'siteurl' );
} else {
switch_to_blog( $blog_id );
$url = get_option( 'siteurl' );
restore_current_blog();
}
$url = set_url_scheme( $url, $scheme );
if ( $path && is_string( $path ) ) {
$url .= '/' . ltrim( $path, '/' );
}
/**
* Filters the site URL.
*
* @since 2.7.0
*
* @param string $url The complete site URL including scheme and path.
* @param string $path Path relative to the site URL. Blank string if no path is specified.
* @param string|null $scheme Scheme to give the site URL context. Accepts 'http', 'https', 'login',
* 'login_post', 'admin', 'relative' or null.
* @param int|null $blog_id Site ID, or null for the current site.
*/
return apply_filters( 'site_url', $url, $path, $scheme, $blog_id );
}
```
[apply\_filters( 'site\_url', string $url, string $path, string|null $scheme, int|null $blog\_id )](../hooks/site_url)
Filters the site URL.
| Uses | Description |
| --- | --- |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [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. |
| [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. |
| [get\_admin\_url()](get_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for a given site. |
| [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. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress esc_sql( string|array $data ): string|array esc\_sql( string|array $data ): string|array
============================================
Escapes data for use in a MySQL query.
Usually you should prepare queries using [wpdb::prepare()](../classes/wpdb/prepare).
Sometimes, spot-escaping is required or useful. One example is preparing an array for use in an IN clause.
NOTE: Since 4.8.3, ‘%’ characters will be replaced with a placeholder string, this prevents certain SQLi attacks from taking place. This change in behaviour may cause issues for code that expects the return value of [esc\_sql()](esc_sql) to be useable for other purposes.
`$data` string|array Required Unescaped data. string|array Escaped data, in the same type as supplied.
* Be careful in using this function correctly. **It will only escape values to be used in strings in the query**. That is, it only provides escaping for values that will be within quotes in the SQL (as in `field = '{$escaped_value}'`). If your value is not going to be within quotes, your code will still be vulnerable to SQL injection. For example, this is vulnerable, because the escaped value is not surrounded by quotes in the SQL query: `ORDER BY {$escaped_value}`. As such, **this function does not escape unquoted numeric values, field names, or SQL keywords**.
* [`$wpdb->prepare()`](../classes/wpdb/prepare) is generally preferred as it corrects some common formatting errors.
* This function was formerly just an alias for [`$wpdb->escape()`](../classes/wpdb/escape), but that function has now been deprecated.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function esc_sql( $data ) {
global $wpdb;
return $wpdb->_escape( $data );
}
```
| Uses | Description |
| --- | --- |
| [wpdb::\_escape()](../classes/wpdb/_escape) wp-includes/class-wpdb.php | Escapes data. Works on arrays. |
| Used By | Description |
| --- | --- |
| [WP\_User\_Query::parse\_orderby()](../classes/wp_user_query/parse_orderby) wp-includes/class-wp-user-query.php | Parses and sanitizes ‘orderby’ keys passed to the user query. |
| [WP\_Comment\_Query::parse\_orderby()](../classes/wp_comment_query/parse_orderby) wp-includes/class-wp-comment-query.php | Parse and sanitize ‘orderby’ keys passed to the comment query. |
| [WP\_Date\_Query::get\_sql\_for\_clause()](../classes/wp_date_query/get_sql_for_clause) wp-includes/class-wp-date-query.php | Turns a first-order date query into SQL for a WHERE clause. |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| [\_pad\_term\_counts()](_pad_term_counts) wp-includes/taxonomy.php | Adds count of children to parent count. |
| [\_update\_post\_term\_count()](_update_post_term_count) wp-includes/taxonomy.php | Updates term count based on object types of the current taxonomy. |
| [WP\_Date\_Query::\_\_construct()](../classes/wp_date_query/__construct) wp-includes/class-wp-date-query.php | Constructor. |
| [get\_page\_by\_path()](get_page_by_path) wp-includes/post.php | Retrieves a page given its path. |
| [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. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
| programming_docs |
wordpress is_plugin_active_for_network( string $plugin ): bool is\_plugin\_active\_for\_network( string $plugin ): bool
========================================================
Determines whether the plugin is active for the entire network.
Only plugins installed in the plugins/ folder can be active.
Plugins in the mu-plugins/ folder can’t be "activated," so this function will return false for those plugins.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
`$plugin` string Required Path to the plugin file relative to the plugins directory. bool True if active for the network, otherwise false.
The file that defines this function (`[wp-admin/includes/plugin.php](https://core.trac.wordpress.org/browser/tags/5.3/src/wp-admin/includes/plugin.php#L0)`) is only loaded in the admin sections. In order to use `is_plugin_active_for_network` outside the admin pages, it’s necessary to include or require `plugin.php` before trying to use it (as shown in the example).
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function is_plugin_active_for_network( $plugin ) {
if ( ! is_multisite() ) {
return false;
}
$plugins = get_site_option( 'active_sitewide_plugins' );
if ( isset( $plugins[ $plugin ] ) ) {
return true;
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [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. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Plugins\_Controller::get\_plugin\_status()](../classes/wp_rest_plugins_controller/get_plugin_status) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Get’s the activation status for a plugin. |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Plugins\_List\_Table::prepare\_items()](../classes/wp_plugins_list_table/prepare_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| [Plugin\_Upgrader\_Skin::\_\_construct()](../classes/plugin_upgrader_skin/__construct) wp-admin/includes/class-plugin-upgrader-skin.php | Constructor. |
| [wp\_plugin\_update\_row()](wp_plugin_update_row) wp-admin/includes/update.php | Displays update information for a plugin. |
| [is\_plugin\_active()](is_plugin_active) wp-admin/includes/plugin.php | Determines whether a plugin is active. |
| [deactivate\_plugins()](deactivate_plugins) wp-admin/includes/plugin.php | Deactivates a single plugin or multiple plugins. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_the_category_by_ID( int $cat_id ): string|WP_Error get\_the\_category\_by\_ID( int $cat\_id ): string|WP\_Error
============================================================
Retrieves category name based on category ID.
`$cat_id` int Required Category ID. string|[WP\_Error](../classes/wp_error) Category name on success, [WP\_Error](../classes/wp_error) on failure.
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function get_the_category_by_ID( $cat_id ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$cat_id = (int) $cat_id;
$category = get_term( $cat_id );
if ( is_wp_error( $category ) ) {
return $category;
}
return ( $category ) ? $category->name : '';
}
```
| Uses | Description |
| --- | --- |
| [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 |
| --- | --- |
| [the\_category\_head()](the_category_head) wp-includes/deprecated.php | Prints a category with optional text before and after. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress _wp_delete_post_menu_item( int $object_id ) \_wp\_delete\_post\_menu\_item( int $object\_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.
Callback for handling a menu item when its original object is deleted.
`$object_id` int Required The ID of the original object being trashed. File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function _wp_delete_post_menu_item( $object_id ) {
$object_id = (int) $object_id;
$menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'post_type' );
foreach ( (array) $menu_item_ids as $menu_item_id ) {
wp_delete_post( $menu_item_id, true );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [wp\_get\_associated\_nav\_menu\_items()](wp_get_associated_nav_menu_items) wp-includes/nav-menu.php | Returns the menu items associated with a particular object. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress list_files( string $folder = '', int $levels = 100, string[] $exclusions = array() ): string[]|false list\_files( string $folder = '', int $levels = 100, string[] $exclusions = array() ): string[]|false
=====================================================================================================
Returns a listing of all files in the specified folder and all subdirectories up to 100 levels deep.
The depth of the recursiveness can be controlled by the $levels param.
`$folder` string Optional Full path to folder. Default: `''`
`$levels` int Optional Levels of folders to follow, Default 100 (PHP Loop limit). Default: `100`
`$exclusions` string[] Optional List of folders and files to skip. Default: `array()`
string[]|false Array of files on success, false on failure.
File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/)
```
function list_files( $folder = '', $levels = 100, $exclusions = array() ) {
if ( empty( $folder ) ) {
return false;
}
$folder = trailingslashit( $folder );
if ( ! $levels ) {
return false;
}
$files = array();
$dir = @opendir( $folder );
if ( $dir ) {
while ( ( $file = readdir( $dir ) ) !== false ) {
// Skip current and parent folder links.
if ( in_array( $file, array( '.', '..' ), true ) ) {
continue;
}
// Skip hidden and excluded files.
if ( '.' === $file[0] || in_array( $file, $exclusions, true ) ) {
continue;
}
if ( is_dir( $folder . $file ) ) {
$files2 = list_files( $folder . $file, $levels - 1 );
if ( $files2 ) {
$files = array_merge( $files, $files2 );
} else {
$files[] = $folder . $file . '/';
}
} else {
$files[] = $folder . $file;
}
}
closedir( $dir );
}
return $files;
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| Used By | Description |
| --- | --- |
| [wp\_privacy\_delete\_old\_export\_files()](wp_privacy_delete_old_export_files) wp-includes/functions.php | Cleans up export files older than three days old. |
| [get\_plugin\_files()](get_plugin_files) wp-admin/includes/plugin.php | Gets a list of a plugin’s 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. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Added the `$exclusions` parameter. |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress get_comment_author_link( int|WP_Comment $comment_ID ): string get\_comment\_author\_link( int|WP\_Comment $comment\_ID ): string
==================================================================
Retrieves the HTML link to the URL of the author of the current comment.
Both [get\_comment\_author\_url()](get_comment_author_url) and [get\_comment\_author()](get_comment_author) rely on [get\_comment()](get_comment) , which falls back to the global comment variable if the $comment\_ID argument is empty.
`$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 link.
Default current comment. string The comment author name or HTML link for author's URL.
Displays the comment author name or HTML link of the comment author’s URL, given a comment ID.
`echo get_comment_author_link( $comment_ID );`
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_comment_author_link( $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
$url = get_comment_author_url( $comment );
$author = get_comment_author( $comment );
if ( empty( $url ) || 'http://' === $url ) {
$return = $author;
} else {
$return = "<a href='$url' rel='external nofollow ugc' class='url'>$author</a>";
}
/**
* Filters the comment author's link for display.
*
* @since 1.5.0
* @since 4.1.0 The `$author` and `$comment_ID` parameters were added.
*
* @param string $return The HTML-formatted comment author link.
* Empty for an invalid URL.
* @param string $author The comment author's username.
* @param string $comment_ID The comment ID as a numeric string.
*/
return apply_filters( 'get_comment_author_link', $return, $author, $comment->comment_ID );
}
```
[apply\_filters( 'get\_comment\_author\_link', string $return, string $author, string $comment\_ID )](../hooks/get_comment_author_link)
Filters the comment author’s link for display.
| Uses | Description |
| --- | --- |
| [get\_comment\_author()](get_comment_author) wp-includes/comment-template.php | Retrieves the author of the current comment. |
| [get\_comment\_author\_url()](get_comment_author_url) wp-includes/comment-template.php | Retrieves the URL of the author of the current comment, not linked. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| 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. |
| [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. |
| [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\_author\_link()](comment_author_link) wp-includes/comment-template.php | Displays 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_constrain_dimensions( int $current_width, int $current_height, int $max_width, int $max_height ): int[] wp\_constrain\_dimensions( int $current\_width, int $current\_height, int $max\_width, int $max\_height ): int[]
================================================================================================================
Calculates the new dimensions for a down-sampled image.
If either width or height are empty, no constraint is applied on that dimension.
`$current_width` int Required Current width of the image. `$current_height` int Required Current height of the image. `$max_width` int Optional Max width in pixels to constrain to. Default 0. `$max_height` int Optional Max height in pixels to constrain to. Default 0. int[] An array of width and height values.
* intThe width in pixels.
* `1`intThe height in pixels.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_constrain_dimensions( $current_width, $current_height, $max_width = 0, $max_height = 0 ) {
if ( ! $max_width && ! $max_height ) {
return array( $current_width, $current_height );
}
$width_ratio = 1.0;
$height_ratio = 1.0;
$did_width = false;
$did_height = false;
if ( $max_width > 0 && $current_width > 0 && $current_width > $max_width ) {
$width_ratio = $max_width / $current_width;
$did_width = true;
}
if ( $max_height > 0 && $current_height > 0 && $current_height > $max_height ) {
$height_ratio = $max_height / $current_height;
$did_height = true;
}
// Calculate the larger/smaller ratios.
$smaller_ratio = min( $width_ratio, $height_ratio );
$larger_ratio = max( $width_ratio, $height_ratio );
if ( (int) round( $current_width * $larger_ratio ) > $max_width || (int) round( $current_height * $larger_ratio ) > $max_height ) {
// The larger ratio is too big. It would result in an overflow.
$ratio = $smaller_ratio;
} else {
// The larger ratio fits, and is likely to be a more "snug" fit.
$ratio = $larger_ratio;
}
// Very small dimensions may result in 0, 1 should be the minimum.
$w = max( 1, (int) round( $current_width * $ratio ) );
$h = max( 1, (int) round( $current_height * $ratio ) );
/*
* Sometimes, due to rounding, we'll end up with a result like this:
* 465x700 in a 177x177 box is 117x176... a pixel short.
* We also have issues with recursive calls resulting in an ever-changing result.
* Constraining to the result of a constraint should yield the original result.
* Thus we look for dimensions that are one pixel shy of the max value and bump them up.
*/
// Note: $did_width means it is possible $smaller_ratio == $width_ratio.
if ( $did_width && $w === $max_width - 1 ) {
$w = $max_width; // Round it up.
}
// Note: $did_height means it is possible $smaller_ratio == $height_ratio.
if ( $did_height && $h === $max_height - 1 ) {
$h = $max_height; // Round it up.
}
/**
* Filters dimensions to constrain down-sampled images to.
*
* @since 4.1.0
*
* @param int[] $dimensions {
* An array of width and height values.
*
* @type int $0 The width in pixels.
* @type int $1 The height in pixels.
* }
* @param int $current_width The current width of the image.
* @param int $current_height The current height of the image.
* @param int $max_width The maximum width permitted.
* @param int $max_height The maximum height permitted.
*/
return apply_filters( 'wp_constrain_dimensions', array( $w, $h ), $current_width, $current_height, $max_width, $max_height );
}
```
[apply\_filters( 'wp\_constrain\_dimensions', int[] $dimensions, int $current\_width, int $current\_height, int $max\_width, int $max\_height )](../hooks/wp_constrain_dimensions)
Filters dimensions to constrain down-sampled images to.
| 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\_matches\_ratio()](wp_image_matches_ratio) wp-includes/media.php | Helper function to test if aspect ratios for two images match. |
| [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. |
| [wp\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. |
| [wp\_expand\_dimensions()](wp_expand_dimensions) wp-includes/media.php | Based on a supplied width/height example, returns the biggest possible dimensions based on the max width/height. |
| [image\_resize\_dimensions()](image_resize_dimensions) wp-includes/media.php | Retrieves calculated resize dimensions for use in [WP\_Image\_Editor](../classes/wp_image_editor). |
| [image\_constrain\_size\_for\_editor()](image_constrain_size_for_editor) wp-includes/media.php | Scales down the default size of an image. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_shortlink_header() wp\_shortlink\_header()
=======================
Sends a Link: rel=shortlink header if a shortlink is defined for the current page.
Attached to the [‘wp’](../hooks/wp) action.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function wp_shortlink_header() {
if ( headers_sent() ) {
return;
}
$shortlink = wp_get_shortlink( 0, 'query' );
if ( empty( $shortlink ) ) {
return;
}
header( 'Link: <' . $shortlink . '>; rel=shortlink', false );
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_shortlink()](wp_get_shortlink) wp-includes/link-template.php | Returns a shortlink for a post, page, attachment, or site. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress comments_link_feed() comments\_link\_feed()
======================
Outputs the link to the comments for the current post in an XML safe way.
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function comments_link_feed() {
/**
* Filters the comments permalink for the current post.
*
* @since 3.6.0
*
* @param string $comment_permalink The current comment permalink with
* '#comments' appended.
*/
echo esc_url( apply_filters( 'comments_link_feed', get_comments_link() ) );
}
```
[apply\_filters( 'comments\_link\_feed', string $comment\_permalink )](../hooks/comments_link_feed)
Filters the comments permalink for the current post.
| Uses | Description |
| --- | --- |
| [get\_comments\_link()](get_comments_link) wp-includes/comment-template.php | Retrieves the link to the current post comments. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [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. |
| 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.