code
stringlengths
2.5k
150k
kind
stringclasses
1 value
wordpress is_time(): bool is\_time(): bool ================ Determines whether the query is for a specific time. For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook. bool Whether the query is for a specific time. File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/) ``` function is_time() { 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_time(); } ``` | Uses | Description | | --- | --- | | [WP\_Query::is\_time()](../classes/wp_query/is_time) wp-includes/class-wp-query.php | Is the query for a specific time? | | [\_\_()](__) 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 | | --- | --- | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress zeroise( int $number, int $threshold ): string zeroise( int $number, int $threshold ): string ============================================== Add leading zeros when necessary. If you set the threshold to ‘4’ and the number is ’10’, then you will get back ‘0010’. If you set the threshold to ‘4’ and the number is ‘5000’, then you will get back ‘5000’. Uses sprintf to append the amount of zeros based on the $threshold parameter and the size of the number. If the number is large enough, then no zeros will be appended. `$number` int Required Number to append zeros to if not greater than threshold. `$threshold` int Required Digit places number needs to be to not have zeros added. string Adds leading zeros to number if needed. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function zeroise( $number, $threshold ) { return sprintf( '%0' . $threshold . 's', $number ); } ``` | Used By | Description | | --- | --- | | [export\_date\_options()](export_date_options) wp-admin/export.php | Create the date options fields for exporting a given post type. | | [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. | | [touch\_time()](touch_time) wp-admin/includes/template.php | Prints out HTML form date elements for editing post or comment publish date. | | [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. | | [antispambot()](antispambot) wp-includes/formatting.php | Converts email addresses characters to HTML entities to block spam bots. | | [get\_calendar()](get_calendar) wp-includes/general-template.php | Displays calendar with days that have posts as links. | | [wp\_title()](wp_title) wp-includes/general-template.php | Displays or retrieves page title for all areas of blog. | | [WP\_Locale::get\_month()](../classes/wp_locale/get_month) wp-includes/class-wp-locale.php | Retrieves the full translated month by month number. | | [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. | | Version | Description | | --- | --- | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress get_default_link_to_edit(): stdClass get\_default\_link\_to\_edit(): stdClass ======================================== Retrieves the default link for editing. stdClass Default link object. File: `wp-admin/includes/bookmark.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/bookmark.php/) ``` function get_default_link_to_edit() { $link = new stdClass; if ( isset( $_GET['linkurl'] ) ) { $link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) ); } else { $link->link_url = ''; } if ( isset( $_GET['name'] ) ) { $link->link_name = esc_attr( wp_unslash( $_GET['name'] ) ); } else { $link->link_name = ''; } $link->link_visible = 'Y'; return $link; } ``` | Uses | Description | | --- | --- | | [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. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress wp_clear_auth_cookie() wp\_clear\_auth\_cookie() ========================= Removes all of the cookies associated with authentication. This function can be replaced via [plugins](https://wordpress.org/support/article/glossary/ "Glossary"). If plugins do not redefine these functions, then this will be used instead. File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/) ``` function wp_clear_auth_cookie() { /** * Fires just before the authentication cookies are cleared. * * @since 2.7.0 */ do_action( 'clear_auth_cookie' ); /** This filter is documented in wp-includes/pluggable.php */ if ( ! apply_filters( 'send_auth_cookies', true ) ) { return; } // Auth cookies. setcookie( AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN ); setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN ); setcookie( AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN ); setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN ); setcookie( LOGGED_IN_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); setcookie( LOGGED_IN_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); // Settings cookies. setcookie( 'wp-settings-' . get_current_user_id(), ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH ); setcookie( 'wp-settings-time-' . get_current_user_id(), ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH ); // Old cookies. setcookie( AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); setcookie( AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); // Even older cookies. setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); // Post password cookie. setcookie( 'wp-postpass_' . COOKIEHASH, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); } ``` [do\_action( 'clear\_auth\_cookie' )](../hooks/clear_auth_cookie) Fires just before the authentication cookies are cleared. [apply\_filters( 'send\_auth\_cookies', bool $send )](../hooks/send_auth_cookies) Allows preventing auth cookies from actually being sent to the client. | Uses | Description | | --- | --- | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. | | Used By | Description | | --- | --- | | [wp\_logout()](wp_logout) wp-includes/pluggable.php | Logs the current user out. | | [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. | | [wp\_clearcookie()](wp_clearcookie) wp-includes/pluggable-deprecated.php | Clears the authentication cookie, logging the user out. This function is deprecated. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress wp_enqueue_registered_block_scripts_and_styles() wp\_enqueue\_registered\_block\_scripts\_and\_styles() ====================================================== Enqueues registered block scripts and styles, depending on current rendered context (only enqueuing editor scripts while in context of the editor). File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/) ``` function wp_enqueue_registered_block_scripts_and_styles() { global $current_screen; if ( wp_should_load_separate_core_block_assets() ) { return; } $load_editor_scripts_and_styles = is_admin() && wp_should_load_block_editor_scripts_and_styles(); $block_registry = WP_Block_Type_Registry::get_instance(); foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) { // Front-end and editor styles. foreach ( $block_type->style_handles as $style_handle ) { wp_enqueue_style( $style_handle ); } // Front-end and editor scripts. foreach ( $block_type->script_handles as $script_handle ) { wp_enqueue_script( $script_handle ); } if ( $load_editor_scripts_and_styles ) { // Editor styles. foreach ( $block_type->editor_style_handles as $editor_style_handle ) { wp_enqueue_style( $editor_style_handle ); } // Editor scripts. foreach ( $block_type->editor_script_handles as $editor_script_handle ) { wp_enqueue_script( $editor_script_handle ); } } } } ``` | 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. | | [WP\_Block\_Type\_Registry::get\_instance()](../classes/wp_block_type_registry/get_instance) wp-includes/class-wp-block-type-registry.php | Utility method to retrieve the main instance of the class. | | [wp\_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. | | [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. | | Version | Description | | --- | --- | | [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. | wordpress do_action_ref_array( string $hook_name, array $args ) do\_action\_ref\_array( string $hook\_name, array $args ) ========================================================= Calls the callback functions that have been added to an action hook, specifying arguments in an array. * [do\_action()](do_action) : This function is identical, but the arguments passed to the functions hooked to `$hook_name` are supplied using an array. `$hook_name` string Required The name of the action to be executed. `$args` array Required The arguments supplied to the functions hooked to `$hook_name`. * This function can be useful when your arguments are already in an array, and/or when there are many arguments to pass. Just make sure that your arguments are in the proper order! * Before PHP 5.4, your callback is passed a reference pointer to the array. Your callback can use this pointer to access all the array elements. Adding action and declaring a call back that hooks the above example action could look like this: ``` add_action('my_action', 'my_callback'); function my_callback( $args ) { //access values with $args[0], $args[1] etc. } ``` Because the array was passed by reference, any changes to the array elements are applied to the original array outside of the function’s scope. * Regardless of PHP version, you can specify the number of array elements when adding the action, and receive each element in a separate parameter in the callback function declaration like so: ``` add_action('my_action', 'my_callback', 10, 4 ); function my_callback( $arg1, $arg2, $arg3, $arg4 ) { //access values with $args1, $args2 etc. } ``` This method copies the array elements into the parameter variables. Any changes to the parameter variables do not affect the original array. * As of PHP 5.4, the array is no longer passed by reference despite the function’s name. You cannot even use the reference sign ‘&’ because call time pass by reference now throws an error. What you can do is pass the reference pointer as an array element. Doing so does require all callbacks added to the action to expect a reference pointer. ``` do_action_ref_array( 'my_action', array( &$args ) ); add_action('my_action', 'my_callback'); function my_callback( &$args ) { //access values with $args[0], $args[1] etc. } ``` Because the original array was passed by reference, any changes to the array elements are applied to the original array outside of the function’s scope. If the array contains an object reference, the technique is as follows: ``` do_action_ref_array( 'my_action', array( &$my_object ) ); add_action('my_action', 'my_callback'); function my_callback( $my_object ) { // $my_object->some_method()... etc. } ``` The object’s properties can be changed. See the action ‘`phpmailer_init`‘ with the callback `fix_phpmailer_messageid()` in WordPress for an example. File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/) ``` function do_action_ref_array( $hook_name, $args ) { global $wp_filter, $wp_actions, $wp_current_filter; if ( ! isset( $wp_actions[ $hook_name ] ) ) { $wp_actions[ $hook_name ] = 1; } else { ++$wp_actions[ $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; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } $wp_filter[ $hook_name ]->do_action( $args ); array_pop( $wp_current_filter ); } ``` | 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\_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. | | [WP\_HTTP\_Requests\_Hooks::dispatch()](../classes/wp_http_requests_hooks/dispatch) wp-includes/class-wp-http-requests-hooks.php | Dispatch a Requests hook to a native WordPress action. | | [WP\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. | | [WP\_Network\_Query::get\_networks()](../classes/wp_network_query/get_networks) wp-includes/class-wp-network-query.php | Gets a list of networks matching the query vars. | | [WP\_Network\_Query::parse\_query()](../classes/wp_network_query/parse_query) wp-includes/class-wp-network-query.php | Parses arguments passed to the network query with default query parameters. | | [WP\_Site\_Query::get\_sites()](../classes/wp_site_query/get_sites) wp-includes/class-wp-site-query.php | Retrieves a list of sites matching the query vars. | | [WP\_Site\_Query::parse\_query()](../classes/wp_site_query/parse_query) wp-includes/class-wp-site-query.php | Parses arguments passed to the site query with default query parameters. | | [do\_action\_deprecated()](do_action_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated action hook. | | [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\_Comment\_Query::parse\_query()](../classes/wp_comment_query/parse_query) wp-includes/class-wp-comment-query.php | Parse arguments passed to the comment query with default query parameters. | | [WP\_Query::setup\_postdata()](../classes/wp_query/setup_postdata) wp-includes/class-wp-query.php | Set up global post data. | | [WP\_User\_Search::prepare\_query()](../classes/wp_user_search/prepare_query) wp-admin/includes/deprecated.php | Prepares the user search query (legacy). | | [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST | | [WP\_Styles::\_\_construct()](../classes/wp_styles/__construct) wp-includes/class-wp-styles.php | Constructor. | | [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. | | [WP::main()](../classes/wp/main) wp-includes/class-wp.php | Sets up all of the variables required by the WordPress environment. | | [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::the\_post()](../classes/wp_query/the_post) wp-includes/class-wp-query.php | Sets up the current post. | | [WP\_Query::have\_posts()](../classes/wp_query/have_posts) wp-includes/class-wp-query.php | Determines whether there are more posts available in the loop. | | [WP\_Query::set\_404()](../classes/wp_query/set_404) wp-includes/class-wp-query.php | Sets the 404 property and saves whether query is feed. | | [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. | | [WP\_Query::parse\_query()](../classes/wp_query/parse_query) wp-includes/class-wp-query.php | Parse a query string and set query type booleans. | | [WP\_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\_admin\_bar\_render()](wp_admin_bar_render) wp-includes/admin-bar.php | Renders the admin bar to the page based on the $wp\_admin\_bar->menu member var. | | [fetch\_feed()](fetch_feed) wp-includes/feed.php | Builds SimplePie object based on RSS or Atom feed from URL. | | [WP\_User\_Query::prepare\_query()](../classes/wp_user_query/prepare_query) wp-includes/class-wp-user-query.php | Prepares the query variables. | | [wp\_signon()](wp_signon) wp-includes/user.php | Authenticates and logs a user in with ‘remember’ capability. | | [WP\_Rewrite::rewrite\_rules()](../classes/wp_rewrite/rewrite_rules) wp-includes/class-wp-rewrite.php | Constructs rewrite matches and queries from permalink structure. | | [WP\_Scripts::init()](../classes/wp_scripts/init) wp-includes/class-wp-scripts.php | Initialize the class. | | [WP\_Widget::form\_callback()](../classes/wp_widget/form_callback) wp-includes/class-wp-widget.php | Generates the widget control form (Do NOT override). | | [pingback()](pingback) wp-includes/comment.php | Pings back the links found in a post. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
programming_docs
wordpress wp_ajax_get_attachment() wp\_ajax\_get\_attachment() =========================== Ajax handler for getting an attachment. 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_attachment() { if ( ! isset( $_REQUEST['id'] ) ) { wp_send_json_error(); } $id = absint( $_REQUEST['id'] ); if ( ! $id ) { wp_send_json_error(); } $post = get_post( $id ); if ( ! $post ) { wp_send_json_error(); } if ( 'attachment' !== $post->post_type ) { wp_send_json_error(); } if ( ! current_user_can( 'upload_files' ) ) { wp_send_json_error(); } $attachment = wp_prepare_attachment_for_js( $id ); if ( ! $attachment ) { wp_send_json_error(); } wp_send_json_success( $attachment ); } ``` | 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. | | [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. | | [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. | | [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 restore_current_locale(): string|false restore\_current\_locale(): string|false ======================================== Restores the translations according to the original 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_current_locale() { /* @var WP_Locale_Switcher $wp_locale_switcher */ global $wp_locale_switcher; return $wp_locale_switcher->restore_current_locale(); } ``` | Uses | Description | | --- | --- | | [WP\_Locale\_Switcher::restore\_current\_locale()](../classes/wp_locale_switcher/restore_current_locale) wp-includes/class-wp-locale-switcher.php | Restores the translations according to the original locale. | | Version | Description | | --- | --- | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. | wordpress wp_generate_password( int $length = 12, bool $special_chars = true, bool $extra_special_chars = false ): string wp\_generate\_password( int $length = 12, bool $special\_chars = true, bool $extra\_special\_chars = false ): string ==================================================================================================================== Generates a random password drawn from the defined set of characters. Uses [wp\_rand()](wp_rand) is used to create passwords with far less predictability than similar native PHP functions like `rand()` or `mt_rand()`. `$length` int Optional The length of password to generate. Default: `12` `$special_chars` bool Optional Whether to include standard special characters. Default: `true` `$extra_special_chars` bool Optional Whether to include other special characters. Used when generating secret keys and salts. Default: `false` string The random password. This function executes the [random\_password](https://codex.wordpress.org/Plugin_API/Filter_Reference/random_password "Plugin API/Filter Reference/random password") filter after generating the password. Normal characters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Special characters: !@#$%^&\*() Extra special characters: -\_ []{}<>~`+=,.;:/?| File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/) ``` function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) { $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; if ( $special_chars ) { $chars .= '!@#$%^&*()'; } if ( $extra_special_chars ) { $chars .= '-_ []{}<>~`+=,.;:/?|'; } $password = ''; for ( $i = 0; $i < $length; $i++ ) { $password .= substr( $chars, wp_rand( 0, strlen( $chars ) - 1 ), 1 ); } /** * Filters the randomly-generated password. * * @since 3.0.0 * @since 5.3.0 Added the `$length`, `$special_chars`, and `$extra_special_chars` parameters. * * @param string $password The generated password. * @param int $length The length of password to generate. * @param bool $special_chars Whether to include standard special characters. * @param bool $extra_special_chars Whether to include other special characters. */ return apply_filters( 'random_password', $password, $length, $special_chars, $extra_special_chars ); } ``` [apply\_filters( 'random\_password', string $password, int $length, bool $special\_chars, bool $extra\_special\_chars )](../hooks/random_password) Filters the randomly-generated password. | Uses | Description | | --- | --- | | [wp\_rand()](wp_rand) wp-includes/pluggable.php | Generates a random non-negative number. | | [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\_block\_templates\_export\_file()](wp_generate_block_templates_export_file) wp-includes/block-template-utils.php | Creates an export of the current templates and template parts from the site editor at the specified path in a ZIP file. | | [wp\_ajax\_nopriv\_generate\_password()](wp_ajax_nopriv_generate_password) wp-admin/includes/ajax-actions.php | Ajax handler for generating a password in the no-privilege context. | | [WP\_Application\_Passwords::create\_new\_application\_password()](../classes/wp_application_passwords/create_new_application_password) wp-includes/class-wp-application-passwords.php | Creates a new application password. | | [WP\_Recovery\_Mode\_Key\_Service::generate\_recovery\_mode\_token()](../classes/wp_recovery_mode_key_service/generate_recovery_mode_token) wp-includes/class-wp-recovery-mode-key-service.php | Creates a recovery mode token. | | [WP\_Recovery\_Mode\_Key\_Service::generate\_and\_store\_recovery\_mode\_key()](../classes/wp_recovery_mode_key_service/generate_and_store_recovery_mode_key) wp-includes/class-wp-recovery-mode-key-service.php | Creates a recovery mode key. | | [WP\_Recovery\_Mode\_Cookie\_Service::generate\_cookie()](../classes/wp_recovery_mode_cookie_service/generate_cookie) wp-includes/class-wp-recovery-mode-cookie-service.php | Generates the recovery mode cookie value. | | [WP\_Recovery\_Mode\_Cookie\_Service::recovery\_mode\_hash()](../classes/wp_recovery_mode_cookie_service/recovery_mode_hash) wp-includes/class-wp-recovery-mode-cookie-service.php | Gets a form of `wp_hash()` specific to Recovery Mode. | | [wp\_generate\_user\_request\_key()](wp_generate_user_request_key) wp-includes/user.php | Returns a confirmation key for a user action and stores the hashed version for future comparison. | | [wp\_privacy\_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\_filter\_oembed\_result()](wp_filter_oembed_result) wp-includes/embed.php | Filters the given oEmbed HTML. | | [get\_post\_embed\_html()](get_post_embed_html) wp-includes/embed.php | Retrieves the embed code for a specific post. | | [get\_password\_reset\_key()](get_password_reset_key) wp-includes/user.php | Creates, stores, then returns a password reset key for user. | | [wp\_ajax\_generate\_password()](wp_ajax_generate_password) wp-admin/includes/ajax-actions.php | Ajax handler for generating a password. | | [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. | | [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. | | [display\_setup\_form()](display_setup_form) wp-admin/install.php | Displays installer setup form. | | [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. | | [wp\_tempnam()](wp_tempnam) wp-admin/includes/file.php | Returns a filename of a temporary unique file. | | [wp\_salt()](wp_salt) wp-includes/pluggable.php | Returns a salt to add to hashes. | | [register\_new\_user()](register_new_user) wp-includes/user.php | Handles registering a new user. | | [wpmu\_activate\_signup()](wpmu_activate_signup) wp-includes/ms-functions.php | Activates a signup. | | [generate\_random\_password()](generate_random_password) wp-includes/ms-deprecated.php | Generates a random password. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress is_search(): bool is\_search(): bool ================== Determines whether the query is for a search. For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook. bool Whether the query is for a search. File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/) ``` function is_search() { 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_search(); } ``` | Uses | Description | | --- | --- | | [WP\_Query::is\_search()](../classes/wp_query/is_search) wp-includes/class-wp-query.php | Is the query for a search? | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. | | Used By | Description | | --- | --- | | [wp\_robots\_noindex\_search()](wp_robots_noindex_search) wp-includes/robots-template.php | Adds `noindex` to the robots meta tag if a search is being performed. | | [wp\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. | | [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. | | [wp\_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. | | [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. | | [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. | | Version | Description | | --- | --- | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress wp_get_popular_importers(): array wp\_get\_popular\_importers(): array ==================================== Returns a list from WordPress.org of popular importer plugins. array Importers with metadata for each. File: `wp-admin/includes/import.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/import.php/) ``` function wp_get_popular_importers() { // Include an unmodified $wp_version. require ABSPATH . WPINC . '/version.php'; $locale = get_user_locale(); $cache_key = 'popular_importers_' . md5( $locale . $wp_version ); $popular_importers = get_site_transient( $cache_key ); if ( ! $popular_importers ) { $url = add_query_arg( array( 'locale' => $locale, 'version' => $wp_version, ), 'http://api.wordpress.org/core/importers/1.1/' ); $options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) ); if ( wp_http_supports( array( 'ssl' ) ) ) { $url = set_url_scheme( $url, 'https' ); } $response = wp_remote_get( $url, $options ); $popular_importers = json_decode( wp_remote_retrieve_body( $response ), true ); if ( is_array( $popular_importers ) ) { set_site_transient( $cache_key, $popular_importers, 2 * DAY_IN_SECONDS ); } else { $popular_importers = false; } } if ( is_array( $popular_importers ) ) { // If the data was received as translated, return it as-is. if ( $popular_importers['translated'] ) { return $popular_importers['importers']; } foreach ( $popular_importers['importers'] as &$importer ) { // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText $importer['description'] = translate( $importer['description'] ); if ( 'WordPress' !== $importer['name'] ) { // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText $importer['name'] = translate( $importer['name'] ); } } return $popular_importers['importers']; } return array( // slug => name, description, plugin slug, and register_importer() slug. 'blogger' => array( 'name' => __( 'Blogger' ), 'description' => __( 'Import posts, comments, and users from a Blogger blog.' ), 'plugin-slug' => 'blogger-importer', 'importer-id' => 'blogger', ), 'wpcat2tag' => array( 'name' => __( 'Categories and Tags Converter' ), 'description' => __( 'Convert existing categories to tags or tags to categories, selectively.' ), 'plugin-slug' => 'wpcat2tag-importer', 'importer-id' => 'wp-cat2tag', ), 'livejournal' => array( 'name' => __( 'LiveJournal' ), 'description' => __( 'Import posts from LiveJournal using their API.' ), 'plugin-slug' => 'livejournal-importer', 'importer-id' => 'livejournal', ), 'movabletype' => array( 'name' => __( 'Movable Type and TypePad' ), 'description' => __( 'Import posts and comments from a Movable Type or TypePad blog.' ), 'plugin-slug' => 'movabletype-importer', 'importer-id' => 'mt', ), 'rss' => array( 'name' => __( 'RSS' ), 'description' => __( 'Import posts from an RSS feed.' ), 'plugin-slug' => 'rss-importer', 'importer-id' => 'rss', ), 'tumblr' => array( 'name' => __( 'Tumblr' ), 'description' => __( 'Import posts &amp; media from Tumblr using their API.' ), 'plugin-slug' => 'tumblr-importer', 'importer-id' => 'tumblr', ), 'wordpress' => array( 'name' => 'WordPress', 'description' => __( 'Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ), 'plugin-slug' => 'wordpress-importer', 'importer-id' => 'wordpress', ), ); } ``` | Uses | Description | | --- | --- | | [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. | | [translate()](translate) wp-includes/l10n.php | Retrieves the translation of $text. | | [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. | | [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. | | [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [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. | | Version | Description | | --- | --- | | [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. | wordpress _build_block_template_result_from_file( array $template_file, string $template_type ): WP_Block_Template \_build\_block\_template\_result\_from\_file( array $template\_file, string $template\_type ): WP\_Block\_Template ================================================================================================================== 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 a unified template object based on a theme file. `$template_file` array Required Theme file. `$template_type` string Required `'wp_template'` or `'wp_template_part'`. [WP\_Block\_Template](../classes/wp_block_template) Template. File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/) ``` function _build_block_template_result_from_file( $template_file, $template_type ) { $default_template_types = get_default_block_template_types(); $template_content = file_get_contents( $template_file['path'] ); $theme = wp_get_theme()->get_stylesheet(); $template = new WP_Block_Template(); $template->id = $theme . '//' . $template_file['slug']; $template->theme = $theme; $template->content = _inject_theme_attribute_in_block_template_content( $template_content ); $template->slug = $template_file['slug']; $template->source = 'theme'; $template->type = $template_type; $template->title = ! empty( $template_file['title'] ) ? $template_file['title'] : $template_file['slug']; $template->status = 'publish'; $template->has_theme_file = true; $template->is_custom = true; if ( 'wp_template' === $template_type && isset( $default_template_types[ $template_file['slug'] ] ) ) { $template->description = $default_template_types[ $template_file['slug'] ]['description']; $template->title = $default_template_types[ $template_file['slug'] ]['title']; $template->is_custom = false; } if ( 'wp_template' === $template_type && isset( $template_file['postTypes'] ) ) { $template->post_types = $template_file['postTypes']; } if ( 'wp_template_part' === $template_type && isset( $template_file['area'] ) ) { $template->area = $template_file['area']; } return $template; } ``` | Uses | Description | | --- | --- | | [\_inject\_theme\_attribute\_in\_block\_template\_content()](_inject_theme_attribute_in_block_template_content) wp-includes/block-template-utils.php | Parses wp\_template content and injects the active theme’s stylesheet as a theme attribute into each wp\_template\_part | | [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\_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. | | Used By | Description | | --- | --- | | [get\_block\_file\_template()](get_block_file_template) wp-includes/block-template-utils.php | Retrieves a unified template object based on a theme file. | | [get\_block\_templates()](get_block_templates) wp-includes/block-template-utils.php | Retrieves a list of unified template objects based on a query. | | Version | Description | | --- | --- | | [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
programming_docs
wordpress get_adjacent_post_rel_link( string $title = '%title', bool $in_same_term = false, int[]|string $excluded_terms = '', bool $previous = true, string $taxonomy = 'category' ): string|void get\_adjacent\_post\_rel\_link( string $title = '%title', bool $in\_same\_term = false, int[]|string $excluded\_terms = '', bool $previous = true, string $taxonomy = 'category' ): string|void =============================================================================================================================================================================================== Retrieves the adjacent post relational link. Can either be next or previous post relational link. `$title` string Optional Link title format. Default `'%title'`. Default: `'%title'` `$in_same_term` bool Optional Whether link should be in a same taxonomy term. Default: `false` `$excluded_terms` int[]|string Optional Array or comma-separated list of excluded term IDs. Default: `''` `$previous` bool Optional Whether to display link to previous or next post. Default: `true` `$taxonomy` string Optional Taxonomy, if $in\_same\_term is true. Default `'category'`. Default: `'category'` string|void The adjacent post relational link URL. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) { $post = get_post(); if ( $previous && is_attachment() && $post ) { $post = get_post( $post->post_parent ); } else { $post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy ); } if ( empty( $post ) ) { return; } $post_title = the_title_attribute( array( 'echo' => false, 'post' => $post, ) ); if ( empty( $post_title ) ) { $post_title = $previous ? __( 'Previous Post' ) : __( 'Next Post' ); } $date = mysql2date( get_option( 'date_format' ), $post->post_date ); $title = str_replace( '%title', $post_title, $title ); $title = str_replace( '%date', $date, $title ); $link = $previous ? "<link rel='prev' title='" : "<link rel='next' title='"; $link .= esc_attr( $title ); $link .= "' href='" . get_permalink( $post ) . "' />\n"; $adjacent = $previous ? 'previous' : 'next'; /** * Filters the adjacent post relational link. * * The dynamic portion of the hook name, `$adjacent`, refers to the type * of adjacency, 'next' or 'previous'. * * Possible hook names include: * * - `next_post_rel_link` * - `previous_post_rel_link` * * @since 2.8.0 * * @param string $link The relational link. */ return apply_filters( "{$adjacent}_post_rel_link", $link ); } ``` [apply\_filters( "{$adjacent}\_post\_rel\_link", string $link )](../hooks/adjacent_post_rel_link) Filters the adjacent post relational link. | Uses | Description | | --- | --- | | [is\_attachment()](is_attachment) wp-includes/query.php | Determines whether the query is for an existing attachment page. | | [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. | | [get\_adjacent\_post()](get_adjacent_post) wp-includes/link-template.php | Retrieves the adjacent post. | | [the\_title\_attribute()](the_title_attribute) wp-includes/post-template.php | Sanitizes the current title when retrieving or displaying. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Used By | Description | | --- | --- | | [adjacent\_posts\_rel\_link()](adjacent_posts_rel_link) wp-includes/link-template.php | Displays the relational links for the posts adjacent to the current post. | | [next\_post\_rel\_link()](next_post_rel_link) wp-includes/link-template.php | Displays the relational link for the next post adjacent to the current post. | | [prev\_post\_rel\_link()](prev_post_rel_link) wp-includes/link-template.php | Displays the relational link for the previous post adjacent to the current post. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress unregister_block_pattern_category( string $category_name ): bool unregister\_block\_pattern\_category( string $category\_name ): bool ==================================================================== Unregisters a pattern category. `$category_name` string Required Pattern category name including namespace. bool True if the pattern category was unregistered with success and false otherwise. File: `wp-includes/class-wp-block-pattern-categories-registry.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-block-pattern-categories-registry.php/) ``` function unregister_block_pattern_category( $category_name ) { return WP_Block_Pattern_Categories_Registry::get_instance()->unregister( $category_name ); } ``` | Uses | Description | | --- | --- | | [WP\_Block\_Pattern\_Categories\_Registry::get\_instance()](../classes/wp_block_pattern_categories_registry/get_instance) wp-includes/class-wp-block-pattern-categories-registry.php | Utility method to retrieve the main instance of the class. | | Version | Description | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. | wordpress get_plugin_updates(): array get\_plugin\_updates(): array ============================= Retrieves plugins 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_plugin_updates() { $all_plugins = get_plugins(); $upgrade_plugins = array(); $current = get_site_transient( 'update_plugins' ); foreach ( (array) $all_plugins as $plugin_file => $plugin_data ) { if ( isset( $current->response[ $plugin_file ] ) ) { $upgrade_plugins[ $plugin_file ] = (object) $plugin_data; $upgrade_plugins[ $plugin_file ]->update = $current->response[ $plugin_file ]; } } return $upgrade_plugins; } ``` | Uses | Description | | --- | --- | | [get\_plugins()](get_plugins) wp-admin/includes/plugin.php | Checks the plugins directory and retrieve all plugin files with plugin data. | | [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. | | 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\_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\_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\_plugin\_updates()](list_plugin_updates) wp-admin/update-core.php | Display the upgrade plugins form. | | Version | Description | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress wp_dashboard_php_nag() wp\_dashboard\_php\_nag() ========================= Displays the PHP update nag. File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/) ``` function wp_dashboard_php_nag() { $response = wp_check_php_version(); if ( ! $response ) { return; } if ( isset( $response['is_secure'] ) && ! $response['is_secure'] ) { // The `is_secure` array key name doesn't actually imply this is a secure version of PHP. It only means it receives security updates. if ( $response['is_lower_than_future_minimum'] ) { $message = sprintf( /* translators: %s: The server PHP version. */ __( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates and soon will not be supported by WordPress. Ensure that PHP is updated on your server as soon as possible. Otherwise you will not be able to upgrade WordPress.' ), PHP_VERSION ); } else { $message = sprintf( /* translators: %s: The server PHP version. */ __( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates. It should be updated.' ), PHP_VERSION ); } } elseif ( $response['is_lower_than_future_minimum'] ) { $message = sprintf( /* translators: %s: The server PHP version. */ __( 'Your site is running on an outdated version of PHP (%s), which soon will not be supported by WordPress. Ensure that PHP is updated on your server as soon as possible. Otherwise you will not be able to upgrade WordPress.' ), PHP_VERSION ); } else { $message = sprintf( /* translators: %s: The server PHP version. */ __( 'Your site is running on an outdated version of PHP (%s), which should be updated.' ), PHP_VERSION ); } ?> <p class="bigger-bolder-text"><?php echo $message; ?></p> <p><?php _e( 'What is PHP and how does it affect my site?' ); ?></p> <p> <?php _e( 'PHP is one of the programming languages used to build WordPress. Newer versions of PHP receive regular security updates and may increase your site&#8217;s performance.' ); ?> <?php if ( ! empty( $response['recommended_version'] ) ) { printf( /* translators: %s: The minimum recommended PHP version. */ __( 'The minimum recommended version of PHP is %s.' ), $response['recommended_version'] ); } ?> </p> <p class="button-container"> <?php printf( '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>', esc_url( wp_get_update_php_url() ), __( 'Learn more about updating PHP' ), /* translators: Accessibility text. */ __( '(opens in a new tab)' ) ); ?> </p> <?php wp_update_php_annotation(); wp_direct_php_update_button(); } ``` | Uses | 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. | | [wp\_get\_update\_php\_url()](wp_get_update_php_url) wp-includes/functions.php | Gets the URL to learn more about updating the PHP version the site is running on. | | [wp\_update\_php\_annotation()](wp_update_php_annotation) wp-includes/functions.php | Prints the default annotation for the web host altering the “Update PHP” page URL. | | [wp\_check\_php\_version()](wp_check_php_version) wp-admin/includes/misc.php | Checks if the user needs to update PHP. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | Version | Description | | --- | --- | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. | wordpress update_user_option( int $user_id, string $option_name, mixed $newvalue, bool $global = false ): int|bool update\_user\_option( int $user\_id, string $option\_name, mixed $newvalue, bool $global = false ): int|bool ============================================================================================================ Updates user option with global blog capability. User options are just like user metadata except that they have support for global blog options. If the ‘global’ parameter is false, which it is by default it will prepend the WordPress table prefix to the option name. Deletes the user option if $newvalue is empty. `$user_id` int Required User ID. `$option_name` string Required User option name. `$newvalue` mixed Required User option value. `$global` bool Optional Whether option name is global or blog specific. Default false (blog specific). Default: `false` int|bool User meta ID if the option didn't exist, true on successful update, false on failure. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function update_user_option( $user_id, $option_name, $newvalue, $global = false ) { global $wpdb; if ( ! $global ) { $option_name = $wpdb->get_blog_prefix() . $option_name; } return update_user_meta( $user_id, $option_name, $newvalue ); } ``` | Uses | Description | | --- | --- | | [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. | | [wpdb::get\_blog\_prefix()](../classes/wpdb/get_blog_prefix) wp-includes/class-wpdb.php | Gets blog prefix. | | Used By | Description | | --- | --- | | [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press) wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. | | [wp\_user\_settings()](wp_user_settings) wp-includes/option.php | Saves and restores user interface settings stored in a cookie. | | [wp\_set\_all\_user\_settings()](wp_set_all_user_settings) wp-includes/option.php | Private. Sets all user interface settings. | | [delete\_all\_user\_settings()](delete_all_user_settings) wp-includes/option.php | Deletes the user settings of the current user. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress get_cat_ID( string $cat_name ): int get\_cat\_ID( string $cat\_name ): int ====================================== Retrieves the ID of a category from its name. `$cat_name` string Required Category name. int Category ID on success, 0 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_ID( $cat_name ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid $cat = get_term_by( 'name', $cat_name, 'category' ); if ( $cat ) { return $cat->term_id; } return 0; } ``` | Uses | Description | | --- | --- | | [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. | | Used By | Description | | --- | --- | | [wp\_xmlrpc\_server::mw\_editPost()](../classes/wp_xmlrpc_server/mw_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post. | | [wp\_xmlrpc\_server::mw\_newPost()](../classes/wp_xmlrpc_server/mw_newpost) wp-includes/class-wp-xmlrpc-server.php | Create a new post. | | Version | Description | | --- | --- | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. | wordpress wp_get_document_title(): string wp\_get\_document\_title(): string ================================== Returns document title for the current page. string Tag with the document title. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function wp_get_document_title() { /** * Filters the document title before it is generated. * * Passing a non-empty value will short-circuit wp_get_document_title(), * returning that value instead. * * @since 4.4.0 * * @param string $title The document title. Default empty string. */ $title = apply_filters( 'pre_get_document_title', '' ); if ( ! empty( $title ) ) { return $title; } global $page, $paged; $title = array( 'title' => '', ); // If it's a 404 page, use a "Page not found" title. if ( is_404() ) { $title['title'] = __( 'Page not found' ); // If it's a search, use a dynamic search results title. } elseif ( is_search() ) { /* translators: %s: Search query. */ $title['title'] = sprintf( __( 'Search Results for &#8220;%s&#8221;' ), get_search_query() ); // If on the front page, use the site title. } elseif ( is_front_page() ) { $title['title'] = get_bloginfo( 'name', 'display' ); // If on a post type archive, use the post type archive title. } elseif ( is_post_type_archive() ) { $title['title'] = post_type_archive_title( '', false ); // If on a taxonomy archive, use the term title. } elseif ( is_tax() ) { $title['title'] = single_term_title( '', false ); /* * If we're on the blog page that is not the homepage * or a single post of any post type, use the post title. */ } elseif ( is_home() || is_singular() ) { $title['title'] = single_post_title( '', false ); // If on a category or tag archive, use the term title. } elseif ( is_category() || is_tag() ) { $title['title'] = single_term_title( '', false ); // If on an author archive, use the author's display name. } elseif ( is_author() && get_queried_object() ) { $author = get_queried_object(); $title['title'] = $author->display_name; // If it's a date archive, use the date as the title. } elseif ( is_year() ) { $title['title'] = get_the_date( _x( 'Y', 'yearly archives date format' ) ); } elseif ( is_month() ) { $title['title'] = get_the_date( _x( 'F Y', 'monthly archives date format' ) ); } elseif ( is_day() ) { $title['title'] = get_the_date(); } // Add a page number if necessary. if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { /* translators: %s: Page number. */ $title['page'] = sprintf( __( 'Page %s' ), max( $paged, $page ) ); } // Append the description or site title to give context. if ( is_front_page() ) { $title['tagline'] = get_bloginfo( 'description', 'display' ); } else { $title['site'] = get_bloginfo( 'name', 'display' ); } /** * Filters the separator for the document title. * * @since 4.4.0 * * @param string $sep Document title separator. Default '-'. */ $sep = apply_filters( 'document_title_separator', '-' ); /** * Filters the parts of the document title. * * @since 4.4.0 * * @param array $title { * The document title parts. * * @type string $title Title of the viewed page. * @type string $page Optional. Page number if paginated. * @type string $tagline Optional. Site description when on home page. * @type string $site Optional. Site title when not on home page. * } */ $title = apply_filters( 'document_title_parts', $title ); $title = implode( " $sep ", array_filter( $title ) ); /** * Filters the document title. * * @since 5.8.0 * * @param string $title Document title. */ $title = apply_filters( 'document_title', $title ); return $title; } ``` [apply\_filters( 'document\_title', string $title )](../hooks/document_title) Filters the document title. [apply\_filters( 'document\_title\_parts', array $title )](../hooks/document_title_parts) Filters the parts of the document title. [apply\_filters( 'document\_title\_separator', string $sep )](../hooks/document_title_separator) Filters the separator for the document title. [apply\_filters( 'pre\_get\_document\_title', string $title )](../hooks/pre_get_document_title) Filters the document title before it is generated. | Uses | Description | | --- | --- | | [is\_year()](is_year) wp-includes/query.php | Determines whether the query is for an existing year archive. | | [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\_author()](is_author) wp-includes/query.php | Determines whether the query is for an existing author archive page. | | [is\_tag()](is_tag) wp-includes/query.php | Determines whether the query is for an existing tag archive page. | | [is\_category()](is_category) wp-includes/query.php | Determines whether the query is for an existing category archive page. | | [is\_home()](is_home) wp-includes/query.php | Determines whether the query is for the blog homepage. | | [is\_tax()](is_tax) wp-includes/query.php | Determines whether the query is for an existing custom taxonomy archive page. | | [is\_front\_page()](is_front_page) wp-includes/query.php | Determines whether the query is for the front page of the site. | | [is\_post\_type\_archive()](is_post_type_archive) wp-includes/query.php | Determines whether the query is for an existing post type archive page. | | [is\_search()](is_search) wp-includes/query.php | Determines whether the query is for a search. | | [is\_day()](is_day) wp-includes/query.php | Determines whether the query is for an existing day archive. | | [is\_404()](is_404) wp-includes/query.php | Determines whether the query has resulted in a 404 (returns no results). | | [single\_post\_title()](single_post_title) wp-includes/general-template.php | Displays or retrieves page title for 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. | | [get\_queried\_object()](get_queried_object) wp-includes/query.php | Retrieves the currently queried object. | | [get\_the\_date()](get_the_date) wp-includes/general-template.php | Retrieves the date on which the post was written. | | [get\_search\_query()](get_search_query) wp-includes/general-template.php | Retrieves the contents of the search WordPress query variable. | | [is\_month()](is_month) wp-includes/query.php | Determines whether the query is for an existing month archive. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [\_block\_template\_render\_title\_tag()](_block_template_render_title_tag) wp-includes/block-template.php | Displays title tag with content, regardless of whether theme has title-tag support. | | [get\_wp\_title\_rss()](get_wp_title_rss) wp-includes/feed.php | Retrieves the blog title for the feed title. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
programming_docs
wordpress _fix_attachment_links( int|object $post ): void|int|WP_Error \_fix\_attachment\_links( int|object $post ): void|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. Replaces hrefs of attachment anchors with up-to-date permalinks. `$post` int|object Required Post ID or post object. void|int|[WP\_Error](../classes/wp_error) Void if nothing fixed. 0 or [WP\_Error](../classes/wp_error) on update failure. The post ID on update success. File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/) ``` function _fix_attachment_links( $post ) { $post = get_post( $post, ARRAY_A ); $content = $post['post_content']; // Don't run if no pretty permalinks or post is not published, scheduled, or privately published. if ( ! get_option( 'permalink_structure' ) || ! in_array( $post['post_status'], array( 'publish', 'future', 'private' ), true ) ) { return; } // Short if there aren't any links or no '?attachment_id=' strings (strpos cannot be zero). if ( ! strpos( $content, '?attachment_id=' ) || ! preg_match_all( '/<a ([^>]+)>[\s\S]+?<\/a>/', $content, $link_matches ) ) { return; } $site_url = get_bloginfo( 'url' ); $site_url = substr( $site_url, (int) strpos( $site_url, '://' ) ); // Remove the http(s). $replace = ''; foreach ( $link_matches[1] as $key => $value ) { if ( ! strpos( $value, '?attachment_id=' ) || ! strpos( $value, 'wp-att-' ) || ! preg_match( '/href=(["\'])[^"\']*\?attachment_id=(\d+)[^"\']*\\1/', $value, $url_match ) || ! preg_match( '/rel=["\'][^"\']*wp-att-(\d+)/', $value, $rel_match ) ) { continue; } $quote = $url_match[1]; // The quote (single or double). $url_id = (int) $url_match[2]; $rel_id = (int) $rel_match[1]; if ( ! $url_id || ! $rel_id || $url_id != $rel_id || strpos( $url_match[0], $site_url ) === false ) { continue; } $link = $link_matches[0][ $key ]; $replace = str_replace( $url_match[0], 'href=' . $quote . get_attachment_link( $url_id ) . $quote, $link ); $content = str_replace( $link, $replace, $content ); } if ( $replace ) { $post['post_content'] = $content; // Escape data pulled from DB. $post = add_magic_quotes( $post ); return wp_update_post( $post ); } } ``` | Uses | Description | | --- | --- | | [add\_magic\_quotes()](add_magic_quotes) wp-includes/functions.php | Walks the array while sanitizing the contents. | | [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. | | [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. | | [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Used By | Description | | --- | --- | | [wp\_write\_post()](wp_write_post) wp-admin/includes/post.php | Creates a new post from the “Write Post” form using `$_POST` information. | | [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress rest_validate_boolean_value_from_schema( mixed $value, string $param ): true|WP_Error rest\_validate\_boolean\_value\_from\_schema( mixed $value, string $param ): true|WP\_Error =========================================================================================== Validates a boolean value based on a schema. `$value` mixed Required The value to validate. `$param` string Required The parameter name, used in error messages. true|[WP\_Error](../classes/wp_error) File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_validate_boolean_value_from_schema( $value, $param ) { if ( ! rest_is_boolean( $value ) ) { return new WP_Error( 'rest_invalid_type', /* translators: 1: Parameter, 2: Type name. */ sprintf( __( '%1$s is not of type %2$s.' ), $param, 'boolean' ), array( 'param' => $param ) ); } return true; } ``` | Uses | Description | | --- | --- | | [rest\_is\_boolean()](rest_is_boolean) wp-includes/rest-api.php | Determines if a given value is boolean-like. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Used By | Description | | --- | --- | | [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. | | Version | Description | | --- | --- | | [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. | wordpress wp_link_pages( string|array $args = '' ): string wp\_link\_pages( string|array $args = '' ): string ================================================== The formatted output of a list of pages. Displays page links for paginated posts (i.e. including the `<!--nextpage-->` Quicktag one or more times). This tag must be within The Loop. `$args` string|array Optional Array or string of default arguments. * `before`stringHTML or text to prepend to each link. Default is `<p> Pages:`. * `after`stringHTML or text to append to each link. Default is `</p>`. * `link_before`stringHTML or text to prepend to each link, inside the `<a>` tag. Also prepended to the current item, which is not linked. * `link_after`stringHTML or text to append to each Pages link inside the `<a>` tag. Also appended to the current item, which is not linked. * `aria_current`stringThe value for the aria-current attribute. Possible values are `'page'`, `'step'`, `'location'`, `'date'`, `'time'`, `'true'`, `'false'`. Default is `'page'`. * `next_or_number`stringIndicates whether page numbers should be used. Valid values are number and next. Default is `'number'`. * `separator`stringText between pagination links. Default is ' '. * `nextpagelink`stringLink text for the next page link, if available. Default is 'Next Page'. * `previouspagelink`stringLink text for the previous page link, if available. Default is 'Previous Page'. * `pagelink`stringFormat string for page numbers. The % in the parameter string will be replaced with the page number, so 'Page %' generates "Page 1", "Page 2", etc. Defaults to `'%'`, just the page number. * `echo`int|boolWhether to echo or not. Accepts `1|true` or `0|false`. Default `1|true`. Default: `''` string Formatted output in HTML. File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/) ``` function wp_link_pages( $args = '' ) { global $page, $numpages, $multipage, $more; $defaults = array( 'before' => '<p class="post-nav-links">' . __( 'Pages:' ), 'after' => '</p>', 'link_before' => '', 'link_after' => '', 'aria_current' => 'page', 'next_or_number' => 'number', 'separator' => ' ', 'nextpagelink' => __( 'Next page' ), 'previouspagelink' => __( 'Previous page' ), 'pagelink' => '%', 'echo' => 1, ); $parsed_args = wp_parse_args( $args, $defaults ); /** * Filters the arguments used in retrieving page links for paginated posts. * * @since 3.0.0 * * @param array $parsed_args An array of page link arguments. See wp_link_pages() * for information on accepted arguments. */ $parsed_args = apply_filters( 'wp_link_pages_args', $parsed_args ); $output = ''; if ( $multipage ) { if ( 'number' === $parsed_args['next_or_number'] ) { $output .= $parsed_args['before']; for ( $i = 1; $i <= $numpages; $i++ ) { $link = $parsed_args['link_before'] . str_replace( '%', $i, $parsed_args['pagelink'] ) . $parsed_args['link_after']; if ( $i != $page || ! $more && 1 == $page ) { $link = _wp_link_page( $i ) . $link . '</a>'; } elseif ( $i === $page ) { $link = '<span class="post-page-numbers current" aria-current="' . esc_attr( $parsed_args['aria_current'] ) . '">' . $link . '</span>'; } /** * Filters the HTML output of individual page number links. * * @since 3.6.0 * * @param string $link The page number HTML output. * @param int $i Page number for paginated posts' page links. */ $link = apply_filters( 'wp_link_pages_link', $link, $i ); // Use the custom links separator beginning with the second link. $output .= ( 1 === $i ) ? ' ' : $parsed_args['separator']; $output .= $link; } $output .= $parsed_args['after']; } elseif ( $more ) { $output .= $parsed_args['before']; $prev = $page - 1; if ( $prev > 0 ) { $link = _wp_link_page( $prev ) . $parsed_args['link_before'] . $parsed_args['previouspagelink'] . $parsed_args['link_after'] . '</a>'; /** This filter is documented in wp-includes/post-template.php */ $output .= apply_filters( 'wp_link_pages_link', $link, $prev ); } $next = $page + 1; if ( $next <= $numpages ) { if ( $prev ) { $output .= $parsed_args['separator']; } $link = _wp_link_page( $next ) . $parsed_args['link_before'] . $parsed_args['nextpagelink'] . $parsed_args['link_after'] . '</a>'; /** This filter is documented in wp-includes/post-template.php */ $output .= apply_filters( 'wp_link_pages_link', $link, $next ); } $output .= $parsed_args['after']; } } /** * Filters the HTML output of page links for paginated posts. * * @since 3.6.0 * * @param string $output HTML output of paginated posts' page links. * @param array|string $args An array or query string of arguments. See wp_link_pages() * for information on accepted arguments. */ $html = apply_filters( 'wp_link_pages', $output, $args ); if ( $parsed_args['echo'] ) { echo $html; } return $html; } ``` [apply\_filters( 'wp\_link\_pages', string $output, array|string $args )](../hooks/wp_link_pages) Filters the HTML output of page links for paginated posts. [apply\_filters( 'wp\_link\_pages\_args', array $parsed\_args )](../hooks/wp_link_pages_args) Filters the arguments used in retrieving page links for paginated posts. [apply\_filters( 'wp\_link\_pages\_link', string $link, int $i )](../hooks/wp_link_pages_link) Filters the HTML output of individual page number links. | Uses | Description | | --- | --- | | [\_wp\_link\_page()](_wp_link_page) wp-includes/post-template.php | Helper function for [wp\_link\_pages()](wp_link_pages) . | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [link\_pages()](link_pages) wp-includes/deprecated.php | Print list of pages based on arguments. | | Version | Description | | --- | --- | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Added the `aria_current` argument. | | [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. | wordpress activate_sitewide_plugin() activate\_sitewide\_plugin() ============================ This function has been deprecated. Use [activate\_plugin()](activate_plugin) instead. Deprecated functionality for activating a network-only plugin. * [activate\_plugin()](activate_plugin) File: `wp-admin/includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms-deprecated.php/) ``` function activate_sitewide_plugin() { _deprecated_function( __FUNCTION__, '3.0.0', 'activate_plugin()' ); 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.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress get_category_template(): string get\_category\_template(): string ================================= Retrieves path of category template in current or parent template. The hierarchy for this template looks like: 1. category-{slug}.php 2. category-{id}.php 3. category.php An example of this is: 1. category-news.php 2. category-2.php 3. category.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 ‘category’. * [get\_query\_template()](get_query_template) string Full path to category template file. File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/) ``` function get_category_template() { $category = get_queried_object(); $templates = array(); if ( ! empty( $category->slug ) ) { $slug_decoded = urldecode( $category->slug ); if ( $slug_decoded !== $category->slug ) { $templates[] = "category-{$slug_decoded}.php"; } $templates[] = "category-{$category->slug}.php"; $templates[] = "category-{$category->term_id}.php"; } $templates[] = 'category.php'; return get_query_template( 'category', $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 `category-{slug}.php` was added to the top of the template hierarchy when the category slug contains multibyte characters. | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress get_theme_mod( string $name, mixed $default = false ): mixed get\_theme\_mod( string $name, mixed $default = false ): mixed ============================================================== Retrieves theme modification value for the active theme. If the modification name does not exist and `$default` is a string, then the default will be passed through the [sprintf()](https://www.php.net/sprintf) PHP function with the template directory URI as the first value and the stylesheet directory URI as the second value. `$name` string Required Theme modification name. `$default` mixed Optional Theme modification default value. Default: `false` mixed Theme modification value. File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/) ``` function get_theme_mod( $name, $default = false ) { $mods = get_theme_mods(); if ( isset( $mods[ $name ] ) ) { /** * Filters the theme modification, or 'theme_mod', value. * * The dynamic portion of the hook name, `$name`, refers to the key name * of the modification array. For example, 'header_textcolor', 'header_image', * and so on depending on the theme options. * * @since 2.2.0 * * @param mixed $current_mod The value of the active theme modification. */ return apply_filters( "theme_mod_{$name}", $mods[ $name ] ); } if ( is_string( $default ) ) { // Only run the replacement if an sprintf() string format pattern was found. if ( preg_match( '#(?<!%)%(?:\d+\$?)?s#', $default ) ) { // Remove a single trailing percent sign. $default = preg_replace( '#(?<!%)%$#', '', $default ); $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ); } } /** This filter is documented in wp-includes/theme.php */ return apply_filters( "theme_mod_{$name}", $default ); } ``` [apply\_filters( "theme\_mod\_{$name}", mixed $current\_mod )](../hooks/theme_mod_name) Filters the theme modification, or ‘theme\_mod’, value. | Uses | Description | | --- | --- | | [get\_theme\_mods()](get_theme_mods) wp-includes/theme.php | Retrieves all theme modifications. | | [get\_template\_directory\_uri()](get_template_directory_uri) wp-includes/theme.php | Retrieves template directory URI for the active theme. | | [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) wp-includes/theme.php | Retrieves stylesheet directory URI for the active theme. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [WP\_REST\_Server::add\_site\_logo\_to\_index()](../classes/wp_rest_server/add_site_logo_to_index) wp-includes/rest-api/class-wp-rest-server.php | Exposes the site logo through the WordPress REST API. | | [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. | | [wp\_map\_sidebars\_widgets()](wp_map_sidebars_widgets) wp-includes/widgets.php | Compares a list of sidebars with their widgets against an allowed list. | | [wp\_get\_custom\_css\_post()](wp_get_custom_css_post) wp-includes/theme.php | Fetches the `custom_css` post for a given theme. | | [get\_header\_video\_url()](get_header_video_url) wp-includes/theme.php | Retrieves header video URL for custom header. | | [\_custom\_logo\_header\_styles()](_custom_logo_header_styles) wp-includes/theme.php | Adds CSS to hide header text for custom logo, based on Customizer setting. | | [has\_custom\_logo()](has_custom_logo) wp-includes/general-template.php | Determines whether the site has a custom logo. | | [get\_custom\_logo()](get_custom_logo) wp-includes/general-template.php | Returns a custom logo, linked to home unless the theme supports removing the link on the home page. | | [WP\_Customize\_Setting::get\_root\_value()](../classes/wp_customize_setting/get_root_value) wp-includes/class-wp-customize-setting.php | Get the root value for a setting, especially for multidimensional ones. | | [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. | | [get\_background\_color()](get_background_color) wp-includes/theme.php | Retrieves value for custom background color. | | [\_custom\_background\_cb()](_custom_background_cb) wp-includes/theme.php | Default custom background callback. | | [\_delete\_attachment\_theme\_mod()](_delete_attachment_theme_mod) wp-includes/theme.php | Checks an attachment being deleted to see if it’s a header or background image. | | [get\_header\_textcolor()](get_header_textcolor) wp-includes/theme.php | Retrieves the custom header text color in 3- or 6-digit hexadecimal form. | | [display\_header\_text()](display_header_text) wp-includes/theme.php | Whether to display the header text. | | [get\_header\_image()](get_header_image) wp-includes/theme.php | Retrieves header image for custom header. | | [\_get\_random\_header\_data()](_get_random_header_data) wp-includes/theme.php | Gets random header image data from registered images in theme. | | [is\_random\_header\_image()](is_random_header_image) wp-includes/theme.php | Checks if random header image is in use. | | [get\_custom\_header()](get_custom_header) wp-includes/theme.php | Gets the header image data. | | [get\_background\_image()](get_background_image) wp-includes/theme.php | Retrieves background image for custom background. | | [switch\_theme()](switch_theme) wp-includes/theme.php | Switches the theme. | | [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. | | [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.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
programming_docs
wordpress floated_admin_avatar( string $name ): string floated\_admin\_avatar( string $name ): string ============================================== Adds avatars to relevant places in admin. `$name` string Required User name. string Avatar with the user name. File: `wp-admin/includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/comment.php/) ``` function floated_admin_avatar( $name ) { $avatar = get_avatar( get_comment(), 32, 'mystery' ); return "$avatar $name"; } ``` | Uses | Description | | --- | --- | | [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. | | [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress untrailingslashit( string $string ): string untrailingslashit( string $string ): string =========================================== Removes trailing forward slashes and backslashes if they exist. The primary use of this is for paths and thus should be used for paths. It is not restricted to paths and offers no specific path support. `$string` string Required What to remove the trailing slashes from. string String without the trailing slashes. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function untrailingslashit( $string ) { return rtrim( $string, '/\\' ); } ``` | Used By | 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. | | [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\_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. | | [clean\_dirsize\_cache()](clean_dirsize_cache) wp-includes/functions.php | Cleans directory size cache used by [recurse\_dirsize()](recurse_dirsize) . | | [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\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. | | [load\_script\_textdomain()](load_script_textdomain) wp-includes/l10n.php | Loads the script translated strings. | | [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\_Request::from\_url()](../classes/wp_rest_request/from_url) wp-includes/rest-api/class-wp-rest-request.php | Retrieves a [WP\_REST\_Request](../classes/wp_rest_request) object from a full URL. | | [\_wp\_upload\_dir()](_wp_upload_dir) wp-includes/functions.php | A non-filtered, non-cached version of [wp\_upload\_dir()](wp_upload_dir) that doesn’t check the path. | | [rest\_api\_loaded()](rest_api_loaded) wp-includes/rest-api.php | Loads the REST API. | | [WP\_MS\_Sites\_List\_Table::handle\_row\_actions()](../classes/wp_ms_sites_list_table/handle_row_actions) wp-admin/includes/class-wp-ms-sites-list-table.php | Generates and displays row action links. | | [WP\_MS\_Sites\_List\_Table::column\_cb()](../classes/wp_ms_sites_list_table/column_cb) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the checkbox column output. | | [WP\_MS\_Sites\_List\_Table::column\_blogname()](../classes/wp_ms_sites_list_table/column_blogname) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the site name column output. | | [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::is\_vcs\_checkout()](../classes/wp_automatic_updater/is_vcs_checkout) wp-admin/includes/class-wp-automatic-updater.php | Checks for version control checkouts. | | [WP\_Filesystem\_SSH2::mkdir()](../classes/wp_filesystem_ssh2/mkdir) wp-admin/includes/class-wp-filesystem-ssh2.php | Creates a directory. | | [WP\_Filesystem\_FTPext::mkdir()](../classes/wp_filesystem_ftpext/mkdir) wp-admin/includes/class-wp-filesystem-ftpext.php | Creates a directory. | | [WP\_Filesystem\_Base::search\_for\_folder()](../classes/wp_filesystem_base/search_for_folder) wp-admin/includes/class-wp-filesystem-base.php | Locates a folder on the remote filesystem. | | [WP\_Filesystem\_Direct::mkdir()](../classes/wp_filesystem_direct/mkdir) wp-admin/includes/class-wp-filesystem-direct.php | Creates a directory. | | [url\_shorten()](url_shorten) wp-includes/formatting.php | Shortens a URL, to be used as link text. | | [get\_alloptions\_110()](get_alloptions_110) wp-admin/includes/upgrade.php | Retrieve all options as it was for 1.2. | | [get\_sample\_permalink()](get_sample_permalink) wp-admin/includes/post.php | Returns a sample permalink based on the post name. | | [WP\_Comments\_List\_Table::column\_author()](../classes/wp_comments_list_table/column_author) wp-admin/includes/class-wp-comments-list-table.php | | | [WP\_Filesystem\_ftpsockets::mkdir()](../classes/wp_filesystem_ftpsockets/mkdir) wp-admin/includes/class-wp-filesystem-ftpsockets.php | Creates a directory. | | [unzip\_file()](unzip_file) wp-admin/includes/file.php | Unzips a specified ZIP file to a location on the filesystem via the WordPress Filesystem Abstraction. | | [\_unzip\_file\_ziparchive()](_unzip_file_ziparchive) wp-admin/includes/file.php | Attempts to unzip an archive using the ZipArchive class. | | [\_unzip\_file\_pclzip()](_unzip_file_pclzip) wp-admin/includes/file.php | Attempts to unzip an archive using the PclZip library. | | [register\_theme\_directory()](register_theme_directory) wp-includes/theme.php | Registers a directory that contains themes. | | [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. | | [\_config\_wp\_home()](_config_wp_home) wp-includes/functions.php | Retrieves the WordPress home page URL. | | [\_config\_wp\_siteurl()](_config_wp_siteurl) wp-includes/functions.php | Retrieves the WordPress site URL. | | [WP\_Widget\_RSS::widget()](../classes/wp_widget_rss/widget) wp-includes/widgets/class-wp-widget-rss.php | Outputs the content for the current RSS widget instance. | | [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | [\_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. | | [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. | | [recurse\_dirsize()](recurse_dirsize) wp-includes/functions.php | Gets the size of a directory recursively. | | [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. | | Version | Description | | --- | --- | | [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. | wordpress get_theme_roots(): array|string get\_theme\_roots(): array|string ================================= Retrieves theme roots. array|string An array of theme roots keyed by template/stylesheet or a single theme root if all themes have the same root. The names of theme directories are without the trailing but with the leading slash. File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/) ``` function get_theme_roots() { global $wp_theme_directories; if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) { return '/themes'; } $theme_roots = get_site_transient( 'theme_roots' ); if ( false === $theme_roots ) { search_theme_directories( true ); // Regenerate the transient. $theme_roots = get_site_transient( 'theme_roots' ); } return $theme_roots; } ``` | Uses | Description | | --- | --- | | [search\_theme\_directories()](search_theme_directories) wp-includes/theme.php | Searches all registered theme directories for complete and valid themes. | | [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. | | Used By | 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. | | Version | Description | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress load_script_textdomain( string $handle, string $domain = 'default', string $path = '' ): string|false load\_script\_textdomain( string $handle, string $domain = 'default', string $path = '' ): string|false ======================================================================================================= Loads the script translated strings. * [WP\_Scripts::set\_translations()](../classes/wp_scripts/set_translations) `$handle` string Required Name of the script to register a translation domain to. `$domain` string Optional Text domain. Default `'default'`. Default: `'default'` `$path` string Optional The full file path to the directory containing translation files. Default: `''` string|false The translated strings in JSON encoding on success, false if the script textdomain could not be loaded. File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/) ``` function load_script_textdomain( $handle, $domain = 'default', $path = '' ) { $wp_scripts = wp_scripts(); if ( ! isset( $wp_scripts->registered[ $handle ] ) ) { return false; } $path = untrailingslashit( $path ); $locale = determine_locale(); // If a path was given and the handle file exists simply return it. $file_base = 'default' === $domain ? $locale : $domain . '-' . $locale; $handle_filename = $file_base . '-' . $handle . '.json'; if ( $path ) { $translations = load_script_translations( $path . '/' . $handle_filename, $handle, $domain ); if ( $translations ) { return $translations; } } $src = $wp_scripts->registered[ $handle ]->src; if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $wp_scripts->content_url && 0 === strpos( $src, $wp_scripts->content_url ) ) ) { $src = $wp_scripts->base_url . $src; } $relative = false; $languages_path = WP_LANG_DIR; $src_url = wp_parse_url( $src ); $content_url = wp_parse_url( content_url() ); $plugins_url = wp_parse_url( plugins_url() ); $site_url = wp_parse_url( site_url() ); // If the host is the same or it's a relative URL. if ( ( ! isset( $content_url['path'] ) || strpos( $src_url['path'], $content_url['path'] ) === 0 ) && ( ! isset( $src_url['host'] ) || ! isset( $content_url['host'] ) || $src_url['host'] === $content_url['host'] ) ) { // Make the src relative the specific plugin or theme. if ( isset( $content_url['path'] ) ) { $relative = substr( $src_url['path'], strlen( $content_url['path'] ) ); } else { $relative = $src_url['path']; } $relative = trim( $relative, '/' ); $relative = explode( '/', $relative ); $languages_path = WP_LANG_DIR . '/' . $relative[0]; $relative = array_slice( $relative, 2 ); // Remove plugins/<plugin name> or themes/<theme name>. $relative = implode( '/', $relative ); } elseif ( ( ! isset( $plugins_url['path'] ) || strpos( $src_url['path'], $plugins_url['path'] ) === 0 ) && ( ! isset( $src_url['host'] ) || ! isset( $plugins_url['host'] ) || $src_url['host'] === $plugins_url['host'] ) ) { // Make the src relative the specific plugin. if ( isset( $plugins_url['path'] ) ) { $relative = substr( $src_url['path'], strlen( $plugins_url['path'] ) ); } else { $relative = $src_url['path']; } $relative = trim( $relative, '/' ); $relative = explode( '/', $relative ); $languages_path = WP_LANG_DIR . '/plugins'; $relative = array_slice( $relative, 1 ); // Remove <plugin name>. $relative = implode( '/', $relative ); } elseif ( ! isset( $src_url['host'] ) || ! isset( $site_url['host'] ) || $src_url['host'] === $site_url['host'] ) { if ( ! isset( $site_url['path'] ) ) { $relative = trim( $src_url['path'], '/' ); } elseif ( ( strpos( $src_url['path'], trailingslashit( $site_url['path'] ) ) === 0 ) ) { // Make the src relative to the WP root. $relative = substr( $src_url['path'], strlen( $site_url['path'] ) ); $relative = trim( $relative, '/' ); } } /** * Filters the relative path of scripts used for finding translation files. * * @since 5.0.2 * * @param string|false $relative The relative path of the script. False if it could not be determined. * @param string $src The full source URL of the script. */ $relative = apply_filters( 'load_script_textdomain_relative_path', $relative, $src ); // If the source is not from WP. if ( false === $relative ) { return load_script_translations( false, $handle, $domain ); } // Translations are always based on the unminified filename. if ( substr( $relative, -7 ) === '.min.js' ) { $relative = substr( $relative, 0, -7 ) . '.js'; } $md5_filename = $file_base . '-' . md5( $relative ) . '.json'; if ( $path ) { $translations = load_script_translations( $path . '/' . $md5_filename, $handle, $domain ); if ( $translations ) { return $translations; } } $translations = load_script_translations( $languages_path . '/' . $md5_filename, $handle, $domain ); if ( $translations ) { return $translations; } return load_script_translations( false, $handle, $domain ); } ``` [apply\_filters( 'load\_script\_textdomain\_relative\_path', string|false $relative, string $src )](../hooks/load_script_textdomain_relative_path) Filters the relative path of scripts used for finding translation files. | Uses | Description | | --- | --- | | [load\_script\_translations()](load_script_translations) wp-includes/l10n.php | Loads the translation data for the given script handle and text domain. | | [determine\_locale()](determine_locale) wp-includes/l10n.php | Determines the current locale desired for the request. | | [wp\_parse\_url()](wp_parse_url) wp-includes/http.php | A wrapper for PHP’s parse\_url() function that handles consistency in the return values across PHP versions. | | [wp\_scripts()](wp_scripts) wp-includes/functions.wp-scripts.php | Initialize $wp\_scripts if it has not been set. | | [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. | | [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. | | [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\_Scripts::print\_translations()](../classes/wp_scripts/print_translations) wp-includes/class-wp-scripts.php | Prints translations set for a specific handle. | | Version | Description | | --- | --- | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | The `$domain` parameter was made optional. | | [5.0.2](https://developer.wordpress.org/reference/since/5.0.2/) | Uses [load\_script\_translations()](load_script_translations) to load translation data. | | [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. | wordpress wp_get_links( string $args = '' ): null|string wp\_get\_links( string $args = '' ): null|string ================================================ This function has been deprecated. Use [wp\_list\_bookmarks()](wp_list_bookmarks) instead. Gets the links associated with category. * [wp\_list\_bookmarks()](wp_list_bookmarks) `$args` string Optional a query string Default: `''` null|string File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function wp_get_links($args = '') { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' ); if ( strpos( $args, '=' ) === false ) { $cat_id = $args; $args = add_query_arg( 'category', $cat_id, $args ); } $defaults = array( 'after' => '<br />', 'before' => '', 'between' => ' ', 'categorize' => 0, 'category' => '', 'echo' => true, 'limit' => -1, 'orderby' => 'name', 'show_description' => true, 'show_images' => true, 'show_rating' => false, 'show_updated' => true, 'title_li' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); return wp_list_bookmarks($parsed_args); } ``` | Uses | Description | | --- | --- | | [wp\_list\_bookmarks()](wp_list_bookmarks) wp-includes/bookmark-template.php | Retrieves or echoes all of the bookmarks. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [wp\_list\_bookmarks()](wp_list_bookmarks) | | [1.0.1](https://developer.wordpress.org/reference/since/1.0.1/) | Introduced. | wordpress rest_get_route_for_term( int|WP_Term $term ): string rest\_get\_route\_for\_term( int|WP\_Term $term ): string ========================================================= Gets the REST API route for a term. `$term` int|[WP\_Term](../classes/wp_term) Required Term ID or term object. string The route path with a leading slash for the given term, or an empty string if there is not a route. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_get_route_for_term( $term ) { $term = get_term( $term ); if ( ! $term instanceof WP_Term ) { return ''; } $taxonomy_route = rest_get_route_for_taxonomy_items( $term->taxonomy ); if ( ! $taxonomy_route ) { return ''; } $route = sprintf( '%s/%d', $taxonomy_route, $term->term_id ); /** * Filters the REST API route for a term. * * @since 5.5.0 * * @param string $route The route path. * @param WP_Term $term The term object. */ return apply_filters( 'rest_route_for_term', $route, $term ); } ``` [apply\_filters( 'rest\_route\_for\_term', string $route, WP\_Term $term )](../hooks/rest_route_for_term) Filters the REST API route for a term. | Uses | Description | | --- | --- | | [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. | | [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\_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\_Locations\_Controller::prepare\_links()](../classes/wp_rest_menu_locations_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Prepares links for the request. | | [WP\_REST\_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\_queried\_resource\_route()](rest_get_queried_resource_route) wp-includes/rest-api.php | Gets the REST route for the currently queried object. | | [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. | | Version | Description | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
programming_docs
wordpress get_page_statuses(): string[] get\_page\_statuses(): string[] =============================== Retrieves all of the WordPress support page statuses. Pages have a limited set of valid status values, this provides the post\_status values and descriptions. string[] Array of page status labels keyed by their status. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function get_page_statuses() { $status = array( 'draft' => __( 'Draft' ), 'private' => __( 'Private' ), 'publish' => __( 'Published' ), ); return $status; } ``` | Uses | Description | | --- | --- | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | Used By | Description | | --- | --- | | [wp\_xmlrpc\_server::wp\_getPageStatusList()](../classes/wp_xmlrpc_server/wp_getpagestatuslist) wp-includes/class-wp-xmlrpc-server.php | Retrieve page statuses. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress wp_insert_term( string $term, string $taxonomy, array|string $args = array() ): array|WP_Error wp\_insert\_term( string $term, string $taxonomy, array|string $args = array() ): array|WP\_Error ================================================================================================= Adds a new term to the database. A non-existent term is inserted in the following sequence: 1. The term is added to the term table, then related to the taxonomy. 2. If everything is correct, several actions are fired. 3. The ‘term\_id\_filter’ is evaluated. 4. The term cache is cleaned. 5. Several more actions are fired. 6. An array is returned containing the `term_id` and `term_taxonomy_id`. If the ‘slug’ argument is not empty, then it is checked to see if the term is invalid. If it is not a valid, existing term, it is added and the term\_id is given. If the taxonomy is hierarchical, and the ‘parent’ argument is not empty, the term is inserted and the term\_id will be given. Error handling: If `$taxonomy` does not exist or `$term` is empty, a [WP\_Error](../classes/wp_error) object will be returned. If the term already exists on the same hierarchical level, or the term slug and name are not unique, a [WP\_Error](../classes/wp_error) object will be returned. `$term` string Required The term name to add. `$taxonomy` string Required The taxonomy to which to add the term. `$args` array|string Optional Array or query string of arguments for inserting a term. * `alias_of`stringSlug of the term to make this term an alias of. Default empty string. Accepts a term slug. * `description`stringThe term description. Default empty string. * `parent`intThe id of the parent term. Default 0. * `slug`stringThe term slug to use. Default empty string. Default: `array()` array|[WP\_Error](../classes/wp_error) An array of the new term data, [WP\_Error](../classes/wp_error) otherwise. * `term_id`intThe new term ID. * `term_taxonomy_id`int|stringThe new term taxonomy ID. Can be a numeric string. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/) ``` function wp_insert_term( $term, $taxonomy, $args = array() ) { global $wpdb; if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } /** * Filters a term before it is sanitized and inserted into the database. * * @since 3.0.0 * @since 6.1.0 The `$args` parameter was added. * * @param string|WP_Error $term The term name to add, or a WP_Error object if there's an error. * @param string $taxonomy Taxonomy slug. * @param array|string $args Array or query string of arguments passed to wp_insert_term(). */ $term = apply_filters( 'pre_insert_term', $term, $taxonomy, $args ); if ( is_wp_error( $term ) ) { return $term; } if ( is_int( $term ) && 0 === $term ) { return new WP_Error( 'invalid_term_id', __( 'Invalid term ID.' ) ); } if ( '' === trim( $term ) ) { return new WP_Error( 'empty_term_name', __( 'A name is required for this term.' ) ); } $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '', ); $args = wp_parse_args( $args, $defaults ); if ( (int) $args['parent'] > 0 && ! term_exists( (int) $args['parent'] ) ) { return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) ); } $args['name'] = $term; $args['taxonomy'] = $taxonomy; // Coerce null description to strings, to avoid database errors. $args['description'] = (string) $args['description']; $args = sanitize_term( $args, $taxonomy, 'db' ); // expected_slashed ($name) $name = wp_unslash( $args['name'] ); $description = wp_unslash( $args['description'] ); $parent = (int) $args['parent']; $slug_provided = ! empty( $args['slug'] ); if ( ! $slug_provided ) { $slug = sanitize_title( $name ); } else { $slug = $args['slug']; } $term_group = 0; if ( $args['alias_of'] ) { $alias = get_term_by( 'slug', $args['alias_of'], $taxonomy ); if ( ! empty( $alias->term_group ) ) { // The alias we want is already in a group, so let's use that one. $term_group = $alias->term_group; } elseif ( ! empty( $alias->term_id ) ) { /* * The alias is not in a group, so we create a new one * and add the alias to it. */ $term_group = $wpdb->get_var( "SELECT MAX(term_group) FROM $wpdb->terms" ) + 1; wp_update_term( $alias->term_id, $taxonomy, array( 'term_group' => $term_group, ) ); } } /* * Prevent the creation of terms with duplicate names at the same level of a taxonomy hierarchy, * unless a unique slug has been explicitly provided. */ $name_matches = get_terms( array( 'taxonomy' => $taxonomy, 'name' => $name, 'hide_empty' => false, 'parent' => $args['parent'], 'update_term_meta_cache' => false, ) ); /* * The `name` match in `get_terms()` doesn't differentiate accented characters, * so we do a stricter comparison here. */ $name_match = null; if ( $name_matches ) { foreach ( $name_matches as $_match ) { if ( strtolower( $name ) === strtolower( $_match->name ) ) { $name_match = $_match; break; } } } if ( $name_match ) { $slug_match = get_term_by( 'slug', $slug, $taxonomy ); if ( ! $slug_provided || $name_match->slug === $slug || $slug_match ) { if ( is_taxonomy_hierarchical( $taxonomy ) ) { $siblings = get_terms( array( 'taxonomy' => $taxonomy, 'get' => 'all', 'parent' => $parent, 'update_term_meta_cache' => false, ) ); $existing_term = null; $sibling_names = wp_list_pluck( $siblings, 'name' ); $sibling_slugs = wp_list_pluck( $siblings, 'slug' ); if ( ( ! $slug_provided || $name_match->slug === $slug ) && in_array( $name, $sibling_names, true ) ) { $existing_term = $name_match; } elseif ( $slug_match && in_array( $slug, $sibling_slugs, true ) ) { $existing_term = $slug_match; } if ( $existing_term ) { return new WP_Error( 'term_exists', __( 'A term with the name provided already exists with this parent.' ), $existing_term->term_id ); } } else { return new WP_Error( 'term_exists', __( 'A term with the name provided already exists in this taxonomy.' ), $name_match->term_id ); } } } $slug = wp_unique_term_slug( $slug, (object) $args ); $data = compact( 'name', 'slug', 'term_group' ); /** * Filters term data before it is inserted into the database. * * @since 4.7.0 * * @param array $data Term data to be inserted. * @param string $taxonomy Taxonomy slug. * @param array $args Arguments passed to wp_insert_term(). */ $data = apply_filters( 'wp_insert_term_data', $data, $taxonomy, $args ); if ( false === $wpdb->insert( $wpdb->terms, $data ) ) { return new WP_Error( 'db_insert_error', __( 'Could not insert term into the database.' ), $wpdb->last_error ); } $term_id = (int) $wpdb->insert_id; // Seems unreachable. However, is used in the case that a term name is provided, which sanitizes to an empty string. if ( empty( $slug ) ) { $slug = sanitize_title( $slug, $term_id ); /** This action is documented in wp-includes/taxonomy.php */ do_action( 'edit_terms', $term_id, $taxonomy ); $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); /** This action is documented in wp-includes/taxonomy.php */ do_action( 'edited_terms', $term_id, $taxonomy ); } $tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id ) ); if ( ! empty( $tt_id ) ) { return array( 'term_id' => $term_id, 'term_taxonomy_id' => $tt_id, ); } if ( false === $wpdb->insert( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ) + array( 'count' => 0 ) ) ) { return new WP_Error( 'db_insert_error', __( 'Could not insert term taxonomy into the database.' ), $wpdb->last_error ); } $tt_id = (int) $wpdb->insert_id; /* * Sanity check: if we just created a term with the same parent + taxonomy + slug but a higher term_id than * an existing term, then we have unwittingly created a duplicate term. Delete the dupe, and use the term_id * and term_taxonomy_id of the older term instead. Then return out of the function so that the "create" hooks * are not fired. */ $duplicate_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.term_id, t.slug, tt.term_taxonomy_id, tt.taxonomy FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON ( tt.term_id = t.term_id ) WHERE t.slug = %s AND tt.parent = %d AND tt.taxonomy = %s AND t.term_id < %d AND tt.term_taxonomy_id != %d", $slug, $parent, $taxonomy, $term_id, $tt_id ) ); /** * Filters the duplicate term check that takes place during term creation. * * Term parent + taxonomy + slug combinations are meant to be unique, and wp_insert_term() * performs a last-minute confirmation of this uniqueness before allowing a new term * to be created. Plugins with different uniqueness requirements may use this filter * to bypass or modify the duplicate-term check. * * @since 5.1.0 * * @param object $duplicate_term Duplicate term row from terms table, if found. * @param string $term Term being inserted. * @param string $taxonomy Taxonomy name. * @param array $args Arguments passed to wp_insert_term(). * @param int $tt_id term_taxonomy_id for the newly created term. */ $duplicate_term = apply_filters( 'wp_insert_term_duplicate_term_check', $duplicate_term, $term, $taxonomy, $args, $tt_id ); if ( $duplicate_term ) { $wpdb->delete( $wpdb->terms, array( 'term_id' => $term_id ) ); $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $tt_id ) ); $term_id = (int) $duplicate_term->term_id; $tt_id = (int) $duplicate_term->term_taxonomy_id; clean_term_cache( $term_id, $taxonomy ); return array( 'term_id' => $term_id, 'term_taxonomy_id' => $tt_id, ); } /** * Fires immediately after a new term is created, before the term cache is cleaned. * * The {@see 'create_$taxonomy'} hook is also available for targeting a specific * taxonomy. * * @since 2.3.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $term_id Term ID. * @param int $tt_id Term taxonomy ID. * @param string $taxonomy Taxonomy slug. * @param array $args Arguments passed to wp_insert_term(). */ do_action( 'create_term', $term_id, $tt_id, $taxonomy, $args ); /** * Fires after a new term is created for a specific taxonomy. * * The dynamic portion of the hook name, `$taxonomy`, refers * to the slug of the taxonomy the term was created for. * * Possible hook names include: * * - `create_category` * - `create_post_tag` * * @since 2.3.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $term_id Term ID. * @param int $tt_id Term taxonomy ID. * @param array $args Arguments passed to wp_insert_term(). */ do_action( "create_{$taxonomy}", $term_id, $tt_id, $args ); /** * Filters the term ID after a new term is created. * * @since 2.3.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $term_id Term ID. * @param int $tt_id Term taxonomy ID. * @param array $args Arguments passed to wp_insert_term(). */ $term_id = apply_filters( 'term_id_filter', $term_id, $tt_id, $args ); clean_term_cache( $term_id, $taxonomy ); /** * Fires after a new term is created, and after the term cache has been cleaned. * * The {@see 'created_$taxonomy'} hook is also available for targeting a specific * taxonomy. * * @since 2.3.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $term_id Term ID. * @param int $tt_id Term taxonomy ID. * @param string $taxonomy Taxonomy slug. * @param array $args Arguments passed to wp_insert_term(). */ do_action( 'created_term', $term_id, $tt_id, $taxonomy, $args ); /** * Fires after a new term in a specific taxonomy is created, and after the term * cache has been cleaned. * * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. * * Possible hook names include: * * - `created_category` * - `created_post_tag` * * @since 2.3.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $term_id Term ID. * @param int $tt_id Term taxonomy ID. * @param array $args Arguments passed to wp_insert_term(). */ do_action( "created_{$taxonomy}", $term_id, $tt_id, $args ); /** * Fires after a term has been saved, and the term cache has been cleared. * * The {@see 'saved_$taxonomy'} hook is also available for targeting a specific * taxonomy. * * @since 5.5.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $term_id Term ID. * @param int $tt_id Term taxonomy ID. * @param string $taxonomy Taxonomy slug. * @param bool $update Whether this is an existing term being updated. * @param array $args Arguments passed to wp_insert_term(). */ do_action( 'saved_term', $term_id, $tt_id, $taxonomy, false, $args ); /** * Fires after a term in a specific taxonomy has been saved, and the term * cache has been cleared. * * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. * * Possible hook names include: * * - `saved_category` * - `saved_post_tag` * * @since 5.5.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $term_id Term ID. * @param int $tt_id Term taxonomy ID. * @param bool $update Whether this is an existing term being updated. * @param array $args Arguments passed to wp_insert_term(). */ do_action( "saved_{$taxonomy}", $term_id, $tt_id, false, $args ); return array( 'term_id' => $term_id, 'term_taxonomy_id' => $tt_id, ); } ``` [do\_action( 'created\_term', int $term\_id, int $tt\_id, string $taxonomy, array $args )](../hooks/created_term) Fires after a new term is created, and after the term cache has been cleaned. [do\_action( "created\_{$taxonomy}", int $term\_id, int $tt\_id, array $args )](../hooks/created_taxonomy) Fires after a new term in a specific taxonomy is created, and after the term cache has been cleaned. [do\_action( 'create\_term', int $term\_id, int $tt\_id, string $taxonomy, array $args )](../hooks/create_term) Fires immediately after a new term is created, before the term cache is cleaned. [do\_action( "create\_{$taxonomy}", int $term\_id, int $tt\_id, array $args )](../hooks/create_taxonomy) Fires after a new term is created for a specific taxonomy. [do\_action( 'edited\_terms', int $term\_id, string $taxonomy, array $args )](../hooks/edited_terms) Fires immediately after a term is updated in the database, but before its term-taxonomy relationship is updated. [do\_action( 'edit\_terms', int $term\_id, string $taxonomy, array $args )](../hooks/edit_terms) Fires immediately before the given terms are edited. [apply\_filters( 'pre\_insert\_term', string|WP\_Error $term, string $taxonomy, array|string $args )](../hooks/pre_insert_term) Filters a term before it is sanitized and inserted into the database. [do\_action( 'saved\_term', int $term\_id, int $tt\_id, string $taxonomy, bool $update, array $args )](../hooks/saved_term) Fires after a term has been saved, and the term cache has been cleared. [do\_action( "saved\_{$taxonomy}", int $term\_id, int $tt\_id, bool $update, array $args )](../hooks/saved_taxonomy) Fires after a term in a specific taxonomy has been saved, and the term cache has been cleared. [apply\_filters( 'term\_id\_filter', int $term\_id, int $tt\_id, array $args )](../hooks/term_id_filter) Filters the term ID after a new term is created. [apply\_filters( 'wp\_insert\_term\_data', array $data, string $taxonomy, array $args )](../hooks/wp_insert_term_data) Filters term data before it is inserted into the database. [apply\_filters( 'wp\_insert\_term\_duplicate\_term\_check', object $duplicate\_term, string $term, string $taxonomy, array $args, int $tt\_id )](../hooks/wp_insert_term_duplicate_term_check) Filters the duplicate term check that takes place during term creation. | Uses | Description | | --- | --- | | [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. | | [sanitize\_term()](sanitize_term) wp-includes/taxonomy.php | Sanitizes all term fields. | | [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. | | [is\_taxonomy\_hierarchical()](is_taxonomy_hierarchical) wp-includes/taxonomy.php | Determines whether the taxonomy object is hierarchical. | | [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. | | [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. | | [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. | | [wpdb::insert()](../classes/wpdb/insert) wp-includes/class-wpdb.php | Inserts a row into the table. | | [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. | | [clean\_term\_cache()](clean_term_cache) wp-includes/taxonomy.php | Removes all of the term IDs from the cache. | | [wp\_list\_pluck()](wp_list_pluck) wp-includes/functions.php | Plucks a certain field out of each object or array in an array. | | [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. | | [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. | | [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. | | [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. | | [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. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Used By | Description | | --- | --- | | [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\_insert\_category()](wp_insert_category) wp-admin/includes/taxonomy.php | Updates an existing Category or creates a new Category. | | [wp\_create\_term()](wp_create_term) wp-admin/includes/taxonomy.php | Adds a new term to the database if it does not already exist. | | [\_wp\_ajax\_add\_hierarchical\_term()](_wp_ajax_add_hierarchical_term) wp-admin/includes/ajax-actions.php | Ajax handler for adding a hierarchical term. | | [wp\_ajax\_add\_link\_category()](wp_ajax_add_link_category) wp-admin/includes/ajax-actions.php | Ajax handler for adding a link category. | | [wp\_ajax\_add\_tag()](wp_ajax_add_tag) wp-admin/includes/ajax-actions.php | Ajax handler to add a tag. | | [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. | | [register\_taxonomy()](register_taxonomy) wp-includes/taxonomy.php | Creates or modifies a taxonomy object. | | [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\_xmlrpc\_server::wp\_newTerm()](../classes/wp_xmlrpc_server/wp_newterm) wp-includes/class-wp-xmlrpc-server.php | Create a new term. | | [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. |
programming_docs
wordpress wpmu_get_blog_allowedthemes( $blog_id ) wpmu\_get\_blog\_allowedthemes( $blog\_id ) =========================================== This function has been deprecated. Use [WP\_Theme::get\_allowed\_on\_site()](../classes/wp_theme/get_allowed_on_site) instead. Deprecated functionality for getting themes allowed on a specific site. * [WP\_Theme::get\_allowed\_on\_site()](../classes/wp_theme/get_allowed_on_site) File: `wp-admin/includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms-deprecated.php/) ``` function wpmu_get_blog_allowedthemes( $blog_id = 0 ) { _deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_site()' ); return array_map( 'intval', WP_Theme::get_allowed_on_site( $blog_id ) ); } ``` | Uses | Description | | --- | --- | | [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. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. | wordpress customize_themes_print_templates() customize\_themes\_print\_templates() ===================================== Prints JS templates for the theme-browsing UI in the Customizer. File: `wp-admin/includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme.php/) ``` function customize_themes_print_templates() { ?> <script type="text/html" id="tmpl-customize-themes-details-view"> <div class="theme-backdrop"></div> <div class="theme-wrap wp-clearfix" role="document"> <div class="theme-header"> <button type="button" class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button> <button type="button" class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button> <button type="button" class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button> </div> <div class="theme-about wp-clearfix"> <div class="theme-screenshots"> <# if ( data.screenshot && data.screenshot[0] ) { #> <div class="screenshot"><img src="{{ data.screenshot[0] }}?ver={{ data.version }}" alt="" /></div> <# } else { #> <div class="screenshot blank"></div> <# } #> </div> <div class="theme-info"> <# if ( data.active ) { #> <span class="current-label"><?php _e( 'Active Theme' ); ?></span> <# } #> <h2 class="theme-name">{{{ data.name }}}<span class="theme-version"> <?php /* translators: %s: Theme version. */ printf( __( 'Version: %s' ), '{{ data.version }}' ); ?> </span></h2> <h3 class="theme-author"> <?php /* translators: %s: Theme author link. */ printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' ); ?> </h3> <# if ( data.stars && 0 != data.num_ratings ) { #> <div class="theme-rating"> {{{ data.stars }}} <a class="num-ratings" target="_blank" href="{{ data.reviews_url }}"> <?php printf( '%1$s <span class="screen-reader-text">%2$s</span>', /* translators: %s: Number of ratings. */ sprintf( __( '(%s ratings)' ), '{{ data.num_ratings }}' ), /* translators: Accessibility text. */ __( '(opens in a new tab)' ) ); ?> </a> </div> <# } #> <# if ( data.hasUpdate ) { #> <# if ( data.updateResponse.compatibleWP && data.updateResponse.compatiblePHP ) { #> <div class="notice notice-warning notice-alt notice-large" data-slug="{{ data.id }}"> <h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3> {{{ data.update }}} </div> <# } else { #> <div class="notice notice-error notice-alt notice-large" data-slug="{{ data.id }}"> <h3 class="notice-title"><?php _e( 'Update Incompatible' ); ?></h3> <p> <# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #> <?php printf( /* translators: %s: Theme name. */ __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ), '{{{ data.name }}}' ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { printf( /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), self_admin_url( 'update-core.php' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '</p><p><em>', '</em>' ); } elseif ( current_user_can( 'update_core' ) ) { printf( /* translators: %s: URL to WordPress Updates screen. */ ' ' . __( '<a href="%s">Please update WordPress</a>.' ), self_admin_url( 'update-core.php' ) ); } elseif ( current_user_can( 'update_php' ) ) { printf( /* translators: %s: URL to Update PHP page. */ ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '</p><p><em>', '</em>' ); } ?> <# } else if ( ! data.updateResponse.compatibleWP ) { #> <?php printf( /* translators: %s: Theme name. */ __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ), '{{{ data.name }}}' ); if ( current_user_can( 'update_core' ) ) { printf( /* translators: %s: URL to WordPress Updates screen. */ ' ' . __( '<a href="%s">Please update WordPress</a>.' ), self_admin_url( 'update-core.php' ) ); } ?> <# } else if ( ! data.updateResponse.compatiblePHP ) { #> <?php printf( /* translators: %s: Theme name. */ __( 'There is a new version of %s available, but it does not work with your version of PHP.' ), '{{{ data.name }}}' ); if ( current_user_can( 'update_php' ) ) { printf( /* translators: %s: URL to Update PHP page. */ ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '</p><p><em>', '</em>' ); } ?> <# } #> </p> </div> <# } #> <# } #> <# if ( data.parent ) { #> <p class="parent-theme"> <?php printf( /* translators: %s: Theme name. */ __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' ); ?> </p> <# } #> <# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #> <div class="notice notice-error notice-alt notice-large"><p> <# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #> <?php _e( 'This theme does not work with your versions of WordPress and PHP.' ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { printf( /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), self_admin_url( 'update-core.php' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '</p><p><em>', '</em>' ); } elseif ( current_user_can( 'update_core' ) ) { printf( /* translators: %s: URL to WordPress Updates screen. */ ' ' . __( '<a href="%s">Please update WordPress</a>.' ), self_admin_url( 'update-core.php' ) ); } elseif ( current_user_can( 'update_php' ) ) { printf( /* translators: %s: URL to Update PHP page. */ ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '</p><p><em>', '</em>' ); } ?> <# } else if ( ! data.compatibleWP ) { #> <?php _e( 'This theme does not work with your version of WordPress.' ); if ( current_user_can( 'update_core' ) ) { printf( /* translators: %s: URL to WordPress Updates screen. */ ' ' . __( '<a href="%s">Please update WordPress</a>.' ), self_admin_url( 'update-core.php' ) ); } ?> <# } else if ( ! data.compatiblePHP ) { #> <?php _e( 'This theme does not work with your version of PHP.' ); if ( current_user_can( 'update_php' ) ) { printf( /* translators: %s: URL to Update PHP page. */ ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '</p><p><em>', '</em>' ); } ?> <# } #> </p></div> <# } else if ( ! data.active && data.blockTheme ) { #> <div class="notice notice-error notice-alt notice-large"><p> <?php _e( 'This theme doesn\'t support Customizer.' ); ?> <# if ( data.actions.activate ) { #> <?php printf( /* translators: %s: URL to the themes page (also it activates the theme). */ ' ' . __( 'However, you can still <a href="%s">activate this theme</a>, and use the Site Editor to customize it.' ), '{{{ data.actions.activate }}}' ); ?> <# } #> </p></div> <# } #> <p class="theme-description">{{{ data.description }}}</p> <# if ( data.tags ) { #> <p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{{ data.tags }}}</p> <# } #> </div> </div> <div class="theme-actions"> <# if ( data.active ) { #> <button type="button" class="button button-primary customize-theme"><?php _e( 'Customize' ); ?></button> <# } else if ( 'installed' === data.type ) { #> <?php if ( current_user_can( 'delete_themes' ) ) { ?> <# if ( data.actions && data.actions['delete'] ) { #> <a href="{{{ data.actions['delete'] }}}" data-slug="{{ data.id }}" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a> <# } #> <?php } ?> <# if ( data.blockTheme ) { #> <?php /* translators: %s: Theme name. */ $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); ?> <# if ( data.compatibleWP && data.compatiblePHP && data.actions.activate ) { #> <a href="{{{ data.actions.activate }}}" class="button button-primary activate" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a> <# } #> <# } else { #> <# if ( data.compatibleWP && data.compatiblePHP ) { #> <button type="button" class="button button-primary preview-theme" data-slug="{{ data.id }}"><?php _e( 'Live Preview' ); ?></button> <# } else { #> <button class="button button-primary disabled"><?php _e( 'Live Preview' ); ?></button> <# } #> <# } #> <# } else { #> <# if ( data.compatibleWP && data.compatiblePHP ) { #> <button type="button" class="button theme-install" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></button> <button type="button" class="button button-primary theme-install preview" data-slug="{{ data.id }}"><?php _e( 'Install &amp; Preview' ); ?></button> <# } else { #> <button type="button" class="button disabled"><?php _ex( 'Cannot Install', 'theme' ); ?></button> <button type="button" class="button button-primary disabled"><?php _e( 'Install &amp; Preview' ); ?></button> <# } #> <# } #> </div> </div> </script> <?php } ``` | Uses | Description | | --- | --- | | [wp\_get\_update\_php\_url()](wp_get_update_php_url) wp-includes/functions.php | Gets the URL to learn more about updating the PHP version the site is running on. | | [wp\_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. | | [\_ex()](_ex) wp-includes/l10n.php | Displays translated string 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. | | [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. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | Version | Description | | --- | --- | | [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. | wordpress is_user_member_of_blog( int $user_id, int $blog_id ): bool is\_user\_member\_of\_blog( int $user\_id, int $blog\_id ): bool ================================================================ Finds out whether a user is a member of a given blog. `$user_id` int Optional The unique ID of the user. Defaults to the current user. `$blog_id` int Optional ID of the blog to check. Defaults to the current site. bool File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) { global $wpdb; $user_id = (int) $user_id; $blog_id = (int) $blog_id; if ( empty( $user_id ) ) { $user_id = get_current_user_id(); } // Technically not needed, but does save calls to get_site() and get_user_meta() // in the event that the function is called when a user isn't logged in. if ( empty( $user_id ) ) { return false; } else { $user = get_userdata( $user_id ); if ( ! $user instanceof WP_User ) { return false; } } if ( ! is_multisite() ) { return true; } if ( empty( $blog_id ) ) { $blog_id = get_current_blog_id(); } $blog = get_site( $blog_id ); if ( ! $blog || ! isset( $blog->domain ) || $blog->archived || $blog->spam || $blog->deleted ) { return false; } $keys = get_user_meta( $user_id ); if ( empty( $keys ) ) { return false; } // No underscore before capabilities in $base_capabilities_key. $base_capabilities_key = $wpdb->base_prefix . 'capabilities'; $site_capabilities_key = $wpdb->base_prefix . $blog_id . '_capabilities'; if ( isset( $keys[ $base_capabilities_key ] ) && 1 == $blog_id ) { return true; } if ( isset( $keys[ $site_capabilities_key ] ) ) { return true; } return false; } ``` | Uses | Description | | --- | --- | | [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. | | [get\_user\_meta()](get_user_meta) wp-includes/user.php | Retrieves user meta field for a user. | | [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. | | [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. | | [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. | | 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\_REST\_Users\_Controller::get\_user()](../classes/wp_rest_users_controller/get_user) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Get the user, if the ID is valid. | | [is\_blog\_user()](is_blog_user) wp-includes/deprecated.php | Checks if the current user belong to a given 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\_admin\_bar\_site\_menu()](wp_admin_bar_site_menu) wp-includes/admin-bar.php | Adds 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\_set\_all\_user\_settings()](wp_set_all_user_settings) wp-includes/option.php | Private. Sets all user interface settings. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress comments_template( string $file = '/comments.php', bool $separate_comments = false ) comments\_template( string $file = '/comments.php', bool $separate\_comments = false ) ====================================================================================== Loads the comment template specified in $file. Will not display the comments template if not on single post or page, or if the post does not have comments. Uses the WordPress database object to query for the comments. The comments are passed through the [‘comments\_array’](../hooks/comments_array) filter hook with the list of comments and the post ID respectively. The `$file` path is passed through a filter hook called [‘comments\_template’](../hooks/comments_template), which includes the TEMPLATEPATH and $file combined. Tries the $filtered path first and if it fails it will require the default comment template from the default theme. If either does not exist, then the WordPress process will be halted. It is advised for that reason, that the default theme is not deleted. Will not try to get the comments if the post has none. `$file` string Optional The file to load. Default `'/comments.php'`. Default: `'/comments.php'` `$separate_comments` bool Optional Whether to separate the comments by comment type. Default: `false` File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function comments_template( $file = '/comments.php', $separate_comments = false ) { global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_identity, $overridden_cpage; if ( ! ( is_single() || is_page() || $withcomments ) || empty( $post ) ) { return; } if ( empty( $file ) ) { $file = '/comments.php'; } $req = get_option( 'require_name_email' ); /* * Comment author information fetched from the comment cookies. */ $commenter = wp_get_current_commenter(); /* * The name of the current comment author escaped for use in attributes. * Escaped by sanitize_comment_cookies(). */ $comment_author = $commenter['comment_author']; /* * The email address of the current comment author escaped for use in attributes. * Escaped by sanitize_comment_cookies(). */ $comment_author_email = $commenter['comment_author_email']; /* * The URL of the current comment author escaped for use in attributes. */ $comment_author_url = esc_url( $commenter['comment_author_url'] ); $comment_args = array( 'orderby' => 'comment_date_gmt', 'order' => 'ASC', 'status' => 'approve', 'post_id' => $post->ID, 'no_found_rows' => false, 'update_comment_meta_cache' => false, // We lazy-load comment meta for performance. ); if ( get_option( 'thread_comments' ) ) { $comment_args['hierarchical'] = 'threaded'; } else { $comment_args['hierarchical'] = 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 ); } } $per_page = 0; if ( get_option( 'page_comments' ) ) { $per_page = (int) get_query_var( 'comments_per_page' ); if ( 0 === $per_page ) { $per_page = (int) get_option( 'comments_per_page' ); } $comment_args['number'] = $per_page; $page = (int) get_query_var( 'cpage' ); if ( $page ) { $comment_args['offset'] = ( $page - 1 ) * $per_page; } elseif ( 'oldest' === get_option( 'default_comments_page' ) ) { $comment_args['offset'] = 0; } else { // If fetching the first page of 'newest', we need a top-level comment count. $top_level_query = new WP_Comment_Query(); $top_level_args = array( 'count' => true, 'orderby' => false, 'post_id' => $post->ID, 'status' => 'approve', ); if ( $comment_args['hierarchical'] ) { $top_level_args['parent'] = 0; } if ( isset( $comment_args['include_unapproved'] ) ) { $top_level_args['include_unapproved'] = $comment_args['include_unapproved']; } /** * Filters the arguments used in the top level comments query. * * @since 5.6.0 * * @see WP_Comment_Query::__construct() * * @param array $top_level_args { * The top level query arguments for the comments template. * * @type bool $count Whether to return a comment count. * @type string|array $orderby The field(s) to order by. * @type int $post_id The post ID. * @type string|array $status The comment status to limit results by. * } */ $top_level_args = apply_filters( 'comments_template_top_level_query_args', $top_level_args ); $top_level_count = $top_level_query->query( $top_level_args ); $comment_args['offset'] = ( ceil( $top_level_count / $per_page ) - 1 ) * $per_page; } } /** * Filters the arguments used to query comments in comments_template(). * * @since 4.5.0 * * @see WP_Comment_Query::__construct() * * @param array $comment_args { * Array of WP_Comment_Query arguments. * * @type string|array $orderby Field(s) to order by. * @type string $order Order of results. Accepts 'ASC' or 'DESC'. * @type string $status Comment status. * @type array $include_unapproved Array of IDs or email addresses whose unapproved comments * will be included in results. * @type int $post_id ID of the post. * @type bool $no_found_rows Whether to refrain from querying for found rows. * @type bool $update_comment_meta_cache Whether to prime cache for comment meta. * @type bool|string $hierarchical Whether to query for comments hierarchically. * @type int $offset Comment offset. * @type int $number Number of comments to fetch. * } */ $comment_args = apply_filters( 'comments_template_query_args', $comment_args ); $comment_query = new WP_Comment_Query( $comment_args ); $_comments = $comment_query->comments; // Trees must be flattened before they're passed to the walker. if ( $comment_args['hierarchical'] ) { $comments_flat = array(); foreach ( $_comments as $_comment ) { $comments_flat[] = $_comment; $comment_children = $_comment->get_children( array( 'format' => 'flat', 'status' => $comment_args['status'], 'orderby' => $comment_args['orderby'], ) ); foreach ( $comment_children as $comment_child ) { $comments_flat[] = $comment_child; } } } else { $comments_flat = $_comments; } /** * Filters the comments array. * * @since 2.1.0 * * @param array $comments Array of comments supplied to the comments template. * @param int $post_id Post ID. */ $wp_query->comments = apply_filters( 'comments_array', $comments_flat, $post->ID ); $comments = &$wp_query->comments; $wp_query->comment_count = count( $wp_query->comments ); $wp_query->max_num_comment_pages = $comment_query->max_num_pages; if ( $separate_comments ) { $wp_query->comments_by_type = separate_comments( $comments ); $comments_by_type = &$wp_query->comments_by_type; } else { $wp_query->comments_by_type = array(); } $overridden_cpage = false; if ( '' == get_query_var( 'cpage' ) && $wp_query->max_num_comment_pages > 1 ) { set_query_var( 'cpage', 'newest' === get_option( 'default_comments_page' ) ? get_comment_pages_count() : 1 ); $overridden_cpage = true; } if ( ! defined( 'COMMENTS_TEMPLATE' ) ) { define( 'COMMENTS_TEMPLATE', true ); } $theme_template = STYLESHEETPATH . $file; /** * Filters the path to the theme template file used for the comments template. * * @since 1.5.1 * * @param string $theme_template The path to the theme template file. */ $include = apply_filters( 'comments_template', $theme_template ); if ( file_exists( $include ) ) { require $include; } elseif ( file_exists( TEMPLATEPATH . $file ) ) { require TEMPLATEPATH . $file; } else { // Backward compat code will be removed in a future release. require ABSPATH . WPINC . '/theme-compat/comments.php'; } } ``` [apply\_filters( 'comments\_array', array $comments, int $post\_id )](../hooks/comments_array) Filters the comments array. [apply\_filters( 'comments\_template', string $theme\_template )](../hooks/comments_template) Filters the path to the theme template file used for the comments template. [apply\_filters( 'comments\_template\_query\_args', array $comment\_args )](../hooks/comments_template_query_args) Filters the arguments used to query comments in [comments\_template()](comments_template) . [apply\_filters( 'comments\_template\_top\_level\_query\_args', array $top\_level\_args )](../hooks/comments_template_top_level_query_args) Filters the arguments used in the top level comments query. | 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. | | [is\_single()](is_single) wp-includes/query.php | Determines whether the query is for an existing single post. | | [is\_page()](is_page) wp-includes/query.php | Determines whether the query is for an existing single 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. | | [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. | | [wp\_get\_current\_commenter()](wp_get_current_commenter) wp-includes/comment.php | Gets current commenter’s name, email, and URL. | | [separate\_comments()](separate_comments) wp-includes/comment.php | Separates an array of comments into an array keyed by comment\_type. | | [get\_comment\_pages\_count()](get_comment_pages_count) wp-includes/comment.php | Calculates the total number of comment pages. | | [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. | | [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 | | --- | --- | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
programming_docs
wordpress do_action( string $hook_name, mixed $arg ) do\_action( string $hook\_name, mixed $arg ) ============================================ Calls the callback functions that have been added to an action hook. This function invokes all functions attached to action hook `$hook_name`. It is possible to create new action hooks by simply calling this function, specifying the name of the new hook using the `$hook_name` parameter. You can pass extra arguments to the hooks, much like you can with `apply_filters()`. Example usage: ``` // The action callback function. function example_callback( $arg1, $arg2 ) { // (maybe) do something with the args. } add_action( 'example_action', 'example_callback', 10, 2 ); /* * Trigger the actions by calling the 'example_callback()' function * that's hooked onto `example_action` above. * * - 'example_action' is the action hook. * - $arg1 and $arg2 are the additional arguments passed to the callback. do_action( 'example_action', $arg1, $arg2 ); ``` `$hook_name` string Required The name of the action to be executed. `$arg` mixed Optional Additional arguments which are passed on to the functions hooked to the action. Default empty. File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/) ``` function do_action( $hook_name, ...$arg ) { global $wp_filter, $wp_actions, $wp_current_filter; if ( ! isset( $wp_actions[ $hook_name ] ) ) { $wp_actions[ $hook_name ] = 1; } else { ++$wp_actions[ $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; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } if ( empty( $arg ) ) { $arg[] = ''; } elseif ( is_array( $arg[0] ) && 1 === count( $arg[0] ) && isset( $arg[0][0] ) && is_object( $arg[0][0] ) ) { // Backward compatibility for PHP4-style passing of `array( &$this )` as action `$arg`. $arg[0] = $arg[0][0]; } $wp_filter[ $hook_name ]->do_action( $arg ); array_pop( $wp_current_filter ); } ``` | 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\_REST\_Menu\_Items\_Controller::create\_item()](../classes/wp_rest_menu_items_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Creates a single post. | | [WP\_REST\_Menu\_Items\_Controller::update\_item()](../classes/wp_rest_menu_items_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Updates a single nav menu item. | | [WP\_REST\_Menu\_Items\_Controller::delete\_item()](../classes/wp_rest_menu_items_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Deletes a single menu item. | | [WP\_REST\_Menus\_Controller::create\_item()](../classes/wp_rest_menus_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Creates a single term in a taxonomy. | | [WP\_REST\_Menus\_Controller::update\_item()](../classes/wp_rest_menus_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Updates a single term from a taxonomy. | | [WP\_REST\_Menus\_Controller::delete\_item()](../classes/wp_rest_menus_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Deletes a single term from a taxonomy. | | [WP\_REST\_Menus\_Controller::handle\_auto\_add()](../classes/wp_rest_menus_controller/handle_auto_add) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Updates the menu’s auto add from a REST request. | | [WP\_REST\_Widgets\_Controller::delete\_item()](../classes/wp_rest_widgets_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Deletes a widget. | | [WP\_REST\_Widgets\_Controller::save\_widget()](../classes/wp_rest_widgets_controller/save_widget) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Saves the widget in the request object. | | [WP\_REST\_Sidebars\_Controller::update\_item()](../classes/wp_rest_sidebars_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Updates a sidebar. | | [WP\_REST\_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\_render\_widget()](wp_render_widget) wp-includes/widgets.php | Calls the render callback of a widget and returns the output. | | [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\_Application\_Passwords::delete\_application\_password()](../classes/wp_application_passwords/delete_application_password) wp-includes/class-wp-application-passwords.php | Deletes an application password. | | [WP\_Application\_Passwords::delete\_all\_application\_passwords()](../classes/wp_application_passwords/delete_all_application_passwords) wp-includes/class-wp-application-passwords.php | Deletes all application passwords for the given user. | | [WP\_Application\_Passwords::create\_new\_application\_password()](../classes/wp_application_passwords/create_new_application_password) wp-includes/class-wp-application-passwords.php | Creates a new application password. | | [WP\_Application\_Passwords::update\_application\_password()](../classes/wp_application_passwords/update_application_password) wp-includes/class-wp-application-passwords.php | Updates an application password. | | [wp\_authenticate\_application\_password()](wp_authenticate_application_password) wp-includes/user.php | Authenticates the user using an application password. | | [wp\_after\_insert\_post()](wp_after_insert_post) wp-includes/post.php | Fires actions after a post, its terms and meta data has been saved. | | [WP\_Application\_Passwords\_List\_Table::column\_default()](../classes/wp_application_passwords_list_table/column_default) wp-admin/includes/class-wp-application-passwords-list-table.php | Generates content for a single row of the table | | [WP\_Application\_Passwords\_List\_Table::print\_js\_template\_row()](../classes/wp_application_passwords_list_table/print_js_template_row) wp-admin/includes/class-wp-application-passwords-list-table.php | Prints the JavaScript template for the new row item. | | [wp\_is\_authorize\_application\_password\_request\_valid()](wp_is_authorize_application_password_request_valid) wp-admin/includes/user.php | Checks if the Authorize Application Password request is valid. | | [core\_auto\_updates\_settings()](core_auto_updates_settings) wp-admin/update-core.php | Display WordPress auto-updates settings. | | [wp\_check\_comment\_disallowed\_list()](wp_check_comment_disallowed_list) wp-includes/comment.php | Checks if a comment contains disallowed characters or words. | | [wp\_sitemaps\_get\_server()](wp_sitemaps_get_server) wp-includes/sitemaps.php | Retrieves the current Sitemaps server instance. | | [do\_favicon()](do_favicon) wp-includes/functions.php | Displays the favicon.ico file 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\_MS\_Sites\_List\_Table::extra\_tablenav()](../classes/wp_ms_sites_list_table/extra_tablenav) wp-admin/includes/class-wp-ms-sites-list-table.php | Extra controls to be displayed between bulk actions and pagination. | | [WP\_Recovery\_Mode\_Key\_Service::generate\_and\_store\_recovery\_mode\_key()](../classes/wp_recovery_mode_key_service/generate_and_store_recovery_mode_key) wp-includes/class-wp-recovery-mode-key-service.php | Creates a recovery mode key. | | [wp\_body\_open()](wp_body_open) wp-includes/general-template.php | Fires the wp\_body\_open action. | | [wp\_maybe\_transition\_site\_statuses\_on\_update()](wp_maybe_transition_site_statuses_on_update) wp-includes/ms-site.php | Triggers actions on site status updates. | | [wp\_prepare\_site\_data()](wp_prepare_site_data) wp-includes/ms-site.php | Prepares site data for insertion or update in the database. | | [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\_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\_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. | | [the\_block\_editor\_meta\_box\_post\_form\_hidden\_fields()](the_block_editor_meta_box_post_form_hidden_fields) wp-admin/includes/post.php | Renders the hidden form required for the meta boxes form. | | [register\_and\_do\_post\_meta\_boxes()](register_and_do_post_meta_boxes) wp-admin/includes/meta-boxes.php | Registers the default post meta boxes, and runs the `do_meta_boxes` actions. | | [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\_Requests\_Table::column\_default()](../classes/wp_privacy_requests_table/column_default) wp-admin/includes/class-wp-privacy-requests-table.php | Default column handler. | | [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\_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. | | [clean\_taxonomy\_cache()](clean_taxonomy_cache) wp-includes/taxonomy.php | Cleans the caches for a taxonomy. | | [wp\_enqueue\_code\_editor()](wp_enqueue_code_editor) wp-includes/general-template.php | Enqueues assets needed by the code editor for the given settings. | | [WP\_Roles::init\_roles()](../classes/wp_roles/init_roles) wp-includes/class-wp-roles.php | Initializes all of the available roles. | | [\_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\_Manager::\_publish\_changeset\_values()](../classes/wp_customize_manager/_publish_changeset_values) wp-includes/class-wp-customize-manager.php | Publishes the values of a changeset. | | [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. | | [\_wp\_customize\_publish\_changeset()](_wp_customize_publish_changeset) wp-includes/theme.php | Publishes a snapshot’s changes. | | [WP\_REST\_Users\_Controller::delete\_item()](../classes/wp_rest_users_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Deletes a single user. | | [WP\_REST\_Users\_Controller::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\_Revisions\_Controller::delete\_item()](../classes/wp_rest_revisions_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Deletes a single revision. | | [WP\_REST\_Attachments\_Controller::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\_Terms\_Controller::delete\_item()](../classes/wp_rest_terms_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Deletes a single term from a taxonomy. | | [WP\_REST\_Terms\_Controller::create\_item()](../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\_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\_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\_Locale\_Switcher::change\_locale()](../classes/wp_locale_switcher/change_locale) wp-includes/class-wp-locale-switcher.php | Changes the site’s locale to the given one. | | [WP\_Locale\_Switcher::switch\_to\_locale()](../classes/wp_locale_switcher/switch_to_locale) wp-includes/class-wp-locale-switcher.php | Switches the translations according to the given locale. | | [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. | | [wp\_check\_comment\_flood()](wp_check_comment_flood) wp-includes/comment.php | Checks whether comment flooding is occurring. | | [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. | | [clean\_network\_cache()](clean_network_cache) wp-includes/ms-network.php | Removes a network from the object cache. | | [\_deprecated\_hook()](_deprecated_hook) wp-includes/functions.php | Marks a deprecated action or filter hook as deprecated and throws a notice. | | [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. | | [rest\_get\_server()](rest_get_server) wp-includes/rest-api.php | Retrieves the current REST server instance. | | [WP\_Metadata\_Lazyloader::queue\_objects()](../classes/wp_metadata_lazyloader/queue_objects) wp-includes/class-wp-metadata-lazyloader.php | Adds objects to the metadata lazy-load queue. | | [unregister\_taxonomy()](unregister_taxonomy) wp-includes/taxonomy.php | Unregisters a taxonomy. | | [unregister\_post\_type()](unregister_post_type) wp-includes/post.php | Unregisters a post type. | | [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. | | [enqueue\_embed\_scripts()](enqueue_embed_scripts) wp-includes/embed.php | Enqueues embed iframe default CSS and JS. | | [get\_password\_reset\_key()](get_password_reset_key) wp-includes/user.php | Creates, stores, then returns a password reset key for user. | | [wp\_handle\_comment\_submission()](wp_handle_comment_submission) wp-includes/comment.php | Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. | | [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. | | [wp\_ajax\_delete\_inactive\_widgets()](wp_ajax_delete_inactive_widgets) wp-admin/includes/ajax-actions.php | Ajax handler for removing inactive widgets. | | [WP\_Customize\_Nav\_Menu\_Item\_Control::content\_template()](../classes/wp_customize_nav_menu_item_control/content_template) wp-includes/customize/class-wp-customize-nav-menu-item-control.php | JS/Underscore template for the control UI. | | [\_deprecated\_constructor()](_deprecated_constructor) wp-includes/functions.php | Marks a constructor as deprecated and informs when it has been used. | | [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\_Links\_List\_Table::column\_default()](../classes/wp_links_list_table/column_default) wp-admin/includes/class-wp-links-list-table.php | Handles the default column output. | | [WP\_MS\_Themes\_List\_Table::column\_default()](../classes/wp_ms_themes_list_table/column_default) wp-admin/includes/class-wp-ms-themes-list-table.php | Handles default column output. | | [wp\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. | | [WP\_MS\_Sites\_List\_Table::column\_default()](../classes/wp_ms_sites_list_table/column_default) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles output for the default column. | | [WP\_MS\_Sites\_List\_Table::column\_plugins()](../classes/wp_ms_sites_list_table/column_plugins) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the plugins column output. | | [WP\_Media\_List\_Table::column\_default()](../classes/wp_media_list_table/column_default) wp-admin/includes/class-wp-media-list-table.php | Handles output for the default column. | | [WP\_Customize\_Manager::set\_post\_value()](../classes/wp_customize_manager/set_post_value) wp-includes/class-wp-customize-manager.php | Overrides a setting’s value in the current customized state. | | [wp\_media\_attach\_action()](wp_media_attach_action) wp-admin/includes/media.php | Encapsulates the logic for Attach/Detach actions. | | [WP\_Customize\_Panel::maybe\_render()](../classes/wp_customize_panel/maybe_render) wp-includes/class-wp-customize-panel.php | Check capabilities and render the panel. | | [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. | | [show\_user\_form()](show_user_form) wp-signup.php | Displays the fields for the new user account registration form. | | [signup\_another\_blog()](signup_another_blog) wp-signup.php | Shows a form for returning users to sign up for another site. | | [confirm\_another\_blog\_signup()](confirm_another_blog_signup) wp-signup.php | Shows a message confirming that the new site has been created. | | [signup\_user()](signup_user) wp-signup.php | Shows a form for a visitor to sign up for a new user account. | | [confirm\_user\_signup()](confirm_user_signup) wp-signup.php | Shows a message confirming that the new user has been registered and is awaiting activation. | | [signup\_blog()](signup_blog) wp-signup.php | Shows a form for a user or visitor to sign up for a new site. | | [confirm\_blog\_signup()](confirm_blog_signup) wp-signup.php | Shows a message confirming that the new site has been registered and is awaiting activation. | | [do\_signup\_header()](do_signup_header) wp-signup.php | Prints signup\_header via wp\_head. | | [show\_blog\_form()](show_blog_form) wp-signup.php | Generates and displays the Sign-up and Create Site forms. | | [display\_setup\_form()](display_setup_form) wp-admin/install.php | Displays installer setup form. | | [WP\_Automatic\_Updater::update()](../classes/wp_automatic_updater/update) wp-admin/includes/class-wp-automatic-updater.php | Updates an item, if appropriate. | | [WP\_Automatic\_Updater::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. | | [Core\_Upgrader::upgrade()](../classes/core_upgrader/upgrade) wp-admin/includes/class-core-upgrader.php | Upgrade WordPress core. | | [Language\_Pack\_Upgrader::bulk\_upgrade()](../classes/language_pack_upgrader/bulk_upgrade) wp-admin/includes/class-language-pack-upgrader.php | Bulk upgrade language packs. | | [Plugin\_Upgrader::bulk\_upgrade()](../classes/plugin_upgrader/bulk_upgrade) wp-admin/includes/class-plugin-upgrader.php | Bulk upgrade several plugins at once. | | [Theme\_Upgrader::install()](../classes/theme_upgrader/install) wp-admin/includes/class-theme-upgrader.php | Install a theme package. | | [Theme\_Upgrader::bulk\_upgrade()](../classes/theme_upgrader/bulk_upgrade) wp-admin/includes/class-theme-upgrader.php | Upgrade several themes at once. | | [WP\_Upgrader::run()](../classes/wp_upgrader/run) wp-admin/includes/class-wp-upgrader.php | Run an upgrade/installation. | | [Plugin\_Upgrader::install()](../classes/plugin_upgrader/install) wp-admin/includes/class-plugin-upgrader.php | Install a plugin package. | | [delete\_theme()](delete_theme) wp-admin/includes/theme.php | Removes a theme. | | [WP\_Screen::set\_current\_screen()](../classes/wp_screen/set_current_screen) wp-admin/includes/class-wp-screen.php | Makes the screen object the current screen. | | [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) 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. | | [grant\_super\_admin()](grant_super_admin) wp-includes/capabilities.php | Grants Super Admin privileges. | | [revoke\_super\_admin()](revoke_super_admin) wp-includes/capabilities.php | Revokes Super Admin privileges. | | [wpmu\_delete\_user()](wpmu_delete_user) wp-admin/includes/ms.php | Delete a user from the network and remove from all sites. | | [update\_user\_status()](update_user_status) wp-includes/ms-deprecated.php | Update the status of a user in the database. | | [WP\_MS\_Themes\_List\_Table::single\_row()](../classes/wp_ms_themes_list_table/single_row) wp-admin/includes/class-wp-ms-themes-list-table.php | | | [populate\_options()](populate_options) wp-admin/includes/schema.php | Create WordPress options and set the default values. | | [WP\_Theme\_Install\_List\_Table::display()](../classes/wp_theme_install_list_table/display) wp-admin/includes/class-wp-theme-install-list-table.php | Displays the theme install table. | | [wp\_plugin\_update\_row()](wp_plugin_update_row) wp-admin/includes/update.php | Displays update information for a plugin. | | [wp\_theme\_update\_row()](wp_theme_update_row) wp-admin/includes/update.php | Displays update information for a theme. | | [wp\_dashboard\_right\_now()](wp_dashboard_right_now) wp-admin/includes/dashboard.php | Dashboard widget that displays some basic stats about the site. | | [wp\_network\_dashboard\_right\_now()](wp_network_dashboard_right_now) wp-admin/includes/dashboard.php | | | [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. | | [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. | | [register\_setting()](register_setting) wp-includes/option.php | Registers a setting and its data. | | [unregister\_setting()](unregister_setting) wp-includes/option.php | Unregisters a setting. | | [uninstall\_plugin()](uninstall_plugin) wp-admin/includes/plugin.php | Uninstalls a single plugin. | | [activate\_plugin()](activate_plugin) wp-admin/includes/plugin.php | Attempts activation of plugin in a “sandbox” and redirects on success. | | [deactivate\_plugins()](deactivate_plugins) wp-admin/includes/plugin.php | Deactivates a single plugin or multiple plugins. | | [delete\_plugins()](delete_plugins) wp-admin/includes/plugin.php | Removes directory and files of a plugin for a list of plugins. | | [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST | | [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::display\_tablenav()](../classes/wp_plugin_install_list_table/display_tablenav) wp-admin/includes/class-wp-plugin-install-list-table.php | | | [\_wp\_admin\_html\_begin()](_wp_admin_html_begin) wp-admin/includes/template.php | Prints out the beginning of the admin HTML header. | | [iframe\_header()](iframe_header) wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. | | [iframe\_footer()](iframe_footer) wp-admin/includes/template.php | Generic Iframe footer 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\_Users\_List\_Table::extra\_tablenav()](../classes/wp_users_list_table/extra_tablenav) wp-admin/includes/class-wp-users-list-table.php | Output the controls to allow user roles to be changed in bulk. | | [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor | | [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. | | [wp\_iframe()](wp_iframe) wp-admin/includes/media.php | Outputs the iframe to display the media upload page. | | [\_admin\_notice\_post\_locked()](_admin_notice_post_locked) wp-admin/includes/post.php | Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post. | | [wp\_create\_post\_autosave()](wp_create_post_autosave) wp-admin/includes/post.php | Creates autosave data for the specified post from `$_POST` data. | | [wp\_ajax\_heartbeat()](wp_ajax_heartbeat) wp-admin/includes/ajax-actions.php | Ajax handler for the Heartbeat API. | | [wp\_ajax\_save\_widget()](wp_ajax_save_widget) wp-admin/includes/ajax-actions.php | Ajax handler for saving a widget. | | [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. | | [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. | | [post\_comment\_status\_meta\_box()](post_comment_status_meta_box) wp-admin/includes/meta-boxes.php | Displays comments status form fields. | | [page\_attributes\_meta\_box()](page_attributes_meta_box) wp-admin/includes/meta-boxes.php | Displays page attributes form fields. | | [link\_submit\_meta\_box()](link_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays link create form fields. | | [wp\_insert\_link()](wp_insert_link) wp-admin/includes/bookmark.php | Inserts a link into the database, or updates an existing link. | | [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. | | [attachment\_submit\_meta\_box()](attachment_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays attachment submit form fields. | | [wp\_delete\_link()](wp_delete_link) wp-admin/includes/bookmark.php | Deletes a specified link from the database. | | [WP\_Media\_List\_Table::extra\_tablenav()](../classes/wp_media_list_table/extra_tablenav) wp-admin/includes/class-wp-media-list-table.php | | | [WP\_Comments\_List\_Table::column\_default()](../classes/wp_comments_list_table/column_default) wp-admin/includes/class-wp-comments-list-table.php | | | [WP\_Comments\_List\_Table::extra\_tablenav()](../classes/wp_comments_list_table/extra_tablenav) wp-admin/includes/class-wp-comments-list-table.php | | | [WP\_Terms\_List\_Table::inline\_edit()](../classes/wp_terms_list_table/inline_edit) wp-admin/includes/class-wp-terms-list-table.php | Outputs the hidden row displayed when inline editing | | [Walker\_Nav\_Menu\_Edit::start\_el()](../classes/walker_nav_menu_edit/start_el) wp-admin/includes/class-walker-nav-menu-edit.php | Start the element output. | | [wp\_nav\_menu\_update\_menu\_items()](wp_nav_menu_update_menu_items) wp-admin/includes/nav-menu.php | Saves nav menu items | | [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::extra\_tablenav()](../classes/wp_posts_list_table/extra_tablenav) wp-admin/includes/class-wp-posts-list-table.php | | | [Custom\_Image\_Header::step\_1()](../classes/custom_image_header/step_1) wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. | | [Custom\_Image\_Header::step\_2()](../classes/custom_image_header/step_2) wp-admin/includes/class-custom-image-header.php | Display second step of custom header image page. | | [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.php | | | [Custom\_Background::handle\_upload()](../classes/custom_background/handle_upload) wp-admin/includes/class-custom-background.php | Handles an Image upload for the background image. | | [do\_activate\_header()](do_activate_header) wp-activate.php | Adds an action hook specific to this page. | | [WP\_User::add\_role()](../classes/wp_user/add_role) wp-includes/class-wp-user.php | Adds role to user. | | [WP\_User::remove\_role()](../classes/wp_user/remove_role) wp-includes/class-wp-user.php | Removes role from user. | | [WP\_User::set\_role()](../classes/wp_user/set_role) wp-includes/class-wp-user.php | Sets the role of the user. | | [WP\_Customize\_Manager::customize\_preview\_init()](../classes/wp_customize_manager/customize_preview_init) wp-includes/class-wp-customize-manager.php | Prints JavaScript settings. | | [WP\_Customize\_Manager::start\_previewing\_theme()](../classes/wp_customize_manager/start_previewing_theme) wp-includes/class-wp-customize-manager.php | If the theme to be previewed isn’t the active theme, add filter callbacks to swap it out at runtime. | | [WP\_Customize\_Manager::stop\_previewing\_theme()](../classes/wp_customize_manager/stop_previewing_theme) wp-includes/class-wp-customize-manager.php | Stops previewing the selected theme. | | [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 | | [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. | | [switch\_theme()](switch_theme) wp-includes/theme.php | Switches the theme. | | [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. | | [wp\_verify\_nonce()](wp_verify_nonce) wp-includes/pluggable.php | Verifies that a correct security nonce was used with time limit. | | [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. | | [check\_admin\_referer()](check_admin_referer) wp-includes/pluggable.php | Ensures intent by verifying that a user was referred from another admin page with the correct security nonce. | | [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. | | [wp\_authenticate()](wp_authenticate) wp-includes/pluggable.php | Authenticates a user, confirming the login credentials are valid. | | [wp\_logout()](wp_logout) wp-includes/pluggable.php | Logs the current user out. | | [wp\_validate\_auth\_cookie()](wp_validate_auth_cookie) wp-includes/pluggable.php | Validates authentication cookie. | | [wp\_set\_current\_user()](wp_set_current_user) wp-includes/pluggable.php | Changes the current user by ID or name. | | [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. | | [wp\_head()](wp_head) wp-includes/general-template.php | Fires the wp\_head action. | | [wp\_footer()](wp_footer) wp-includes/general-template.php | Fires the wp\_footer action. | | [wp\_meta()](wp_meta) wp-includes/general-template.php | Theme container function for the ‘wp\_meta’ action. | | [get\_header()](get_header) wp-includes/general-template.php | Loads header template. | | [get\_footer()](get_footer) wp-includes/general-template.php | Loads footer template. | | [get\_sidebar()](get_sidebar) wp-includes/general-template.php | Loads sidebar template. | | [get\_template\_part()](get_template_part) wp-includes/general-template.php | Loads a template part into a template. | | [get\_search\_form()](get_search_form) wp-includes/general-template.php | Displays search form. | | [delete\_usermeta()](delete_usermeta) wp-includes/deprecated.php | Remove user meta data. | | [update\_usermeta()](update_usermeta) wp-includes/deprecated.php | Update metadata of user. | | [WP\_Query::have\_posts()](../classes/wp_query/have_posts) wp-includes/class-wp-query.php | Determines whether there are more posts available in the loop. | | [WP\_Query::the\_comment()](../classes/wp_query/the_comment) wp-includes/class-wp-query.php | Sets up the current comment. | | [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. | | [WP\_Query::parse\_tax\_query()](../classes/wp_query/parse_tax_query) wp-includes/class-wp-query.php | Parses various taxonomy related query vars. | | [shutdown\_action\_hook()](shutdown_action_hook) wp-includes/load.php | Runs just before PHP shuts down execution. | | [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\_print\_scripts()](wp_print_scripts) wp-includes/functions.wp-scripts.php | Prints scripts in document head that are in the $handles queue. | | [\_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. | | [do\_robots()](do_robots) wp-includes/functions.php | Displays the default robots.txt file content. | | [do\_feed()](do_feed) wp-includes/functions.php | Loads the feed template from the use of an action hook. | | [wp\_widgets\_init()](wp_widgets_init) wp-includes/widgets.php | Registers all of the default WordPress widgets on startup. | | [WP\_Customize\_Section::maybe\_render()](../classes/wp_customize_section/maybe_render) wp-includes/class-wp-customize-section.php | Check capabilities and render the section. | | [\_update\_post\_term\_count()](_update_post_term_count) wp-includes/taxonomy.php | Updates term count based on object types of the current taxonomy. | | [\_update\_generic\_term\_count()](_update_generic_term_count) wp-includes/taxonomy.php | Updates term count based on number of objects. | | [clean\_object\_term\_cache()](clean_object_term_cache) wp-includes/taxonomy.php | Removes the taxonomy relationship to terms from the cache. | | [wp\_update\_term()](wp_update_term) wp-includes/taxonomy.php | Updates term based on arguments provided. | | [clean\_term\_cache()](clean_term_cache) wp-includes/taxonomy.php | Removes all of the term IDs from the cache. | | [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. | | [wp\_remove\_object\_terms()](wp_remove_object_terms) wp-includes/taxonomy.php | Removes term(s) associated with a given object. | | [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. | | [register\_taxonomy()](register_taxonomy) wp-includes/taxonomy.php | Creates or modifies a taxonomy object. | | [register\_taxonomy\_for\_object\_type()](register_taxonomy_for_object_type) wp-includes/taxonomy.php | Adds an already registered taxonomy to an object type. | | [unregister\_taxonomy\_for\_object\_type()](unregister_taxonomy_for_object_type) wp-includes/taxonomy.php | Removes an already registered taxonomy from an object type. | | [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. | | [wp\_version\_check()](wp_version_check) wp-includes/update.php | Checks WordPress version against the newest version. | | [wp\_print\_styles()](wp_print_styles) wp-includes/functions.wp-styles.php | Display styles that are in the $handles queue. | | [wp\_admin\_bar\_render()](wp_admin_bar_render) wp-includes/admin-bar.php | Renders the admin bar to the page based on the $wp\_admin\_bar->menu member var. | | [WP\_Customize\_Setting::preview()](../classes/wp_customize_setting/preview) wp-includes/class-wp-customize-setting.php | Add filters to supply the setting’s value when accessed. | | [WP\_Customize\_Setting::save()](../classes/wp_customize_setting/save) wp-includes/class-wp-customize-setting.php | Checks user capabilities and theme supports, and then saves the value of the setting. | | [WP\_Customize\_Setting::update()](../classes/wp_customize_setting/update) wp-includes/class-wp-customize-setting.php | Save the value of the setting, using the related API. | | [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. | | [delete\_site\_transient()](delete_site_transient) wp-includes/option.php | Deletes a site transient. | | [set\_transient()](set_transient) wp-includes/option.php | Sets/updates the value of a transient. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [add\_option()](add_option) wp-includes/option.php | Adds a new option. | | [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. | | [delete\_transient()](delete_transient) wp-includes/option.php | Deletes a transient. | | [reset\_password()](reset_password) wp-includes/user.php | Handles resetting the user’s password. | | [register\_new\_user()](register_new_user) wp-includes/user.php | Handles registering a new user. | | [clean\_user\_cache()](clean_user_cache) wp-includes/user.php | Cleans all user caches. | | [wp\_insert\_user()](wp_insert_user) wp-includes/user.php | Inserts a user into the database. | | [wp\_signon()](wp_signon) wp-includes/user.php | Authenticates and logs a user in with ‘remember’ capability. | | [load\_template()](load_template) wp-includes/template.php | Requires the template file with WordPress environment. | | [get\_the\_post\_thumbnail()](get_the_post_thumbnail) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail. | | [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\_playlist\_shortcode()](wp_playlist_shortcode) wp-includes/media.php | Builds the Playlist shortcode output. | | [clean\_post\_cache()](clean_post_cache) wp-includes/post.php | Will clean the post in the cache. | | [clean\_attachment\_cache()](clean_attachment_cache) wp-includes/post.php | Will clean the attachment in the cache. | | [\_publish\_post\_hook()](_publish_post_hook) wp-includes/post.php | Hook to schedule pings and enclosures when a post is published. | | [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. | | [wp\_publish\_post()](wp_publish_post) wp-includes/post.php | Publishes a post by transitioning the post status. | | [wp\_transition\_post\_status()](wp_transition_post_status) wp-includes/post.php | Fires actions related to the transitioning of a post’s status. | | [wp\_untrash\_post\_comments()](wp_untrash_post_comments) wp-includes/post.php | Restores comments for a post from the Trash. | | [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. | | [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. | | [wp\_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\_trash\_post\_comments()](wp_trash_post_comments) wp-includes/post.php | Moves comments for a post to the Trash. | | [stick\_post()](stick_post) wp-includes/post.php | Makes a post sticky. | | [unstick\_post()](unstick_post) wp-includes/post.php | Un-sticks a post. | | [register\_post\_type()](register_post_type) wp-includes/post.php | Registers a post type. | | [WP\_Rewrite::set\_permalink\_structure()](../classes/wp_rewrite/set_permalink_structure) wp-includes/class-wp-rewrite.php | Sets the main permalink structure for the site. | | [\_wp\_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\_delete\_post\_revision()](wp_delete_post_revision) wp-includes/revision.php | Deletes a revision. | | [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) . | | [wpmu\_activate\_signup()](wpmu_activate_signup) wp-includes/ms-functions.php | Activates a signup. | | [wpmu\_create\_user()](wpmu_create_user) wp-includes/ms-functions.php | Creates a user. | | [wpmu\_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. | | [add\_user\_to\_blog()](add_user_to_blog) wp-includes/ms-functions.php | Adds a user to a blog, along with specifying the user’s role. | | [remove\_user\_from\_blog()](remove_user_from_blog) wp-includes/ms-functions.php | Removes a user from a blog. | | [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) . | | [clean\_blog\_cache()](clean_blog_cache) wp-includes/ms-site.php | Clean the blog cache | | [wpmu\_update\_blogs\_date()](wpmu_update_blogs_date) wp-includes/ms-blogs.php | Update the last\_updated field for the current site. | | [wp\_delete\_nav\_menu()](wp_delete_nav_menu) wp-includes/nav-menu.php | Deletes a navigation menu. | | [wp\_update\_nav\_menu\_object()](wp_update_nav_menu_object) wp-includes/nav-menu.php | Saves the properties of a menu or create a new menu with those properties. | | [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. | | [wp\_xmlrpc\_server::mt\_getPostCategories()](../classes/wp_xmlrpc_server/mt_getpostcategories) wp-includes/class-wp-xmlrpc-server.php | Retrieve post categories. | | [wp\_xmlrpc\_server::mt\_setPostCategories()](../classes/wp_xmlrpc_server/mt_setpostcategories) wp-includes/class-wp-xmlrpc-server.php | Sets categories for a post. | | [wp\_xmlrpc\_server::mt\_supportedMethods()](../classes/wp_xmlrpc_server/mt_supportedmethods) wp-includes/class-wp-xmlrpc-server.php | Retrieve an array of methods supported by this server. | | [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::mt\_getTrackbackPings()](../classes/wp_xmlrpc_server/mt_gettrackbackpings) wp-includes/class-wp-xmlrpc-server.php | Retrieve trackbacks sent to a given post. | | [wp\_xmlrpc\_server::mt\_publishPost()](../classes/wp_xmlrpc_server/mt_publishpost) wp-includes/class-wp-xmlrpc-server.php | Sets a post’s publish status to ‘publish’. | | [wp\_xmlrpc\_server::pingback\_ping()](../classes/wp_xmlrpc_server/pingback_ping) wp-includes/class-wp-xmlrpc-server.php | Retrieves a pingback and registers it. | | [wp\_xmlrpc\_server::pingback\_extensions\_getPingbacks()](../classes/wp_xmlrpc_server/pingback_extensions_getpingbacks) wp-includes/class-wp-xmlrpc-server.php | Retrieve array of URLs that pingbacked the given URL. | | [wp\_xmlrpc\_server::mw\_editPost()](../classes/wp_xmlrpc_server/mw_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post. | | [wp\_xmlrpc\_server::mw\_getPost()](../classes/wp_xmlrpc_server/mw_getpost) wp-includes/class-wp-xmlrpc-server.php | Retrieve post. | | [wp\_xmlrpc\_server::mw\_getRecentPosts()](../classes/wp_xmlrpc_server/mw_getrecentposts) wp-includes/class-wp-xmlrpc-server.php | Retrieve list of recent posts. | | [wp\_xmlrpc\_server::mw\_getCategories()](../classes/wp_xmlrpc_server/mw_getcategories) wp-includes/class-wp-xmlrpc-server.php | Retrieve the list of categories on a given blog. | | [wp\_xmlrpc\_server::mw\_newMediaObject()](../classes/wp_xmlrpc_server/mw_newmediaobject) wp-includes/class-wp-xmlrpc-server.php | Uploads a file, following your settings. | | [wp\_xmlrpc\_server::mt\_getRecentPostTitles()](../classes/wp_xmlrpc_server/mt_getrecentposttitles) wp-includes/class-wp-xmlrpc-server.php | Retrieve the post titles of recent posts. | | [wp\_xmlrpc\_server::mt\_getCategoryList()](../classes/wp_xmlrpc_server/mt_getcategorylist) wp-includes/class-wp-xmlrpc-server.php | Retrieve list of all categories on blog. | | [wp\_xmlrpc\_server::blogger\_getUserInfo()](../classes/wp_xmlrpc_server/blogger_getuserinfo) wp-includes/class-wp-xmlrpc-server.php | Retrieve user’s data. | | [wp\_xmlrpc\_server::blogger\_getPost()](../classes/wp_xmlrpc_server/blogger_getpost) wp-includes/class-wp-xmlrpc-server.php | Retrieve post. | | [wp\_xmlrpc\_server::blogger\_getRecentPosts()](../classes/wp_xmlrpc_server/blogger_getrecentposts) wp-includes/class-wp-xmlrpc-server.php | Retrieve list of recent posts. | | [wp\_xmlrpc\_server::blogger\_newPost()](../classes/wp_xmlrpc_server/blogger_newpost) wp-includes/class-wp-xmlrpc-server.php | Creates new post. | | [wp\_xmlrpc\_server::blogger\_editPost()](../classes/wp_xmlrpc_server/blogger_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post. | | [wp\_xmlrpc\_server::blogger\_deletePost()](../classes/wp_xmlrpc_server/blogger_deletepost) wp-includes/class-wp-xmlrpc-server.php | Remove a post. | | [wp\_xmlrpc\_server::mw\_newPost()](../classes/wp_xmlrpc_server/mw_newpost) wp-includes/class-wp-xmlrpc-server.php | Create a new post. | | [wp\_xmlrpc\_server::wp\_getMediaItem()](../classes/wp_xmlrpc_server/wp_getmediaitem) wp-includes/class-wp-xmlrpc-server.php | Retrieve a media item by ID | | [wp\_xmlrpc\_server::wp\_getPostFormats()](../classes/wp_xmlrpc_server/wp_getpostformats) wp-includes/class-wp-xmlrpc-server.php | Retrieves a list of post formats used by the site. | | [wp\_xmlrpc\_server::wp\_getPostType()](../classes/wp_xmlrpc_server/wp_getposttype) wp-includes/class-wp-xmlrpc-server.php | Retrieves a post type | | [wp\_xmlrpc\_server::wp\_getPostTypes()](../classes/wp_xmlrpc_server/wp_getposttypes) wp-includes/class-wp-xmlrpc-server.php | Retrieves a post types | | [wp\_xmlrpc\_server::wp\_getRevisions()](../classes/wp_xmlrpc_server/wp_getrevisions) wp-includes/class-wp-xmlrpc-server.php | Retrieve revisions for a specific post. | | [wp\_xmlrpc\_server::wp\_restoreRevision()](../classes/wp_xmlrpc_server/wp_restorerevision) wp-includes/class-wp-xmlrpc-server.php | Restore a post revision | | [wp\_xmlrpc\_server::wp\_getMediaLibrary()](../classes/wp_xmlrpc_server/wp_getmedialibrary) wp-includes/class-wp-xmlrpc-server.php | Retrieves a collection of media library items (or attachments) | | [wp\_xmlrpc\_server::blogger\_getUsersBlogs()](../classes/wp_xmlrpc_server/blogger_getusersblogs) wp-includes/class-wp-xmlrpc-server.php | Retrieve blogs that user owns. | | [wp\_xmlrpc\_server::wp\_getComments()](../classes/wp_xmlrpc_server/wp_getcomments) wp-includes/class-wp-xmlrpc-server.php | Retrieve comments. | | [wp\_xmlrpc\_server::wp\_deleteComment()](../classes/wp_xmlrpc_server/wp_deletecomment) wp-includes/class-wp-xmlrpc-server.php | Delete a comment. | | [wp\_xmlrpc\_server::wp\_editComment()](../classes/wp_xmlrpc_server/wp_editcomment) wp-includes/class-wp-xmlrpc-server.php | Edit comment. | | [wp\_xmlrpc\_server::wp\_newComment()](../classes/wp_xmlrpc_server/wp_newcomment) wp-includes/class-wp-xmlrpc-server.php | Create new comment. | | [wp\_xmlrpc\_server::wp\_getCommentStatusList()](../classes/wp_xmlrpc_server/wp_getcommentstatuslist) wp-includes/class-wp-xmlrpc-server.php | Retrieve all of the comment status. | | [wp\_xmlrpc\_server::wp\_getCommentCount()](../classes/wp_xmlrpc_server/wp_getcommentcount) wp-includes/class-wp-xmlrpc-server.php | Retrieve comment count. | | [wp\_xmlrpc\_server::wp\_getPostStatusList()](../classes/wp_xmlrpc_server/wp_getpoststatuslist) wp-includes/class-wp-xmlrpc-server.php | Retrieve post statuses. | | [wp\_xmlrpc\_server::wp\_getPageStatusList()](../classes/wp_xmlrpc_server/wp_getpagestatuslist) wp-includes/class-wp-xmlrpc-server.php | Retrieve page statuses. | | [wp\_xmlrpc\_server::wp\_getPages()](../classes/wp_xmlrpc_server/wp_getpages) wp-includes/class-wp-xmlrpc-server.php | Retrieve Pages. | | [wp\_xmlrpc\_server::wp\_newPage()](../classes/wp_xmlrpc_server/wp_newpage) wp-includes/class-wp-xmlrpc-server.php | Create new page. | | [wp\_xmlrpc\_server::wp\_deletePage()](../classes/wp_xmlrpc_server/wp_deletepage) wp-includes/class-wp-xmlrpc-server.php | Delete page. | | [wp\_xmlrpc\_server::wp\_editPage()](../classes/wp_xmlrpc_server/wp_editpage) wp-includes/class-wp-xmlrpc-server.php | Edit page. | | [wp\_xmlrpc\_server::wp\_getPageList()](../classes/wp_xmlrpc_server/wp_getpagelist) wp-includes/class-wp-xmlrpc-server.php | Retrieve page list. | | [wp\_xmlrpc\_server::wp\_getAuthors()](../classes/wp_xmlrpc_server/wp_getauthors) wp-includes/class-wp-xmlrpc-server.php | Retrieve authors list. | | [wp\_xmlrpc\_server::wp\_getTags()](../classes/wp_xmlrpc_server/wp_gettags) wp-includes/class-wp-xmlrpc-server.php | Get list of all tags | | [wp\_xmlrpc\_server::wp\_newCategory()](../classes/wp_xmlrpc_server/wp_newcategory) wp-includes/class-wp-xmlrpc-server.php | Create new category. | | [wp\_xmlrpc\_server::wp\_deleteCategory()](../classes/wp_xmlrpc_server/wp_deletecategory) wp-includes/class-wp-xmlrpc-server.php | Remove category. | | [wp\_xmlrpc\_server::wp\_suggestCategories()](../classes/wp_xmlrpc_server/wp_suggestcategories) wp-includes/class-wp-xmlrpc-server.php | Retrieve category list. | | [wp\_xmlrpc\_server::wp\_getComment()](../classes/wp_xmlrpc_server/wp_getcomment) wp-includes/class-wp-xmlrpc-server.php | Retrieve comment. | | [wp\_xmlrpc\_server::wp\_getPosts()](../classes/wp_xmlrpc_server/wp_getposts) wp-includes/class-wp-xmlrpc-server.php | Retrieve posts. | | [wp\_xmlrpc\_server::wp\_newTerm()](../classes/wp_xmlrpc_server/wp_newterm) wp-includes/class-wp-xmlrpc-server.php | Create a new term. | | [wp\_xmlrpc\_server::wp\_editTerm()](../classes/wp_xmlrpc_server/wp_editterm) wp-includes/class-wp-xmlrpc-server.php | Edit a term. | | [wp\_xmlrpc\_server::wp\_deleteTerm()](../classes/wp_xmlrpc_server/wp_deleteterm) wp-includes/class-wp-xmlrpc-server.php | Delete a term. | | [wp\_xmlrpc\_server::wp\_getTerm()](../classes/wp_xmlrpc_server/wp_getterm) wp-includes/class-wp-xmlrpc-server.php | Retrieve a term. | | [wp\_xmlrpc\_server::wp\_getTerms()](../classes/wp_xmlrpc_server/wp_getterms) wp-includes/class-wp-xmlrpc-server.php | Retrieve all terms for a taxonomy. | | [wp\_xmlrpc\_server::wp\_getTaxonomy()](../classes/wp_xmlrpc_server/wp_gettaxonomy) wp-includes/class-wp-xmlrpc-server.php | Retrieve a taxonomy. | | [wp\_xmlrpc\_server::wp\_getTaxonomies()](../classes/wp_xmlrpc_server/wp_gettaxonomies) wp-includes/class-wp-xmlrpc-server.php | Retrieve all taxonomies. | | [wp\_xmlrpc\_server::wp\_getUser()](../classes/wp_xmlrpc_server/wp_getuser) wp-includes/class-wp-xmlrpc-server.php | Retrieve a user. | | [wp\_xmlrpc\_server::wp\_getUsers()](../classes/wp_xmlrpc_server/wp_getusers) wp-includes/class-wp-xmlrpc-server.php | Retrieve users. | | [wp\_xmlrpc\_server::wp\_getProfile()](../classes/wp_xmlrpc_server/wp_getprofile) wp-includes/class-wp-xmlrpc-server.php | Retrieve information about the requesting user. | | [wp\_xmlrpc\_server::wp\_editProfile()](../classes/wp_xmlrpc_server/wp_editprofile) wp-includes/class-wp-xmlrpc-server.php | Edit user’s profile. | | [wp\_xmlrpc\_server::wp\_getPage()](../classes/wp_xmlrpc_server/wp_getpage) wp-includes/class-wp-xmlrpc-server.php | Retrieve page. | | [wp\_xmlrpc\_server::wp\_newPost()](../classes/wp_xmlrpc_server/wp_newpost) wp-includes/class-wp-xmlrpc-server.php | Create a new post for any registered post type. | | [wp\_xmlrpc\_server::wp\_editPost()](../classes/wp_xmlrpc_server/wp_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post for any registered post type. | | [wp\_xmlrpc\_server::wp\_deletePost()](../classes/wp_xmlrpc_server/wp_deletepost) wp-includes/class-wp-xmlrpc-server.php | Delete a post for any registered post type. | | [wp\_xmlrpc\_server::wp\_getPost()](../classes/wp_xmlrpc_server/wp_getpost) wp-includes/class-wp-xmlrpc-server.php | Retrieve a post. | | [wp\_xmlrpc\_server::wp\_getUsersBlogs()](../classes/wp_xmlrpc_server/wp_getusersblogs) wp-includes/class-wp-xmlrpc-server.php | Retrieve the blogs of the user. | | [WP\_Customize\_Control::maybe\_render()](../classes/wp_customize_control/maybe_render) wp-includes/class-wp-customize-control.php | Check capabilities and render the control. | | [dynamic\_sidebar()](dynamic_sidebar) wp-includes/widgets.php | Display dynamic sidebar. | | [the\_widget()](the_widget) wp-includes/widgets.php | Output an arbitrary widget as a template tag. | | [wp\_register\_sidebar\_widget()](wp_register_sidebar_widget) wp-includes/widgets.php | Register an instance of a widget. | | [wp\_unregister\_sidebar\_widget()](wp_unregister_sidebar_widget) wp-includes/widgets.php | Remove widget from sidebar. | | [register\_sidebar()](register_sidebar) wp-includes/widgets.php | Builds the definition for a single sidebar and returns the ID. | | [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. | | [WP\_Customize\_Widgets::wp\_ajax\_update\_widget()](../classes/wp_customize_widgets/wp_ajax_update_widget) wp-includes/class-wp-customize-widgets.php | Updates widget settings asynchronously. | | [WP\_Customize\_Widgets::print\_styles()](../classes/wp_customize_widgets/print_styles) wp-includes/class-wp-customize-widgets.php | Calls admin\_print\_styles-widgets.php and admin\_print\_styles hooks to allow custom styles from plugins. | | [WP\_Customize\_Widgets::print\_scripts()](../classes/wp_customize_widgets/print_scripts) wp-includes/class-wp-customize-widgets.php | Calls admin\_print\_scripts-widgets.php and admin\_print\_scripts hooks to allow custom scripts from plugins. | | [WP\_Customize\_Widgets::enqueue\_scripts()](../classes/wp_customize_widgets/enqueue_scripts) wp-includes/class-wp-customize-widgets.php | Enqueues scripts and styles for Customizer panel and export data to JavaScript. | | [WP\_Customize\_Widgets::print\_footer\_scripts()](../classes/wp_customize_widgets/print_footer_scripts) wp-includes/class-wp-customize-widgets.php | Calls admin\_print\_footer\_scripts and admin\_print\_scripts hooks to allow custom scripts from plugins. | | [WP\_Customize\_Widgets::customize\_controls\_init()](../classes/wp_customize_widgets/customize_controls_init) wp-includes/class-wp-customize-widgets.php | Ensures all widgets get loaded into the Customizer. | | [print\_head\_scripts()](print_head_scripts) wp-includes/script-loader.php | Prints the script queue in the HTML head on admin pages. | | [wp\_print\_head\_scripts()](wp_print_head_scripts) wp-includes/script-loader.php | Prints the script queue in the HTML head on the front end. | | [wp\_print\_footer\_scripts()](wp_print_footer_scripts) wp-includes/script-loader.php | Hooks to print the scripts and styles in the footer. | | [wp\_enqueue\_scripts()](wp_enqueue_scripts) wp-includes/script-loader.php | Wrapper for do\_action( ‘wp\_enqueue\_scripts’ ). | | [clean\_comment\_cache()](clean_comment_cache) wp-includes/comment.php | Removes a comment from the object cache. | | [wp\_new\_comment()](wp_new_comment) wp-includes/comment.php | Adds a new comment to the database. | | [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\_update\_comment\_count\_now()](wp_update_comment_count_now) wp-includes/comment.php | Updates the comment count for the post. | | [do\_all\_pings()](do_all_pings) wp-includes/comment.php | Performs all pingbacks, enclosures, trackbacks, and sends to pingback services. | | [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\_transition\_comment\_status()](wp_transition_comment_status) wp-includes/comment.php | Calls hooks for when a comment status transition occurs. | | [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. | | [wp\_trash\_comment()](wp_trash_comment) wp-includes/comment.php | Moves a comment to the Trash | | [wp\_untrash\_comment()](wp_untrash_comment) wp-includes/comment.php | Removes a comment from the Trash | | [wp\_allow\_comment()](wp_allow_comment) wp-includes/comment.php | Validates whether this comment is allowed to be made. | | [delete\_metadata()](delete_metadata) wp-includes/meta.php | Deletes metadata for the specified object. | | [update\_metadata\_by\_mid()](update_metadata_by_mid) wp-includes/meta.php | Updates metadata by meta ID. | | [delete\_metadata\_by\_mid()](delete_metadata_by_mid) wp-includes/meta.php | Deletes metadata by meta ID. | | [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::enqueue\_scripts()](../classes/_wp_editors/enqueue_scripts) 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. | | [WP\_Error::add()](../classes/wp_error/add) wp-includes/class-wp-error.php | Adds an error or appends an additional message to an existing error. | | [\_WP\_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. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Formalized the existing and already documented `...$arg` parameter by adding it to the function signature. | | [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
programming_docs
wordpress wxr_tag_name( WP_Term $tag ) wxr\_tag\_name( WP\_Term $tag ) =============================== Outputs a tag\_name XML tag from a given tag object. `$tag` [WP\_Term](../classes/wp_term) Required Tag Object. File: `wp-admin/includes/export.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/export.php/) ``` function wxr_tag_name( $tag ) { if ( empty( $tag->name ) ) { return; } echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . "</wp:tag_name>\n"; } ``` | Uses | Description | | --- | --- | | [wxr\_cdata()](wxr_cdata) wp-admin/includes/export.php | Wraps given string in XML CDATA tag. | | Used By | Description | | --- | --- | | [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress _wp_post_revision_data( array|WP_Post $post = array(), bool $autosave = false ): array \_wp\_post\_revision\_data( array|WP\_Post $post = array(), bool $autosave = false ): array =========================================================================================== This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Returns a post array ready to be inserted into the posts table as a post revision. `$post` array|[WP\_Post](../classes/wp_post) Optional A post array or a [WP\_Post](../classes/wp_post) object to be processed for insertion as a post revision. Default: `array()` `$autosave` bool Optional Is the revision an autosave? Default: `false` array Post array ready to be inserted as a post revision. File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/) ``` function _wp_post_revision_data( $post = array(), $autosave = false ) { if ( ! is_array( $post ) ) { $post = get_post( $post, ARRAY_A ); } $fields = _wp_post_revision_fields( $post ); $revision_data = array(); foreach ( array_intersect( array_keys( $post ), array_keys( $fields ) ) as $field ) { $revision_data[ $field ] = $post[ $field ]; } $revision_data['post_parent'] = $post['ID']; $revision_data['post_status'] = 'inherit'; $revision_data['post_type'] = 'revision'; $revision_data['post_name'] = $autosave ? "$post[ID]-autosave-v1" : "$post[ID]-revision-v1"; // "1" is the revisioning system version. $revision_data['post_date'] = isset( $post['post_modified'] ) ? $post['post_modified'] : ''; $revision_data['post_date_gmt'] = isset( $post['post_modified_gmt'] ) ? $post['post_modified_gmt'] : ''; return $revision_data; } ``` | Uses | Description | | --- | --- | | [\_wp\_post\_revision\_fields()](_wp_post_revision_fields) wp-includes/revision.php | Determines which fields of posts are to be saved in revisions. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Used By | Description | | --- | --- | | [WP\_REST\_Autosaves\_Controller::create\_post\_autosave()](../classes/wp_rest_autosaves_controller/create_post_autosave) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Creates autosave for the specified post. | | [wp\_create\_post\_autosave()](wp_create_post_autosave) wp-admin/includes/post.php | Creates autosave data for the specified post from `$_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. | | Version | Description | | --- | --- | | [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. | wordpress _wp_credits_add_profile_link( string $display_name, string $username, string $profiles ) \_wp\_credits\_add\_profile\_link( string $display\_name, string $username, string $profiles ) ============================================================================================== This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Retrieve the link to a contributor’s WordPress.org profile page. `$display_name` string Required The contributor's display name (passed by reference). `$username` string Required The contributor's username. `$profiles` string Required URL to the contributor's WordPress.org profile page. File: `wp-admin/includes/credits.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/credits.php/) ``` function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) { $display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>'; } ``` | Uses | Description | | --- | --- | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | Version | Description | | --- | --- | | [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. | wordpress wp_update_term_count( int|array $terms, string $taxonomy, bool $do_deferred = false ): bool wp\_update\_term\_count( int|array $terms, string $taxonomy, bool $do\_deferred = false ): bool =============================================================================================== Updates the amount of terms in taxonomy. If there is a taxonomy callback applied, then it will be called for updating the count. The default action is to count what the amount of terms have the relationship of term ID. Once that is done, then update the database. `$terms` int|array Required The term\_taxonomy\_id of the terms. `$taxonomy` string Required The context of the term. `$do_deferred` bool Optional Whether to flush the deferred term counts too. Default: `false` bool If no terms will return false, and if successful will return true. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/) ``` function wp_update_term_count( $terms, $taxonomy, $do_deferred = false ) { static $_deferred = array(); if ( $do_deferred ) { foreach ( (array) array_keys( $_deferred ) as $tax ) { wp_update_term_count_now( $_deferred[ $tax ], $tax ); unset( $_deferred[ $tax ] ); } } if ( empty( $terms ) ) { return false; } if ( ! is_array( $terms ) ) { $terms = array( $terms ); } if ( wp_defer_term_counting() ) { if ( ! isset( $_deferred[ $taxonomy ] ) ) { $_deferred[ $taxonomy ] = array(); } $_deferred[ $taxonomy ] = array_unique( array_merge( $_deferred[ $taxonomy ], $terms ) ); return true; } return wp_update_term_count_now( $terms, $taxonomy ); } ``` | Uses | Description | | --- | --- | | [wp\_update\_term\_count\_now()](wp_update_term_count_now) wp-includes/taxonomy.php | Performs term count update immediately. | | [wp\_defer\_term\_counting()](wp_defer_term_counting) wp-includes/taxonomy.php | Enables or disables term counting. | | Used By | Description | | --- | --- | | [wp\_defer\_term\_counting()](wp_defer_term_counting) wp-includes/taxonomy.php | Enables or disables term counting. | | [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. | | [\_update\_term\_count\_on\_transition\_post\_status()](_update_term_count_on_transition_post_status) wp-includes/post.php | Updates the custom taxonomies’ term counts when a post’s status is changed. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress generate_random_password( int $len = 8 ) generate\_random\_password( int $len = 8 ) ========================================== This function has been deprecated. Use [wp\_generate\_password()](wp_generate_password) instead. Generates a random password. * [wp\_generate\_password()](wp_generate_password) `$len` int Optional The length of password to generate. Default: `8` File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/) ``` function generate_random_password( $len = 8 ) { _deprecated_function( __FUNCTION__, '3.0.0', 'wp_generate_password()' ); return wp_generate_password( $len ); } ``` | Uses | Description | | --- | --- | | [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. | | [\_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\_generate\_password()](wp_generate_password) | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress wp_install( string $blog_title, string $user_name, string $user_email, bool $is_public, string $deprecated = '', string $user_password = '', string $language = '' ): array wp\_install( string $blog\_title, string $user\_name, string $user\_email, bool $is\_public, string $deprecated = '', string $user\_password = '', string $language = '' ): array ================================================================================================================================================================================= Installs the site. Runs the required functions to set up and populate the database, including primary admin user and initial options. `$blog_title` string Required Site title. `$user_name` string Required User's username. `$user_email` string Required User's email. `$is_public` bool Required Whether the site is public. `$deprecated` string Optional Not used. Default: `''` `$user_password` string Optional User's chosen password. Default empty (random password). Default: `''` `$language` string Optional Language chosen. Default: `''` array Data for the newly installed site. * `url`stringThe URL of the site. * `user_id`intThe ID of the site owner. * `password`stringThe password of the site owner, if their user account didn't already exist. * `password_message`stringThe explanatory message regarding the password. File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/) ``` function wp_install( $blog_title, $user_name, $user_email, $is_public, $deprecated = '', $user_password = '', $language = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.6.0' ); } wp_check_mysql_version(); wp_cache_flush(); make_db_current_silent(); populate_options(); populate_roles(); update_option( 'blogname', $blog_title ); update_option( 'admin_email', $user_email ); update_option( 'blog_public', $is_public ); // Freshness of site - in the future, this could get more specific about actions taken, perhaps. update_option( 'fresh_site', 1 ); if ( $language ) { update_option( 'WPLANG', $language ); } $guessurl = wp_guess_url(); update_option( 'siteurl', $guessurl ); // If not a public site, don't ping. if ( ! $is_public ) { update_option( 'default_pingback_flag', 0 ); } /* * Create default user. If the user already exists, the user tables are * being shared among sites. Just set the role in that case. */ $user_id = username_exists( $user_name ); $user_password = trim( $user_password ); $email_password = false; $user_created = false; if ( ! $user_id && empty( $user_password ) ) { $user_password = wp_generate_password( 12, false ); $message = __( '<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.' ); $user_id = wp_create_user( $user_name, $user_password, $user_email ); update_user_meta( $user_id, 'default_password_nag', true ); $email_password = true; $user_created = true; } elseif ( ! $user_id ) { // Password has been provided. $message = '<em>' . __( 'Your chosen password.' ) . '</em>'; $user_id = wp_create_user( $user_name, $user_password, $user_email ); $user_created = true; } else { $message = __( 'User already exists. Password inherited.' ); } $user = new WP_User( $user_id ); $user->set_role( 'administrator' ); if ( $user_created ) { $user->user_url = $guessurl; wp_update_user( $user ); } wp_install_defaults( $user_id ); wp_install_maybe_enable_pretty_permalinks(); flush_rewrite_rules(); wp_new_blog_notification( $blog_title, $guessurl, $user_id, ( $email_password ? $user_password : __( 'The password you chose during installation.' ) ) ); wp_cache_flush(); /** * Fires after a site is fully installed. * * @since 3.9.0 * * @param WP_User $user The site owner. */ do_action( 'wp_install', $user ); return array( 'url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message, ); } ``` [do\_action( 'wp\_install', WP\_User $user )](../hooks/wp_install) Fires after a site is fully installed. | Uses | Description | | --- | --- | | [wp\_install\_maybe\_enable\_pretty\_permalinks()](wp_install_maybe_enable_pretty_permalinks) wp-admin/includes/upgrade.php | Maybe enable pretty permalinks on installation. | | [populate\_roles()](populate_roles) wp-admin/includes/schema.php | Execute WordPress role creation for the various WordPress versions. | | [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. | | [username\_exists()](username_exists) wp-includes/user.php | Determines whether the given username exists. | | [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. | | [wp\_create\_user()](wp_create_user) wp-includes/user.php | Provides a simpler way of inserting a user into the database. | | [wp\_guess\_url()](wp_guess_url) wp-includes/functions.php | Guesses the URL for the site. | | [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. | | [wp\_cache\_flush()](wp_cache_flush) wp-includes/cache.php | Removes all cache items. | | [WP\_User::\_\_construct()](../classes/wp_user/__construct) wp-includes/class-wp-user.php | Constructor. | | [wp\_new\_blog\_notification()](wp_new_blog_notification) wp-admin/includes/upgrade.php | Notifies the site admin that the installation of WordPress is complete. | | [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. | | [make\_db\_current\_silent()](make_db_current_silent) wp-admin/includes/upgrade.php | Updates the database tables to a new schema, but without displaying results. | | [wp\_check\_mysql\_version()](wp_check_mysql_version) wp-admin/includes/upgrade.php | Checks the version of the installed MySQL binary. | | [populate\_options()](populate_options) wp-admin/includes/schema.php | Create WordPress options and set the default values. | | [flush\_rewrite\_rules()](flush_rewrite_rules) wp-includes/rewrite.php | Removes rewrite rules and then recreate rewrite rules. | | [\_\_()](__) 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. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress get_weekstartend( string $mysqlstring, int|string $start_of_week = '' ): int[] get\_weekstartend( string $mysqlstring, int|string $start\_of\_week = '' ): int[] ================================================================================= Gets the week start and end from the datetime or date string from MySQL. `$mysqlstring` string Required Date or datetime field type from MySQL. `$start_of_week` int|string Optional Start of the week as an integer. Default: `''` int[] Week start and end dates as Unix timestamps. * `start`intThe week start date as a Unix timestamp. * `end`intThe week end date as a Unix timestamp. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function get_weekstartend( $mysqlstring, $start_of_week = '' ) { // MySQL string year. $my = substr( $mysqlstring, 0, 4 ); // MySQL string month. $mm = substr( $mysqlstring, 8, 2 ); // MySQL string day. $md = substr( $mysqlstring, 5, 2 ); // The timestamp for MySQL string day. $day = mktime( 0, 0, 0, $md, $mm, $my ); // The day of the week from the timestamp. $weekday = gmdate( 'w', $day ); if ( ! is_numeric( $start_of_week ) ) { $start_of_week = get_option( 'start_of_week' ); } if ( $weekday < $start_of_week ) { $weekday += 7; } // The most recent week start day on or before $day. $start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week ); // $start + 1 week - 1 second. $end = $start + WEEK_IN_SECONDS - 1; return compact( 'start', 'end' ); } ``` | Uses | Description | | --- | --- | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [wp\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. | | Version | Description | | --- | --- | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress safecss_filter_attr( string $css, string $deprecated = '' ): string safecss\_filter\_attr( string $css, string $deprecated = '' ): string ===================================================================== Filters an inline style attribute and removes disallowed rules. `$css` string Required A string of CSS rules. `$deprecated` string Optional Not used. Default: `''` string Filtered string of CSS rules. File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/) ``` function safecss_filter_attr( $css, $deprecated = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.8.1' ); // Never implemented. } $css = wp_kses_no_null( $css ); $css = str_replace( array( "\n", "\r", "\t" ), '', $css ); $allowed_protocols = wp_allowed_protocols(); $css_array = explode( ';', trim( $css ) ); /** * Filters the list of allowed CSS attributes. * * @since 2.8.1 * * @param string[] $attr Array of allowed CSS attributes. */ $allowed_attr = apply_filters( 'safe_style_css', array( 'background', 'background-color', 'background-image', 'background-position', 'background-size', 'background-attachment', 'background-blend-mode', 'border', 'border-radius', 'border-width', 'border-color', 'border-style', 'border-right', 'border-right-color', 'border-right-style', 'border-right-width', 'border-bottom', 'border-bottom-color', 'border-bottom-left-radius', 'border-bottom-right-radius', 'border-bottom-style', 'border-bottom-width', 'border-bottom-right-radius', 'border-bottom-left-radius', 'border-left', 'border-left-color', 'border-left-style', 'border-left-width', 'border-top', 'border-top-color', 'border-top-left-radius', 'border-top-right-radius', 'border-top-style', 'border-top-width', 'border-top-left-radius', 'border-top-right-radius', 'border-spacing', 'border-collapse', 'caption-side', 'columns', 'column-count', 'column-fill', 'column-gap', 'column-rule', 'column-span', 'column-width', 'color', 'filter', 'font', 'font-family', 'font-size', 'font-style', 'font-variant', 'font-weight', 'letter-spacing', 'line-height', 'text-align', 'text-decoration', 'text-indent', 'text-transform', 'height', 'min-height', 'max-height', 'width', 'min-width', 'max-width', 'margin', 'margin-right', 'margin-bottom', 'margin-left', 'margin-top', 'margin-block-start', 'margin-block-end', 'margin-inline-start', 'margin-inline-end', 'padding', 'padding-right', 'padding-bottom', 'padding-left', 'padding-top', 'padding-block-start', 'padding-block-end', 'padding-inline-start', 'padding-inline-end', 'flex', 'flex-basis', 'flex-direction', 'flex-flow', 'flex-grow', 'flex-shrink', 'flex-wrap', 'gap', 'column-gap', 'row-gap', 'grid-template-columns', 'grid-auto-columns', 'grid-column-start', 'grid-column-end', 'grid-column-gap', 'grid-template-rows', 'grid-auto-rows', 'grid-row-start', 'grid-row-end', 'grid-row-gap', 'grid-gap', 'justify-content', 'justify-items', 'justify-self', 'align-content', 'align-items', 'align-self', 'clear', 'cursor', 'direction', 'float', 'list-style-type', 'object-fit', 'object-position', 'overflow', 'vertical-align', // Custom CSS properties. '--*', ) ); /* * CSS attributes that accept URL data types. * * This is in accordance to the CSS spec and unrelated to * the sub-set of supported attributes above. * * See: https://developer.mozilla.org/en-US/docs/Web/CSS/url */ $css_url_data_types = array( 'background', 'background-image', 'cursor', 'list-style', 'list-style-image', ); /* * CSS attributes that accept gradient data types. * */ $css_gradient_data_types = array( 'background', 'background-image', ); if ( empty( $allowed_attr ) ) { return $css; } $css = ''; foreach ( $css_array as $css_item ) { if ( '' === $css_item ) { continue; } $css_item = trim( $css_item ); $css_test_string = $css_item; $found = false; $url_attr = false; $gradient_attr = false; $is_custom_var = false; if ( strpos( $css_item, ':' ) === false ) { $found = true; } else { $parts = explode( ':', $css_item, 2 ); $css_selector = trim( $parts[0] ); // Allow assigning values to CSS variables. if ( in_array( '--*', $allowed_attr, true ) && preg_match( '/^--[a-zA-Z0-9-_]+$/', $css_selector ) ) { $allowed_attr[] = $css_selector; $is_custom_var = true; } if ( in_array( $css_selector, $allowed_attr, true ) ) { $found = true; $url_attr = in_array( $css_selector, $css_url_data_types, true ); $gradient_attr = in_array( $css_selector, $css_gradient_data_types, true ); } if ( $is_custom_var ) { $css_value = trim( $parts[1] ); $url_attr = str_starts_with( $css_value, 'url(' ); $gradient_attr = str_contains( $css_value, '-gradient(' ); } } if ( $found && $url_attr ) { // Simplified: matches the sequence `url(*)`. preg_match_all( '/url\([^)]+\)/', $parts[1], $url_matches ); foreach ( $url_matches[0] as $url_match ) { // Clean up the URL from each of the matches above. preg_match( '/^url\(\s*([\'\"]?)(.*)(\g1)\s*\)$/', $url_match, $url_pieces ); if ( empty( $url_pieces[2] ) ) { $found = false; break; } $url = trim( $url_pieces[2] ); if ( empty( $url ) || wp_kses_bad_protocol( $url, $allowed_protocols ) !== $url ) { $found = false; break; } else { // Remove the whole `url(*)` bit that was matched above from the CSS. $css_test_string = str_replace( $url_match, '', $css_test_string ); } } } if ( $found && $gradient_attr ) { $css_value = trim( $parts[1] ); if ( preg_match( '/^(repeating-)?(linear|radial|conic)-gradient\(([^()]|rgb[a]?\([^()]*\))*\)$/', $css_value ) ) { // Remove the whole `gradient` bit that was matched above from the CSS. $css_test_string = str_replace( $css_value, '', $css_test_string ); } } if ( $found ) { /* * Allow CSS functions like var(), calc(), etc. by removing them from the test string. * Nested functions and parentheses are also removed, so long as the parentheses are balanced. */ $css_test_string = preg_replace( '/\b(?:var|calc|min|max|minmax|clamp)(\((?:[^()]|(?1))*\))/', '', $css_test_string ); /* * Disallow CSS containing \ ( & } = or comments, except for within url(), var(), calc(), etc. * which were removed from the test string above. */ $allow_css = ! preg_match( '%[\\\(&=}]|/\*%', $css_test_string ); /** * Filters the check for unsafe CSS in `safecss_filter_attr`. * * Enables developers to determine whether a section of CSS should be allowed or discarded. * By default, the value will be false if the part contains \ ( & } = or comments. * Return true to allow the CSS part to be included in the output. * * @since 5.5.0 * * @param bool $allow_css Whether the CSS in the test string is considered safe. * @param string $css_test_string The CSS string to test. */ $allow_css = apply_filters( 'safecss_filter_attr_allow_css', $allow_css, $css_test_string ); // Only add the CSS part if it passes the regex check. if ( $allow_css ) { if ( '' !== $css ) { $css .= ';'; } $css .= $css_item; } } } return $css; } ``` [apply\_filters( 'safecss\_filter\_attr\_allow\_css', bool $allow\_css, string $css\_test\_string )](../hooks/safecss_filter_attr_allow_css) Filters the check for unsafe CSS in `safecss_filter_attr`. [apply\_filters( 'safe\_style\_css', string[] $attr )](../hooks/safe_style_css) Filters the list of allowed CSS attributes. | Uses | Description | | --- | --- | | [wp\_kses\_no\_null()](wp_kses_no_null) wp-includes/kses.php | Removes any invalid control characters in a text string. | | [wp\_kses\_bad\_protocol()](wp_kses_bad_protocol) wp-includes/kses.php | Sanitizes a string and removed disallowed URL protocols. | | [wp\_allowed\_protocols()](wp_allowed_protocols) wp-includes/functions.php | Retrieves a list of protocols to allow in HTML attributes. | | [\_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\_Style\_Engine\_CSS\_Declarations::filter\_declaration()](../classes/wp_style_engine_css_declarations/filter_declaration) wp-includes/style-engine/class-wp-style-engine-css-declarations.php | Filters a CSS property + value pair. | | [WP\_Theme\_JSON::is\_safe\_css\_declaration()](../classes/wp_theme_json/is_safe_css_declaration) wp-includes/class-wp-theme-json.php | Checks that a declaration provided by the user is safe. | | [wp\_kses\_attr\_check()](wp_kses_attr_check) wp-includes/kses.php | Determines whether an attribute is allowed. | | Version | Description | | --- | --- | | [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Added support for `min()`, `max()`, `minmax()`, `clamp()`, nested `var()` values, and assigning values to CSS variables. Added support for `object-fit`, `gap`, `column-gap`, `row-gap`, and `flex-wrap`. Extended `margin-*` and `padding-*` support for logical properties. | | [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Added support for `calc()` and `var()` values. | | [5.7.1](https://developer.wordpress.org/reference/since/5.7.1/) | Added support for `object-position`. | | [5.3.1](https://developer.wordpress.org/reference/since/5.3.1/) | Added support for gradient backgrounds. | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added support for `grid`, `flex` and `column` layout properties. Extended `background-*` support for individual properties. | | [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Added support for `background-position` and `grid-template-columns`. | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Added support for `text-transform`. | | [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Added support for `background-image`. | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Added support for `list-style-type`. | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added support for `min-height`, `max-height`, `min-width`, and `max-width`. | | [2.8.1](https://developer.wordpress.org/reference/since/2.8.1/) | Introduced. |
programming_docs
wordpress wp_create_nonce( string|int $action = -1 ): string wp\_create\_nonce( string|int $action = -1 ): string ==================================================== Creates a cryptographic token tied to a specific action, user, user session, and window of time. `$action` string|int Optional Scalar value to add context to the nonce. Default: `-1` string The token. The function should be called using the [init](https://codex.wordpress.org/Plugin_API/Action_Reference/init "Plugin API/Action Reference/init") or any subsequent action [hook](https://wordpress.org/support/article/glossary/ "Glossary"). Calling it outside of an action hook can lead to problems, see the [ticket #14024](https://core.trac.wordpress.org/ticket/14024) for details. File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/) ``` function wp_create_nonce( $action = -1 ) { $user = wp_get_current_user(); $uid = (int) $user->ID; if ( ! $uid ) { /** This filter is documented in wp-includes/pluggable.php */ $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); } $token = wp_get_session_token( $action ); $i = wp_nonce_tick( $action ); return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 ); } ``` [apply\_filters( 'nonce\_user\_logged\_out', int $uid, string|int $action )](../hooks/nonce_user_logged_out) Filters whether the user who generated the nonce is logged out. | Uses | Description | | --- | --- | | [wp\_get\_session\_token()](wp_get_session_token) wp-includes/user.php | Retrieves the current session token from the logged\_in cookie. | | [wp\_nonce\_tick()](wp_nonce_tick) wp-includes/pluggable.php | Returns the time-dependent variable for nonce creation. | | [wp\_hash()](wp_hash) wp-includes/pluggable.php | Gets hash of given string. | | [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user 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\_refresh\_metabox\_loader\_nonces()](wp_refresh_metabox_loader_nonces) wp-admin/includes/misc.php | Refresh nonces used with meta boxes in the block editor. | | [WP\_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\_Data\_Removal\_Requests\_List\_Table::column\_email()](../classes/wp_privacy_data_removal_requests_list_table/column_email) wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Actions column. | | [WP\_Privacy\_Data\_Removal\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_removal_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Next steps column. | | [wp\_ajax\_rest\_nonce()](wp_ajax_rest_nonce) wp-admin/includes/ajax-actions.php | Ajax handler to renew the REST API nonce. | | [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. | | [resume\_theme()](resume_theme) wp-admin/includes/theme.php | Tries to resume a single theme. | | [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::enqueue\_scripts()](../classes/wp_site_health/enqueue_scripts) wp-admin/includes/class-wp-site-health.php | Enqueues the site health scripts. | | [resume\_plugin()](resume_plugin) wp-admin/includes/plugin.php | Tries to resume a single plugin. | | [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\_default\_packages\_inline\_scripts()](wp_default_packages_inline_scripts) wp-includes/script-loader.php | Adds inline scripts required for the WordPress JavaScript packages. | | [wp\_refresh\_heartbeat\_nonces()](wp_refresh_heartbeat_nonces) wp-admin/includes/misc.php | Adds the latest Heartbeat and REST-API nonce to the Heartbeat response. | | [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\_localize\_community\_events()](wp_localize_community_events) wp-includes/script-loader.php | Localizes community events data that needs to be passed to dashboard.js. | | [wp\_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\_Manager::get\_nonces()](../classes/wp_customize_manager/get_nonces) wp-includes/class-wp-customize-manager.php | Gets nonces for the Customizer. | | [WP\_Customize\_Nav\_Menus::filter\_nonces()](../classes/wp_customize_nav_menus/filter_nonces) wp-includes/class-wp-customize-nav-menus.php | Adds a nonce for customizing menus. | | [rest\_cookie\_check\_errors()](rest_cookie_check_errors) wp-includes/rest-api.php | Checks for errors when using cookie-based authentication. | | [WP\_Comments\_List\_Table::handle\_row\_actions()](../classes/wp_comments_list_table/handle_row_actions) wp-admin/includes/class-wp-comments-list-table.php | Generates and displays row actions links. | | [WP\_Media\_List\_Table::column\_parent()](../classes/wp_media_list_table/column_parent) wp-admin/includes/class-wp-media-list-table.php | Handles the parent column output. | | [WP\_Customize\_Widgets::refresh\_nonces()](../classes/wp_customize_widgets/refresh_nonces) wp-includes/class-wp-customize-widgets.php | Refreshes the nonce for widget updates. | | [WP\_Customize\_Background\_Image\_Control::enqueue()](../classes/wp_customize_background_image_control/enqueue) wp-includes/customize/class-wp-customize-background-image-control.php | Enqueue control related scripts/styles. | | [wp\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. | | [wp\_refresh\_post\_nonces()](wp_refresh_post_nonces) wp-admin/includes/misc.php | Checks nonce expiration on the New/Edit Post screen and refresh if needed. | | [install\_plugins\_favorites\_form()](install_plugins_favorites_form) wp-admin/includes/plugin-install.php | Shows a username form for the favorites page. | | [\_wp\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. | | [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 | | | [compression\_test()](compression_test) wp-admin/includes/template.php | Tests support for compressing JavaScript from PHP. | | [\_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. | | [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor | | [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. | | [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. | | [\_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\_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\_replyto\_comment()](wp_ajax_replyto_comment) wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. | | [wp\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. | | [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\_heartbeat\_settings()](wp_heartbeat_settings) wp-includes/general-template.php | Default settings for heartbeat. | | [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. | | [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. | | [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. | | [WP\_Customize\_Header\_Image\_Control::enqueue()](../classes/wp_customize_header_image_control/enqueue) wp-includes/customize/class-wp-customize-header-image-control.php | | | [wp\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. | | Version | Description | | --- | --- | | [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Session tokens were integrated with nonce creation. | | [2.0.3](https://developer.wordpress.org/reference/since/2.0.3/) | Introduced. | wordpress _upgrade_cron_array( array $cron ): array \_upgrade\_cron\_array( array $cron ): 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. Upgrade a cron info array. This function upgrades the cron info array to version 2. `$cron` array Required Cron info array from [\_get\_cron\_array()](_get_cron_array) . array An upgraded cron info array. File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/) ``` function _upgrade_cron_array( $cron ) { if ( isset( $cron['version'] ) && 2 == $cron['version'] ) { return $cron; } $new_cron = array(); foreach ( (array) $cron as $timestamp => $hooks ) { foreach ( (array) $hooks as $hook => $args ) { $key = md5( serialize( $args['args'] ) ); $new_cron[ $timestamp ][ $hook ][ $key ] = $args; } } $new_cron['version'] = 2; update_option( 'cron', $new_cron ); return $new_cron; } ``` | Uses | Description | | --- | --- | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | Used By | Description | | --- | --- | | [\_get\_cron\_array()](_get_cron_array) wp-includes/cron.php | Retrieve cron info array option. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress get_index_template(): string get\_index\_template(): string ============================== Retrieves path of index 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 ‘index’. * [get\_query\_template()](get_query_template) string Full path to index template file. File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/) ``` function get_index_template() { return get_query_template( 'index' ); } ``` | 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 preview_theme_ob_filter( string $content ): string preview\_theme\_ob\_filter( string $content ): 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. Callback function for ob\_start() to capture all links in the theme. `$content` string Required string File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function preview_theme_ob_filter( $content ) { _deprecated_function( __FUNCTION__, '4.3.0' ); return $content; } ``` | Uses | Description | | --- | --- | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [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_category_feed_link( int|WP_Term|object $cat, string $feed = '' ): string get\_category\_feed\_link( int|WP\_Term|object $cat, string $feed = '' ): string ================================================================================ Retrieves the feed link for a category. Returns a link to the feed for all posts in a given category. A specific feed can be requested or left blank to get the default feed. `$cat` int|[WP\_Term](../classes/wp_term)|object Required The ID or category 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 Link to the feed for the category specified by `$cat`. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function get_category_feed_link( $cat, $feed = '' ) { return get_term_feed_link( $cat, 'category', $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. | | [get\_category\_rss\_link()](get_category_rss_link) wp-includes/deprecated.php | Print/Return link to category RSS2 feed. | | [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. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress has_header_image(): bool has\_header\_image(): bool ========================== Checks whether a header image is set or not. * [get\_header\_image()](get_header_image) bool Whether a header image 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_image() { return (bool) get_header_image(); } ``` | Uses | Description | | --- | --- | | [get\_header\_image()](get_header_image) wp-includes/theme.php | Retrieves header image for custom header. | | Used By | Description | | --- | --- | | [has\_custom\_header()](has_custom_header) wp-includes/theme.php | Checks whether a custom header is set or not. | | Version | Description | | --- | --- | | [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. | wordpress wp_admin_bar_appearance_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_appearance\_menu( WP\_Admin\_Bar $wp\_admin\_bar ) ================================================================== Adds appearance submenu items to the “Site Name” menu. `$wp_admin_bar` [WP\_Admin\_Bar](../classes/wp_admin_bar) Required The [WP\_Admin\_Bar](../classes/wp_admin_bar) instance. File: `wp-includes/admin-bar.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/admin-bar.php/) ``` function wp_admin_bar_appearance_menu( $wp_admin_bar ) { $wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance', ) ); if ( current_user_can( 'switch_themes' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __( 'Themes' ), 'href' => admin_url( 'themes.php' ), ) ); } if ( ! current_user_can( 'edit_theme_options' ) ) { return; } if ( current_theme_supports( 'widgets' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __( 'Widgets' ), 'href' => admin_url( 'widgets.php' ), ) ); } if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __( 'Menus' ), 'href' => admin_url( 'nav-menus.php' ), ) ); } if ( current_theme_supports( 'custom-background' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'background', 'title' => __( 'Background' ), 'href' => admin_url( 'themes.php?page=custom-background' ), 'meta' => array( 'class' => 'hide-if-customize', ), ) ); } if ( current_theme_supports( 'custom-header' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'header', 'title' => __( 'Header' ), 'href' => admin_url( 'themes.php?page=custom-header' ), 'meta' => array( 'class' => 'hide-if-customize', ), ) ); } } ``` | Uses | Description | | --- | --- | | [WP\_Admin\_Bar::add\_group()](../classes/wp_admin_bar/add_group) wp-includes/class-wp-admin-bar.php | Adds a group to a toolbar menu node. | | [WP\_Admin\_Bar::add\_node()](../classes/wp_admin_bar/add_node) wp-includes/class-wp-admin-bar.php | Adds a node to the menu. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. | | Used By | Description | | --- | --- | | [wp\_admin\_bar\_site\_menu()](wp_admin_bar_site_menu) wp-includes/admin-bar.php | Adds the “Site Name” menu. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
programming_docs
wordpress sanitize_trackback_urls( string $to_ping ): string sanitize\_trackback\_urls( string $to\_ping ): string ===================================================== Sanitizes space or carriage return separated URLs that are used to send trackbacks. `$to_ping` string Required Space or carriage return separated URLs string URLs starting with the http or https protocol, separated by a carriage return. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function sanitize_trackback_urls( $to_ping ) { $urls_to_ping = preg_split( '/[\r\n\t ]/', trim( $to_ping ), -1, PREG_SPLIT_NO_EMPTY ); foreach ( $urls_to_ping as $k => $url ) { if ( ! preg_match( '#^https?://.#i', $url ) ) { unset( $urls_to_ping[ $k ] ); } } $urls_to_ping = array_map( 'sanitize_url', $urls_to_ping ); $urls_to_ping = implode( "\n", $urls_to_ping ); /** * Filters a list of trackback URLs following sanitization. * * The string returned here consists of a space or carriage return-delimited list * of trackback URLs. * * @since 3.4.0 * * @param string $urls_to_ping Sanitized space or carriage return separated URLs. * @param string $to_ping Space or carriage return separated URLs before sanitization. */ return apply_filters( 'sanitize_trackback_urls', $urls_to_ping, $to_ping ); } ``` [apply\_filters( 'sanitize\_trackback\_urls', string $urls\_to\_ping, string $to\_ping )](../hooks/sanitize_trackback_urls) Filters a list of trackback URLs following sanitization. | 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\_to\_ping()](get_to_ping) wp-includes/post.php | Retrieves URLs that need to be pinged. | | [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 the_date_xml() the\_date\_xml() ================ Outputs the date in iso8601 format for xml files. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function the_date_xml() { echo mysql2date( 'Y-m-d', get_post()->post_date, false ); } ``` | Uses | Description | | --- | --- | | [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Version | Description | | --- | --- | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. | wordpress upload_is_user_over_quota( bool $display_message = true ): bool upload\_is\_user\_over\_quota( bool $display\_message = true ): bool ==================================================================== Check whether a site has used its allotted upload space. `$display_message` bool Optional If set to true and the quota is exceeded, a warning message is displayed. Default: `true` bool True if user is over upload space quota, otherwise false. File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/) ``` function upload_is_user_over_quota( $display_message = true ) { if ( get_site_option( 'upload_space_check_disabled' ) ) { return false; } $space_allowed = get_space_allowed(); if ( ! is_numeric( $space_allowed ) ) { $space_allowed = 10; // Default space allowed is 10 MB. } $space_used = get_space_used(); if ( ( $space_allowed - $space_used ) < 0 ) { if ( $display_message ) { printf( /* translators: %s: Allowed space allocation. */ __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ), size_format( $space_allowed * MB_IN_BYTES ) ); } return true; } else { return false; } } ``` | Uses | Description | | --- | --- | | [size\_format()](size_format) wp-includes/functions.php | Converts a number of bytes to the largest unit the bytes will fit into. | | [get\_space\_allowed()](get_space_allowed) wp-includes/ms-functions.php | Returns the upload quota for the current blog. | | [get\_space\_used()](get_space_used) wp-includes/ms-functions.php | Returns the space used by the current site. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [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. | | [WP\_Importer::is\_user\_over\_quota()](../classes/wp_importer/is_user_over_quota) wp-admin/includes/class-wp-importer.php | Check if user has exceeded disk quota | | [wp\_xmlrpc\_server::mw\_newMediaObject()](../classes/wp_xmlrpc_server/mw_newmediaobject) wp-includes/class-wp-xmlrpc-server.php | Uploads a file, following your settings. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress type_url_form_video(): string type\_url\_form\_video(): 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 a video 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_video() { _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('video')" ); return wp_media_insert_url_form( 'video' ); } ``` | 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 get_author_link( bool $display, int $author_id, string $author_nicename = '' ): string|null get\_author\_link( bool $display, int $author\_id, string $author\_nicename = '' ): string|null =============================================================================================== This function has been deprecated. Use [get\_author\_posts\_url()](get_author_posts_url) instead. Returns or Prints link to the author’s posts. * [get\_author\_posts\_url()](get_author_posts_url) `$display` bool Required `$author_id` int Required `$author_nicename` string Optional Default: `''` string|null File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_author_link($display, $author_id, $author_nicename = '') { _deprecated_function( __FUNCTION__, '2.1.0', 'get_author_posts_url()' ); $link = get_author_posts_url($author_id, $author_nicename); if ( $display ) echo $link; return $link; } ``` | Uses | Description | | --- | --- | | [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. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [get\_author\_posts\_url()](get_author_posts_url) | | [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. | wordpress get_editable_roles(): array[] get\_editable\_roles(): array[] =============================== Fetch a filtered list of user roles that the current user is allowed to edit. Simple function whose main purpose is to allow filtering of the list of roles in the $wp\_roles object so that plugins can remove inappropriate ones depending on the situation or user making edits. Specifically because without filtering anyone with the edit\_users capability can edit others to be administrators, even if they are only editors or authors. This filter allows admins to delegate user management. array[] Array of arrays containing role information. * Which roles a user can assign are determined by passing all roles through the [`editable_roles`](../hooks/editable_roles "Plugin API/Filter Reference/editable roles") filter. * The file that defines this function (`wp-admin/includes/user.php`) is only loaded in the admin sections. File: `wp-admin/includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/user.php/) ``` function get_editable_roles() { $all_roles = wp_roles()->roles; /** * Filters the list of editable roles. * * @since 2.8.0 * * @param array[] $all_roles Array of arrays containing role information. */ $editable_roles = apply_filters( 'editable_roles', $all_roles ); return $editable_roles; } ``` [apply\_filters( 'editable\_roles', array[] $all\_roles )](../hooks/editable_roles) Filters the list of editable roles. | Uses | Description | | --- | --- | | [wp\_roles()](wp_roles) wp-includes/capabilities.php | Retrieves the global [WP\_Roles](../classes/wp_roles) instance and instantiates it if necessary. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [WP\_REST\_Users\_Controller::check\_role\_update()](../classes/wp_rest_users_controller/check_role_update) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Determines if the current user is allowed to make the desired roles change. | | [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST | | [wp\_dropdown\_roles()](wp_dropdown_roles) wp-admin/includes/template.php | Prints out option HTML elements for role selectors. | | [admin\_created\_user\_email()](admin_created_user_email) wp-admin/includes/user.php | | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress wp_initialize_site( int|WP_Site $site_id, array $args = array() ): true|WP_Error wp\_initialize\_site( int|WP\_Site $site\_id, array $args = array() ): true|WP\_Error ===================================================================================== Runs the initialization routine for a given site. This process includes creating the site’s database tables and populating them with defaults. `$site_id` int|[WP\_Site](../classes/wp_site) Required Site ID or object. `$args` array Optional Arguments to modify the initialization behavior. * `user_id`intRequired. User ID for the site administrator. * `title`stringSite title. Default is 'Site %d' where %d is the site ID. * `options`arrayCustom option $key => $value pairs to use. * `meta`arrayCustom site metadata $key => $value pairs to use. Default: `array()` true|[WP\_Error](../classes/wp_error) True on success, or error object on failure. File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/) ``` function wp_initialize_site( $site_id, array $args = array() ) { global $wpdb, $wp_roles; if ( empty( $site_id ) ) { return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) ); } $site = get_site( $site_id ); if ( ! $site ) { return new WP_Error( 'site_invalid_id', __( 'Site with the ID does not exist.' ) ); } if ( wp_is_site_initialized( $site ) ) { return new WP_Error( 'site_already_initialized', __( 'The site appears to be already initialized.' ) ); } $network = get_network( $site->network_id ); if ( ! $network ) { $network = get_network(); } $args = wp_parse_args( $args, array( 'user_id' => 0, /* translators: %d: Site ID. */ 'title' => sprintf( __( 'Site %d' ), $site->id ), 'options' => array(), 'meta' => array(), ) ); /** * Filters the arguments for initializing a site. * * @since 5.1.0 * * @param array $args Arguments to modify the initialization behavior. * @param WP_Site $site Site that is being initialized. * @param WP_Network $network Network that the site belongs to. */ $args = apply_filters( 'wp_initialize_site_args', $args, $site, $network ); $orig_installing = wp_installing(); if ( ! $orig_installing ) { wp_installing( true ); } $switch = false; if ( get_current_blog_id() !== $site->id ) { $switch = true; switch_to_blog( $site->id ); } require_once ABSPATH . 'wp-admin/includes/upgrade.php'; // Set up the database tables. make_db_current_silent( 'blog' ); $home_scheme = 'http'; $siteurl_scheme = 'http'; if ( ! is_subdomain_install() ) { if ( 'https' === parse_url( get_home_url( $network->site_id ), PHP_URL_SCHEME ) ) { $home_scheme = 'https'; } if ( 'https' === parse_url( get_network_option( $network->id, 'siteurl' ), PHP_URL_SCHEME ) ) { $siteurl_scheme = 'https'; } } // Populate the site's options. populate_options( array_merge( array( 'home' => untrailingslashit( $home_scheme . '://' . $site->domain . $site->path ), 'siteurl' => untrailingslashit( $siteurl_scheme . '://' . $site->domain . $site->path ), 'blogname' => wp_unslash( $args['title'] ), 'admin_email' => '', 'upload_path' => get_network_option( $network->id, 'ms_files_rewriting' ) ? UPLOADBLOGSDIR . "/{$site->id}/files" : get_blog_option( $network->site_id, 'upload_path' ), 'blog_public' => (int) $site->public, 'WPLANG' => get_network_option( $network->id, 'WPLANG' ), ), $args['options'] ) ); // Clean blog cache after populating options. clean_blog_cache( $site ); // Populate the site's roles. populate_roles(); $wp_roles = new WP_Roles(); // Populate metadata for the site. populate_site_meta( $site->id, $args['meta'] ); // Remove all permissions that may exist for the site. $table_prefix = $wpdb->get_blog_prefix(); delete_metadata( 'user', 0, $table_prefix . 'user_level', null, true ); // Delete all. delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); // Delete all. // Install default site content. wp_install_defaults( $args['user_id'] ); // Set the site administrator. add_user_to_blog( $site->id, $args['user_id'], 'administrator' ); if ( ! user_can( $args['user_id'], 'manage_network' ) && ! get_user_meta( $args['user_id'], 'primary_blog', true ) ) { update_user_meta( $args['user_id'], 'primary_blog', $site->id ); } if ( $switch ) { restore_current_blog(); } wp_installing( $orig_installing ); return true; } ``` [apply\_filters( 'wp\_initialize\_site\_args', array $args, WP\_Site $site, WP\_Network $network )](../hooks/wp_initialize_site_args) Filters the arguments for initializing a site. | Uses | Description | | --- | --- | | [wp\_is\_site\_initialized()](wp_is_site_initialized) wp-includes/ms-site.php | Checks whether a site is initialized. | | [wpdb::get\_blog\_prefix()](../classes/wpdb/get_blog_prefix) wp-includes/class-wpdb.php | Gets blog prefix. | | [is\_subdomain\_install()](is_subdomain_install) wp-includes/ms-load.php | Whether a subdomain configuration is enabled. | | [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. | | [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. | | [get\_user\_meta()](get_user_meta) wp-includes/user.php | Retrieves user meta field for a user. | | [get\_blog\_option()](get_blog_option) wp-includes/ms-blogs.php | Retrieve option value for a given blog id based on name of option. | | [get\_home\_url()](get_home_url) wp-includes/link-template.php | Retrieves the URL for a given site where the front end is accessible. | | [clean\_blog\_cache()](clean_blog_cache) wp-includes/ms-site.php | Clean the blog cache | | [populate\_site\_meta()](populate_site_meta) wp-admin/includes/schema.php | Creates WordPress site meta and sets the default values. | | [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. | | [delete\_metadata()](delete_metadata) wp-includes/meta.php | Deletes metadata for the specified object. | | [restore\_current\_blog()](restore_current_blog) wp-includes/ms-blogs.php | Restore the current blog, after calling [switch\_to\_blog()](switch_to_blog) . | | [WP\_Roles::\_\_construct()](../classes/wp_roles/__construct) wp-includes/class-wp-roles.php | Constructor. | | [user\_can()](user_can) wp-includes/capabilities.php | Returns whether a particular user has the specified capability. | | [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. | | [make\_db\_current\_silent()](make_db_current_silent) wp-admin/includes/upgrade.php | Updates the database tables to a new schema, but without displaying results. | | [populate\_options()](populate_options) wp-admin/includes/schema.php | Create WordPress options and set the default values. | | [populate\_roles()](populate_roles) wp-admin/includes/schema.php | Execute WordPress role creation for the various WordPress versions. | | [get\_network\_option()](get_network_option) wp-includes/option.php | Retrieves a network’s option value based on the option name. | | [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. | | [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. | | [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. | | [switch\_to\_blog()](switch_to_blog) wp-includes/ms-blogs.php | Switch the current blog. | | [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Version | Description | | --- | --- | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. | wordpress get_post_embed_html( int $width, int $height, int|WP_Post $post = null ): string|false get\_post\_embed\_html( int $width, int $height, int|WP\_Post $post = null ): string|false ========================================================================================== Retrieves the embed code for a specific post. `$width` int Required The width for the response. `$height` int Required The height for the response. `$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or object. Default is global `$post`. Default: `null` string|false Embed code on success, false if post doesn't exist. File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/) ``` function get_post_embed_html( $width, $height, $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $embed_url = get_post_embed_url( $post ); $secret = wp_generate_password( 10, false ); $embed_url .= "#?secret={$secret}"; $output = sprintf( '<blockquote class="wp-embedded-content" data-secret="%1$s"><a href="%2$s">%3$s</a></blockquote>', esc_attr( $secret ), esc_url( get_permalink( $post ) ), get_the_title( $post ) ); $output .= sprintf( '<iframe sandbox="allow-scripts" security="restricted" src="%1$s" width="%2$d" height="%3$d" title="%4$s" data-secret="%5$s" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe>', esc_url( $embed_url ), absint( $width ), absint( $height ), esc_attr( sprintf( /* translators: 1: Post title, 2: Site title. */ __( '&#8220;%1$s&#8221; &#8212; %2$s' ), get_the_title( $post ), get_bloginfo( 'name' ) ) ), esc_attr( $secret ) ); // Note that the script must be placed after the <blockquote> and <iframe> due to a regexp parsing issue in // `wp_filter_oembed_result()`. Because of the regex pattern starts with `|(<blockquote>.*?</blockquote>)?.*|` // wherein the <blockquote> is marked as being optional, if it is not at the beginning of the string then the group // will fail to match and everything will be matched by `.*` and not included in the group. This regex issue goes // back to WordPress 4.4, so in order to not break older installs this script must come at the end. $output .= wp_get_inline_script_tag( file_get_contents( ABSPATH . WPINC . '/js/wp-embed' . wp_scripts_get_suffix() . '.js' ) ); /** * Filters the embed HTML output for a given post. * * @since 4.4.0 * * @param string $output The default iframe tag to display embedded content. * @param WP_Post $post Current post object. * @param int $width Width of the response. * @param int $height Height of the response. */ return apply_filters( 'embed_html', $output, $post, $width, $height ); } ``` [apply\_filters( 'embed\_html', string $output, WP\_Post $post, int $width, int $height )](../hooks/embed_html) Filters the embed HTML output for a given post. | Uses | Description | | --- | --- | | [wp\_get\_inline\_script\_tag()](wp_get_inline_script_tag) wp-includes/script-loader.php | Wraps inline JavaScript 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. | | [get\_post\_embed\_url()](get_post_embed_url) wp-includes/embed.php | Retrieves the URL to embed a specific post in an iframe. | | [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. | | [get\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_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. | | [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Used By | Description | | --- | --- | | [print\_embed\_sharing\_dialog()](print_embed_sharing_dialog) wp-includes/embed.php | Prints the necessary markup for the embed sharing dialog. | | [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. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
programming_docs
wordpress image_hwstring( int|string $width, int|string $height ): string image\_hwstring( int|string $width, int|string $height ): string ================================================================ Retrieves width and height attributes using given width and height values. Both attributes are required in the sense that both parameters must have a value, but are optional in that if you set them to false or null, then they will not be added to the returned string. You can set the value using a string, but it will only take numeric values. If you wish to put ‘px’ after the numbers, then it will be stripped out of the return. `$width` int|string Required Image width in pixels. `$height` int|string Required Image height in pixels. string HTML attributes for width and, or height. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/) ``` function image_hwstring( $width, $height ) { $out = ''; if ( $width ) { $out .= 'width="' . (int) $width . '" '; } if ( $height ) { $out .= 'height="' . (int) $height . '" '; } return $out; } ``` | Used By | Description | | --- | --- | | [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. | | [get\_image\_tag()](get_image_tag) wp-includes/media.php | Gets an img tag for an image attachment, scaling it down if requested. | | [wp\_get\_attachment\_image()](wp_get_attachment_image) wp-includes/media.php | Gets an HTML img element representing an image attachment. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress walk_page_tree( array $pages, int $depth, int $current_page, array $args ): string walk\_page\_tree( array $pages, int $depth, int $current\_page, array $args ): string ===================================================================================== Retrieves HTML list content for page list. `$pages` array Required `$depth` int Required `$current_page` int Required `$args` array Required string File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/) ``` function walk_page_tree( $pages, $depth, $current_page, $args ) { if ( empty( $args['walker'] ) ) { $walker = new Walker_Page; } else { /** * @var Walker $walker */ $walker = $args['walker']; } foreach ( (array) $pages as $page ) { if ( $page->post_parent ) { $args['pages_with_children'][ $page->post_parent ] = true; } } return $walker->walk( $pages, $depth, $args, $current_page ); } ``` | Uses | Description | | --- | --- | | [Walker::walk()](../classes/walker/walk) wp-includes/class-wp-walker.php | Displays array of elements hierarchically. | | Used By | Description | | --- | --- | | [wp\_list\_pages()](wp_list_pages) wp-includes/post-template.php | Retrieves or displays a list of pages (or hierarchical post type items) in list (li) format. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress debug_fwrite( mixed $fp, string $message ) debug\_fwrite( mixed $fp, string $message ) =========================================== This function has been deprecated. Use [error\_log()](https://www.php.net/manual/en/function.error-log.php) instead. Write contents to the file used for debugging. * [error\_log()](https://www.php.net/manual/en/function.error-log.php) `$fp` mixed Required Unused. `$message` string Required Message to log. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function debug_fwrite( $fp, $message ) { _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); if ( ! empty( $GLOBALS['debug'] ) ) error_log( $message ); } ``` | 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 set_theme_mod( string $name, mixed $value ): bool set\_theme\_mod( string $name, mixed $value ): bool =================================================== Updates theme modification value for the active theme. `$name` string Required Theme modification name. `$value` mixed Required Theme modification value. bool True if the value was updated, false otherwise. File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/) ``` function set_theme_mod( $name, $value ) { $mods = get_theme_mods(); $old_value = isset( $mods[ $name ] ) ? $mods[ $name ] : false; /** * Filters the theme modification, or 'theme_mod', value on save. * * The dynamic portion of the hook name, `$name`, refers to the key name * of the modification array. For example, 'header_textcolor', 'header_image', * and so on depending on the theme options. * * @since 3.9.0 * * @param mixed $value The new value of the theme modification. * @param mixed $old_value The current value of the theme modification. */ $mods[ $name ] = apply_filters( "pre_set_theme_mod_{$name}", $value, $old_value ); $theme = get_option( 'stylesheet' ); return update_option( "theme_mods_$theme", $mods ); } ``` [apply\_filters( "pre\_set\_theme\_mod\_{$name}", mixed $value, mixed $old\_value )](../hooks/pre_set_theme_mod_name) Filters the theme modification, or ‘theme\_mod’, value on save. | Uses | Description | | --- | --- | | [get\_theme\_mods()](get_theme_mods) wp-includes/theme.php | Retrieves all theme modifications. | | [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. | | 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\_menus\_changed()](_wp_menus_changed) wp-includes/nav-menu.php | Handles menu config after theme change. | | [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\_Customize\_Custom\_CSS\_Setting::update()](../classes/wp_customize_custom_css_setting/update) wp-includes/customize/class-wp-customize-custom-css-setting.php | Store the CSS setting value in the custom\_css custom post type for the stylesheet. | | [WP\_Customize\_Setting::set\_root\_value()](../classes/wp_customize_setting/set_root_value) wp-includes/class-wp-customize-setting.php | Set the root value for a setting, especially for multidimensional ones. | | [wp\_ajax\_menu\_locations\_save()](wp_ajax_menu_locations_save) wp-admin/includes/ajax-actions.php | Ajax handler for menu locations save. | | [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::reset\_header\_image()](../classes/custom_image_header/reset_header_image) wp-admin/includes/class-custom-image-header.php | Reset a header image to the default image for the theme. | | [Custom\_Image\_Header::take\_action()](../classes/custom_image_header/take_action) wp-admin/includes/class-custom-image-header.php | Execute custom header modification. | | [Custom\_Background::wp\_set\_background\_image()](../classes/custom_background/wp_set_background_image) wp-admin/includes/class-custom-background.php | | | [Custom\_Background::take\_action()](../classes/custom_background/take_action) wp-admin/includes/class-custom-background.php | Executes custom background modification. | | [Custom\_Background::handle\_upload()](../classes/custom_background/handle_upload) wp-admin/includes/class-custom-background.php | Handles an Image upload for the background image. | | [switch\_theme()](switch_theme) wp-includes/theme.php | Switches the theme. | | [wp\_delete\_nav\_menu()](wp_delete_nav_menu) wp-includes/nav-menu.php | Deletes a navigation menu. | | Version | Description | | --- | --- | | [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | A return value was added. | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress wp_get_scheduled_event( string $hook, array $args = array(), int|null $timestamp = null ): object|false wp\_get\_scheduled\_event( string $hook, array $args = array(), int|null $timestamp = null ): object|false ========================================================================================================== Retrieve a scheduled event. Retrieve the full event object for a given event, if no timestamp is specified the next scheduled event is returned. `$hook` string Required Action hook of the event. `$args` array Optional Array containing each separate argument to pass to the hook's callback function. Although not passed to a callback, these arguments are used to uniquely identify the event, so they should be the same as those used when originally scheduling the event. Default: `array()` `$timestamp` int|null Optional Unix timestamp (UTC) of the event. If not specified, the next scheduled event is returned. Default: `null` object|false The event object. False if the event does not exist. File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/) ``` function wp_get_scheduled_event( $hook, $args = array(), $timestamp = null ) { /** * Filter to preflight or hijack retrieving a scheduled event. * * Returning a non-null value will short-circuit the normal process, * returning the filtered value instead. * * Return false if the event does not exist, otherwise an event object * should be returned. * * @since 5.1.0 * * @param null|false|object $pre Value to return instead. Default null to continue retrieving the event. * @param string $hook Action hook of the event. * @param array $args Array containing each separate argument to pass to the hook's callback function. * Although not passed to a callback, these arguments are used to uniquely identify * the event. * @param int|null $timestamp Unix timestamp (UTC) of the event. Null to retrieve next scheduled event. */ $pre = apply_filters( 'pre_get_scheduled_event', null, $hook, $args, $timestamp ); if ( null !== $pre ) { return $pre; } if ( null !== $timestamp && ! is_numeric( $timestamp ) ) { return false; } $crons = _get_cron_array(); if ( empty( $crons ) ) { return false; } $key = md5( serialize( $args ) ); if ( ! $timestamp ) { // Get next event. $next = false; foreach ( $crons as $timestamp => $cron ) { if ( isset( $cron[ $hook ][ $key ] ) ) { $next = $timestamp; break; } } if ( ! $next ) { return false; } $timestamp = $next; } elseif ( ! isset( $crons[ $timestamp ][ $hook ][ $key ] ) ) { return false; } $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $crons[ $timestamp ][ $hook ][ $key ]['schedule'], 'args' => $args, ); if ( isset( $crons[ $timestamp ][ $hook ][ $key ]['interval'] ) ) { $event->interval = $crons[ $timestamp ][ $hook ][ $key ]['interval']; } return $event; } ``` [apply\_filters( 'pre\_get\_scheduled\_event', null|false|object $pre, string $hook, array $args, int|null $timestamp )](../hooks/pre_get_scheduled_event) Filter to preflight or hijack retrieving a scheduled event. | Uses | Description | | --- | --- | | [\_get\_cron\_array()](_get_cron_array) wp-includes/cron.php | Retrieve cron info array option. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [wp\_reschedule\_event()](wp_reschedule_event) wp-includes/cron.php | Reschedules a recurring event. | | [wp\_next\_scheduled()](wp_next_scheduled) wp-includes/cron.php | Retrieve the next timestamp for an event. | | [wp\_get\_schedule()](wp_get_schedule) wp-includes/cron.php | Retrieve the recurrence schedule for an event. | | Version | Description | | --- | --- | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. | wordpress do_shortcode( string $content, bool $ignore_html = false ): string do\_shortcode( string $content, bool $ignore\_html = false ): string ==================================================================== Searches content for shortcodes and filter shortcodes through their hooks. If there are no shortcode tags defined, then the content will be returned without any filtering. This might cause issues when plugins are disabled but the shortcode will still show up in the post or content. `$content` string Required Content to search for shortcodes. `$ignore_html` bool Optional When true, shortcodes inside HTML elements will be skipped. Default: `false` string Content with shortcodes filtered out. If there are no shortcode tags defined, then the content will be returned without any filtering. This might cause issues if a plugin is disabled as its shortcode will still show up in the post or content. File: `wp-includes/shortcodes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/shortcodes.php/) ``` function do_shortcode( $content, $ignore_html = false ) { global $shortcode_tags; if ( false === strpos( $content, '[' ) ) { return $content; } if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) { return $content; } // Find all registered tag names in $content. preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches ); $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] ); if ( empty( $tagnames ) ) { return $content; } $content = do_shortcodes_in_html_tags( $content, $ignore_html, $tagnames ); $pattern = get_shortcode_regex( $tagnames ); $content = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $content ); // Always restore square braces so we don't break things like <!--[if IE ]>. $content = unescape_invalid_shortcodes( $content ); return $content; } ``` | Uses | Description | | --- | --- | | [do\_shortcodes\_in\_html\_tags()](do_shortcodes_in_html_tags) wp-includes/shortcodes.php | Searches only inside HTML elements for shortcodes and process them. | | [unescape\_invalid\_shortcodes()](unescape_invalid_shortcodes) wp-includes/shortcodes.php | Removes placeholders added by [do\_shortcodes\_in\_html\_tags()](do_shortcodes_in_html_tags) . | | [get\_shortcode\_regex()](get_shortcode_regex) wp-includes/shortcodes.php | Retrieves the shortcode regular expression for searching. | | 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. | | [apply\_shortcodes()](apply_shortcodes) wp-includes/shortcodes.php | Searches content for shortcodes and filter shortcodes through their hooks. | | [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\_Widget\_Text::widget()](../classes/wp_widget_text/widget) wp-includes/widgets/class-wp-widget-text.php | Outputs the content for the current Text widget instance. | | [WP\_Embed::run\_shortcode()](../classes/wp_embed/run_shortcode) wp-includes/class-wp-embed.php | Processes the [embed] shortcode. | | [img\_caption\_shortcode()](img_caption_shortcode) wp-includes/media.php | Builds the Caption shortcode output. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress ms_site_check(): true|string ms\_site\_check(): true|string ============================== Checks status of current blog. Checks if the blog is deleted, inactive, archived, or spammed. Dies with a default message if the blog does not pass the check. To change the default message when a blog does not pass the check, use the wp-content/blog-deleted.php, blog-inactive.php and blog-suspended.php drop-ins. true|string Returns true on success, or drop-in file to include. File: `wp-includes/ms-load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-load.php/) ``` function ms_site_check() { /** * Filters checking the status of the current blog. * * @since 3.0.0 * * @param bool|null $check Whether to skip the blog status check. Default null. */ $check = apply_filters( 'ms_site_check', null ); if ( null !== $check ) { return true; } // Allow super admins to see blocked sites. if ( is_super_admin() ) { return true; } $blog = get_site(); if ( '1' == $blog->deleted ) { if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) { return WP_CONTENT_DIR . '/blog-deleted.php'; } else { wp_die( __( 'This site is no longer available.' ), '', array( 'response' => 410 ) ); } } if ( '2' == $blog->deleted ) { if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) ) { return WP_CONTENT_DIR . '/blog-inactive.php'; } else { $admin_email = str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_network()->domain ) ); wp_die( sprintf( /* translators: %s: Admin email link. */ __( 'This site has not been activated yet. If you are having problems activating your site, please contact %s.' ), sprintf( '<a href="mailto:%1$s">%1$s</a>', $admin_email ) ) ); } } if ( '1' == $blog->archived || '1' == $blog->spam ) { if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) { return WP_CONTENT_DIR . '/blog-suspended.php'; } else { wp_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) ); } } return true; } ``` [apply\_filters( 'ms\_site\_check', bool|null $check )](../hooks/ms_site_check) Filters checking the status of the current blog. | Uses | Description | | --- | --- | | [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. | | [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. | | [is\_super\_admin()](is_super_admin) wp-includes/capabilities.php | Determines whether user is a site admin. | | [\_\_()](__) 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. | | [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 | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
programming_docs
wordpress wp_update_term( int $term_id, string $taxonomy, array $args = array() ): array|WP_Error wp\_update\_term( int $term\_id, string $taxonomy, array $args = array() ): array|WP\_Error =========================================================================================== Updates term based on arguments provided. The `$args` will indiscriminately override all values with the same field name. Care must be taken to not override important information need to update or update will fail (or perhaps create a new term, neither would be acceptable). Defaults will set ‘alias\_of’, ‘description’, ‘parent’, and ‘slug’ if not defined in `$args` already. ‘alias\_of’ will create a term group, if it doesn’t already exist, and update it for the `$term`. If the ‘slug’ argument in `$args` is missing, then the ‘name’ will be used. If you set ‘slug’ and it isn’t unique, then a [WP\_Error](../classes/wp_error) is returned. If you don’t pass any slug, then a unique one will be created. `$term_id` int Required The ID of the term. `$taxonomy` string Required The taxonomy of the term. `$args` array Optional Array of arguments for updating a term. * `alias_of`stringSlug of the term to make this term an alias of. Default empty string. Accepts a term slug. * `description`stringThe term description. Default empty string. * `parent`intThe id of the parent term. Default 0. * `slug`stringThe term slug to use. Default empty string. Default: `array()` array|[WP\_Error](../classes/wp_error) An array containing the `term_id` and `term_taxonomy_id`, [WP\_Error](../classes/wp_error) otherwise. Any of the following $args will be updated on the term: * name * slug * term\_group * description * parent * alias\_of (see above) File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/) ``` function wp_update_term( $term_id, $taxonomy, $args = array() ) { global $wpdb; if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } $term_id = (int) $term_id; // First, get all of the original args. $term = get_term( $term_id, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } if ( ! $term ) { return new WP_Error( 'invalid_term', __( 'Empty Term.' ) ); } $term = (array) $term->data; // Escape data pulled from DB. $term = wp_slash( $term ); // Merge old and new args with new args overwriting old ones. $args = array_merge( $term, $args ); $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '', ); $args = wp_parse_args( $args, $defaults ); $args = sanitize_term( $args, $taxonomy, 'db' ); $parsed_args = $args; // expected_slashed ($name) $name = wp_unslash( $args['name'] ); $description = wp_unslash( $args['description'] ); $parsed_args['name'] = $name; $parsed_args['description'] = $description; if ( '' === trim( $name ) ) { return new WP_Error( 'empty_term_name', __( 'A name is required for this term.' ) ); } if ( (int) $parsed_args['parent'] > 0 && ! term_exists( (int) $parsed_args['parent'] ) ) { return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) ); } $empty_slug = false; if ( empty( $args['slug'] ) ) { $empty_slug = true; $slug = sanitize_title( $name ); } else { $slug = $args['slug']; } $parsed_args['slug'] = $slug; $term_group = isset( $parsed_args['term_group'] ) ? $parsed_args['term_group'] : 0; if ( $args['alias_of'] ) { $alias = get_term_by( 'slug', $args['alias_of'], $taxonomy ); if ( ! empty( $alias->term_group ) ) { // The alias we want is already in a group, so let's use that one. $term_group = $alias->term_group; } elseif ( ! empty( $alias->term_id ) ) { /* * The alias is not in a group, so we create a new one * and add the alias to it. */ $term_group = $wpdb->get_var( "SELECT MAX(term_group) FROM $wpdb->terms" ) + 1; wp_update_term( $alias->term_id, $taxonomy, array( 'term_group' => $term_group, ) ); } $parsed_args['term_group'] = $term_group; } /** * Filters the term parent. * * Hook to this filter to see if it will cause a hierarchy loop. * * @since 3.1.0 * * @param int $parent ID of the parent term. * @param int $term_id Term ID. * @param string $taxonomy Taxonomy slug. * @param array $parsed_args An array of potentially altered update arguments for the given term. * @param array $args Arguments passed to wp_update_term(). */ $parent = (int) apply_filters( 'wp_update_term_parent', $args['parent'], $term_id, $taxonomy, $parsed_args, $args ); // Check for duplicate slug. $duplicate = get_term_by( 'slug', $slug, $taxonomy ); if ( $duplicate && $duplicate->term_id !== $term_id ) { // If an empty slug was passed or the parent changed, reset the slug to something unique. // Otherwise, bail. if ( $empty_slug || ( $parent !== (int) $term['parent'] ) ) { $slug = wp_unique_term_slug( $slug, (object) $args ); } else { /* translators: %s: Taxonomy term slug. */ return new WP_Error( 'duplicate_term_slug', sprintf( __( 'The slug &#8220;%s&#8221; is already in use by another term.' ), $slug ) ); } } $tt_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id ) ); // Check whether this is a shared term that needs splitting. $_term_id = _split_shared_term( $term_id, $tt_id ); if ( ! is_wp_error( $_term_id ) ) { $term_id = $_term_id; } /** * Fires immediately before the given terms are edited. * * @since 2.9.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $term_id Term ID. * @param string $taxonomy Taxonomy slug. * @param array $args Arguments passed to wp_update_term(). */ do_action( 'edit_terms', $term_id, $taxonomy, $args ); $data = compact( 'name', 'slug', 'term_group' ); /** * Filters term data before it is updated in the database. * * @since 4.7.0 * * @param array $data Term data to be updated. * @param int $term_id Term ID. * @param string $taxonomy Taxonomy slug. * @param array $args Arguments passed to wp_update_term(). */ $data = apply_filters( 'wp_update_term_data', $data, $term_id, $taxonomy, $args ); $wpdb->update( $wpdb->terms, $data, compact( 'term_id' ) ); if ( empty( $slug ) ) { $slug = sanitize_title( $name, $term_id ); $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); } /** * Fires immediately after a term is updated in the database, but before its * term-taxonomy relationship is updated. * * @since 2.9.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $term_id Term ID. * @param string $taxonomy Taxonomy slug. * @param array $args Arguments passed to wp_update_term(). */ do_action( 'edited_terms', $term_id, $taxonomy, $args ); /** * Fires immediate before a term-taxonomy relationship is updated. * * @since 2.9.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $tt_id Term taxonomy ID. * @param string $taxonomy Taxonomy slug. * @param array $args Arguments passed to wp_update_term(). */ do_action( 'edit_term_taxonomy', $tt_id, $taxonomy, $args ); $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) ); /** * Fires immediately after a term-taxonomy relationship is updated. * * @since 2.9.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $tt_id Term taxonomy ID. * @param string $taxonomy Taxonomy slug. * @param array $args Arguments passed to wp_update_term(). */ do_action( 'edited_term_taxonomy', $tt_id, $taxonomy, $args ); /** * Fires after a term has been updated, but before the term cache has been cleaned. * * The {@see 'edit_$taxonomy'} hook is also available for targeting a specific * taxonomy. * * @since 2.3.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $term_id Term ID. * @param int $tt_id Term taxonomy ID. * @param string $taxonomy Taxonomy slug. * @param array $args Arguments passed to wp_update_term(). */ do_action( 'edit_term', $term_id, $tt_id, $taxonomy, $args ); /** * Fires after a term in a specific taxonomy has been updated, but before the term * cache has been cleaned. * * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. * * Possible hook names include: * * - `edit_category` * - `edit_post_tag` * * @since 2.3.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $term_id Term ID. * @param int $tt_id Term taxonomy ID. * @param array $args Arguments passed to wp_update_term(). */ do_action( "edit_{$taxonomy}", $term_id, $tt_id, $args ); /** This filter is documented in wp-includes/taxonomy.php */ $term_id = apply_filters( 'term_id_filter', $term_id, $tt_id ); clean_term_cache( $term_id, $taxonomy ); /** * Fires after a term has been updated, and the term cache has been cleaned. * * The {@see 'edited_$taxonomy'} hook is also available for targeting a specific * taxonomy. * * @since 2.3.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $term_id Term ID. * @param int $tt_id Term taxonomy ID. * @param string $taxonomy Taxonomy slug. * @param array $args Arguments passed to wp_update_term(). */ do_action( 'edited_term', $term_id, $tt_id, $taxonomy, $args ); /** * Fires after a term for a specific taxonomy has been updated, and the term * cache has been cleaned. * * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. * * Possible hook names include: * * - `edited_category` * - `edited_post_tag` * * @since 2.3.0 * @since 6.1.0 The `$args` parameter was added. * * @param int $term_id Term ID. * @param int $tt_id Term taxonomy ID. * @param array $args Arguments passed to wp_update_term(). */ do_action( "edited_{$taxonomy}", $term_id, $tt_id, $args ); /** This action is documented in wp-includes/taxonomy.php */ do_action( 'saved_term', $term_id, $tt_id, $taxonomy, true, $args ); /** This action is documented in wp-includes/taxonomy.php */ do_action( "saved_{$taxonomy}", $term_id, $tt_id, true, $args ); return array( 'term_id' => $term_id, 'term_taxonomy_id' => $tt_id, ); } ``` [do\_action( 'edited\_term', int $term\_id, int $tt\_id, string $taxonomy, array $args )](../hooks/edited_term) Fires after a term has been updated, and the term cache has been cleaned. [do\_action( 'edited\_terms', int $term\_id, string $taxonomy, array $args )](../hooks/edited_terms) Fires immediately after a term is updated in the database, but before its term-taxonomy relationship is updated. [do\_action( 'edited\_term\_taxonomy', int $tt\_id, string $taxonomy, array $args )](../hooks/edited_term_taxonomy) Fires immediately after a term-taxonomy relationship is updated. [do\_action( "edited\_{$taxonomy}", int $term\_id, int $tt\_id, array $args )](../hooks/edited_taxonomy) Fires after a term for a specific taxonomy has been updated, and the term cache has been cleaned. [do\_action( 'edit\_term', int $term\_id, int $tt\_id, string $taxonomy, array $args )](../hooks/edit_term) Fires after a term has been updated, but before the term cache has been cleaned. [do\_action( 'edit\_terms', int $term\_id, string $taxonomy, array $args )](../hooks/edit_terms) Fires immediately before the given terms are edited. [do\_action( 'edit\_term\_taxonomy', int $tt\_id, string $taxonomy, array $args )](../hooks/edit_term_taxonomy) Fires immediate before a term-taxonomy relationship is updated. [do\_action( "edit\_{$taxonomy}", int $term\_id, int $tt\_id, array $args )](../hooks/edit_taxonomy) Fires after a term in a specific taxonomy has been updated, but before the term cache has been cleaned. [do\_action( 'saved\_term', int $term\_id, int $tt\_id, string $taxonomy, bool $update, array $args )](../hooks/saved_term) Fires after a term has been saved, and the term cache has been cleared. [do\_action( "saved\_{$taxonomy}", int $term\_id, int $tt\_id, bool $update, array $args )](../hooks/saved_taxonomy) Fires after a term in a specific taxonomy has been saved, and the term cache has been cleared. [apply\_filters( 'term\_id\_filter', int $term\_id, int $tt\_id, array $args )](../hooks/term_id_filter) Filters the term ID after a new term is created. [apply\_filters( 'wp\_update\_term\_data', array $data, int $term\_id, string $taxonomy, array $args )](../hooks/wp_update_term_data) Filters term data before it is updated in the database. [apply\_filters( 'wp\_update\_term\_parent', int $parent, int $term\_id, string $taxonomy, array $parsed\_args, array $args )](../hooks/wp_update_term_parent) Filters the term parent. | Uses | Description | | --- | --- | | [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. | | [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. | | [clean\_term\_cache()](clean_term_cache) wp-includes/taxonomy.php | Removes all of the term IDs from the cache. | | [wp\_update\_term()](wp_update_term) wp-includes/taxonomy.php | Updates term based on arguments provided. | | [wp\_unique\_term\_slug()](wp_unique_term_slug) wp-includes/taxonomy.php | Makes term slug unique, if it isn’t already. | | [sanitize\_term()](sanitize_term) wp-includes/taxonomy.php | Sanitizes all term fields. | | [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. | | [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. | | [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. | | [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. | | [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. | | [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. | | [\_\_()](__) 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\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. | | [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Used By | Description | | --- | --- | | [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\_insert\_category()](wp_insert_category) wp-admin/includes/taxonomy.php | Updates an existing Category or creates a new Category. | | [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\_check\_term\_hierarchy\_for\_loops()](wp_check_term_hierarchy_for_loops) wp-includes/taxonomy.php | Checks the given subset of the term hierarchy for hierarchy loops. | | [wp\_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\_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\_xmlrpc\_server::wp\_editTerm()](../classes/wp_xmlrpc_server/wp_editterm) wp-includes/class-wp-xmlrpc-server.php | Edit a term. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress clean_category_cache( int $id ) clean\_category\_cache( int $id ) ================================= Removes the category cache data based on ID. `$id` int Required Category ID File: `wp-includes/category.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category.php/) ``` function clean_category_cache( $id ) { clean_term_cache( $id, 'category' ); } ``` | Uses | Description | | --- | --- | | [clean\_term\_cache()](clean_term_cache) wp-includes/taxonomy.php | Removes all of the term IDs from the cache. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress deactivate_sitewide_plugin( $plugin = false ) deactivate\_sitewide\_plugin( $plugin = false ) =============================================== This function has been deprecated. Use [deactivate\_plugin()](deactivate_plugin) instead. Deprecated functionality for deactivating a network-only plugin. * [deactivate\_plugin()](deactivate_plugin) File: `wp-admin/includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms-deprecated.php/) ``` function deactivate_sitewide_plugin( $plugin = false ) { _deprecated_function( __FUNCTION__, '3.0.0', 'deactivate_plugin()' ); } ``` | Uses | Description | | --- | --- | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress newuser_notify_siteadmin( int $user_id ): bool newuser\_notify\_siteadmin( int $user\_id ): bool ================================================= Notifies the network admin that a new user has been activated. Filter [‘newuser\_notify\_siteadmin’](../hooks/newuser_notify_siteadmin) to change the content of the notification email. `$user_id` int Required The new user's ID. bool File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/) ``` function newuser_notify_siteadmin( $user_id ) { if ( 'yes' !== get_site_option( 'registrationnotification' ) ) { return false; } $email = get_site_option( 'admin_email' ); if ( is_email( $email ) == false ) { return false; } $user = get_userdata( $user_id ); $options_site_url = esc_url( network_admin_url( 'settings.php' ) ); $msg = sprintf( /* translators: New user notification email. 1: User login, 2: User IP address, 3: URL to Network Settings screen. */ __( 'New User: %1$s Remote IP address: %2$s Disable these notifications: %3$s' ), $user->user_login, wp_unslash( $_SERVER['REMOTE_ADDR'] ), $options_site_url ); /** * Filters the message body of the new user activation email sent * to the network administrator. * * @since MU (3.0.0) * * @param string $msg Email body. * @param WP_User $user WP_User instance of the new user. */ $msg = apply_filters( 'newuser_notify_siteadmin', $msg, $user ); /* translators: New user notification email subject. %s: User login. */ wp_mail( $email, sprintf( __( 'New User Registration: %s' ), $user->user_login ), $msg ); return true; } ``` [apply\_filters( 'newuser\_notify\_siteadmin', string $msg, WP\_User $user )](../hooks/newuser_notify_siteadmin) Filters the message body of the new user 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. | | [\_\_()](__) 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. | | [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
programming_docs
wordpress language_attributes( string $doctype = 'html' ) language\_attributes( string $doctype = 'html' ) ================================================ Displays the language attributes for the ‘html’ tag. Builds up a set of HTML attributes containing the text direction and language information for the page. `$doctype` string Optional The type of HTML document. Accepts `'xhtml'` or `'html'`. Default `'html'`. Default: `'html'` File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function language_attributes( $doctype = 'html' ) { echo get_language_attributes( $doctype ); } ``` | Uses | Description | | --- | --- | | [get\_language\_attributes()](get_language_attributes) wp-includes/general-template.php | Gets the language attributes for the ‘html’ tag. | | Used By | Description | | --- | --- | | [WP\_REST\_Widget\_Types\_Controller::render\_legacy\_widget\_preview\_iframe()](../classes/wp_rest_widget_types_controller/render_legacy_widget_preview_iframe) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Renders a page containing a preview of the requested Legacy Widget block. | | [login\_header()](login_header) wp-login.php | Output the login page header. | | [display\_header()](display_header) wp-admin/install.php | Display installation header. | | [\_wp\_admin\_html\_begin()](_wp_admin_html_begin) wp-admin/includes/template.php | Prints out the beginning of the admin HTML header. | | Version | Description | | --- | --- | | [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Converted into a wrapper for [get\_language\_attributes()](get_language_attributes) . | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress has_post_parent( int|WP_Post|null $post = null ): bool has\_post\_parent( int|WP\_Post|null $post = null ): bool ========================================================= Returns whether the given post has a parent 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` bool Whether the post has a parent post. File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/) ``` function has_post_parent( $post = null ) { return (bool) get_post_parent( $post ); } ``` | Uses | Description | | --- | --- | | [get\_post\_parent()](get_post_parent) wp-includes/post-template.php | Retrieves the parent post object for the given post. | | Version | Description | | --- | --- | | [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. | wordpress get_active_blog_for_user( int $user_id ): WP_Site|void get\_active\_blog\_for\_user( int $user\_id ): WP\_Site|void ============================================================ Gets one of a user’s active blogs. Returns the user’s primary blog, if they have one and it is active. If it’s inactive, function returns another active blog of the user. If none are found, the user is added as a Subscriber to the Dashboard Blog and that blog is returned. `$user_id` int Required The unique ID of the user [WP\_Site](../classes/wp_site)|void The blog object File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/) ``` function get_active_blog_for_user( $user_id ) { $blogs = get_blogs_of_user( $user_id ); if ( empty( $blogs ) ) { return; } if ( ! is_multisite() ) { return $blogs[ get_current_blog_id() ]; } $primary_blog = get_user_meta( $user_id, 'primary_blog', true ); $first_blog = current( $blogs ); if ( false !== $primary_blog ) { if ( ! isset( $blogs[ $primary_blog ] ) ) { update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id ); $primary = get_site( $first_blog->userblog_id ); } else { $primary = get_site( $primary_blog ); } } else { // TODO: Review this call to add_user_to_blog too - to get here the user must have a role on this blog? $result = add_user_to_blog( $first_blog->userblog_id, $user_id, 'subscriber' ); if ( ! is_wp_error( $result ) ) { update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id ); $primary = $first_blog; } } if ( ( ! is_object( $primary ) ) || ( 1 == $primary->archived || 1 == $primary->spam || 1 == $primary->deleted ) ) { $blogs = get_blogs_of_user( $user_id, true ); // If a user's primary blog is shut down, check their other blogs. $ret = false; if ( is_array( $blogs ) && count( $blogs ) > 0 ) { foreach ( (array) $blogs as $blog_id => $blog ) { if ( get_current_network_id() != $blog->site_id ) { continue; } $details = get_site( $blog_id ); if ( is_object( $details ) && 0 == $details->archived && 0 == $details->spam && 0 == $details->deleted ) { $ret = $details; if ( get_user_meta( $user_id, 'primary_blog', true ) != $blog_id ) { update_user_meta( $user_id, 'primary_blog', $blog_id ); } if ( ! get_user_meta( $user_id, 'source_domain', true ) ) { update_user_meta( $user_id, 'source_domain', $details->domain ); } break; } } } else { return; } return $ret; } else { return $primary; } } ``` | Uses | Description | | --- | --- | | [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. | | [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. | | [get\_blogs\_of\_user()](get_blogs_of_user) wp-includes/user.php | Gets the sites a user belongs to. | | [get\_user\_meta()](get_user_meta) wp-includes/user.php | Retrieves user meta field for a user. | | [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. | | [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. | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [get\_dashboard\_url()](get_dashboard_url) wp-includes/link-template.php | Retrieves the URL to the user’s dashboard. | | [WP\_Admin\_Bar::initialize()](../classes/wp_admin_bar/initialize) wp-includes/class-wp-admin-bar.php | Initializes the admin bar. | | [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 | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress get_available_post_statuses( string $type = 'post' ): string[] get\_available\_post\_statuses( string $type = 'post' ): string[] ================================================================= Returns all the possible statuses for a post type. `$type` string Optional The post\_type you want the statuses for. Default `'post'`. Default: `'post'` string[] An array of all the statuses for the supplied post type. File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/) ``` function get_available_post_statuses( $type = 'post' ) { $stati = wp_count_posts( $type ); return array_keys( get_object_vars( $stati ) ); } ``` | Uses | Description | | --- | --- | | [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. | | Used By | Description | | --- | --- | | [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. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress add_menu_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', string $icon_url = '', int|float $position = null ): string add\_menu\_page( string $page\_title, string $menu\_title, string $capability, string $menu\_slug, callable $callback = '', string $icon\_url = '', int|float $position = null ): string ======================================================================================================================================================================================== Adds a top-level menu page. This function takes a capability which will be used to determine whether or not a page is included in the menu. The function which is hooked in to handle the output of the page must check that the user has the required capability as well. `$page_title` string Required The text to be displayed in the title tags of the page when the menu is selected. `$menu_title` string Required The text to be used for the menu. `$capability` string Required The capability required for this menu to be displayed to the user. `$menu_slug` string Required The slug name to refer to this menu by. Should be unique for this menu page and only include lowercase alphanumeric, dashes, and underscores characters to be compatible with [sanitize\_key()](sanitize_key) . `$callback` callable Optional The function to be called to output the content for this page. Default: `''` `$icon_url` string Optional The URL to the icon to be used for this menu. * Pass a base64-encoded SVG using a data URI, which will be colored to match the color scheme. This should begin with `'data:image/svg+xml;base64,'`. * Pass the name of a Dashicons helper class to use a font icon, e.g. `'dashicons-chart-pie'`. * Pass `'none'` to leave div.wp-menu-image empty so an icon can be added via CSS. Default: `''` `$position` int|float Optional The position in the menu order this item should appear. Default: `null` string The resulting page's hook\_suffix. * **Important Note:** Since WordPress 4.4, you do not need to worry about making the position number unique to avoid conflicts. See trac ticket [#23316](https://core.trac.wordpress.org/ticket/23316) for more information. * If you’re running into the “You do not have sufficient permissions to access this page” error, then you’ve hooked too early. The hook you should use is [admin\_menu](../hooks/admin_menu). * If you only want to move existing admin menu items to different positions, you can use the admin\_menu hook to unset menu items from their current positions in the global $menu and $submenu variables (which are arrays), and reset them elsewhere in the array. * This function takes a ‘capability’ (see [Roles and Capabilities](https://codex.wordpress.org/Roles_and_Capabilities "Roles and Capabilities")) which will be used to determine whether or not a page is included in the menu. The function which is hooked in to handle the output of the page must check that the user has the required ‘capability’ as well. * If you are using the [Settings API](https://codex.wordpress.org/Settings_API "Settings API") to save data, and need the user to be other than the administrator, will need to modify the permissions via the hook option\_page\_capability\_{$option\_group}, where $option\_group is the same as option\_group in [register\_setting()](https://developer.wordpress.org/reference/function/register_setting/) . Check out the [Settings API](https://codex.wordpress.org/Settings_API "Settings API"). Example allowing an editor to save data: ``` // Register settings using the Settings API function wpdocs_register_my_setting() { register_setting( 'my-options-group', 'my-option-name', 'intval' ); } add_action( 'admin_init', 'wpdocs_register_my_setting' ); // Modify capability function wpdocs_my_page_capability( $capability ) { return 'edit_others_posts'; } add_filter( 'option_page_capability_my-options-group', 'wpdocs_my_page_capability' ); ``` * 2 – Dashboard * 4 – Separator * 5 – Posts * 10 – Media * 15 – Links * 20 – Pages * 25 – Comments * 59 – Separator * 60 – Appearance * 65 – Plugins * 70 – Users * 75 – Tools * 80 – Settings * 99 – Separator * 2 – Dashboard * 4 – Separator * 5 – Sites * 10 – Users * 15 – Themes * 20 – Plugins * 25 – Settings * 30 – Updates * 99 – Separator File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/) ``` function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '', $position = null ) { global $menu, $admin_page_hooks, $_registered_pages, $_parent_pages; $menu_slug = plugin_basename( $menu_slug ); $admin_page_hooks[ $menu_slug ] = sanitize_title( $menu_title ); $hookname = get_plugin_page_hookname( $menu_slug, '' ); if ( ! empty( $callback ) && ! empty( $hookname ) && current_user_can( $capability ) ) { add_action( $hookname, $callback ); } if ( empty( $icon_url ) ) { $icon_url = 'dashicons-admin-generic'; $icon_class = 'menu-icon-generic '; } else { $icon_url = set_url_scheme( $icon_url ); $icon_class = ''; } $new_menu = array( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $icon_class . $hookname, $hookname, $icon_url ); if ( null !== $position && ! is_numeric( $position ) ) { _doing_it_wrong( __FUNCTION__, sprintf( /* translators: %s: add_menu_page() */ __( 'The seventh parameter passed to %s should be numeric representing menu position.' ), '<code>add_menu_page()</code>' ), '6.0.0' ); $position = null; } if ( null === $position || ! is_numeric( $position ) ) { $menu[] = $new_menu; } elseif ( isset( $menu[ (string) $position ] ) ) { $collision_avoider = base_convert( substr( md5( $menu_slug . $menu_title ), -4 ), 16, 10 ) * 0.00001; $position = (string) ( $position + $collision_avoider ); $menu[ $position ] = $new_menu; } else { /* * Cast menu position to a string. * * This allows for floats to be passed as the position. PHP will normally cast a float to an * integer value, this ensures the float retains its mantissa (positive fractional part). * * A string containing an integer value, eg "10", is treated as a numeric index. */ $position = (string) $position; $menu[ $position ] = $new_menu; } $_registered_pages[ $hookname ] = true; // No parent as top level. $_parent_pages[ $menu_slug ] = false; return $hookname; } ``` | Uses | Description | | --- | --- | | [get\_plugin\_page\_hookname()](get_plugin_page_hookname) wp-admin/includes/plugin.php | Gets the hook name for the administrative page of a plugin. | | [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. | | [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. | | [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. | | [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. | | Used By | Description | | --- | --- | | [add\_object\_page()](add_object_page) wp-admin/includes/deprecated.php | Add a top-level menu page in the ‘objects’ section. | | [add\_utility\_page()](add_utility_page) wp-admin/includes/deprecated.php | Add a top-level menu page in the ‘utility’ section. | | Version | Description | | --- | --- | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress comment_author_url_link( string $linktext = '', string $before = '', string $after = '', int|WP_Comment $comment ) comment\_author\_url\_link( string $linktext = '', string $before = '', string $after = '', int|WP\_Comment $comment ) ====================================================================================================================== Displays the HTML link of the URL of the author of the current comment. `$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. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) { echo get_comment_author_url_link( $linktext, $before, $after, $comment ); } ``` | Uses | Description | | --- | --- | | [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. | | Version | Description | | --- | --- | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Added the `$comment` parameter. | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress force_balance_tags( string $text ): string force\_balance\_tags( string $text ): string ============================================ Balances tags of string using a modified stack. `$text` string Required Text to be balanced. string Balanced text. ##### Usage: ``` <?php $balanced_text = force_balance_tags( $text ); ?> ``` This function is used in the short post excerpt list, to prevent unmatched elements. For example, it makes ``` <div><b>This is an excerpt. <!--more--> and this is more text... </b></div> ``` not break, when the html after the more tag is cut off. ``` <div><b>This is an excerpt. ``` should be changed to: ``` <div><b>This is an excerpt. </b></div> ``` by the `force_balance_tags` function. ##### Notes: * Ignores the ‘`use_balanceTags`‘ option. * This function is not used for all WP pages due to bugs and performance issues. This function doesn’t use an HTML parser but some potentially expensive regular expressions. This function shall only be used if the length of the excerpt can be controlled; otherwise memory issues or some [obscure bugs](https://core.trac.wordpress.org/ticket/19855) can occur. * This function uses two hard-coded lists of elements for single tags and nestable tags. WordPress uses multiple such lists and the lists not kept in sync. If an element isn’t part of these lists or changed its nesting behavior, it may lead to incorrect markup. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function force_balance_tags( $text ) { $tagstack = array(); $stacksize = 0; $tagqueue = ''; $newtext = ''; // Known single-entity/self-closing tags. $single_tags = array( 'area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source', 'track', 'wbr' ); // Tags that can be immediately nested within themselves. $nestable_tags = array( 'article', 'aside', 'blockquote', 'details', 'div', 'figure', 'object', 'q', 'section', 'span' ); // WP bug fix for comments - in case you REALLY meant to type '< !--'. $text = str_replace( '< !--', '< !--', $text ); // WP bug fix for LOVE <3 (and other situations with '<' before a number). $text = preg_replace( '#<([0-9]{1})#', '&lt;$1', $text ); /** * Matches supported tags. * * To get the pattern as a string without the comments paste into a PHP * REPL like `php -a`. * * @see https://html.spec.whatwg.org/#elements-2 * @see https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name * * @example * ~# php -a * php > $s = [paste copied contents of expression below including parentheses]; * php > echo $s; */ $tag_pattern = ( '#<' . // Start with an opening bracket. '(/?)' . // Group 1 - If it's a closing tag it'll have a leading slash. '(' . // Group 2 - Tag name. // Custom element tags have more lenient rules than HTML tag names. '(?:[a-z](?:[a-z0-9._]*)-(?:[a-z0-9._-]+)+)' . '|' . // Traditional tag rules approximate HTML tag names. '(?:[\w:]+)' . ')' . '(?:' . // We either immediately close the tag with its '>' and have nothing here. '\s*' . '(/?)' . // Group 3 - "attributes" for empty tag. '|' . // Or we must start with space characters to separate the tag name from the attributes (or whitespace). '(\s+)' . // Group 4 - Pre-attribute whitespace. '([^>]*)' . // Group 5 - Attributes. ')' . '>#' // End with a closing bracket. ); while ( preg_match( $tag_pattern, $text, $regex ) ) { $full_match = $regex[0]; $has_leading_slash = ! empty( $regex[1] ); $tag_name = $regex[2]; $tag = strtolower( $tag_name ); $is_single_tag = in_array( $tag, $single_tags, true ); $pre_attribute_ws = isset( $regex[4] ) ? $regex[4] : ''; $attributes = trim( isset( $regex[5] ) ? $regex[5] : $regex[3] ); $has_self_closer = '/' === substr( $attributes, -1 ); $newtext .= $tagqueue; $i = strpos( $text, $full_match ); $l = strlen( $full_match ); // Clear the shifter. $tagqueue = ''; if ( $has_leading_slash ) { // End tag. // If too many closing tags. if ( $stacksize <= 0 ) { $tag = ''; // Or close to be safe $tag = '/' . $tag. // If stacktop value = tag close value, then pop. } elseif ( $tagstack[ $stacksize - 1 ] === $tag ) { // Found closing tag. $tag = '</' . $tag . '>'; // Close tag. array_pop( $tagstack ); $stacksize--; } else { // Closing tag not at top, search for it. for ( $j = $stacksize - 1; $j >= 0; $j-- ) { if ( $tagstack[ $j ] === $tag ) { // Add tag to tagqueue. for ( $k = $stacksize - 1; $k >= $j; $k-- ) { $tagqueue .= '</' . array_pop( $tagstack ) . '>'; $stacksize--; } break; } } $tag = ''; } } else { // Begin tag. if ( $has_self_closer ) { // If it presents itself as a self-closing tag... // ...but it isn't a known single-entity self-closing tag, then don't let it be treated as such // and immediately close it with a closing tag (the tag will encapsulate no text as a result). if ( ! $is_single_tag ) { $attributes = trim( substr( $attributes, 0, -1 ) ) . "></$tag"; } } elseif ( $is_single_tag ) { // Else if it's a known single-entity tag but it doesn't close itself, do so. $pre_attribute_ws = ' '; $attributes .= '/'; } else { // It's not a single-entity tag. // If the top of the stack is the same as the tag we want to push, close previous tag. if ( $stacksize > 0 && ! in_array( $tag, $nestable_tags, true ) && $tagstack[ $stacksize - 1 ] === $tag ) { $tagqueue = '</' . array_pop( $tagstack ) . '>'; $stacksize--; } $stacksize = array_push( $tagstack, $tag ); } // Attributes. if ( $has_self_closer && $is_single_tag ) { // We need some space - avoid <br/> and prefer <br />. $pre_attribute_ws = ' '; } $tag = '<' . $tag . $pre_attribute_ws . $attributes . '>'; // If already queuing a close tag, then put this tag on too. if ( ! empty( $tagqueue ) ) { $tagqueue .= $tag; $tag = ''; } } $newtext .= substr( $text, 0, $i ) . $tag; $text = substr( $text, $i + $l ); } // Clear tag queue. $newtext .= $tagqueue; // Add remaining text. $newtext .= $text; while ( $x = array_pop( $tagstack ) ) { $newtext .= '</' . $x . '>'; // Add remaining tags to close. } // WP fix for the bug with HTML comments. $newtext = str_replace( '< !--', '<!--', $newtext ); $newtext = str_replace( '< !--', '< !--', $newtext ); return $newtext; } ``` | Used By | Description | | --- | --- | | [balanceTags()](balancetags) wp-includes/formatting.php | Balances tags if forced to, or if the ‘use\_balanceTags’ option is set to true. | | [get\_the\_content()](get_the_content) wp-includes/post-template.php | Retrieves the post content. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Improve accuracy and add support for custom element tags. | | [2.0.4](https://developer.wordpress.org/reference/since/2.0.4/) | Introduced. |
programming_docs
wordpress post_preview(): string post\_preview(): string ======================= Saves a draft or manually autosaves for the purpose of showing a post preview. string URL to redirect to show the preview. File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/) ``` function post_preview() { $post_ID = (int) $_POST['post_ID']; $_POST['ID'] = $post_ID; $post = get_post( $post_ID ); if ( ! $post ) { wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); } if ( ! current_user_can( 'edit_post', $post->ID ) ) { wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); } $is_autosave = false; if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author && ( 'draft' === $post->post_status || 'auto-draft' === $post->post_status ) ) { $saved_post_id = edit_post(); } else { $is_autosave = true; if ( isset( $_POST['post_status'] ) && 'auto-draft' === $_POST['post_status'] ) { $_POST['post_status'] = 'draft'; } $saved_post_id = wp_create_post_autosave( $post->ID ); } if ( is_wp_error( $saved_post_id ) ) { wp_die( $saved_post_id->get_error_message() ); } $query_args = array(); if ( $is_autosave && $saved_post_id ) { $query_args['preview_id'] = $post->ID; $query_args['preview_nonce'] = wp_create_nonce( 'post_preview_' . $post->ID ); if ( isset( $_POST['post_format'] ) ) { $query_args['post_format'] = empty( $_POST['post_format'] ) ? 'standard' : sanitize_key( $_POST['post_format'] ); } if ( isset( $_POST['_thumbnail_id'] ) ) { $query_args['_thumbnail_id'] = ( (int) $_POST['_thumbnail_id'] <= 0 ) ? '-1' : (int) $_POST['_thumbnail_id']; } } return get_preview_post_link( $post, $query_args ); } ``` | Uses | Description | | --- | --- | | [get\_preview\_post\_link()](get_preview_post_link) wp-includes/link-template.php | Retrieves the URL used for the post preview. | | [wp\_check\_post\_lock()](wp_check_post_lock) wp-admin/includes/post.php | Determines whether the post is currently being edited by another user. | | [wp\_create\_post\_autosave()](wp_create_post_autosave) wp-admin/includes/post.php | Creates autosave data for the specified post from `$_POST` data. | | [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. | | [wp\_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. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. | | [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. | | [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 | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress remove_post_type_support( string $post_type, string $feature ) remove\_post\_type\_support( string $post\_type, string $feature ) ================================================================== Removes support for a feature from a post type. `$post_type` string Required The post type for which to remove the feature. `$feature` string Required The feature being removed. All features are directly associated with a functional area of the edit screen, such as the editor or a meta box. Additionally, the ‘revisions’ feature dictates whether the post type will store revisions, and the ‘comments’ feature dictates whether the comments count will show on the edit screen. Typically [remove\_post\_type\_support()](remove_post_type_support) should be attached to the ‘init’ [action hook](https://codex.wordpress.org/Plugin_API/Action_Reference "Plugin API/Action Reference"). Possible values of parameter `$feature` * ‘title’ * ‘editor’ (content) * ‘author’ * ‘thumbnail’ (featured image) (current theme must also support [Post Thumbnails](https://codex.wordpress.org/Post_Thumbnails "Post Thumbnails")) * ‘excerpt’ * ‘trackbacks’ * ‘custom-fields’ * ‘comments’ (also will see comment count balloon on edit screen) * ‘revisions’ (will store revisions) * ‘page-attributes’ (template and menu order) (hierarchical must be true) * ‘post-formats’ removes post formats, see [Post Formats](https://wordpress.org/support/article/post-formats/ "Post Formats") File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function remove_post_type_support( $post_type, $feature ) { global $_wp_post_type_features; unset( $_wp_post_type_features[ $post_type ][ $feature ] ); } ``` | Used By | Description | | --- | --- | | [\_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. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress add_image_size( string $name, int $width, int $height, bool|array $crop = false ) add\_image\_size( string $name, int $width, int $height, bool|array $crop = false ) =================================================================================== Registers a new image size. `$name` string Required Image size identifier. `$width` int Optional Image width in pixels. Default 0. `$height` int Optional Image height in pixels. Default 0. `$crop` bool|array Optional Image cropping behavior. If false, the image will be scaled (default), If true, image will be cropped to the specified dimensions using center positions. If an array, the image will be cropped using the array to specify the crop location. Array values must be in the format: array( x\_crop\_position, y\_crop\_position ) where: * x\_crop\_position accepts: `'left'`, `'center'`, or `'right'`. * y\_crop\_position accepts: `'top'`, `'center'`, or `'bottom'`. Default: `false` These are the reserved image size names recognized by WordPress: ‘thumb’, ‘thumbnail’, ‘medium’, ‘medium\_large’, ‘large’, and ‘post-thumbnail’. The names “thumb” & “thumbnail” are just aliases- they are exactly the same. For a detailed explanation and “why”, read further inside the [image\_downsize()](image_downsize) article. However, if needed, you can always set the options yourself: ``` update_option( 'thumbnail_size_w', 160 ); update_option( 'thumbnail_size_h', 160 ); update_option( 'thumbnail_crop', 1 ); ``` **Set the image size by resizing the image proportionally (without distorting it):** ``` add_image_size( 'custom-size', 220, 180 ); // 220 pixels wide by 180 pixels tall, soft proportional crop mode ``` **Set the image size by cropping the image (not showing part of it):** ``` add_image_size( 'custom-size', 220, 180, true ); // 220 pixels wide by 180 pixels tall, hard crop mode ``` **Set the image size by cropping the image and defining a crop position:** ``` add_image_size( 'custom-size', 220, 220, array( 'left', 'top' ) ); // Hard crop left top ``` **When setting a crop position, the first value in the array is the x axis crop position, the second is the y axis crop position.** * x\_crop\_position accepts ‘left’ ‘center’, or ‘right’. * y\_crop\_position accepts ‘top’, ‘center’, or ‘bottom’. By default, these values default to ‘center’ when using hard crop mode. You can find examples of the various crop types [here](https://havecamerawilltravel.com/photographer/wordpress-thumbnail-crop). Now that you’ve defined some custom image sizes, there are a variety of ways that you can use them. For Featured Images To use your custom image sizes for a post’s featured image, you can use [the\_post\_thumbnail()](the_post_thumbnail) in the appropriate theme template file… Note: To enable featured images the current theme must include add\_theme\_support( ‘post-thumbnails’ ); in its functions.php file. See also Post Thumbnails. ``` if ( has_post_thumbnail() ) { the_post_thumbnail( 'your-custom-size' ); } ``` You can also make your custom sizes selectable from your WordPress admin. To do so, you have to use the image\_size\_names\_choose hook to assign them a normal, human-readable name… ``` add_filter( 'image_size_names_choose', 'my_custom_sizes' ); function my_custom_sizes( $sizes ) { return array_merge( $sizes, array( 'your-custom-size' => __( 'Your Custom Size Name' ), ) ); } ``` You can output images (by size) directly from the WordPress Media Library using PHP as well. To do this, simply use [wp\_get\_attachment\_image()](wp_get_attachment_image) . ``` // Assuming your Media Library image has a post id of 42... echo wp_get_attachment_image( 42, 'your-custom-size' ); ``` Note: If you just want the image URL instead of a pre-built ![]() tag, you can use [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) instead. Using the ‘false’ setting will fail to produce a new image in the upload directory if one of the image dimensions of the uploaded image are equal to the new image size. If a registered image size is removed from functions.php, then any image uploaded before that point and then deleted from the media library afterwards, does not have those auto-generated sizes deleted too. Only image sizes that exist in functions.php are deleted. Although height and width are not required parameters, their default values (0) will lead to unwanted behavior, so bear in mind that you should always define them. Use a value of 9999 to define the other dimension as the one to be considered when image resize is executed. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/) ``` function add_image_size( $name, $width = 0, $height = 0, $crop = false ) { global $_wp_additional_image_sizes; $_wp_additional_image_sizes[ $name ] = array( 'width' => absint( $width ), 'height' => absint( $height ), 'crop' => $crop, ); } ``` | Uses | Description | | --- | --- | | [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. | | Used By | Description | | --- | --- | | [\_wp\_add\_additional\_image\_sizes()](_wp_add_additional_image_sizes) wp-includes/media.php | Adds additional default image sub-sizes. | | [set\_post\_thumbnail\_size()](set_post_thumbnail_size) wp-includes/media.php | Registers an image size for the post thumbnail. | | Version | Description | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress wp_is_auto_update_enabled_for_type( string $type ): bool wp\_is\_auto\_update\_enabled\_for\_type( string $type ): bool ============================================================== Checks whether auto-updates are enabled. `$type` string Required The type of update being checked: `'theme'` or `'plugin'`. bool True if auto-updates are enabled for `$type`, false otherwise. File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/) ``` function wp_is_auto_update_enabled_for_type( $type ) { if ( ! class_exists( 'WP_Automatic_Updater' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-automatic-updater.php'; } $updater = new WP_Automatic_Updater(); $enabled = ! $updater->is_disabled(); switch ( $type ) { case 'plugin': /** * Filters whether plugins auto-update is enabled. * * @since 5.5.0 * * @param bool $enabled True if plugins auto-update is enabled, false otherwise. */ return apply_filters( 'plugins_auto_update_enabled', $enabled ); case 'theme': /** * Filters whether themes auto-update is enabled. * * @since 5.5.0 * * @param bool $enabled True if themes auto-update is enabled, false otherwise. */ return apply_filters( 'themes_auto_update_enabled', $enabled ); } return false; } ``` [apply\_filters( 'plugins\_auto\_update\_enabled', bool $enabled )](../hooks/plugins_auto_update_enabled) Filters whether plugins auto-update is enabled. [apply\_filters( 'themes\_auto\_update\_enabled', bool $enabled )](../hooks/themes_auto_update_enabled) Filters whether themes auto-update 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\_Site\_Health::detect\_plugin\_theme\_auto\_update\_issues()](../classes/wp_site_health/detect_plugin_theme_auto_update_issues) wp-admin/includes/class-wp-site-health.php | Checks for potential issues with plugin and theme auto-updates. | | [WP\_Debug\_Data::debug\_data()](../classes/wp_debug_data/debug_data) wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. | | [WP\_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\_prepare\_themes\_for\_js()](wp_prepare_themes_for_js) wp-admin/includes/theme.php | Prepares themes for JavaScript. | | [WP\_Plugins\_List\_Table::\_\_construct()](../classes/wp_plugins_list_table/__construct) wp-admin/includes/class-wp-plugins-list-table.php | Constructor. | | [WP\_MS\_Themes\_List\_Table::\_\_construct()](../classes/wp_ms_themes_list_table/__construct) wp-admin/includes/class-wp-ms-themes-list-table.php | Constructor. | | [list\_plugin\_updates()](list_plugin_updates) wp-admin/update-core.php | Display the upgrade plugins form. | | [list\_theme\_updates()](list_theme_updates) wp-admin/update-core.php | Display the upgrade themes form. | | Version | Description | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. | wordpress get_comments_popup_template(): string get\_comments\_popup\_template(): string ======================================== This function has been deprecated. Retrieve path of comment popup template in current or parent template. string Full path to comments popup template file. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_comments_popup_template() { _deprecated_function( __FUNCTION__, '4.5.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.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | This function has been deprecated. | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress get_linkobjects( int $category, string $orderby = 'name', int $limit ): array get\_linkobjects( int $category, string $orderby = 'name', int $limit ): array ============================================================================== This function has been deprecated. Use [get\_bookmarks()](get_bookmarks) instead. Gets an array of link objects associated with category n. Usage: ``` $links = get_linkobjects(1); if ($links) { foreach ($links as $link) { echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>'; } } ``` Fields are: * link\_id * link\_url * link\_name * link\_image * link\_target * link\_category * link\_description * link\_visible * link\_owner * link\_rating * link\_updated * link\_rel * link\_notes * [get\_bookmarks()](get_bookmarks) `$category` int Optional The category to use. If no category supplied, uses all. Default 0. `$orderby` string Optional The order to output the links. E.g. `'id'`, `'name'`, `'url'`, `'description'`, `'rating'`, or `'owner'`. Default `'name'`. If you start the name with an underscore, the order will be reversed. Specifying `'rand'` as the order will return links in a random order. Default: `'name'` `$limit` int Optional Limit to X entries. If not specified, all entries are shown. Default 0. array File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); $links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ; $links_array = array(); foreach ($links as $link) $links_array[] = $link; return $links_array; } ``` | Uses | Description | | --- | --- | | [get\_bookmarks()](get_bookmarks) wp-includes/bookmark.php | Retrieves the list of bookmarks. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Used By | Description | | --- | --- | | [get\_linkobjectsbyname()](get_linkobjectsbyname) wp-includes/deprecated.php | Gets an array of link objects associated with category $cat\_name. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [get\_bookmarks()](get_bookmarks) | | [1.0.1](https://developer.wordpress.org/reference/since/1.0.1/) | Introduced. | wordpress wp_authenticate_username_password( WP_User|WP_Error|null $user, string $username, string $password ): WP_User|WP_Error wp\_authenticate\_username\_password( WP\_User|WP\_Error|null $user, string $username, string $password ): WP\_User|WP\_Error ============================================================================================================================= Authenticates a user, confirming the username and password are valid. `$user` [WP\_User](../classes/wp_user)|[WP\_Error](../classes/wp_error)|null Required [WP\_User](../classes/wp_user) or [WP\_Error](../classes/wp_error) object from a previous callback. Default null. `$username` string Required Username for authentication. `$password` string Required Password for authentication. [WP\_User](../classes/wp_user)|[WP\_Error](../classes/wp_error) [WP\_User](../classes/wp_user) on success, [WP\_Error](../classes/wp_error) on failure. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function wp_authenticate_username_password( $user, $username, $password ) { if ( $user instanceof WP_User ) { return $user; } if ( empty( $username ) || empty( $password ) ) { if ( is_wp_error( $user ) ) { return $user; } $error = new WP_Error(); if ( empty( $username ) ) { $error->add( 'empty_username', __( '<strong>Error:</strong> The username field is empty.' ) ); } if ( empty( $password ) ) { $error->add( 'empty_password', __( '<strong>Error:</strong> The password field is empty.' ) ); } return $error; } $user = get_user_by( 'login', $username ); if ( ! $user ) { return new WP_Error( 'invalid_username', sprintf( /* translators: %s: User name. */ __( '<strong>Error:</strong> The username <strong>%s</strong> is not registered on this site. If you are unsure of your username, try your email address instead.' ), $username ) ); } /** * Filters whether the given user can be authenticated with the provided password. * * @since 2.5.0 * * @param WP_User|WP_Error $user WP_User or WP_Error object if a previous * callback failed authentication. * @param string $password Password to check against the user. */ $user = apply_filters( 'wp_authenticate_user', $user, $password ); if ( is_wp_error( $user ) ) { return $user; } if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) { return new WP_Error( 'incorrect_password', sprintf( /* translators: %s: User name. */ __( '<strong>Error:</strong> The password you entered for the username %s is incorrect.' ), '<strong>' . $username . '</strong>' ) . ' <a href="' . wp_lostpassword_url() . '">' . __( 'Lost your password?' ) . '</a>' ); } return $user; } ``` [apply\_filters( 'wp\_authenticate\_user', WP\_User|WP\_Error $user, string $password )](../hooks/wp_authenticate_user) Filters whether the given user can be authenticated with the provided password. | Uses | Description | | --- | --- | | [wp\_check\_password()](wp_check_password) wp-includes/pluggable.php | Checks the plaintext password against the encrypted Password. | | [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. | | [wp\_lostpassword\_url()](wp_lostpassword_url) wp-includes/general-template.php | Returns the URL that allows the user to reset the lost password. | | [\_\_()](__) 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 | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
programming_docs
wordpress post_categories_meta_box( WP_Post $post, array $box ) post\_categories\_meta\_box( WP\_Post $post, array $box ) ========================================================= Displays post categories form fields. `$post` [WP\_Post](../classes/wp_post) Required Current post object. `$box` array Required Categories 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 `'category'`. File: `wp-admin/includes/meta-boxes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/meta-boxes.php/) ``` function post_categories_meta_box( $post, $box ) { $defaults = array( 'taxonomy' => 'category' ); 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'] ); ?> <div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv"> <ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs"> <li class="tabs"><a href="#<?php echo $tax_name; ?>-all"><?php echo $taxonomy->labels->all_items; ?></a></li> <li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php echo esc_html( $taxonomy->labels->most_used ); ?></a></li> </ul> <div id="<?php echo $tax_name; ?>-pop" class="tabs-panel" style="display: none;"> <ul id="<?php echo $tax_name; ?>checklist-pop" class="categorychecklist form-no-clear" > <?php $popular_ids = wp_popular_terms_checklist( $tax_name ); ?> </ul> </div> <div id="<?php echo $tax_name; ?>-all" class="tabs-panel"> <?php $name = ( 'category' === $tax_name ) ? 'post_category' : 'tax_input[' . $tax_name . ']'; // Allows for an empty term set to be sent. 0 is an invalid term ID and will be ignored by empty() checks. echo "<input type='hidden' name='{$name}[]' value='0' />"; ?> <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear"> <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids, ) ); ?> </ul> </div> <?php if ( current_user_can( $taxonomy->cap->edit_terms ) ) : ?> <div id="<?php echo $tax_name; ?>-adder" class="wp-hidden-children"> <a id="<?php echo $tax_name; ?>-add-toggle" href="#<?php echo $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new"> <?php /* translators: %s: Add New taxonomy label. */ printf( __( '+ %s' ), $taxonomy->labels->add_new_item ); ?> </a> <p id="<?php echo $tax_name; ?>-add" class="category-add wp-hidden-child"> <label class="screen-reader-text" for="new<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label> <input type="text" name="new<?php echo $tax_name; ?>" id="new<?php echo $tax_name; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true" /> <label class="screen-reader-text" for="new<?php echo $tax_name; ?>_parent"> <?php echo $taxonomy->labels->parent_item_colon; ?> </label> <?php $parent_dropdown_args = array( 'taxonomy' => $tax_name, 'hide_empty' => 0, 'name' => 'new' . $tax_name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '&mdash; ' . $taxonomy->labels->parent_item . ' &mdash;', ); /** * Filters the arguments for the taxonomy parent dropdown on the Post Edit page. * * @since 4.4.0 * * @param array $parent_dropdown_args { * Optional. Array of arguments to generate parent dropdown. * * @type string $taxonomy Name of the taxonomy to retrieve. * @type bool $hide_if_empty True to skip generating markup if no * categories are found. Default 0. * @type string $name Value for the 'name' attribute * of the select element. * Default "new{$tax_name}_parent". * @type string $orderby Which column to use for ordering * terms. Default 'name'. * @type bool|int $hierarchical Whether to traverse the taxonomy * hierarchy. Default 1. * @type string $show_option_none Text to display for the "none" option. * Default "&mdash; {$parent} &mdash;", * where `$parent` is 'parent_item' * taxonomy label. * } */ $parent_dropdown_args = apply_filters( 'post_edit_category_parent_dropdown_args', $parent_dropdown_args ); wp_dropdown_categories( $parent_dropdown_args ); ?> <input type="button" id="<?php echo $tax_name; ?>-add-submit" data-wp-lists="add:<?php echo $tax_name; ?>checklist:<?php echo $tax_name; ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $taxonomy->labels->add_new_item ); ?>" /> <?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?> <span id="<?php echo $tax_name; ?>-ajax-response"></span> </p> </div> <?php endif; ?> </div> <?php } ``` [apply\_filters( 'post\_edit\_category\_parent\_dropdown\_args', array $parent\_dropdown\_args )](../hooks/post_edit_category_parent_dropdown_args) Filters the arguments for the taxonomy parent dropdown on the Post Edit page. | Uses | Description | | --- | --- | | [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\_terms\_checklist()](wp_terms_checklist) wp-admin/includes/template.php | Outputs an unordered list of checkbox input elements labelled with term names. | | [wp\_dropdown\_categories()](wp_dropdown_categories) wp-includes/category-template.php | Displays or retrieves the HTML dropdown list of categories. | | [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. | | [\_\_()](__) 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. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Version | Description | | --- | --- | | [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. | wordpress get_tag_regex( string $tag ): string get\_tag\_regex( string $tag ): string ====================================== Returns RegEx body to liberally match an opening HTML tag. Matches an opening HTML tag that: 1. Is self-closing or 2. Has no body but has a closing tag of the same name or 3. Contains a body and a closing tag of the same name Note: this RegEx does not balance inner tags and does not attempt to produce valid HTML `$tag` string Required An HTML tag name. Example: `'video'`. string Tag RegEx. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function get_tag_regex( $tag ) { if ( empty( $tag ) ) { return ''; } return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) ); } ``` | Uses | Description | | --- | --- | | [tag\_escape()](tag_escape) wp-includes/formatting.php | Escapes an HTML tag name. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress validate_file( string $file, string[] $allowed_files = array() ): int validate\_file( string $file, string[] $allowed\_files = array() ): int ======================================================================= Validates a file name and path against an allowed set of rules. A return value of `1` means the file path contains directory traversal. A return value of `2` means the file path contains a Windows drive path. A return value of `3` means the file is not in the allowed files list. `$file` string Required File path. `$allowed_files` string[] Optional Array of allowed files. Default: `array()` int 0 means nothing is wrong, greater than 0 means something was wrong. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function validate_file( $file, $allowed_files = array() ) { if ( ! is_scalar( $file ) || '' === $file ) { return 0; } // `../` on its own is not allowed: if ( '../' === $file ) { return 1; } // More than one occurrence of `../` is not allowed: if ( preg_match_all( '#\.\./#', $file, $matches, PREG_SET_ORDER ) && ( count( $matches ) > 1 ) ) { return 1; } // `../` which does not occur at the end of the path is not allowed: if ( false !== strpos( $file, '../' ) && '../' !== mb_substr( $file, -3, 3 ) ) { return 1; } // Files not in the allowed file list are not allowed: if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files, true ) ) { return 3; } // Absolute Windows drive paths are not allowed: if ( ':' === substr( $file, 1, 1 ) ) { return 2; } return 0; } ``` | Used By | Description | | --- | --- | | [WP\_REST\_Plugins\_Controller::validate\_plugin\_param()](../classes/wp_rest_plugins_controller/validate_plugin_param) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Checks that the “plugin” parameter is a valid path. | | [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\_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. | | [validate\_plugin()](validate_plugin) wp-admin/includes/plugin.php | Validates the plugin path. | | [validate\_file\_to\_edit()](validate_file_to_edit) wp-admin/includes/file.php | Makes sure that the file that was requested to be edited is allowed to be edited. | | [download\_url()](download_url) wp-admin/includes/file.php | Downloads a URL to a local temporary file using the WordPress HTTP API. | | [\_unzip\_file\_ziparchive()](_unzip_file_ziparchive) wp-admin/includes/file.php | Attempts to unzip an archive using the ZipArchive class. | | [\_unzip\_file\_pclzip()](_unzip_file_pclzip) wp-admin/includes/file.php | Attempts to unzip an archive using the PclZip library. | | [WP\_Customize\_Manager::\_\_construct()](../classes/wp_customize_manager/__construct) wp-includes/class-wp-customize-manager.php | Constructor. | | [wp\_get\_active\_and\_valid\_plugins()](wp_get_active_and_valid_plugins) wp-includes/load.php | Retrieve an array of active and valid plugin files. | | [get\_single\_template()](get_single_template) wp-includes/template.php | Retrieves path of single template in current or parent template. Applies to single Posts, single Attachments, and single custom post types. | | [get\_page\_template()](get_page_template) wp-includes/template.php | Retrieves path of page template in current or parent template. | | [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. | | Version | Description | | --- | --- | | [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. | wordpress wp_deregister_style( string $handle ) wp\_deregister\_style( string $handle ) ======================================= Remove a registered stylesheet. * [WP\_Dependencies::remove()](../classes/wp_dependencies/remove) `$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_deregister_style( $handle ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); wp_styles()->remove( $handle ); } ``` | Uses | Description | | --- | --- | | [wp\_styles()](wp_styles) wp-includes/functions.wp-styles.php | Initialize $wp\_styles if it has not been set. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress wp_check_post_hierarchy_for_loops( int $post_parent, int $post_ID ): int wp\_check\_post\_hierarchy\_for\_loops( int $post\_parent, int $post\_ID ): int =============================================================================== Checks the given subset of the post hierarchy for hierarchy loops. Prevents loops from forming and breaks those that it finds. Attached to the [‘wp\_insert\_post\_parent’](../hooks/wp_insert_post_parent) filter. * [wp\_find\_hierarchy\_loop()](wp_find_hierarchy_loop) `$post_parent` int Required ID of the parent for the post we're checking. `$post_ID` int Required ID of the post we're checking. int The new post\_parent for the post, 0 otherwise. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function wp_check_post_hierarchy_for_loops( $post_parent, $post_ID ) { // Nothing fancy here - bail. if ( ! $post_parent ) { return 0; } // New post can't cause a loop. if ( ! $post_ID ) { return $post_parent; } // Can't be its own parent. if ( $post_parent == $post_ID ) { return 0; } // Now look for larger loops. $loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_ID, $post_parent ); if ( ! $loop ) { return $post_parent; // No loop. } // Setting $post_parent to the given value causes a loop. if ( isset( $loop[ $post_ID ] ) ) { return 0; } // There's a loop, but it doesn't contain $post_ID. Break the loop. foreach ( array_keys( $loop ) as $loop_member ) { wp_update_post( array( 'ID' => $loop_member, 'post_parent' => 0, ) ); } return $post_parent; } ``` | Uses | Description | | --- | --- | | [wp\_find\_hierarchy\_loop()](wp_find_hierarchy_loop) wp-includes/functions.php | Finds hierarchy loops using a callback function that maps object IDs to parent IDs. | | [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress wp_get_post_parent_id( int|WP_Post|null $post = null ): int|false wp\_get\_post\_parent\_id( int|WP\_Post|null $post = null ): int|false ====================================================================== Returns the ID of the post’s parent. `$post` int|[WP\_Post](../classes/wp_post)|null Optional Post ID or post object. Defaults to global $post. Default: `null` int|false Post parent ID (which can be 0 if there is no parent), or false if the post does not exist. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function wp_get_post_parent_id( $post = null ) { $post = get_post( $post ); if ( ! $post || is_wp_error( $post ) ) { return false; } return (int) $post->post_parent; } ``` | Uses | Description | | --- | --- | | [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/) | The `$post` parameter was made optional. | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress user_can_set_post_date( int $user_id, int $blog_id = 1, int $category_id = 'None' ): bool user\_can\_set\_post\_date( int $user\_id, int $blog\_id = 1, int $category\_id = 'None' ): bool ================================================================================================ This function has been deprecated. Use [current\_user\_can()](current_user_can) instead. Whether user can set new posts’ dates. * [current\_user\_can()](current_user_can) `$user_id` int Required `$blog_id` int Optional Not Used Default: `1` `$category_id` int Optional Not Used Default: `'None'` bool File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') { _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); $author_data = get_userdata($user_id); return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); } ``` | Uses | Description | | --- | --- | | [user\_can\_create\_post()](user_can_create_post) wp-includes/deprecated.php | Whether user can create a post. | | [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Use [current\_user\_can()](current_user_can) | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress multisite_over_quota_message() multisite\_over\_quota\_message() ================================= Displays the out of storage quota message in Multisite. File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/) ``` function multisite_over_quota_message() { echo '<p>' . sprintf( /* translators: %s: Allowed space allocation. */ __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ), size_format( get_space_allowed() * MB_IN_BYTES ) ) . '</p>'; } ``` | Uses | Description | | --- | --- | | [get\_space\_allowed()](get_space_allowed) wp-includes/ms-functions.php | Returns the upload quota for the current blog. | | [size\_format()](size_format) wp-includes/functions.php | Converts a number of bytes to the largest unit the bytes will fit into. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | Version | Description | | --- | --- | | [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. | wordpress wp_blacklist_check( string $author, string $email, string $url, string $comment, string $user_ip, string $user_agent ): bool wp\_blacklist\_check( string $author, string $email, string $url, string $comment, string $user\_ip, string $user\_agent ): bool ================================================================================================================================ This function has been deprecated. Use [wp\_check\_comment\_disallowed\_list()](wp_check_comment_disallowed_list) instead. Please consider writing more inclusive code. Does comment contain disallowed characters or words. `$author` string Required The author of the comment `$email` string Required The email of the comment `$url` string Required The url used in the comment `$comment` string Required The comment content `$user_ip` string Required The comment author's IP address `$user_agent` string Required The author's browser user agent bool True if comment contains disallowed content, false if comment does not File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function wp_blacklist_check( $author, $email, $url, $comment, $user_ip, $user_agent ) { _deprecated_function( __FUNCTION__, '5.5.0', 'wp_check_comment_disallowed_list()' ); return wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent ); } ``` | 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. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Use [wp\_check\_comment\_disallowed\_list()](wp_check_comment_disallowed_list) instead. Please consider writing more inclusive code. | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
programming_docs
wordpress format_code_lang( string $code = '' ): string format\_code\_lang( string $code = '' ): string =============================================== Returns the language for a language code. `$code` string Optional The two-letter language code. Default: `''` string The language corresponding to $code if it exists. If it does not exist, then the first two letters of $code is returned. File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/) ``` function format_code_lang( $code = '' ) { $code = strtolower( substr( $code, 0, 2 ) ); $lang_codes = array( 'aa' => 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali', 'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree', 'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi; Dhivehi; Maldivian', 'nl' => 'Dutch; Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijjian', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Western Frisian', 'ff' => 'Fulah', 'ka' => 'Georgian', 'de' => 'German', 'gd' => 'Gaelic; Scottish Gaelic', 'ga' => 'Irish', 'gl' => 'Galician', 'gv' => 'Manx', 'el' => 'Greek, Modern', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian; Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'io' => 'Ido', 'ii' => 'Sichuan Yi', 'iu' => 'Inuktitut', 'ie' => 'Interlingue', 'ia' => 'Interlingua (International Auxiliary Language Association)', 'id' => 'Indonesian', 'ik' => 'Inupiaq', 'it' => 'Italian', 'jv' => 'Javanese', 'ja' => 'Japanese', 'kl' => 'Kalaallisut; Greenlandic', 'kn' => 'Kannada', 'ks' => 'Kashmiri', 'kr' => 'Kanuri', 'kk' => 'Kazakh', 'km' => 'Central Khmer', 'ki' => 'Kikuyu; Gikuyu', 'rw' => 'Kinyarwanda', 'ky' => 'Kirghiz; Kyrgyz', 'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kuanyama; Kwanyama', 'ku' => 'Kurdish', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'li' => 'Limburgan; Limburger; Limburgish', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish; Letzeburgesch', 'lu' => 'Luba-Katanga', 'lg' => 'Ganda', 'mk' => 'Macedonian', 'mh' => 'Marshallese', 'ml' => 'Malayalam', 'mi' => 'Maori', 'mr' => 'Marathi', 'ms' => 'Malay', 'mg' => 'Malagasy', 'mt' => 'Maltese', 'mo' => 'Moldavian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo; Navaho', 'nr' => 'Ndebele, South; South Ndebele', 'nd' => 'Ndebele, North; North Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål', 'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian', 'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili', 'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek', 've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh', 'wa' => 'Walloon', 'wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu', ); /** * Filters the language codes. * * @since MU (3.0.0) * * @param string[] $lang_codes Array of key/value pairs of language codes where key is the short version. * @param string $code A two-letter designation of the language. */ $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code ); return strtr( $code, $lang_codes ); } ``` [apply\_filters( 'lang\_codes', string[] $lang\_codes, string $code )](../hooks/lang_codes) Filters the 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 | | --- | --- | | [mu\_dropdown\_languages()](mu_dropdown_languages) wp-admin/includes/ms.php | Generates and displays a drop-down of available languages. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress get_all_category_ids(): int[] get\_all\_category\_ids(): int[] ================================ This function has been deprecated. Use [get\_terms()](get_terms) instead. Retrieves all category IDs. * [get\_terms()](get_terms) int[] List of all of the category IDs. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_all_category_ids() { _deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' ); $cat_ids = get_terms( array( 'taxonomy' => 'category', 'fields' => 'ids', 'get' => 'all', ) ); return $cat_ids; } ``` | Uses | Description | | --- | --- | | [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Used By | Description | | --- | --- | | [get\_category\_children()](get_category_children) wp-includes/deprecated.php | Retrieve category children list separated before and after the term IDs. | | Version | Description | | --- | --- | | [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Use [get\_terms()](get_terms) | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress the_tags( string $before = null, string $sep = ', ', string $after = '' ) the\_tags( string $before = null, string $sep = ', ', string $after = '' ) ========================================================================== Displays the tags for a post. `$before` string Optional String to use before the tags. Defaults to `'Tags:'`. Default: `null` `$sep` string Optional String to use between the tags. Default: `', '` `$after` string Optional String to use after the tags. Default: `''` This function returns an array of objects, one object for each tag assigned to the post. If this function is used in The Loop, then no ID need be passed. File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/) ``` function the_tags( $before = null, $sep = ', ', $after = '' ) { if ( null === $before ) { $before = __( 'Tags: ' ); } $the_tags = get_the_tag_list( $before, $sep, $after ); if ( ! is_wp_error( $the_tags ) ) { echo $the_tags; } } ``` | Uses | Description | | --- | --- | | [get\_the\_tag\_list()](get_the_tag_list) wp-includes/category-template.php | Retrieves the tags for a post formatted as a string. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress wp_debug_backtrace_summary( string $ignore_class = null, int $skip_frames, bool $pretty = true ): string|array wp\_debug\_backtrace\_summary( string $ignore\_class = null, int $skip\_frames, bool $pretty = true ): string|array =================================================================================================================== Returns a comma-separated string or array of functions that have been called to get to the current point in code. * <https://core.trac.wordpress.org/ticket/19589> `$ignore_class` string Optional A class to ignore all function calls within - useful when you want to just give info about the callee. Default: `null` `$skip_frames` int Optional A number of stack frames to skip - useful for unwinding back to the source of the issue. Default 0. `$pretty` bool Optional Whether you want a comma separated string instead of the raw array returned. Default: `true` string|array Either a string containing a reversed comma separated trace or an array of individual calls. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) { static $truncate_paths; $trace = debug_backtrace( false ); $caller = array(); $check_class = ! is_null( $ignore_class ); $skip_frames++; // Skip this function. if ( ! isset( $truncate_paths ) ) { $truncate_paths = array( wp_normalize_path( WP_CONTENT_DIR ), wp_normalize_path( ABSPATH ), ); } foreach ( $trace as $call ) { if ( $skip_frames > 0 ) { $skip_frames--; } elseif ( isset( $call['class'] ) ) { if ( $check_class && $ignore_class == $call['class'] ) { continue; // Filter out calls. } $caller[] = "{$call['class']}{$call['type']}{$call['function']}"; } else { if ( in_array( $call['function'], array( 'do_action', 'apply_filters', 'do_action_ref_array', 'apply_filters_ref_array' ), true ) ) { $caller[] = "{$call['function']}('{$call['args'][0]}')"; } elseif ( in_array( $call['function'], array( 'include', 'include_once', 'require', 'require_once' ), true ) ) { $filename = isset( $call['args'][0] ) ? $call['args'][0] : ''; $caller[] = $call['function'] . "('" . str_replace( $truncate_paths, '', wp_normalize_path( $filename ) ) . "')"; } else { $caller[] = $call['function']; } } } if ( $pretty ) { return implode( ', ', array_reverse( $caller ) ); } else { return $caller; } } ``` | Uses | Description | | --- | --- | | [wp\_normalize\_path()](wp_normalize_path) wp-includes/functions.php | Normalizes a filesystem path. | | Used By | Description | | --- | --- | | [wpdb::get\_caller()](../classes/wpdb/get_caller) wp-includes/class-wpdb.php | Retrieves a comma-separated list of the names of the functions that called [wpdb](../classes/wpdb). | | Version | Description | | --- | --- | | [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. | wordpress add_posts_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', int $position = null ): string|false add\_posts\_page( string $page\_title, string $menu\_title, string $capability, string $menu\_slug, callable $callback = '', int $position = null ): string|false ================================================================================================================================================================= Adds a submenu page to the Posts main menu. This function takes a capability which will be used to determine whether or not a page is included in the menu. The function which is hooked in to handle the output of the page must check that the user has the required capability as well. `$page_title` string Required The text to be displayed in the title tags of the page when the menu is selected. `$menu_title` string Required The text to be used for the menu. `$capability` string Required The capability required for this menu to be displayed to the user. `$menu_slug` string Required The slug name to refer to this menu by (should be unique for this menu). `$callback` callable Optional The function to be called to output the content for this page. Default: `''` `$position` int Optional The position in the menu order this item should appear. Default: `null` string|false The resulting page's hook\_suffix, or false if the user does not have the capability required. * This function is a simple wrapper for a call to [add\_submenu\_page()](add_submenu_page) , passing the received arguments and specifying ‘`edit.php`‘ as the `$parent_slug` argument. This means the new page will be added as a sub menu to the `Posts` menu. * The `$capability` parameter is used to determine whether or not the page is included in the menu based on the [Roles and Capabilities](https://wordpress.org/support/article/roles-and-capabilities/)) of the current user. * The function handling the output of the options page should also verify the user’s capabilities. * If you’re running into the »*You do not have sufficient permissions to access this page.*« message in a ``wp_die()`` screen, then you’ve hooked too early. The hook, you should use is `[admin\_menu](../hooks/admin_menu)`. File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/) ``` function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } ``` | Uses | Description | | --- | --- | | [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added the `$position` parameter. | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress spawn_cron( int $gmt_time ): bool spawn\_cron( int $gmt\_time ): bool =================================== Sends a request to run cron through HTTP request that doesn’t halt page loading. `$gmt_time` int Optional Unix timestamp (UTC). Default 0 (current time is used). bool True if spawned, false if no events spawned. File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/) ``` function spawn_cron( $gmt_time = 0 ) { if ( ! $gmt_time ) { $gmt_time = microtime( true ); } if ( defined( 'DOING_CRON' ) || isset( $_GET['doing_wp_cron'] ) ) { return false; } /* * Get the cron lock, which is a Unix timestamp of when the last cron was spawned * and has not finished running. * * Multiple processes on multiple web servers can run this code concurrently, * this lock attempts to make spawning as atomic as possible. */ $lock = get_transient( 'doing_cron' ); if ( $lock > $gmt_time + 10 * MINUTE_IN_SECONDS ) { $lock = 0; } // Don't run if another process is currently running it or more than once every 60 sec. if ( $lock + WP_CRON_LOCK_TIMEOUT > $gmt_time ) { return false; } // Sanity check. $crons = wp_get_ready_cron_jobs(); if ( empty( $crons ) ) { return false; } $keys = array_keys( $crons ); if ( isset( $keys[0] ) && $keys[0] > $gmt_time ) { return false; } if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) { if ( 'GET' !== $_SERVER['REQUEST_METHOD'] || defined( 'DOING_AJAX' ) || defined( 'XMLRPC_REQUEST' ) ) { return false; } $doing_wp_cron = sprintf( '%.22F', $gmt_time ); set_transient( 'doing_cron', $doing_wp_cron ); ob_start(); wp_redirect( add_query_arg( 'doing_wp_cron', $doing_wp_cron, wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); echo ' '; // Flush any buffers and send the headers. wp_ob_end_flush_all(); flush(); include_once ABSPATH . 'wp-cron.php'; return true; } // Set the cron lock with the current unix timestamp, when the cron is being spawned. $doing_wp_cron = sprintf( '%.22F', $gmt_time ); set_transient( 'doing_cron', $doing_wp_cron ); /** * Filters the cron request arguments. * * @since 3.5.0 * @since 4.5.0 The `$doing_wp_cron` parameter was added. * * @param array $cron_request_array { * An array of cron request URL arguments. * * @type string $url The cron request URL. * @type int $key The 22 digit GMT microtime. * @type array $args { * An array of cron request arguments. * * @type int $timeout The request timeout in seconds. Default .01 seconds. * @type bool $blocking Whether to set blocking for the request. Default false. * @type bool $sslverify Whether SSL should be verified for the request. Default false. * } * } * @param string $doing_wp_cron The unix timestamp of the cron lock. */ $cron_request = apply_filters( 'cron_request', array( 'url' => add_query_arg( 'doing_wp_cron', $doing_wp_cron, site_url( 'wp-cron.php' ) ), 'key' => $doing_wp_cron, 'args' => array( 'timeout' => 0.01, 'blocking' => false, /** This filter is documented in wp-includes/class-wp-http-streams.php */ 'sslverify' => apply_filters( 'https_local_ssl_verify', false ), ), ), $doing_wp_cron ); $result = wp_remote_post( $cron_request['url'], $cron_request['args'] ); return ! is_wp_error( $result ); } ``` [apply\_filters( 'cron\_request', array $cron\_request\_array, string $doing\_wp\_cron )](../hooks/cron_request) Filters the cron request arguments. [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\_get\_ready\_cron\_jobs()](wp_get_ready_cron_jobs) wp-includes/cron.php | Retrieve cron jobs ready to be run. | | [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. | | [wp\_ob\_end\_flush\_all()](wp_ob_end_flush_all) wp-includes/functions.php | Flushes all output buffers for PHP 5.2. | | [site\_url()](site_url) wp-includes/link-template.php | Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. | | [wp\_remote\_post()](wp_remote_post) wp-includes/http.php | Performs an HTTP request using the POST method and returns its response. | | [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\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. | | [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [\_wp\_cron()](_wp_cron) wp-includes/cron.php | Run scheduled callbacks or spawn cron for all scheduled events. | | Version | Description | | --- | --- | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Return values added. | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
programming_docs
wordpress wp_cache_close(): true wp\_cache\_close(): true ======================== Closes the cache. This function has ceased to do anything since WordPress 2.5. The functionality was removed along with the rest of the persistent cache. This does not mean that plugins can’t implement this function when they need to make sure that the cache is cleaned up after WordPress no longer needs it. true Always returns true. File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/) ``` function wp_cache_close() { return true; } ``` | Used By | Description | | --- | --- | | [shutdown\_action\_hook()](shutdown_action_hook) wp-includes/load.php | Runs just before PHP shuts down execution. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress populate_roles_280() populate\_roles\_280() ====================== Create and modify WordPress roles for WordPress 2.8. File: `wp-admin/includes/schema.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/schema.php/) ``` function populate_roles_280() { $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'install_themes' ); } } ``` | Uses | Description | | --- | --- | | [get\_role()](get_role) wp-includes/capabilities.php | Retrieves role object. | | Used By | Description | | --- | --- | | [populate\_roles()](populate_roles) wp-admin/includes/schema.php | Execute WordPress role creation for the various WordPress versions. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress get_post_format_link( string $format ): string|WP_Error|false get\_post\_format\_link( string $format ): string|WP\_Error|false ================================================================= Returns a link to a post format index. `$format` string Required The post format slug. string|[WP\_Error](../classes/wp_error)|false The post format term link. File: `wp-includes/post-formats.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-formats.php/) ``` function get_post_format_link( $format ) { $term = get_term_by( 'slug', 'post-format-' . $format, 'post_format' ); if ( ! $term || is_wp_error( $term ) ) { return false; } return get_term_link( $term ); } ``` | Uses | Description | | --- | --- | | [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. | | [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | 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. | | [WP\_REST\_Post\_Format\_Search\_Handler::prepare\_item()](../classes/wp_rest_post_format_search_handler/prepare_item) wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php | Prepares the search result for a given ID. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress _deprecated_argument( string $function, string $version, string $message = '' ) \_deprecated\_argument( string $function, string $version, string $message = '' ) ================================================================================= Marks a function argument as deprecated and inform when it has been used. This function is to be used whenever a deprecated function argument is used. Before this function is called, the argument must be checked for whether it was used by comparing it to its default value or evaluating whether it is empty. For example: ``` if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '3.0.0' ); } ``` There is a hook deprecated\_argument\_run that will be called that can be used to get the backtrace up to what file and function used the deprecated argument. The current behavior is to trigger a user error if WP\_DEBUG is true. `$function` string Required The function that was called. `$version` string Required The version of WordPress that deprecated the argument used. `$message` string Optional A message regarding the change. Default: `''` File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function _deprecated_argument( $function, $version, $message = '' ) { /** * Fires when a deprecated argument is called. * * @since 3.0.0 * * @param string $function The function that was called. * @param string $message A message regarding the change. * @param string $version The version of WordPress that deprecated the argument used. */ do_action( 'deprecated_argument_run', $function, $message, $version ); /** * Filters whether to trigger an error for deprecated arguments. * * @since 3.0.0 * * @param bool $trigger Whether to trigger the error for deprecated arguments. Default true. */ if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) { if ( function_exists( '__' ) ) { if ( $message ) { trigger_error( sprintf( /* translators: 1: PHP function name, 2: Version number, 3: Optional message regarding the change. */ __( 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s' ), $function, $version, $message ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( /* translators: 1: PHP function name, 2: Version number. */ __( 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.' ), $function, $version ), E_USER_DEPRECATED ); } } else { if ( $message ) { trigger_error( sprintf( 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ), E_USER_DEPRECATED ); } } } } ``` [do\_action( 'deprecated\_argument\_run', string $function, string $message, string $version )](../hooks/deprecated_argument_run) Fires when a deprecated argument is called. [apply\_filters( 'deprecated\_argument\_trigger\_error', bool $trigger )](../hooks/deprecated_argument_trigger_error) Filters whether to trigger an error for deprecated arguments. | Uses | Description | | --- | --- | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [\_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\_merged\_data()](../classes/wp_theme_json_resolver/get_merged_data) wp-includes/class-wp-theme-json-resolver.php | Returns the data merged from multiple origins. | | [WP\_Theme\_JSON::get\_stylesheet()](../classes/wp_theme_json/get_stylesheet) wp-includes/class-wp-theme-json.php | Returns the stylesheet that results of processing the theme.json structure this object represents. | | [wp\_get\_environment\_type()](wp_get_environment_type) wp-includes/load.php | Retrieves the current environment type. | | [WP\_User::\_\_unset()](../classes/wp_user/__unset) wp-includes/class-wp-user.php | Magic method for unsetting a certain custom field. | | [update\_user\_status()](update_user_status) wp-includes/ms-deprecated.php | Update the status of a user in the database. | | [wp\_save\_image\_file()](wp_save_image_file) wp-admin/includes/image-edit.php | Saves image to file. | | [image\_edit\_apply\_changes()](image_edit_apply_changes) wp-admin/includes/image-edit.php | Performs group of changes on Editor specified. | | [wp\_stream\_image()](wp_stream_image) wp-admin/includes/image-edit.php | Streams image in [WP\_Image\_Editor](../classes/wp_image_editor) to browser. | | [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. | | [register\_setting()](register_setting) wp-includes/option.php | Registers a setting and its data. | | [unregister\_setting()](unregister_setting) wp-includes/option.php | Unregisters a setting. | | [get\_plugin\_data()](get_plugin_data) wp-admin/includes/plugin.php | Parses the plugin contents to retrieve plugin’s metadata. | | [add\_settings\_field()](add_settings_field) wp-admin/includes/template.php | Adds a new field to a section of a settings page. | | [add\_settings\_section()](add_settings_section) wp-admin/includes/template.php | Adds a new section to a settings page. | | [xfn\_check()](xfn_check) wp-admin/includes/meta-boxes.php | Displays ‘checked’ checkboxes attribute for XFN microformat options. | | [WP\_User::has\_cap()](../classes/wp_user/has_cap) wp-includes/class-wp-user.php | Returns whether the user has the specified capability. | | [WP\_User::\_\_isset()](../classes/wp_user/__isset) wp-includes/class-wp-user.php | Magic method for checking the existence of a certain custom field. | | [WP\_User::\_\_get()](../classes/wp_user/__get) wp-includes/class-wp-user.php | Magic method for accessing custom fields. | | [WP\_User::\_\_set()](../classes/wp_user/__set) wp-includes/class-wp-user.php | Magic method for setting custom user fields. | | [wp\_clear\_scheduled\_hook()](wp_clear_scheduled_hook) wp-includes/cron.php | Unschedules all events attached to the hook with the specified arguments. | | [get\_category\_parents()](get_category_parents) wp-includes/category-template.php | Retrieves category parents with separator. | | [wp\_dropdown\_categories()](wp_dropdown_categories) wp-includes/category-template.php | Displays or retrieves the HTML dropdown list of categories. | | [load\_plugin\_textdomain()](load_plugin_textdomain) wp-includes/l10n.php | Loads a plugin’s translated strings. | | [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. | | [convert\_chars()](convert_chars) wp-includes/formatting.php | Converts lone & characters into `&#038;` (a.k.a. `&amp;`) | | [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. | | [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | [safecss\_filter\_attr()](safecss_filter_attr) wp-includes/kses.php | Filters an inline style attribute and removes disallowed rules. | | [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\_categories()](get_categories) wp-includes/category.php | Retrieves a list of category objects. | | [wp\_upload\_bits()](wp_upload_bits) wp-includes/functions.php | Creates a file in the upload folder with given content. | | [wp\_get\_http\_headers()](wp_get_http_headers) wp-includes/functions.php | Retrieves HTTP Headers from URL. | | [get\_adjacent\_post()](get_adjacent_post) wp-includes/link-template.php | Retrieves the adjacent post. | | [get\_delete\_post\_link()](get_delete_post_link) wp-includes/link-template.php | Retrieves the delete posts link for post. | | [WP\_Admin\_Bar::\_\_get()](../classes/wp_admin_bar/__get) wp-includes/class-wp-admin-bar.php | | | [WP\_Admin\_Bar::add\_node()](../classes/wp_admin_bar/add_node) wp-includes/class-wp-admin-bar.php | Adds a node to the menu. | | [get\_wp\_title\_rss()](get_wp_title_rss) wp-includes/feed.php | Retrieves the blog title for the feed title. | | [wp\_title\_rss()](wp_title_rss) wp-includes/feed.php | Displays the blog title for display of the feed title. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [add\_option()](add_option) wp-includes/option.php | Adds a new option. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | [WP\_User\_Query::prepare\_query()](../classes/wp_user_query/prepare_query) wp-includes/class-wp-user-query.php | Prepares the query variables. | | [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. | | [wp\_list\_post\_revisions()](wp_list_post_revisions) wp-includes/post-template.php | Displays a list of a post’s revisions. | | [the\_attachment\_link()](the_attachment_link) wp-includes/post-template.php | Displays an attachment page link using an image or icon. | | [get\_the\_excerpt()](get_the_excerpt) wp-includes/post-template.php | Retrieves the post excerpt. | | [wp\_get\_recent\_posts()](wp_get_recent_posts) wp-includes/post.php | Retrieves a number of recent posts. | | [the\_author\_posts\_link()](the_author_posts_link) wp-includes/author-template.php | Displays an HTML link to the author page of the current post’s author. | | [get\_the\_author()](get_the_author) wp-includes/author-template.php | Retrieves the author of the current post. | | [the\_author()](the_author) wp-includes/author-template.php | Displays the name of the author of the current post. | | [update\_blog\_status()](update_blog_status) wp-includes/ms-blogs.php | Update a blog details field. | | [get\_last\_updated()](get_last_updated) wp-includes/ms-blogs.php | Get a list of most recently updated blogs. | | [update\_blog\_option()](update_blog_option) wp-includes/ms-blogs.php | Update an option for a particular blog. | | [ms\_subdomain\_constants()](ms_subdomain_constants) wp-includes/ms-default-constants.php | Defines Multisite subdomain constants and handles warnings and notices. | | [wp\_get\_sidebars\_widgets()](wp_get_sidebars_widgets) wp-includes/widgets.php | Retrieve full list of sidebars and their widget instance IDs. | | [trackback\_url()](trackback_url) wp-includes/comment-template.php | Displays the current post’s trackback URL. | | [trackback\_rdf()](trackback_rdf) wp-includes/comment-template.php | Generates and displays the RDF for the trackback information of current post. | | [comments\_link()](comments_link) wp-includes/comment-template.php | Displays the link to the current post comments. | | [discover\_pingback\_server\_uri()](discover_pingback_server_uri) wp-includes/comment.php | Finds a pingback server URI based on the given URL. | | [\_WP\_Editors::parse\_settings()](../classes/_wp_editors/parse_settings) wp-includes/class-wp-editor.php | Parse default arguments for the editor instance. | | Version | Description | | --- | --- | | [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | The error type is now classified as E\_USER\_DEPRECATED (used to default to E\_USER\_NOTICE). | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress _list_meta_row( array $entry, int $count ): string \_list\_meta\_row( array $entry, int $count ): string ===================================================== Outputs a single row of public meta data in the Custom Fields meta box. `$entry` array Required `$count` int Required string File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/) ``` function _list_meta_row( $entry, &$count ) { static $update_nonce = ''; if ( is_protected_meta( $entry['meta_key'], 'post' ) ) { return ''; } if ( ! $update_nonce ) { $update_nonce = wp_create_nonce( 'add-meta' ); } $r = ''; ++ $count; if ( is_serialized( $entry['meta_value'] ) ) { if ( is_serialized_string( $entry['meta_value'] ) ) { // This is a serialized string, so we should display it. $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] ); } else { // This is a serialized array/object so we should NOT display it. --$count; return ''; } } $entry['meta_key'] = esc_attr( $entry['meta_key'] ); $entry['meta_value'] = esc_textarea( $entry['meta_value'] ); // Using a <textarea />. $entry['meta_id'] = (int) $entry['meta_id']; $delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] ); $r .= "\n\t<tr id='meta-{$entry['meta_id']}'>"; $r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta-{$entry['meta_id']}-key'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta-{$entry['meta_id']}-key' type='text' size='20' value='{$entry['meta_key']}' />"; $r .= "\n\t\t<div class='submit'>"; $r .= get_submit_button( __( 'Delete' ), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array( 'data-wp-lists' => "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce" ) ); $r .= "\n\t\t"; $r .= get_submit_button( __( 'Update' ), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array( 'data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce" ) ); $r .= '</div>'; $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false ); $r .= '</td>'; $r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta-{$entry['meta_id']}-value' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>"; return $r; } ``` | Uses | Description | | --- | --- | | [get\_submit\_button()](get_submit_button) wp-admin/includes/template.php | Returns a submit button, with provided text and appropriate class. | | [esc\_textarea()](esc_textarea) wp-includes/formatting.php | Escaping for textarea values. | | [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\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. | | [is\_serialized()](is_serialized) wp-includes/functions.php | Checks value to find if it was serialized. | | [is\_serialized\_string()](is_serialized_string) wp-includes/functions.php | Checks whether serialized data is of string type. | | [maybe\_unserialize()](maybe_unserialize) wp-includes/functions.php | Unserializes data only if it was serialized. | | [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. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | Used By | Description | | --- | --- | | [list\_meta()](list_meta) wp-admin/includes/template.php | Outputs a post’s public meta data in the Custom Fields meta box. | | [wp\_ajax\_add\_meta()](wp_ajax_add_meta) wp-admin/includes/ajax-actions.php | Ajax handler for adding meta. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
programming_docs
wordpress _http_build_query( array|object $data, string $prefix = null, string $sep = null, string $key = '', bool $urlencode = true ): string \_http\_build\_query( array|object $data, string $prefix = null, string $sep = null, string $key = '', bool $urlencode = true ): string ======================================================================================================================================= This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use [https://www.php.net/manual/en/function.http-build-query.php](httpswww-php-netmanualenfunction-http-build-query-php) instead. From php.net (modified by Mark Jaquith to behave like the native PHP5 function). * <https://www.php.net/manual/en/function.http-build-query.php> `$data` array|object Required An array or object of data. Converted to array. `$prefix` string Optional Numeric index. If set, start parameter numbering with it. Default: `null` `$sep` string Optional Argument separator; defaults to `'arg_separator.output'`. Default: `null` `$key` string Optional Used to prefix key name. Default: `''` `$urlencode` bool Optional Whether to use urlencode() in the result. Default: `true` string The query string. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urlencode = true ) { $ret = array(); foreach ( (array) $data as $k => $v ) { if ( $urlencode ) { $k = urlencode( $k ); } if ( is_int( $k ) && null != $prefix ) { $k = $prefix . $k; } if ( ! empty( $key ) ) { $k = $key . '%5B' . $k . '%5D'; } if ( null === $v ) { continue; } elseif ( false === $v ) { $v = '0'; } if ( is_array( $v ) || is_object( $v ) ) { array_push( $ret, _http_build_query( $v, '', $sep, $k, $urlencode ) ); } elseif ( $urlencode ) { array_push( $ret, $k . '=' . urlencode( $v ) ); } else { array_push( $ret, $k . '=' . $v ); } } if ( null === $sep ) { $sep = ini_get( 'arg_separator.output' ); } return implode( $sep, $ret ); } ``` | Uses | Description | | --- | --- | | [\_http\_build\_query()](_http_build_query) wp-includes/functions.php | From php.net (modified by Mark Jaquith to behave like the native PHP5 function). | | Used By | Description | | --- | --- | | [build\_query()](build_query) wp-includes/functions.php | Builds URL query based on an associative and, or indexed array. | | [\_http\_build\_query()](_http_build_query) wp-includes/functions.php | From php.net (modified by Mark Jaquith to behave like the native PHP5 function). | | Version | Description | | --- | --- | | [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. | wordpress wp_ajax_update_welcome_panel() wp\_ajax\_update\_welcome\_panel() ================================== Ajax handler for updating whether to display the welcome panel. File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/) ``` function wp_ajax_update_welcome_panel() { check_ajax_referer( 'welcome-panel-nonce', 'welcomepanelnonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } update_user_meta( get_current_user_id(), 'show_welcome_panel', empty( $_POST['visible'] ) ? 0 : 1 ); wp_die( 1 ); } ``` | Uses | Description | | --- | --- | | [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. | | [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. | | [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 get_comment_reply_link( array $args = array(), int|WP_Comment $comment = null, int|WP_Post $post = null ): string|false|null get\_comment\_reply\_link( array $args = array(), int|WP\_Comment $comment = null, int|WP\_Post $post = null ): string|false|null ================================================================================================================================= Retrieves HTML content for reply to comment link. `$args` array Optional Override default arguments. * `add_below`stringThe first part of the selector used to identify the comment to respond below. The resulting value is passed as the first parameter to addComment.moveForm(), concatenated as $add\_below-$comment->comment\_ID. Default `'comment'`. * `respond_id`stringThe selector identifying the responding comment. Passed as the third parameter to addComment.moveForm(), and appended to the link URL as a hash value. Default `'respond'`. * `reply_text`stringThe text of the Reply link. Default `'Reply'`. * `login_text`stringThe text of the link to reply if logged out. Default 'Log in to Reply'. * `max_depth`intThe max depth of the comment tree. Default 0. * `depth`intThe depth of the new comment. Must be greater than 0 and less than the value of the `'thread_comments_depth'` option set in Settings > Discussion. Default 0. * `before`stringThe text or HTML to add before the reply link. * `after`stringThe text or HTML to add after the reply link. Default: `array()` `$comment` int|[WP\_Comment](../classes/wp_comment) Optional Comment being replied to. Default current comment. Default: `null` `$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object the comment is going to be displayed on. Default current post. Default: `null` string|false|null Link to show comment form, if successful. False, if comments are closed. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function get_comment_reply_link( $args = array(), $comment = null, $post = null ) { $defaults = array( 'add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __( 'Reply' ), /* translators: Comment reply button text. %s: Comment author name. */ 'reply_to_text' => __( 'Reply to %s' ), 'login_text' => __( 'Log in to Reply' ), 'max_depth' => 0, 'depth' => 0, 'before' => '', 'after' => '', ); $args = wp_parse_args( $args, $defaults ); if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] ) { return; } $comment = get_comment( $comment ); if ( empty( $comment ) ) { return; } if ( empty( $post ) ) { $post = $comment->comment_post_ID; } $post = get_post( $post ); if ( ! comments_open( $post->ID ) ) { return false; } if ( get_option( 'page_comments' ) ) { $permalink = str_replace( '#comment-' . $comment->comment_ID, '', get_comment_link( $comment ) ); } else { $permalink = get_permalink( $post->ID ); } /** * Filters the comment reply link arguments. * * @since 4.1.0 * * @param array $args Comment reply link arguments. See get_comment_reply_link() * for more information on accepted arguments. * @param WP_Comment $comment The object of the comment being replied to. * @param WP_Post $post The WP_Post object. */ $args = apply_filters( 'comment_reply_link_args', $args, $comment, $post ); if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) { $link = sprintf( '<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>', esc_url( wp_login_url( get_permalink() ) ), $args['login_text'] ); } else { $data_attributes = array( 'commentid' => $comment->comment_ID, 'postid' => $post->ID, 'belowelement' => $args['add_below'] . '-' . $comment->comment_ID, 'respondelement' => $args['respond_id'], 'replyto' => sprintf( $args['reply_to_text'], get_comment_author( $comment ) ), ); $data_attribute_string = ''; foreach ( $data_attributes as $name => $value ) { $data_attribute_string .= " data-{$name}=\"" . esc_attr( $value ) . '"'; } $data_attribute_string = trim( $data_attribute_string ); $link = sprintf( "<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>", esc_url( add_query_arg( array( 'replytocom' => $comment->comment_ID, 'unapproved' => false, 'moderation-hash' => false, ), $permalink ) ) . '#' . $args['respond_id'], $data_attribute_string, esc_attr( sprintf( $args['reply_to_text'], get_comment_author( $comment ) ) ), $args['reply_text'] ); } /** * Filters the comment reply link. * * @since 2.7.0 * * @param string $link The HTML markup for the comment reply link. * @param array $args An array of arguments overriding the defaults. * @param WP_Comment $comment The object of the comment being replied. * @param WP_Post $post The WP_Post object. */ return apply_filters( 'comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post ); } ``` [apply\_filters( 'comment\_reply\_link', string $link, array $args, WP\_Comment $comment, WP\_Post $post )](../hooks/comment_reply_link) Filters the comment reply link. [apply\_filters( 'comment\_reply\_link\_args', array $args, WP\_Comment $comment, WP\_Post $post )](../hooks/comment_reply_link_args) Filters the comment reply link arguments. | Uses | Description | | --- | --- | | [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. | | [comments\_open()](comments_open) wp-includes/comment-template.php | Determines whether the current post is open for comments. | | [get\_comment\_link()](get_comment_link) wp-includes/comment-template.php | Retrieves the link to a given comment. | | [get\_comment\_author()](get_comment_author) wp-includes/comment-template.php | Retrieves the author of the current comment. | | [\_\_()](__) 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. | | [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | [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. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. | | Used By | Description | | --- | --- | | [comment\_reply\_link()](comment_reply_link) wp-includes/comment-template.php | Displays the HTML content for reply to comment link. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the ability for `$comment` to also accept a [WP\_Comment](../classes/wp_comment) object. | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress wp_get_recent_posts( array $args = array(), string $output = ARRAY_A ): array|false wp\_get\_recent\_posts( array $args = array(), string $output = ARRAY\_A ): array|false ======================================================================================= Retrieves a number of recent posts. * [get\_posts()](get_posts) `$args` array Optional Arguments to retrieve posts. Default: `array()` `$output` string Optional The required return type. One of OBJECT or ARRAY\_A, which correspond to a [WP\_Post](../classes/wp_post) object or an associative array, respectively. Default: `ARRAY_A` array|false Array of recent posts, where the type of each element is determined by the `$output` parameter. Empty array on failure. Only the value of ARRAY\_A is checked for $output. Any other value or constant passed will return an array of objects. This function returns posts in an associative array (ARRAY\_A) format which is compatible with WordPress versions below 3.1. To get output similar to [get\_posts()](get_posts) , use OBJECT as the second parameter: wp\_get\_recent\_posts( $args, OBJECT ); File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) { if ( is_numeric( $args ) ) { _deprecated_argument( __FUNCTION__, '3.1.0', __( 'Passing an integer number of posts is deprecated. Pass an array of arguments instead.' ) ); $args = array( 'numberposts' => absint( $args ) ); } // Set default arguments. $defaults = array( 'numberposts' => 10, 'offset' => 0, 'category' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending, private', 'suppress_filters' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $results = get_posts( $parsed_args ); // Backward compatibility. Prior to 3.1 expected posts to be returned in array. if ( ARRAY_A === $output ) { foreach ( $results as $key => $result ) { $results[ $key ] = get_object_vars( $result ); } return $results ? $results : array(); } return $results ? $results : false; } ``` | Uses | Description | | --- | --- | | [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. | | [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | Used By | Description | | --- | --- | | [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::mt\_getRecentPostTitles()](../classes/wp_xmlrpc_server/mt_getrecentposttitles) wp-includes/class-wp-xmlrpc-server.php | Retrieve the post titles of recent posts. | | [wp\_xmlrpc\_server::blogger\_getRecentPosts()](../classes/wp_xmlrpc_server/blogger_getrecentposts) wp-includes/class-wp-xmlrpc-server.php | Retrieve list of recent posts. | | [wp\_xmlrpc\_server::wp\_getPosts()](../classes/wp_xmlrpc_server/wp_getposts) wp-includes/class-wp-xmlrpc-server.php | Retrieve posts. | | Version | Description | | --- | --- | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. | wordpress get_userdatabylogin( string $user_login ): bool|object get\_userdatabylogin( string $user\_login ): bool|object ======================================================== This function has been deprecated. Use [get\_user\_by()](get_user_by) instead. Retrieve user info by login name. * [get\_user\_by()](get_user_by) `$user_login` string Required User's username bool|object False on failure, User DB row object File: `wp-includes/pluggable-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable-deprecated.php/) ``` function get_userdatabylogin($user_login) { _deprecated_function( __FUNCTION__, '3.3.0', "get_user_by('login')" ); return get_user_by('login', $user_login); } ``` | Uses | Description | | --- | --- | | [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.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Use [get\_user\_by()](get_user_by) | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress rich_edit_exists(): bool rich\_edit\_exists(): bool ========================== This function has been deprecated. Determine if TinyMCE is available. Checks to see if the user has deleted the tinymce files to slim down their WordPress installation. bool Whether TinyMCE exists. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function rich_edit_exists() { global $wp_rich_edit_exists; _deprecated_function( __FUNCTION__, '3.9.0' ); if ( ! isset( $wp_rich_edit_exists ) ) $wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' ); return $wp_rich_edit_exists; } ``` | Uses | Description | | --- | --- | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | This function has been deprecated. | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress links_add_target( string $content, string $target = '_blank', string[] $tags = array('a') ): string links\_add\_target( string $content, string $target = '\_blank', string[] $tags = array('a') ): string ====================================================================================================== Adds a Target attribute to all links in passed content. This function by default only applies to `<a>` tags, however this can be modified by the 3rd param. \_NOTE:\_ Any current target attributed will be stripped and replaced. `$content` string Required String to search for links in. `$target` string Optional The Target to add to the links. Default: `'_blank'` `$tags` string[] Optional An array of tags to apply to. Default: `array('a')` string The processed content. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function links_add_target( $content, $target = '_blank', $tags = array( 'a' ) ) { global $_links_add_target; $_links_add_target = $target; $tags = implode( '|', (array) $tags ); return preg_replace_callback( "!<($tags)((\s[^>]*)?)>!i", '_links_add_target', $content ); } ``` | Used By | Description | | --- | --- | | [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
programming_docs
wordpress wp_check_browser_version(): array|false wp\_check\_browser\_version(): array|false ========================================== Checks if the user needs a browser update. array|false Array of browser data on success, false on failure. File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/) ``` function wp_check_browser_version() { if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { return false; } $key = md5( $_SERVER['HTTP_USER_AGENT'] ); $response = get_site_transient( 'browser_' . $key ); if ( false === $response ) { // Include an unmodified $wp_version. require ABSPATH . WPINC . '/version.php'; $url = 'http://api.wordpress.org/core/browse-happy/1.1/'; $options = array( 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), ); if ( wp_http_supports( array( 'ssl' ) ) ) { $url = set_url_scheme( $url, 'https' ); } $response = wp_remote_post( $url, $options ); if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { return false; } /** * Response should be an array with: * 'platform' - string - A user-friendly platform name, if it can be determined * 'name' - string - A user-friendly browser name * 'version' - string - The version of the browser the user is using * 'current_version' - string - The most recent version of the browser * 'upgrade' - boolean - Whether the browser needs an upgrade * 'insecure' - boolean - Whether the browser is deemed insecure * 'update_url' - string - The url to visit to upgrade * 'img_src' - string - An image representing the browser * 'img_src_ssl' - string - An image (over SSL) representing the browser */ $response = json_decode( wp_remote_retrieve_body( $response ), true ); if ( ! is_array( $response ) ) { return false; } set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS ); } return $response; } ``` | Uses | Description | | --- | --- | | [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. | | [wp\_http\_supports()](wp_http_supports) wp-includes/http.php | Determines if there is an HTTP Transport that can process this request. | | [wp\_remote\_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. | | [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. | | [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. | | [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [dashboard\_browser\_nag\_class()](dashboard_browser_nag_class) wp-admin/includes/dashboard.php | Adds an additional class to the browser nag if the current version is insecure. | | [wp\_dashboard\_browser\_nag()](wp_dashboard_browser_nag) wp-admin/includes/dashboard.php | Displays the browser update nag. | | [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. | | Version | Description | | --- | --- | | [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. | wordpress the_category_rss( string $type = null ) the\_category\_rss( string $type = null ) ========================================= Displays the post categories in the feed. * [get\_the\_category\_rss()](get_the_category_rss) : For better explanation. `$type` string Optional default is the type returned by [get\_default\_feed()](get_default_feed) . Default: `null` File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/) ``` function the_category_rss( $type = null ) { echo get_the_category_rss( $type ); } ``` | Uses | 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 | | --- | --- | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress activate_plugin( string $plugin, string $redirect = '', bool $network_wide = false, bool $silent = false ): null|WP_Error activate\_plugin( string $plugin, string $redirect = '', bool $network\_wide = false, bool $silent = false ): null|WP\_Error ============================================================================================================================ Attempts activation of plugin in a “sandbox” and redirects on success. A plugin that is already activated will not attempt to be activated again. 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. Also, the options will not be updated and the activation hook will not be called on plugin error. It should be noted that in no way the below code will actually prevent errors within the file. The code should not be used elsewhere to replicate the "sandbox", which uses redirection to work. {@source 13 1} If any errors are found or text is outputted, then it will be captured to ensure that the success redirection will update the error redirection. `$plugin` string Required Path to the plugin file relative to the plugins directory. `$redirect` string Optional URL to redirect to. Default: `''` `$network_wide` bool Optional Whether to enable the plugin for all sites in the network or just the current site. Multisite only. Default: `false` `$silent` bool Optional Whether to prevent calling activation hooks. Default: `false` null|[WP\_Error](../classes/wp_error) Null on success, [WP\_Error](../classes/wp_error) on invalid file. Plugin will fail to activate with the following generic response for multiple reasons, including; issues parsing the header information, issue with the ‘plugin’ cache (see [WordPress Object Cache](../classes/wp_object_cache)), or a permissions error. ``` The plugin does not have a valid header. ``` Issues with the plugin cache, are caused when the plugin files are added or modified, after the plugins have all been initialised. This can be resolved by reloading the page, sending the `activate_plugin()` as a separate AJAX request, or if necessary, by manually updating the cache. Example below: ``` $cache_plugins = wp_cache_get( 'plugins', 'plugins' ); if ( !empty( $cache_plugins ) ) { $new_plugin = array( 'Name' => $plugin_name, 'PluginURI' => $plugin_uri, 'Version' => $plugin_version, 'Description' => $plugin_description, 'Author' => $author_name, 'AuthorURI' => $author_uri, 'TextDomain' => '', 'DomainPath' => '', 'Network' => '', 'Title' => $plugin_name, 'AuthorName' => $author_name, ); $cache_plugins[''][$plugin_path] = $new_plugin; wp_cache_set( 'plugins', $cache_plugins, 'plugins' ); } ``` File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/) ``` function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) { $plugin = plugin_basename( trim( $plugin ) ); if ( is_multisite() && ( $network_wide || is_network_only_plugin( $plugin ) ) ) { $network_wide = true; $current = get_site_option( 'active_sitewide_plugins', array() ); $_GET['networkwide'] = 1; // Back compat for plugins looking for this value. } else { $current = get_option( 'active_plugins', array() ); } $valid = validate_plugin( $plugin ); if ( is_wp_error( $valid ) ) { return $valid; } $requirements = validate_plugin_requirements( $plugin ); if ( is_wp_error( $requirements ) ) { return $requirements; } if ( $network_wide && ! isset( $current[ $plugin ] ) || ! $network_wide && ! in_array( $plugin, $current, true ) ) { if ( ! empty( $redirect ) ) { // We'll override this later if the plugin can be included without fatal error. wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) ); } ob_start(); // Load the plugin to test whether it throws any errors. plugin_sandbox_scrape( $plugin ); if ( ! $silent ) { /** * Fires before a plugin is activated. * * If a plugin is silently activated (such as during an update), * this hook does not fire. * * @since 2.9.0 * * @param string $plugin Path to the plugin file relative to the plugins directory. * @param bool $network_wide Whether to enable the plugin for all sites in the network * or just the current site. Multisite only. Default false. */ do_action( 'activate_plugin', $plugin, $network_wide ); /** * Fires as a specific plugin is being activated. * * This hook is the "activation" hook used internally by register_activation_hook(). * The dynamic portion of the hook name, `$plugin`, refers to the plugin basename. * * If a plugin is silently activated (such as during an update), this hook does not fire. * * @since 2.0.0 * * @param bool $network_wide Whether to enable the plugin for all sites in the network * or just the current site. Multisite only. Default false. */ do_action( "activate_{$plugin}", $network_wide ); } if ( $network_wide ) { $current = get_site_option( 'active_sitewide_plugins', array() ); $current[ $plugin ] = time(); update_site_option( 'active_sitewide_plugins', $current ); } else { $current = get_option( 'active_plugins', array() ); $current[] = $plugin; sort( $current ); update_option( 'active_plugins', $current ); } if ( ! $silent ) { /** * Fires after a plugin has been activated. * * If a plugin is silently activated (such as during an update), * this hook does not fire. * * @since 2.9.0 * * @param string $plugin Path to the plugin file relative to the plugins directory. * @param bool $network_wide Whether to enable the plugin for all sites in the network * or just the current site. Multisite only. Default false. */ do_action( 'activated_plugin', $plugin, $network_wide ); } if ( ob_get_length() > 0 ) { $output = ob_get_clean(); return new WP_Error( 'unexpected_output', __( 'The plugin generated unexpected output.' ), $output ); } ob_end_clean(); } return null; } ``` [do\_action( 'activated\_plugin', string $plugin, bool $network\_wide )](../hooks/activated_plugin) Fires after a plugin has been activated. [do\_action( "activate\_{$plugin}", bool $network\_wide )](../hooks/activate_plugin) Fires as a specific plugin is being activated. | Uses | Description | | --- | --- | | [validate\_plugin\_requirements()](validate_plugin_requirements) wp-admin/includes/plugin.php | Validates the plugin requirements for WordPress version and PHP version. | | [update\_site\_option()](update_site_option) wp-includes/option.php | Updates the value of an option that was already added for the current network. | | [is\_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. | | [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. | | [validate\_plugin()](validate_plugin) wp-admin/includes/plugin.php | Validates the plugin path. | | [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. | | [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. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. | | [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Used By | Description | | --- | --- | | [WP\_REST\_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. | | [activate\_plugins()](activate_plugins) wp-admin/includes/plugin.php | Activates multiple plugins. | | Version | Description | | --- | --- | | [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Test for WordPress version and PHP version compatibility. | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress add_links_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', int $position = null ): string|false add\_links\_page( string $page\_title, string $menu\_title, string $capability, string $menu\_slug, callable $callback = '', int $position = null ): string|false ================================================================================================================================================================= Adds a submenu page to the Links main menu. This function takes a capability which will be used to determine whether or not a page is included in the menu. The function which is hooked in to handle the output of the page must check that the user has the required capability as well. `$page_title` string Required The text to be displayed in the title tags of the page when the menu is selected. `$menu_title` string Required The text to be used for the menu. `$capability` string Required The capability required for this menu to be displayed to the user. `$menu_slug` string Required The slug name to refer to this menu by (should be unique for this menu). `$callback` callable Optional The function to be called to output the content for this page. Default: `''` `$position` int Optional The position in the menu order this item should appear. Default: `null` string|false The resulting page's hook\_suffix, or false if the user does not have the capability required. * If you’re running into the »*You do not have sufficient permissions to access this page.*« message in a [wp\_die()](wp_die) screen, then you’ve hooked too early. The hook you should use is `admin_menu`. * This function is a simple wrapper for a call to [add\_submenu\_page()](add_submenu_page) , passing the received arguments and specifying ‘`link-manager.php`‘ as the `$parent_slug` argument. This means the new page will be added as a sub menu to the Links menu. * The `$capability` parameter is used to determine whether or not the page is included in the menu based on the [Roles and Capabilities](https://wordpress.org/support/article/roles-and-capabilities/) of the current user. * The function handling the output of the options page should also verify the user’s capabilities. File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/) ``` function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } ``` | Uses | Description | | --- | --- | | [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added the `$position` parameter. | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress wp_handle_comment_submission( array $comment_data ): WP_Comment|WP_Error wp\_handle\_comment\_submission( array $comment\_data ): WP\_Comment|WP\_Error ============================================================================== Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. This function expects unslashed data, as opposed to functions such as `wp_new_comment()` which expect slashed data. `$comment_data` array Required Comment data. * `comment_post_ID`string|intThe ID of the post that relates to the comment. * `author`stringThe name of the comment author. * `email`stringThe comment author email address. * `url`stringThe comment author URL. * `comment`stringThe content of the comment. * `comment_parent`string|intThe ID of this comment's parent, if any. Default 0. * `_wp_unfiltered_html_comment`stringThe nonce value for allowing unfiltered HTML. [WP\_Comment](../classes/wp_comment)|[WP\_Error](../classes/wp_error) A [WP\_Comment](../classes/wp_comment) object on success, a [WP\_Error](../classes/wp_error) object on failure. File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/) ``` function wp_handle_comment_submission( $comment_data ) { $comment_post_id = 0; $comment_author = ''; $comment_author_email = ''; $comment_author_url = ''; $comment_content = ''; $comment_parent = 0; $user_id = 0; if ( isset( $comment_data['comment_post_ID'] ) ) { $comment_post_id = (int) $comment_data['comment_post_ID']; } if ( isset( $comment_data['author'] ) && is_string( $comment_data['author'] ) ) { $comment_author = trim( strip_tags( $comment_data['author'] ) ); } if ( isset( $comment_data['email'] ) && is_string( $comment_data['email'] ) ) { $comment_author_email = trim( $comment_data['email'] ); } if ( isset( $comment_data['url'] ) && is_string( $comment_data['url'] ) ) { $comment_author_url = trim( $comment_data['url'] ); } if ( isset( $comment_data['comment'] ) && is_string( $comment_data['comment'] ) ) { $comment_content = trim( $comment_data['comment'] ); } if ( isset( $comment_data['comment_parent'] ) ) { $comment_parent = absint( $comment_data['comment_parent'] ); } $post = get_post( $comment_post_id ); if ( empty( $post->comment_status ) ) { /** * Fires when a comment is attempted on a post that does not exist. * * @since 1.5.0 * * @param int $comment_post_id Post ID. */ do_action( 'comment_id_not_found', $comment_post_id ); return new WP_Error( 'comment_id_not_found' ); } // get_post_status() will get the parent status for attachments. $status = get_post_status( $post ); if ( ( 'private' === $status ) && ! current_user_can( 'read_post', $comment_post_id ) ) { return new WP_Error( 'comment_id_not_found' ); } $status_obj = get_post_status_object( $status ); if ( ! comments_open( $comment_post_id ) ) { /** * Fires when a comment is attempted on a post that has comments closed. * * @since 1.5.0 * * @param int $comment_post_id Post ID. */ do_action( 'comment_closed', $comment_post_id ); return new WP_Error( 'comment_closed', __( 'Sorry, comments are closed for this item.' ), 403 ); } elseif ( 'trash' === $status ) { /** * Fires when a comment is attempted on a trashed post. * * @since 2.9.0 * * @param int $comment_post_id Post ID. */ do_action( 'comment_on_trash', $comment_post_id ); return new WP_Error( 'comment_on_trash' ); } elseif ( ! $status_obj->public && ! $status_obj->private ) { /** * Fires when a comment is attempted on a post in draft mode. * * @since 1.5.1 * * @param int $comment_post_id Post ID. */ do_action( 'comment_on_draft', $comment_post_id ); if ( current_user_can( 'read_post', $comment_post_id ) ) { return new WP_Error( 'comment_on_draft', __( 'Sorry, comments are not allowed for this item.' ), 403 ); } else { return new WP_Error( 'comment_on_draft' ); } } elseif ( post_password_required( $comment_post_id ) ) { /** * Fires when a comment is attempted on a password-protected post. * * @since 2.9.0 * * @param int $comment_post_id Post ID. */ do_action( 'comment_on_password_protected', $comment_post_id ); return new WP_Error( 'comment_on_password_protected' ); } else { /** * Fires before a comment is posted. * * @since 2.8.0 * * @param int $comment_post_id Post ID. */ do_action( 'pre_comment_on_post', $comment_post_id ); } // If the user is logged in. $user = wp_get_current_user(); if ( $user->exists() ) { if ( empty( $user->display_name ) ) { $user->display_name = $user->user_login; } $comment_author = $user->display_name; $comment_author_email = $user->user_email; $comment_author_url = $user->user_url; $user_id = $user->ID; if ( current_user_can( 'unfiltered_html' ) ) { if ( ! isset( $comment_data['_wp_unfiltered_html_comment'] ) || ! wp_verify_nonce( $comment_data['_wp_unfiltered_html_comment'], 'unfiltered-html-comment_' . $comment_post_id ) ) { 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 { if ( get_option( 'comment_registration' ) ) { return new WP_Error( 'not_logged_in', __( 'Sorry, you must be logged in to comment.' ), 403 ); } } $comment_type = 'comment'; if ( get_option( 'require_name_email' ) && ! $user->exists() ) { if ( '' == $comment_author_email || '' == $comment_author ) { return new WP_Error( 'require_name_email', __( '<strong>Error:</strong> Please fill the required fields.' ), 200 ); } elseif ( ! is_email( $comment_author_email ) ) { return new WP_Error( 'require_valid_email', __( '<strong>Error:</strong> Please enter a valid email address.' ), 200 ); } } $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' ); /** * Filters whether an empty comment should be allowed. * * @since 5.1.0 * * @param bool $allow_empty_comment Whether to allow empty comments. Default false. * @param array $commentdata Array of comment data to be sent to wp_insert_comment(). */ $allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata ); if ( '' === $comment_content && ! $allow_empty_comment ) { return new WP_Error( 'require_valid_comment', __( '<strong>Error:</strong> Please type your comment text.' ), 200 ); } $check_max_lengths = wp_check_comment_data_max_lengths( $commentdata ); if ( is_wp_error( $check_max_lengths ) ) { return $check_max_lengths; } $comment_id = wp_new_comment( wp_slash( $commentdata ), true ); if ( is_wp_error( $comment_id ) ) { return $comment_id; } if ( ! $comment_id ) { return new WP_Error( 'comment_save_error', __( '<strong>Error:</strong> The comment could not be saved. Please try again later.' ), 500 ); } return get_comment( $comment_id ); } ``` [apply\_filters( 'allow\_empty\_comment', bool $allow\_empty\_comment, array $commentdata )](../hooks/allow_empty_comment) Filters whether an empty comment should be allowed. [do\_action( 'comment\_closed', int $comment\_post\_id )](../hooks/comment_closed) Fires when a comment is attempted on a post that has comments closed. [do\_action( 'comment\_id\_not\_found', int $comment\_post\_id )](../hooks/comment_id_not_found) Fires when a comment is attempted on a post that does not exist. [do\_action( 'comment\_on\_draft', int $comment\_post\_id )](../hooks/comment_on_draft) Fires when a comment is attempted on a post in draft mode. [do\_action( 'comment\_on\_password\_protected', int $comment\_post\_id )](../hooks/comment_on_password_protected) Fires when a comment is attempted on a password-protected post. [do\_action( 'comment\_on\_trash', int $comment\_post\_id )](../hooks/comment_on_trash) Fires when a comment is attempted on a trashed post. [do\_action( 'pre\_comment\_on\_post', int $comment\_post\_id )](../hooks/pre_comment_on_post) Fires before a comment is posted. | Uses | Description | | --- | --- | | [wp\_check\_comment\_data\_max\_lengths()](wp_check_comment_data_max_lengths) wp-includes/comment.php | Compares the lengths of comment data against the maximum character limits. | | [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. | | [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. | | [wp\_verify\_nonce()](wp_verify_nonce) wp-includes/pluggable.php | Verifies that a correct security nonce was used with time limit. | | [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\_new\_comment()](wp_new_comment) wp-includes/comment.php | Adds a new comment to the database. | | [comments\_open()](comments_open) wp-includes/comment-template.php | Determines whether the current post is open for comments. | | [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. | | [get\_post\_status\_object()](get_post_status_object) wp-includes/post.php | Retrieves a post status object by name. | | [get\_post\_status()](get_post_status) wp-includes/post.php | Retrieves the post status based on the post ID. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. | | [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. | | [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. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. | | [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. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
programming_docs
wordpress get_post_types( array|string $args = array(), string $output = 'names', string $operator = 'and' ): string[]|WP_Post_Type[] get\_post\_types( array|string $args = array(), string $output = 'names', string $operator = 'and' ): string[]|WP\_Post\_Type[] =============================================================================================================================== Gets a list of all registered post type objects. * [register\_post\_type()](register_post_type) : for accepted arguments. `$args` array|string Optional An array of key => value arguments to match against the post type objects. Default: `array()` `$output` string Optional The type of output to return. Accepts post type `'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; `'not'` means no elements may match. Default `'and'`. Default: `'and'` string[]|[WP\_Post\_Type](../classes/wp_post_type)[] An array of post type names or objects. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) { global $wp_post_types; $field = ( 'names' === $output ) ? 'name' : false; return wp_filter_object_list( $wp_post_types, $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\_Block\_Patterns\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_block_patterns_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php | Checks whether a given request has permission to read block patterns. | | [WP\_REST\_Block\_Pattern\_Categories\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_block_pattern_categories_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php | Checks whether a given request has permission to read block patterns. | | [WP\_REST\_Menu\_Items\_Controller::check\_has\_read\_only\_access()](../classes/wp_rest_menu_items_controller/check_has_read_only_access) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Checks whether the current user has read permission for the endpoint. | | [WP\_REST\_URL\_Details\_Controller::permissions\_check()](../classes/wp_rest_url_details_controller/permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Checks whether a given request has permission to read remote URLs. | | [WP\_REST\_Menus\_Controller::check\_has\_read\_only\_access()](../classes/wp_rest_menus_controller/check_has_read_only_access) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Checks whether the current user has read permission for the endpoint. | | [\_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\_Pattern\_Directory\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_pattern_directory_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php | Checks whether a given request has permission to view the local block pattern directory. | | [WP\_REST\_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::check\_read\_active\_theme\_permission()](../classes/wp_rest_themes_controller/check_read_active_theme_permission) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Checks if a theme can be read. | | [do\_all\_trackbacks()](do_all_trackbacks) wp-includes/comment.php | Performs all trackbacks. | | [do\_all\_enclosures()](do_all_enclosures) wp-includes/comment.php | Performs all enclosures. | | [do\_all\_pingbacks()](do_all_pingbacks) wp-includes/comment.php | Performs all pingbacks. | | [WP\_REST\_Block\_Types\_Controller::check\_read\_permission()](../classes/wp_rest_block_types_controller/check_read_permission) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Checks whether a given block type should be visible. | | [WP\_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\_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\_REST\_Post\_Search\_Handler::\_\_construct()](../classes/wp_rest_post_search_handler/__construct) wp-includes/rest-api/search/class-wp-rest-post-search-handler.php | Constructor. | | [WP\_Theme::get\_post\_templates()](../classes/wp_theme/get_post_templates) wp-includes/class-wp-theme.php | Returns the theme’s post templates. | | [create\_initial\_rest\_routes()](create_initial_rest_routes) wp-includes/rest-api.php | Registers default REST API routes. | | [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::get\_items\_permissions\_check()](../classes/wp_rest_users_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Permissions check for getting all users. | | [WP\_REST\_Users\_Controller::get\_items()](../classes/wp_rest_users_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves all users. | | [WP\_REST\_Users\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_users_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Checks if a given request has access to read a user. | | [WP\_REST\_Post\_Statuses\_Controller::check\_read\_permission()](../classes/wp_rest_post_statuses_controller/check_read_permission) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Checks whether a given post status should be visible. | | [WP\_REST\_Post\_Statuses\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_post_statuses_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Checks whether a given request has permission to read post statuses. | | [WP\_REST\_Post\_Types\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_post_types_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Checks whether a given request has permission to read types. | | [WP\_REST\_Post\_Types\_Controller::get\_items()](../classes/wp_rest_post_types_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Retrieves all public post types. | | [get\_post\_embed\_url()](get_post_embed_url) wp-includes/embed.php | Retrieves the URL to embed a specific post in an iframe. | | [WP\_Screen::render\_view\_mode()](../classes/wp_screen/render_view_mode) wp-admin/includes/class-wp-screen.php | Renders the list table view mode preferences. | | [WP\_Customize\_Nav\_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\_delete\_user()](wp_delete_user) wp-admin/includes/user.php | Remove user and optionally reassign posts and links to another user. | | [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\_ajax\_menu\_get\_metabox()](wp_ajax_menu_get_metabox) wp-admin/includes/ajax-actions.php | Ajax handler for retrieving menu meta boxes. | | [wp\_ajax\_find\_posts()](wp_ajax_find_posts) wp-admin/includes/ajax-actions.php | Ajax handler for querying posts for the Find Posts modal. | | [WP\_Terms\_List\_Table::\_\_construct()](../classes/wp_terms_list_table/__construct) wp-admin/includes/class-wp-terms-list-table.php | Constructor. | | [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::parse\_request()](../classes/wp/parse_request) wp-includes/class-wp.php | Parses the request to find the correct WordPress query. | | [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. | | [WP\_Embed::cache\_oembed()](../classes/wp_embed/cache_oembed) wp-includes/class-wp-embed.php | Triggers a caching of all oEmbed results. | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [wp\_admin\_bar\_new\_content\_menu()](wp_admin_bar_new_content_menu) wp-includes/admin-bar.php | Adds “Add New” menu. | | [WP\_User\_Query::prepare\_query()](../classes/wp_user_query/prepare_query) wp-includes/class-wp-user-query.php | Prepares the query variables. | | [\_get\_last\_post\_time()](_get_last_post_time) wp-includes/post.php | Gets the timestamp of the last time any post was modified or published. | | [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). | | [\_add\_post\_type\_submenus()](_add_post_type_submenus) wp-includes/post.php | Adds submenus for post types. | | [WP\_Rewrite::generate\_rewrite\_rules()](../classes/wp_rewrite/generate_rewrite_rules) wp-includes/class-wp-rewrite.php | Generates rewrite rules from a permalink structure. | | [url\_to\_postid()](url_to_postid) wp-includes/rewrite.php | Examines a URL and try to determine the post ID it represents. | | [redirect\_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\_xmlrpc\_server::wp\_getPostTypes()](../classes/wp_xmlrpc_server/wp_getposttypes) wp-includes/class-wp-xmlrpc-server.php | Retrieves a post types | | [\_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 | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress wp_direct_php_update_button() wp\_direct\_php\_update\_button() ================================= Displays a button directly linking to a PHP update process. This provides hosts with a way for users to be sent directly to their PHP update process. The button is only displayed if a URL is returned by `wp_get_direct_php_update_url()`. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp_direct_php_update_button() { $direct_update_url = wp_get_direct_php_update_url(); if ( empty( $direct_update_url ) ) { return; } echo '<p class="button-container">'; printf( '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>', esc_url( $direct_update_url ), __( 'Update PHP' ), /* translators: Accessibility text. */ __( '(opens in a new tab)' ) ); echo '</p>'; } ``` | Uses | Description | | --- | --- | | [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-includes/l10n.php | Retrieves the translation of $text. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | Used By | Description | | --- | --- | | [wp\_dashboard\_php\_nag()](wp_dashboard_php_nag) wp-admin/includes/dashboard.php | Displays the PHP update nag. | | Version | Description | | --- | --- | | [5.1.1](https://developer.wordpress.org/reference/since/5.1.1/) | Introduced. | wordpress iis7_save_url_rewrite_rules(): bool|null iis7\_save\_url\_rewrite\_rules(): bool|null ============================================ Updates the IIS web.config file with the current rules if it is writable. If the permalinks do not require rewrite rules then the rules are deleted from the web.config file. 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 iis7_save_url_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(); $web_config_file = $home_path . 'web.config'; // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP. if ( iis7_supports_permalinks() && ( ! file_exists( $web_config_file ) && win_is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks() || win_is_writable( $web_config_file ) ) ) { $rule = $wp_rewrite->iis7_url_rewrite_rules( false ); if ( ! empty( $rule ) ) { return iis7_add_rewrite_rule( $web_config_file, $rule ); } else { return iis7_delete_rewrite_rule( $web_config_file ); } } return false; } ``` | Uses | Description | | --- | --- | | [iis7\_add\_rewrite\_rule()](iis7_add_rewrite_rule) wp-admin/includes/misc.php | Adds WordPress rewrite rule to the IIS 7+ configuration file. | | [iis7\_delete\_rewrite\_rule()](iis7_delete_rewrite_rule) wp-admin/includes/misc.php | Deletes WordPress rewrite rule from web.config file if it exists there. | | [get\_home\_path()](get_home_path) wp-admin/includes/file.php | Gets the absolute filesystem path to the root of the WordPress installation. | | [iis7\_supports\_permalinks()](iis7_supports_permalinks) wp-includes/functions.php | Checks if IIS 7+ supports pretty permalinks. | | [win\_is\_writable()](win_is_writable) wp-includes/functions.php | Workaround for Windows bug in is\_writable() function | | [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::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 | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress wp_add_inline_style( string $handle, string $data ): bool wp\_add\_inline\_style( string $handle, string $data ): bool ============================================================ Add extra CSS styles to a registered stylesheet. Styles will only be added if the stylesheet is already in the queue. Accepts a string $data containing the CSS. If two or more CSS code blocks are added to the same stylesheet $handle, they will be printed in the order they were added, i.e. the latter added styles can redeclare the previous. * [WP\_Styles::add\_inline\_style()](../classes/wp_styles/add_inline_style) `$handle` string Required Name of the stylesheet to add the extra styles to. `$data` string Required String containing the CSS styles to be added. bool True on success, false on failure. File: `wp-includes/functions.wp-styles.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-styles.php/) ``` function wp_add_inline_style( $handle, $data ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); if ( false !== stripos( $data, '</style>' ) ) { _doing_it_wrong( __FUNCTION__, sprintf( /* translators: 1: <style>, 2: wp_add_inline_style() */ __( 'Do not pass %1$s tags to %2$s.' ), '<code>&lt;style&gt;</code>', '<code>wp_add_inline_style()</code>' ), '3.7.0' ); $data = trim( preg_replace( '#<style[^>]*>(.*)</style>#is', '$1', $data ) ); } return wp_styles()->add_inline_style( $handle, $data ); } ``` | Uses | Description | | --- | --- | | [stripos()](stripos) wp-includes/class-pop3.php | | | [wp\_styles()](wp_styles) wp-includes/functions.wp-styles.php | Initialize $wp\_styles if it has not been set. | | [WP\_Styles::add\_inline\_style()](../classes/wp_styles/add_inline_style) wp-includes/class-wp-styles.php | Adds extra CSS styles to a registered stylesheet. | | [\_\_()](__) 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\_enqueue\_stored\_styles()](wp_enqueue_stored_styles) wp-includes/script-loader.php | Fetches, processes and compiles stored core styles, then combines and renders them to the page. | | [wp\_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\_theme\_json\_webfonts\_handler()](_wp_theme_json_webfonts_handler) wp-includes/script-loader.php | Runs the theme.json webfonts handler. | | [wp\_enqueue\_global\_styles\_css\_custom\_properties()](wp_enqueue_global_styles_css_custom_properties) wp-includes/script-loader.php | Function that enqueues the CSS Custom Properties coming from theme.json. | | [wp\_enqueue\_global\_styles()](wp_enqueue_global_styles) wp-includes/script-loader.php | Enqueues the global styles defined via theme.json. | | [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. | | Version | Description | | --- | --- | | [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. | wordpress get_archives_link( string $url, string $text, string $format = 'html', string $before = '', string $after = '', bool $selected = false ): string get\_archives\_link( string $url, string $text, string $format = 'html', string $before = '', string $after = '', bool $selected = false ): string ================================================================================================================================================== Retrieves archive link content based on predefined or custom code. The format can be one of four styles. The ‘link’ for head element, ‘option’ for use in the select element, ‘html’ for use in list (either ol or ul HTML elements). Custom content is also supported using the before and after parameters. The ‘link’ format uses the `<link>` HTML element with the **archives** relationship. The before and after parameters are not used. The text parameter is used to describe the link. The ‘option’ format uses the option HTML element for use in select element. The value is the url parameter and the before and after parameters are used between the text description. The ‘html’ format, which is the default, uses the li HTML element for use in the list HTML elements. The before parameter is before the link and the after parameter is after the closing link. The custom format uses the before parameter before the link (‘a’ HTML element) and the after parameter after the closing link tag. If the above three values for the format are not used, then custom format is assumed. `$url` string Required URL to archive. `$text` string Required Archive text description. `$format` string Optional Can be `'link'`, `'option'`, `'html'`, or custom. Default `'html'`. Default: `'html'` `$before` string Optional Content to prepend to the description. Default: `''` `$after` string Optional Content to append to the description. Default: `''` `$selected` bool Optional Set to true if the current page is the selected archive page. Default: `false` string HTML link content for archive. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function get_archives_link( $url, $text, $format = 'html', $before = '', $after = '', $selected = false ) { $text = wptexturize( $text ); $url = esc_url( $url ); $aria_current = $selected ? ' aria-current="page"' : ''; if ( 'link' === $format ) { $link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n"; } elseif ( 'option' === $format ) { $selected_attr = $selected ? " selected='selected'" : ''; $link_html = "\t<option value='$url'$selected_attr>$before $text $after</option>\n"; } elseif ( 'html' === $format ) { $link_html = "\t<li>$before<a href='$url'$aria_current>$text</a>$after</li>\n"; } else { // Custom. $link_html = "\t$before<a href='$url'$aria_current>$text</a>$after\n"; } /** * Filters the archive link content. * * @since 2.6.0 * @since 4.5.0 Added the `$url`, `$text`, `$format`, `$before`, and `$after` parameters. * @since 5.2.0 Added the `$selected` parameter. * * @param string $link_html The archive HTML link content. * @param string $url URL to archive. * @param string $text Archive text description. * @param string $format Link format. Can be 'link', 'option', 'html', or custom. * @param string $before Content to prepend to the description. * @param string $after Content to append to the description. * @param bool $selected True if the current page is the selected archive. */ return apply_filters( 'get_archives_link', $link_html, $url, $text, $format, $before, $after, $selected ); } ``` [apply\_filters( 'get\_archives\_link', string $link\_html, string $url, string $text, string $format, string $before, string $after, bool $selected )](../hooks/get_archives_link) Filters the archive link content. | Uses | Description | | --- | --- | | [wptexturize()](wptexturize) wp-includes/formatting.php | Replaces common plain text characters with formatted entities. | | [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 | | --- | --- | | [wp\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. | | Version | Description | | --- | --- | | [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Added the `$selected` parameter. | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
programming_docs
wordpress wp_playlist_shortcode( array $attr ): string wp\_playlist\_shortcode( array $attr ): string ============================================== Builds the Playlist shortcode output. This implements the functionality of the playlist shortcode for displaying a collection of WordPress audio or video files in a post. `$attr` array Required Array of default playlist attributes. * `type`stringType of playlist to display. Accepts `'audio'` or `'video'`. Default `'audio'`. * `order`stringDesignates ascending or descending order of items in the playlist. Accepts `'ASC'`, `'DESC'`. Default `'ASC'`. * `orderby`stringAny column, or columns, to sort the playlist. If $ids are passed, this defaults to the order of the $ids array (`'post__in'`). Otherwise default is 'menu\_order ID'. * `id`intIf an explicit $ids array is not present, this parameter will determine which attachments are used for the playlist. Default is the current post ID. * `ids`arrayCreate a playlist out of these explicit attachment IDs. If empty, a playlist will be created from all $type attachments of $id. Default empty. * `exclude`arrayList of specific attachment IDs to exclude from the playlist. Default empty. * `style`stringPlaylist style to use. Accepts `'light'` or `'dark'`. Default `'light'`. * `tracklist`boolWhether to show or hide the playlist. Default true. * `tracknumbers`boolWhether to show or hide the numbers next to entries in the playlist. Default true. * `images`boolShow or hide the video or audio thumbnail (Featured Image/post thumbnail). Default true. * `artists`boolWhether to show or hide artist name in the playlist. Default true. string Playlist output. Empty string if the passed type is unsupported. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/) ``` function wp_playlist_shortcode( $attr ) { global $content_width; $post = get_post(); static $instance = 0; $instance++; if ( ! empty( $attr['ids'] ) ) { // 'ids' is explicitly ordered, unless you specify otherwise. if ( empty( $attr['orderby'] ) ) { $attr['orderby'] = 'post__in'; } $attr['include'] = $attr['ids']; } /** * Filters the playlist output. * * Returning a non-empty value from the filter will short-circuit generation * of the default playlist output, returning the passed value instead. * * @since 3.9.0 * @since 4.2.0 The `$instance` parameter was added. * * @param string $output Playlist output. Default empty. * @param array $attr An array of shortcode attributes. * @param int $instance Unique numeric ID of this playlist shortcode instance. */ $output = apply_filters( 'post_playlist', '', $attr, $instance ); if ( ! empty( $output ) ) { return $output; } $atts = shortcode_atts( array( 'type' => 'audio', 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post ? $post->ID : 0, 'include' => '', 'exclude' => '', 'style' => 'light', 'tracklist' => true, 'tracknumbers' => true, 'images' => true, 'artists' => true, ), $attr, 'playlist' ); $id = (int) $atts['id']; if ( 'audio' !== $atts['type'] ) { $atts['type'] = 'video'; } $args = array( 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => $atts['type'], 'order' => $atts['order'], 'orderby' => $atts['orderby'], ); if ( ! empty( $atts['include'] ) ) { $args['include'] = $atts['include']; $_attachments = get_posts( $args ); $attachments = array(); foreach ( $_attachments as $key => $val ) { $attachments[ $val->ID ] = $_attachments[ $key ]; } } elseif ( ! empty( $atts['exclude'] ) ) { $args['post_parent'] = $id; $args['exclude'] = $atts['exclude']; $attachments = get_children( $args ); } else { $args['post_parent'] = $id; $attachments = get_children( $args ); } if ( empty( $attachments ) ) { return ''; } if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $att_id => $attachment ) { $output .= wp_get_attachment_link( $att_id ) . "\n"; } return $output; } $outer = 22; // Default padding and border of wrapper. $default_width = 640; $default_height = 360; $theme_width = empty( $content_width ) ? $default_width : ( $content_width - $outer ); $theme_height = empty( $content_width ) ? $default_height : round( ( $default_height * $theme_width ) / $default_width ); $data = array( 'type' => $atts['type'], // Don't pass strings to JSON, will be truthy in JS. 'tracklist' => wp_validate_boolean( $atts['tracklist'] ), 'tracknumbers' => wp_validate_boolean( $atts['tracknumbers'] ), 'images' => wp_validate_boolean( $atts['images'] ), 'artists' => wp_validate_boolean( $atts['artists'] ), ); $tracks = array(); foreach ( $attachments as $attachment ) { $url = wp_get_attachment_url( $attachment->ID ); $ftype = wp_check_filetype( $url, wp_get_mime_types() ); $track = array( 'src' => $url, 'type' => $ftype['type'], 'title' => $attachment->post_title, 'caption' => $attachment->post_excerpt, 'description' => $attachment->post_content, ); $track['meta'] = array(); $meta = wp_get_attachment_metadata( $attachment->ID ); if ( ! empty( $meta ) ) { foreach ( wp_get_attachment_id3_keys( $attachment ) as $key => $label ) { if ( ! empty( $meta[ $key ] ) ) { $track['meta'][ $key ] = $meta[ $key ]; } } if ( 'video' === $atts['type'] ) { if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) { $width = $meta['width']; $height = $meta['height']; $theme_height = round( ( $height * $theme_width ) / $width ); } else { $width = $default_width; $height = $default_height; } $track['dimensions'] = array( 'original' => compact( 'width', 'height' ), 'resized' => array( 'width' => $theme_width, 'height' => $theme_height, ), ); } } if ( $atts['images'] ) { $thumb_id = get_post_thumbnail_id( $attachment->ID ); if ( ! empty( $thumb_id ) ) { list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'full' ); $track['image'] = compact( 'src', 'width', 'height' ); list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'thumbnail' ); $track['thumb'] = compact( 'src', 'width', 'height' ); } else { $src = wp_mime_type_icon( $attachment->ID ); $width = 48; $height = 64; $track['image'] = compact( 'src', 'width', 'height' ); $track['thumb'] = compact( 'src', 'width', 'height' ); } } $tracks[] = $track; } $data['tracks'] = $tracks; $safe_type = esc_attr( $atts['type'] ); $safe_style = esc_attr( $atts['style'] ); ob_start(); if ( 1 === $instance ) { /** * Prints and enqueues playlist scripts, styles, and JavaScript templates. * * @since 3.9.0 * * @param string $type Type of playlist. Possible values are 'audio' or 'video'. * @param string $style The 'theme' for the playlist. Core provides 'light' and 'dark'. */ do_action( 'wp_playlist_scripts', $atts['type'], $atts['style'] ); } ?> <div class="wp-playlist wp-<?php echo $safe_type; ?>-playlist wp-playlist-<?php echo $safe_style; ?>"> <?php if ( 'audio' === $atts['type'] ) : ?> <div class="wp-playlist-current-item"></div> <?php endif; ?> <<?php echo $safe_type; ?> controls="controls" preload="none" width="<?php echo (int) $theme_width; ?>" <?php if ( 'video' === $safe_type ) { echo ' height="', (int) $theme_height, '"'; } ?> ></<?php echo $safe_type; ?>> <div class="wp-playlist-next"></div> <div class="wp-playlist-prev"></div> <noscript> <ol> <?php foreach ( $attachments as $att_id => $attachment ) { printf( '<li>%s</li>', wp_get_attachment_link( $att_id ) ); } ?> </ol> </noscript> <script type="application/json" class="wp-playlist-script"><?php echo wp_json_encode( $data ); ?></script> </div> <?php return ob_get_clean(); } ``` [apply\_filters( 'post\_playlist', string $output, array $attr, int $instance )](../hooks/post_playlist) Filters the playlist output. [do\_action( 'wp\_playlist\_scripts', string $type, string $style )](../hooks/wp_playlist_scripts) Prints and enqueues playlist scripts, styles, and JavaScript templates. | Uses | Description | | --- | --- | | [get\_children()](get_children) wp-includes/post.php | Retrieves all children of the post parent ID. | | [wp\_mime\_type\_icon()](wp_mime_type_icon) wp-includes/post.php | Retrieves the icon for a MIME type or attachment. | | [wp\_validate\_boolean()](wp_validate_boolean) wp-includes/functions.php | Filters/validates a variable as a boolean. | | [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. | | [is\_feed()](is_feed) wp-includes/query.php | Determines whether the query is for a feed. | | [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. | | [shortcode\_atts()](shortcode_atts) wp-includes/shortcodes.php | Combines user attributes with known attributes and fill in defaults when needed. | | [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. | | [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. | | [get\_post\_thumbnail\_id()](get_post_thumbnail_id) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail ID. | | [wp\_get\_attachment\_link()](wp_get_attachment_link) wp-includes/post-template.php | Retrieves an attachment page link using an image or icon, if possible. | | [wp\_get\_attachment\_id3\_keys()](wp_get_attachment_id3_keys) wp-includes/media.php | Returns useful keys to use to lookup data from an attachment’s stored metadata. | | [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) wp-includes/media.php | Retrieves an image to represent an attachment. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Version | Description | | --- | --- | | [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. | wordpress wp_style_engine_get_stylesheet_from_context( string $context, array $options = array() ): string wp\_style\_engine\_get\_stylesheet\_from\_context( string $context, array $options = array() ): string ====================================================================================================== Returns compiled CSS from a store, if found. `$context` string Required A valid context name, corresponding to an existing store key. `$options` array Optional An array of options. * `optimize`boolWhether to optimize the CSS output, e.g., combine rules. Default is `false`. * `prettify`boolWhether to add new lines and indents to output. Default is the test of whether the global constant `SCRIPT_DEBUG` is defined. Default: `array()` string A compiled CSS string. 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_stylesheet_from_context( $context, $options = array() ) { return WP_Style_Engine::compile_stylesheet_from_css_rules( WP_Style_Engine::get_store( $context )->get_all_rules(), $options ); } ``` | Uses | Description | | --- | --- | | [WP\_Style\_Engine::compile\_stylesheet\_from\_css\_rules()](../classes/wp_style_engine/compile_stylesheet_from_css_rules) wp-includes/style-engine/class-wp-style-engine.php | Returns a compiled stylesheet from stored CSS rules. | | [WP\_Style\_Engine::get\_store()](../classes/wp_style_engine/get_store) wp-includes/style-engine/class-wp-style-engine.php | Returns a store by store key. | | Used By | Description | | --- | --- | | [wp\_enqueue\_stored\_styles()](wp_enqueue_stored_styles) wp-includes/script-loader.php | Fetches, processes and compiles stored core styles, then combines and renders them to the page. | | Version | Description | | --- | --- | | [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. | wordpress mbstring_binary_safe_encoding( bool $reset = false ) mbstring\_binary\_safe\_encoding( bool $reset = false ) ======================================================= Sets the mbstring internal encoding to a binary safe encoding when func\_overload is enabled. When mbstring.func\_overload is in use for multi-byte encodings, the results from strlen() and similar functions respect the utf8 characters, causing binary data to return incorrect lengths. This function overrides the mbstring encoding to a binary-safe encoding, and resets it to the users expected encoding afterwards through the `reset_mbstring_encoding` function. It is safe to recursively call this function, however each `mbstring_binary_safe_encoding()` call must be followed up with an equal number of `reset_mbstring_encoding()` calls. * [reset\_mbstring\_encoding()](reset_mbstring_encoding) `$reset` bool Optional Whether to reset the encoding back to a previously-set encoding. Default: `false` File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function mbstring_binary_safe_encoding( $reset = false ) { static $encodings = array(); static $overloaded = null; if ( is_null( $overloaded ) ) { if ( function_exists( 'mb_internal_encoding' ) && ( (int) ini_get( 'mbstring.func_overload' ) & 2 ) // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated ) { $overloaded = true; } else { $overloaded = false; } } if ( false === $overloaded ) { return; } if ( ! $reset ) { $encoding = mb_internal_encoding(); array_push( $encodings, $encoding ); mb_internal_encoding( 'ISO-8859-1' ); } if ( $reset && $encodings ) { $encoding = array_pop( $encodings ); mb_internal_encoding( $encoding ); } } ``` | Used By | Description | | --- | --- | | [verify\_file\_signature()](verify_file_signature) wp-admin/includes/file.php | Verifies the contents of a file against its ED25519 signature. | | [wpdb::strip\_invalid\_text()](../classes/wpdb/strip_invalid_text) wp-includes/class-wpdb.php | Strips any invalid characters based on value/charset pairs. | | [WP\_Filesystem\_FTPext::put\_contents()](../classes/wp_filesystem_ftpext/put_contents) wp-admin/includes/class-wp-filesystem-ftpext.php | Writes a string to a file. | | [WP\_Filesystem\_Direct::put\_contents()](../classes/wp_filesystem_direct/put_contents) wp-admin/includes/class-wp-filesystem-direct.php | Writes a string to a file. | | [wp\_read\_image\_metadata()](wp_read_image_metadata) wp-admin/includes/image.php | Gets extended image metadata, exif or iptc as available. | | [WP\_Filesystem\_ftpsockets::dirlist()](../classes/wp_filesystem_ftpsockets/dirlist) wp-admin/includes/class-wp-filesystem-ftpsockets.php | Gets details for files in a directory or a specific file. | | [WP\_Filesystem\_ftpsockets::get\_contents()](../classes/wp_filesystem_ftpsockets/get_contents) wp-admin/includes/class-wp-filesystem-ftpsockets.php | Reads entire file into a string. | | [WP\_Filesystem\_ftpsockets::put\_contents()](../classes/wp_filesystem_ftpsockets/put_contents) wp-admin/includes/class-wp-filesystem-ftpsockets.php | Writes a string to a file. | | [\_unzip\_file\_pclzip()](_unzip_file_pclzip) wp-admin/includes/file.php | Attempts to unzip an archive using the PclZip library. | | [seems\_utf8()](seems_utf8) wp-includes/formatting.php | Checks to see if a string is utf8 encoded. | | [utf8\_uri\_encode()](utf8_uri_encode) wp-includes/formatting.php | Encodes the Unicode values to be used in the URI. | | [WP\_Http::request()](../classes/wp_http/request) wp-includes/class-wp-http.php | Send an HTTP request to a URI. | | [reset\_mbstring\_encoding()](reset_mbstring_encoding) wp-includes/functions.php | Resets the mbstring internal encoding to a users previously set encoding. | | Version | Description | | --- | --- | | [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. | wordpress wp_validate_logged_in_cookie( int|false $user_id ): int|false wp\_validate\_logged\_in\_cookie( int|false $user\_id ): int|false ================================================================== Validates the logged-in cookie. Checks the logged-in cookie if the previous auth cookie could not be validated and parsed. This is a callback for the [‘determine\_current\_user’](../hooks/determine_current_user) filter, rather than API. `$user_id` int|false Required The user ID (or false) as received from the `determine_current_user` filter. int|false User ID if validated, false otherwise. If a user ID from an earlier filter callback is received, that value is returned. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function wp_validate_logged_in_cookie( $user_id ) { if ( $user_id ) { return $user_id; } if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) { return false; } return wp_validate_auth_cookie( $_COOKIE[ LOGGED_IN_COOKIE ], 'logged_in' ); } ``` | Uses | Description | | --- | --- | | [wp\_validate\_auth\_cookie()](wp_validate_auth_cookie) wp-includes/pluggable.php | Validates authentication cookie. | | [is\_blog\_admin()](is_blog_admin) wp-includes/load.php | Determines whether the current request is for a site’s administrative interface. | | [is\_network\_admin()](is_network_admin) wp-includes/load.php | Determines whether the current request is for the network administrative interface. | | Version | Description | | --- | --- | | [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. | wordpress wp_load_press_this() wp\_load\_press\_this() ======================= File: `wp-admin/press-this.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/press-this.php/) ``` function wp_load_press_this() { $plugin_slug = 'press-this'; $plugin_file = 'press-this/press-this-plugin.php'; if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { wp_die( __( 'Sorry, you are not allowed to create posts as this user.' ), __( 'You need a higher level of permission.' ), 403 ); } elseif ( is_plugin_active( $plugin_file ) ) { include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php'; $wp_press_this = new WP_Press_This_Plugin(); $wp_press_this->html(); } elseif ( current_user_can( 'activate_plugins' ) ) { if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_file ) ) { $url = wp_nonce_url( add_query_arg( array( 'action' => 'activate', 'plugin' => $plugin_file, 'from' => 'press-this', ), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file ); $action = sprintf( '<a href="%1$s" aria-label="%2$s">%2$s</a>', esc_url( $url ), __( 'Activate Press This' ) ); } else { if ( is_main_site() ) { $url = wp_nonce_url( add_query_arg( array( 'action' => 'install-plugin', 'plugin' => $plugin_slug, 'from' => 'press-this', ), self_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug ); $action = sprintf( '<a href="%1$s" class="install-now" data-slug="%2$s" data-name="%2$s" aria-label="%3$s">%3$s</a>', esc_url( $url ), esc_attr( $plugin_slug ), __( 'Install Now' ) ); } else { $action = sprintf( /* translators: %s: URL to Press This bookmarklet on the main site. */ __( 'Press This is not installed. Please install Press This from <a href="%s">the main site</a>.' ), get_admin_url( get_current_network_id(), 'press-this.php' ) ); } } wp_die( __( 'The Press This plugin is required.' ) . '<br />' . $action, __( 'Installation Required' ), 200 ); } else { wp_die( __( 'Press This is not available. Please contact your site administrator.' ), __( 'Installation Required' ), 200 ); } } ``` | Uses | Description | | --- | --- | | [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. | | [is\_plugin\_active()](is_plugin_active) wp-admin/includes/plugin.php | Determines whether a plugin is active. | | [is\_main\_site()](is_main_site) wp-includes/functions.php | Determines whether a site is the main site of the current network. | | [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\_admin\_url()](get_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for a given site. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [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\_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. | | [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
programming_docs
wordpress wp_head() wp\_head() ========== Fires the wp\_head action. See [‘wp\_head’](../hooks/wp_head). File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function wp_head() { /** * Prints scripts or data in the head tag on the front end. * * @since 1.5.0 */ do_action( 'wp_head' ); } ``` [do\_action( 'wp\_head' )](../hooks/wp_head) Prints scripts or data in the head tag on the front end. | Uses | Description | | --- | --- | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | Used By | Description | | --- | --- | | [WP\_REST\_Widget\_Types\_Controller::render\_legacy\_widget\_preview\_iframe()](../classes/wp_rest_widget_types_controller/render_legacy_widget_preview_iframe) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Renders a page containing a preview of the requested Legacy Widget block. | | Version | Description | | --- | --- | | [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. | wordpress get_post_format_string( string $slug ): string get\_post\_format\_string( string $slug ): string ================================================= Returns a pretty, translated version of a post format slug `$slug` string Required A post format slug. string The translated post format name. File: `wp-includes/post-formats.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-formats.php/) ``` function get_post_format_string( $slug ) { $strings = get_post_format_strings(); if ( ! $slug ) { return $strings['standard']; } else { return ( isset( $strings[ $slug ] ) ) ? $strings[ $slug ] : ''; } } ``` | Uses | Description | | --- | --- | | [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 | | 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. | | [WP\_REST\_Post\_Format\_Search\_Handler::prepare\_item()](../classes/wp_rest_post_format_search_handler/prepare_item) wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php | Prepares the search result for a given ID. | | [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. | | [post\_format\_meta\_box()](post_format_meta_box) wp-admin/includes/meta-boxes.php | Displays post format form elements. | | [WP\_Posts\_List\_Table::inline\_edit()](../classes/wp_posts_list_table/inline_edit) wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing | | [\_post\_format\_get\_term()](_post_format_get_term) wp-includes/post-formats.php | Remove the post format prefix from the name property of the term object created by [get\_term()](get_term) . | | [\_post\_format\_get\_terms()](_post_format_get_terms) wp-includes/post-formats.php | Remove the post format prefix from the name property of the term objects created by [get\_terms()](get_terms) . | | [\_post\_format\_wp\_get\_object\_terms()](_post_format_wp_get_object_terms) wp-includes/post-formats.php | Remove the post format prefix from the name property of the term objects created by [wp\_get\_object\_terms()](wp_get_object_terms) . | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress set_post_thumbnail_size( int $width, int $height, bool|array $crop = false ) set\_post\_thumbnail\_size( int $width, int $height, bool|array $crop = false ) =============================================================================== Registers an image size for the post thumbnail. * [add\_image\_size()](add_image_size) : for details on cropping behavior. `$width` int Required Image width in pixels. `$height` int Required Image height in pixels. `$crop` bool|array Optional Whether to crop images to specified width and height or resize. An array can specify positioning of the crop area. Default: `false` * To register additional image sizes for Featured Images use: [add\_image\_size()](add_image_size) . * To enable featured images, the current theme must include `add_theme_support( 'post-thumbnails' );` in its [functions.php](https://developer.wordpress.org/themes/basics/theme-functions/) file. See also [Post Thumbnails](https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/). * This function will not resize your existing featured images. To regenerate existing images in the new size, use the [Regenerate Thumbnails](https://wordpress.org/plugins/regenerate-thumbnails/) plugin. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/) ``` function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) { add_image_size( 'post-thumbnail', $width, $height, $crop ); } ``` | Uses | Description | | --- | --- | | [add\_image\_size()](add_image_size) wp-includes/media.php | Registers a new image size. | | Version | Description | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress esc_html__( string $text, string $domain = 'default' ): string esc\_html\_\_( string $text, string $domain = 'default' ): string ================================================================= Retrieves the translation of $text and escapes it for safe use in HTML output. If there is no translation, or the text domain isn’t loaded, the original text is escaped and returned. `$text` string Required Text to translate. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings. Default `'default'`. Default: `'default'` string Translated text. File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/) ``` function esc_html__( $text, $domain = 'default' ) { return esc_html( translate( $text, $domain ) ); } ``` | Uses | Description | | --- | --- | | [translate()](translate) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | Used By | Description | | --- | --- | | [get\_the\_block\_template\_html()](get_the_block_template_html) wp-includes/block-template.php | Returns the markup for the current template. | | [WP\_Application\_Passwords\_List\_Table::print\_js\_template\_row()](../classes/wp_application_passwords_list_table/print_js_template_row) wp-admin/includes/class-wp-application-passwords-list-table.php | Prints the JavaScript template for the new row item. | | [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\_Privacy\_Data\_Removal\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_removal_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Next steps column. | | [WP\_Privacy\_Data\_Export\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_export_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php | Displays the next steps column. | | [wp\_privacy\_generate\_personal\_data\_export\_group\_html()](wp_privacy_generate_personal_data_export_group_html) wp-admin/includes/privacy-tools.php | Generate a single group for the personal data export report. | | [wp\_privacy\_generate\_personal\_data\_export\_file()](wp_privacy_generate_personal_data_export_file) wp-admin/includes/privacy-tools.php | Generate the personal data export file. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress get_privacy_policy_url(): string get\_privacy\_policy\_url(): string =================================== Retrieves the URL to the privacy policy page. string The URL to the privacy policy page. Empty string if it doesn't exist. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function get_privacy_policy_url() { $url = ''; $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); if ( ! empty( $policy_page_id ) && get_post_status( $policy_page_id ) === 'publish' ) { $url = (string) get_permalink( $policy_page_id ); } /** * Filters the URL of the privacy policy page. * * @since 4.9.6 * * @param string $url The URL to the privacy policy page. Empty string * if it doesn't exist. * @param int $policy_page_id The ID of privacy policy page. */ return apply_filters( 'privacy_policy_url', $url, $policy_page_id ); } ``` [apply\_filters( 'privacy\_policy\_url', string $url, int $policy\_page\_id )](../hooks/privacy_policy_url) Filters the URL of the privacy policy page. | Uses | Description | | --- | --- | | [get\_post\_status()](get_post_status) wp-includes/post.php | Retrieves the post status based on the post ID. | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [\_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. | | [get\_the\_privacy\_policy\_link()](get_the_privacy_policy_link) wp-includes/link-template.php | Returns the privacy policy link with formatting, when applicable. | | Version | Description | | --- | --- | | [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. | wordpress wp_list_widget_controls( string $sidebar, string $sidebar_name = '' ) wp\_list\_widget\_controls( string $sidebar, string $sidebar\_name = '' ) ========================================================================= Show the widgets and their settings for a sidebar. Used in the admin widget config screen. `$sidebar` string Required Sidebar ID. `$sidebar_name` string Optional Sidebar name. Default: `''` File: `wp-admin/includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/widgets.php/) ``` function wp_list_widget_controls( $sidebar, $sidebar_name = '' ) { add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' ); $description = wp_sidebar_description( $sidebar ); echo '<div id="' . esc_attr( $sidebar ) . '" class="widgets-sortables">'; if ( $sidebar_name ) { $add_to = sprintf( /* translators: %s: Widgets sidebar name. */ __( 'Add to: %s' ), $sidebar_name ); ?> <div class="sidebar-name" data-add-to="<?php echo esc_attr( $add_to ); ?>"> <button type="button" class="handlediv hide-if-no-js" aria-expanded="true"> <span class="screen-reader-text"><?php echo esc_html( $sidebar_name ); ?></span> <span class="toggle-indicator" aria-hidden="true"></span> </button> <h2><?php echo esc_html( $sidebar_name ); ?> <span class="spinner"></span></h2> </div> <?php } if ( ! empty( $description ) ) { ?> <div class="sidebar-description"> <p class="description"><?php echo $description; ?></p> </div> <?php } dynamic_sidebar( $sidebar ); echo '</div>'; } ``` | Uses | Description | | --- | --- | | [dynamic\_sidebar()](dynamic_sidebar) wp-includes/widgets.php | Display dynamic sidebar. | | [wp\_sidebar\_description()](wp_sidebar_description) wp-includes/widgets.php | Retrieve description for a sidebar. | | [\_\_()](__) 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. | | [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. | wordpress populate_roles() populate\_roles() ================= Execute WordPress role creation for the various WordPress versions. File: `wp-admin/includes/schema.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/schema.php/) ``` function populate_roles() { populate_roles_160(); populate_roles_210(); populate_roles_230(); populate_roles_250(); populate_roles_260(); populate_roles_270(); populate_roles_280(); populate_roles_300(); } ``` | Uses | 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. | | Used By | Description | | --- | --- | | [wp\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. | | [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. | | [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress the_weekday() the\_weekday() ============== Displays the weekday on which the post was written. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function the_weekday() { global $wp_locale; $post = get_post(); if ( ! $post ) { return; } $the_weekday = $wp_locale->get_weekday( get_post_time( 'w', false, $post ) ); /** * Filters the weekday on which the post was written, for display. * * @since 0.71 * * @param string $the_weekday */ echo apply_filters( 'the_weekday', $the_weekday ); } ``` [apply\_filters( 'the\_weekday', string $the\_weekday )](../hooks/the_weekday) Filters the weekday on which the post was written, for display. | Uses | Description | | --- | --- | | [get\_post\_time()](get_post_time) wp-includes/general-template.php | Retrieves the time at which the post was written. | | [WP\_Locale::get\_weekday()](../classes/wp_locale/get_weekday) wp-includes/class-wp-locale.php | Retrieves the full translated weekday word. | | [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 | | --- | --- | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress is_plugin_inactive( string $plugin ): bool is\_plugin\_inactive( string $plugin ): bool ============================================ Determines whether the plugin is inactive. Reverse of [is\_plugin\_active()](is_plugin_active) . Used as a callback. 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\_plugin\_active()](is_plugin_active) `$plugin` string Required Path to the plugin file relative to the plugins directory. bool True if inactive. False if active. ##### Usage: In the Admin Area: ``` <?php $active = is_plugin_inactive( $plugin ); ?> ``` In the front end, in a theme, etc… ``` <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); $active = is_plugin_inactive( $plugin ); ?> ``` File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/) ``` function is_plugin_inactive( $plugin ) { return ! is_plugin_active( $plugin ); } ``` | Uses | Description | | --- | --- | | [is\_plugin\_active()](is_plugin_active) wp-admin/includes/plugin.php | Determines whether a plugin is active. | | Used By | Description | | --- | --- | | [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\_ajax\_install\_plugin()](wp_ajax_install_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for installing a plugin. | | [wp\_link\_manager\_disabled\_message()](wp_link_manager_disabled_message) wp-admin/includes/bookmark.php | Outputs the ‘disabled’ message for the WordPress Link Manager. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress get_calendar( bool $initial = true, bool $echo = true ): void|string get\_calendar( bool $initial = true, bool $echo = true ): void|string ===================================================================== Displays calendar with days that have posts as links. The calendar is cached, which will be retrieved, if it exists. If there are no posts for the month, then it will not be displayed. `$initial` bool Optional Whether to use initial calendar names. Default: `true` `$echo` bool Optional Whether to display the calendar output. Default: `true` void|string Void if `$echo` argument is true, calendar HTML if `$echo` is false. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function get_calendar( $initial = true, $echo = true ) { global $wpdb, $m, $monthnum, $year, $wp_locale, $posts; $key = md5( $m . $monthnum . $year ); $cache = wp_cache_get( 'get_calendar', 'calendar' ); if ( $cache && is_array( $cache ) && isset( $cache[ $key ] ) ) { /** This filter is documented in wp-includes/general-template.php */ $output = apply_filters( 'get_calendar', $cache[ $key ] ); if ( $echo ) { echo $output; return; } return $output; } if ( ! is_array( $cache ) ) { $cache = array(); } // Quick check. If we have no posts at all, abort! if ( ! $posts ) { $gotsome = $wpdb->get_var( "SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1" ); if ( ! $gotsome ) { $cache[ $key ] = ''; wp_cache_set( 'get_calendar', $cache, 'calendar' ); return; } } if ( isset( $_GET['w'] ) ) { $w = (int) $_GET['w']; } // week_begins = 0 stands for Sunday. $week_begins = (int) get_option( 'start_of_week' ); // Let's figure out when we are. if ( ! empty( $monthnum ) && ! empty( $year ) ) { $thismonth = zeroise( (int) $monthnum, 2 ); $thisyear = (int) $year; } elseif ( ! empty( $w ) ) { // We need to get the month from MySQL. $thisyear = (int) substr( $m, 0, 4 ); // It seems MySQL's weeks disagree with PHP's. $d = ( ( $w - 1 ) * 7 ) + 6; $thismonth = $wpdb->get_var( "SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')" ); } elseif ( ! empty( $m ) ) { $thisyear = (int) substr( $m, 0, 4 ); if ( strlen( $m ) < 6 ) { $thismonth = '01'; } else { $thismonth = zeroise( (int) substr( $m, 4, 2 ), 2 ); } } else { $thisyear = current_time( 'Y' ); $thismonth = current_time( 'm' ); } $unixmonth = mktime( 0, 0, 0, $thismonth, 1, $thisyear ); $last_day = gmdate( 't', $unixmonth ); // Get the next and previous month and year with at least one post. $previous = $wpdb->get_row( "SELECT MONTH(post_date) AS month, YEAR(post_date) AS year FROM $wpdb->posts WHERE post_date < '$thisyear-$thismonth-01' AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1" ); $next = $wpdb->get_row( "SELECT MONTH(post_date) AS month, YEAR(post_date) AS year FROM $wpdb->posts WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59' AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date ASC LIMIT 1" ); /* translators: Calendar caption: 1: Month name, 2: 4-digit year. */ $calendar_caption = _x( '%1$s %2$s', 'calendar caption' ); $calendar_output = '<table id="wp-calendar" class="wp-calendar-table"> <caption>' . sprintf( $calendar_caption, $wp_locale->get_month( $thismonth ), gmdate( 'Y', $unixmonth ) ) . '</caption> <thead> <tr>'; $myweek = array(); for ( $wdcount = 0; $wdcount <= 6; $wdcount++ ) { $myweek[] = $wp_locale->get_weekday( ( $wdcount + $week_begins ) % 7 ); } foreach ( $myweek as $wd ) { $day_name = $initial ? $wp_locale->get_weekday_initial( $wd ) : $wp_locale->get_weekday_abbrev( $wd ); $wd = esc_attr( $wd ); $calendar_output .= "\n\t\t<th scope=\"col\" title=\"$wd\">$day_name</th>"; } $calendar_output .= ' </tr> </thead> <tbody> <tr>'; $daywithpost = array(); // Get days with posts. $dayswithposts = $wpdb->get_results( "SELECT DISTINCT DAYOFMONTH(post_date) FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' AND post_type = 'post' AND post_status = 'publish' AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N ); if ( $dayswithposts ) { foreach ( (array) $dayswithposts as $daywith ) { $daywithpost[] = (int) $daywith[0]; } } // See how much we should pad in the beginning. $pad = calendar_week_mod( gmdate( 'w', $unixmonth ) - $week_begins ); if ( 0 != $pad ) { $calendar_output .= "\n\t\t" . '<td colspan="' . esc_attr( $pad ) . '" class="pad">&nbsp;</td>'; } $newrow = false; $daysinmonth = (int) gmdate( 't', $unixmonth ); for ( $day = 1; $day <= $daysinmonth; ++$day ) { if ( isset( $newrow ) && $newrow ) { $calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t"; } $newrow = false; if ( current_time( 'j' ) == $day && current_time( 'm' ) == $thismonth && current_time( 'Y' ) == $thisyear ) { $calendar_output .= '<td id="today">'; } else { $calendar_output .= '<td>'; } if ( in_array( $day, $daywithpost, true ) ) { // Any posts today? $date_format = gmdate( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) ); /* translators: Post calendar label. %s: Date. */ $label = sprintf( __( 'Posts published on %s' ), $date_format ); $calendar_output .= sprintf( '<a href="%s" aria-label="%s">%s</a>', get_day_link( $thisyear, $thismonth, $day ), esc_attr( $label ), $day ); } else { $calendar_output .= $day; } $calendar_output .= '</td>'; if ( 6 == calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) { $newrow = true; } } $pad = 7 - calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ); if ( 0 != $pad && 7 != $pad ) { $calendar_output .= "\n\t\t" . '<td class="pad" colspan="' . esc_attr( $pad ) . '">&nbsp;</td>'; } $calendar_output .= "\n\t</tr>\n\t</tbody>"; $calendar_output .= "\n\t</table>"; $calendar_output .= '<nav aria-label="' . __( 'Previous and next months' ) . '" class="wp-calendar-nav">'; if ( $previous ) { $calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">&laquo; ' . $wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) ) . '</a></span>'; } else { $calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-prev">&nbsp;</span>'; } $calendar_output .= "\n\t\t" . '<span class="pad">&nbsp;</span>'; if ( $next ) { $calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-next"><a href="' . get_month_link( $next->year, $next->month ) . '">' . $wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) ) . ' &raquo;</a></span>'; } else { $calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-next">&nbsp;</span>'; } $calendar_output .= ' </nav>'; $cache[ $key ] = $calendar_output; wp_cache_set( 'get_calendar', $cache, 'calendar' ); if ( $echo ) { /** * Filters the HTML calendar output. * * @since 3.0.0 * * @param string $calendar_output HTML output of the calendar. */ echo apply_filters( 'get_calendar', $calendar_output ); return; } /** This filter is documented in wp-includes/general-template.php */ return apply_filters( 'get_calendar', $calendar_output ); } ``` [apply\_filters( 'get\_calendar', string $calendar\_output )](../hooks/get_calendar) Filters the HTML calendar output. | Uses | Description | | --- | --- | | [WP\_Locale::get\_weekday()](../classes/wp_locale/get_weekday) wp-includes/class-wp-locale.php | Retrieves the full translated weekday word. | | [get\_month\_link()](get_month_link) wp-includes/link-template.php | Retrieves the permalink for the month archives with year. | | [wpdb::get\_row()](../classes/wpdb/get_row) wp-includes/class-wpdb.php | Retrieves one row from the database. | | [zeroise()](zeroise) wp-includes/formatting.php | Add leading zeros when necessary. | | [calendar\_week\_mod()](calendar_week_mod) wp-includes/general-template.php | Gets number of days since the start of the week. | | [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. | | [WP\_Locale::get\_month()](../classes/wp_locale/get_month) wp-includes/class-wp-locale.php | Retrieves the full translated month by month number. | | [WP\_Locale::get\_month\_abbrev()](../classes/wp_locale/get_month_abbrev) wp-includes/class-wp-locale.php | Retrieves translated version of month abbreviation string. | | [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. | | [WP\_Locale::get\_weekday\_initial()](../classes/wp_locale/get_weekday_initial) wp-includes/class-wp-locale.php | Retrieves the translated weekday initial. | | [WP\_Locale::get\_weekday\_abbrev()](../classes/wp_locale/get_weekday_abbrev) wp-includes/class-wp-locale.php | Retrieves the translated weekday abbreviation. | | [get\_day\_link()](get_day_link) wp-includes/link-template.php | Retrieves the permalink for the day archives with year and month. | | [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | [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\_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. | | Version | Description | | --- | --- | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
programming_docs
wordpress get_comments_number( int|WP_Post $post ): string|int get\_comments\_number( int|WP\_Post $post ): string|int ======================================================= Retrieves the amount of comments a post has. `$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is the global `$post`. string|int If the post exists, a numeric string representing the number of comments the post has, otherwise 0. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function get_comments_number( $post = 0 ) { $post = get_post( $post ); $count = $post ? $post->comment_count : 0; $post_id = $post ? $post->ID : 0; /** * Filters the returned comment count for a post. * * @since 1.5.0 * * @param string|int $count A string representing the number of comments a post has, otherwise 0. * @param int $post_id Post ID. */ return apply_filters( 'get_comments_number', $count, $post_id ); } ``` [apply\_filters( 'get\_comments\_number', string|int $count, int $post\_id )](../hooks/get_comments_number) Filters the returned comment count for a post. | Uses | Description | | --- | --- | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Used By | Description | | --- | --- | | [print\_embed\_comments\_button()](print_embed_comments_button) wp-includes/embed.php | Prints the necessary markup for the embed comments button. | | [get\_comments\_number\_text()](get_comments_number_text) wp-includes/comment-template.php | Displays the language string for the number of comments the current post has. | | [WP\_List\_Table::comments\_bubble()](../classes/wp_list_table/comments_bubble) wp-admin/includes/class-wp-list-table.php | Displays a comment count bubble. | | [comments\_popup\_link()](comments_popup_link) wp-includes/comment-template.php | Displays the link to the comments for the current post ID. | | [get\_comments\_link()](get_comments_link) wp-includes/comment-template.php | Retrieves the link to the current post comments. | | Version | Description | | --- | --- | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress wp_maybe_generate_attachment_metadata( WP_Post $attachment ) wp\_maybe\_generate\_attachment\_metadata( WP\_Post $attachment ) ================================================================= Maybe attempts to generate attachment metadata, if missing. `$attachment` [WP\_Post](../classes/wp_post) Required Attachment object. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/) ``` function wp_maybe_generate_attachment_metadata( $attachment ) { if ( empty( $attachment ) || empty( $attachment->ID ) ) { return; } $attachment_id = (int) $attachment->ID; $file = get_attached_file( $attachment_id ); $meta = wp_get_attachment_metadata( $attachment_id ); if ( empty( $meta ) && file_exists( $file ) ) { $_meta = get_post_meta( $attachment_id ); $_lock = 'wp_generating_att_' . $attachment_id; if ( ! array_key_exists( '_wp_attachment_metadata', $_meta ) && ! get_transient( $_lock ) ) { set_transient( $_lock, $file ); wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); delete_transient( $_lock ); } } } ``` | Uses | 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. | | [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\_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. | | [get\_attached\_file()](get_attached_file) wp-includes/post.php | Retrieves attached file path based on attachment ID. | | [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. | | Used By | Description | | --- | --- | | [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor | | Version | Description | | --- | --- | | [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. | wordpress _update_blog_date_on_post_publish( string $new_status, string $old_status, WP_Post $post ) \_update\_blog\_date\_on\_post\_publish( string $new\_status, string $old\_status, WP\_Post $post ) =================================================================================================== Handler for updating the site’s last updated date when a post is published or an already published post is changed. `$new_status` string Required The new post status. `$old_status` string Required The old post status. `$post` [WP\_Post](../classes/wp_post) Required Post object. 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_publish( $new_status, $old_status, $post ) { $post_type_obj = get_post_type_object( $post->post_type ); if ( ! $post_type_obj || ! $post_type_obj->public ) { return; } if ( 'publish' !== $new_status && 'publish' !== $old_status ) { return; } // Post was freshly published, published post was saved, or published post was unpublished. 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\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. | | Version | Description | | --- | --- | | [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. | wordpress rest_parse_request_arg( mixed $value, WP_REST_Request $request, string $param ): mixed rest\_parse\_request\_arg( mixed $value, WP\_REST\_Request $request, string $param ): mixed =========================================================================================== Parse a request argument based on details registered to the route. Runs a validation check and sanitizes the value, primarily to be used via the `sanitize_callback` arguments in the endpoint args registration. `$value` mixed Required `$request` [WP\_REST\_Request](../classes/wp_rest_request) Required `$param` string Required mixed File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_parse_request_arg( $value, $request, $param ) { $is_valid = rest_validate_request_arg( $value, $request, $param ); if ( is_wp_error( $is_valid ) ) { return $is_valid; } $value = rest_sanitize_request_arg( $value, $request, $param ); return $value; } ``` | Uses | Description | | --- | --- | | [rest\_validate\_request\_arg()](rest_validate_request_arg) wp-includes/rest-api.php | Validate a request argument based on details registered to the route. | | [rest\_sanitize\_request\_arg()](rest_sanitize_request_arg) wp-includes/rest-api.php | Sanitize a request argument based on details registered to the route. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [WP\_REST\_Search\_Controller::sanitize\_subtypes()](../classes/wp_rest_search_controller/sanitize_subtypes) wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php | Sanitizes the list of subtypes, to ensure only subtypes of the passed type are included. | | [WP\_REST\_Settings\_Controller::sanitize\_callback()](../classes/wp_rest_settings_controller/sanitize_callback) wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php | Custom sanitize callback used for all options to allow the use of ‘null’. | | Version | Description | | --- | --- | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. | wordpress _add_plugin_file_editor_to_tools() \_add\_plugin\_file\_editor\_to\_tools() ======================================== This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Adds the ‘Plugin File Editor’ menu item after the ‘Themes File Editor’ in Tools for block themes. File: `wp-admin/menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/menu.php/) ``` function _add_plugin_file_editor_to_tools() { if ( ! wp_is_block_theme() ) { return; } add_submenu_page( 'tools.php', __( 'Plugin File Editor' ), __( 'Plugin File Editor' ), 'edit_plugins', 'plugin-editor.php' ); } ``` | Uses | Description | | --- | --- | | [wp\_is\_block\_theme()](wp_is_block_theme) wp-includes/theme.php | Returns whether the active theme is a block-based theme or not. | | [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | Version | Description | | --- | --- | | [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. | wordpress wp_is_uuid( mixed $uuid, int $version = null ): bool wp\_is\_uuid( mixed $uuid, int $version = null ): bool ====================================================== Validates that a UUID is valid. `$uuid` mixed Required UUID to check. `$version` int Optional Specify which version of UUID to check against. Default is none, to accept any UUID version. Otherwise, only version allowed is `4`. Default: `null` bool The string is a valid UUID or false on failure. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp_is_uuid( $uuid, $version = null ) { if ( ! is_string( $uuid ) ) { return false; } if ( is_numeric( $version ) ) { if ( 4 !== (int) $version ) { _doing_it_wrong( __FUNCTION__, __( 'Only UUID V4 is supported at this time.' ), '4.9.0' ); return false; } $regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/'; } else { $regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/'; } return (bool) preg_match( $regex, $uuid ); } ``` | Uses | Description | | --- | --- | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. | | Used By | Description | | --- | --- | | [wp\_is\_authorize\_application\_password\_request\_valid()](wp_is_authorize_application_password_request_valid) wp-admin/includes/user.php | Checks if the Authorize Application Password request is valid. | | [WP\_Customize\_Manager::establish\_loaded\_changeset()](../classes/wp_customize_manager/establish_loaded_changeset) wp-includes/class-wp-customize-manager.php | Establishes the loaded changeset. | | [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. | | [WP\_Customize\_Manager::setup\_theme()](../classes/wp_customize_manager/setup_theme) wp-includes/class-wp-customize-manager.php | Starts preview and customize theme. | | Version | Description | | --- | --- | | [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. | wordpress enqueue_editor_block_styles_assets() enqueue\_editor\_block\_styles\_assets() ======================================== Function responsible for enqueuing the assets required for block styles functionality on the editor. File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/) ``` function enqueue_editor_block_styles_assets() { $block_styles = WP_Block_Styles_Registry::get_instance()->get_all_registered(); $register_script_lines = array( '( function() {' ); foreach ( $block_styles as $block_name => $styles ) { foreach ( $styles as $style_properties ) { $block_style = array( 'name' => $style_properties['name'], 'label' => $style_properties['label'], ); if ( isset( $style_properties['is_default'] ) ) { $block_style['isDefault'] = $style_properties['is_default']; } $register_script_lines[] = sprintf( ' wp.blocks.registerBlockStyle( \'%s\', %s );', $block_name, wp_json_encode( $block_style ) ); } } $register_script_lines[] = '} )();'; $inline_script = implode( "\n", $register_script_lines ); wp_register_script( 'wp-block-styles', false, array( 'wp-blocks' ), true, true ); wp_add_inline_script( 'wp-block-styles', $inline_script ); wp_enqueue_script( 'wp-block-styles' ); } ``` | 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. | | [wp\_add\_inline\_script()](wp_add_inline_script) wp-includes/functions.wp-scripts.php | Adds extra code to a registered script. | | [wp\_register\_script()](wp_register_script) wp-includes/functions.wp-scripts.php | Register a new script. | | [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. | | [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. | wordpress wp_admin_bar_new_content_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_new\_content\_menu( WP\_Admin\_Bar $wp\_admin\_bar ) ==================================================================== Adds “Add New” 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_new_content_menu( $wp_admin_bar ) { $actions = array(); $cpts = (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' ); if ( isset( $cpts['post'] ) && current_user_can( $cpts['post']->cap->create_posts ) ) { $actions['post-new.php'] = array( $cpts['post']->labels->name_admin_bar, 'new-post' ); } if ( isset( $cpts['attachment'] ) && current_user_can( 'upload_files' ) ) { $actions['media-new.php'] = array( $cpts['attachment']->labels->name_admin_bar, 'new-media' ); } if ( current_user_can( 'manage_links' ) ) { $actions['link-add.php'] = array( _x( 'Link', 'add new from admin bar' ), 'new-link' ); } if ( isset( $cpts['page'] ) && current_user_can( $cpts['page']->cap->create_posts ) ) { $actions['post-new.php?post_type=page'] = array( $cpts['page']->labels->name_admin_bar, 'new-page' ); } unset( $cpts['post'], $cpts['page'], $cpts['attachment'] ); // Add any additional custom post types. foreach ( $cpts as $cpt ) { if ( ! current_user_can( $cpt->cap->create_posts ) ) { continue; } $key = 'post-new.php?post_type=' . $cpt->name; $actions[ $key ] = array( $cpt->labels->name_admin_bar, 'new-' . $cpt->name ); } // Avoid clash with parent node and a 'content' post type. if ( isset( $actions['post-new.php?post_type=content'] ) ) { $actions['post-new.php?post_type=content'][1] = 'add-new-content'; } if ( current_user_can( 'create_users' ) || ( is_multisite() && current_user_can( 'promote_users' ) ) ) { $actions['user-new.php'] = array( _x( 'User', 'add new from admin bar' ), 'new-user' ); } if ( ! $actions ) { return; } $title = '<span class="ab-icon" aria-hidden="true"></span><span class="ab-label">' . _x( 'New', 'admin bar menu group label' ) . '</span>'; $wp_admin_bar->add_node( array( 'id' => 'new-content', 'title' => $title, 'href' => admin_url( current( array_keys( $actions ) ) ), ) ); foreach ( $actions as $link => $action ) { list( $title, $id ) = $action; $wp_admin_bar->add_node( array( 'parent' => 'new-content', 'id' => $id, 'title' => $title, 'href' => admin_url( $link ), ) ); } } ``` | Uses | Description | | --- | --- | | [WP\_Admin\_Bar::add\_node()](../classes/wp_admin_bar/add_node) wp-includes/class-wp-admin-bar.php | Adds a node to the menu. | | [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. | | [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. | | [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress get_post_types_by_support( array|string $feature, string $operator = 'and' ): string[] get\_post\_types\_by\_support( array|string $feature, string $operator = 'and' ): string[] ========================================================================================== Retrieves a list of post type names that support a specific feature. `$feature` array|string Required Single feature or an array of features the post types should support. `$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; `'not'` means no elements may match. Default `'and'`. Default: `'and'` string[] A list of post type names. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function get_post_types_by_support( $feature, $operator = 'and' ) { global $_wp_post_type_features; $features = array_fill_keys( (array) $feature, true ); return array_keys( wp_filter_object_list( $_wp_post_type_features, $features, $operator ) ); } ``` | Uses | Description | | --- | --- | | [wp\_filter\_object\_list()](wp_filter_object_list) wp-includes/functions.php | Filters a list of objects, based on a set of key => value arguments. | | Version | Description | | --- | --- | | [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. | wordpress touch_time( int|bool $edit = 1, int|bool $for_post = 1, int $tab_index, int|bool $multi ) touch\_time( int|bool $edit = 1, int|bool $for\_post = 1, int $tab\_index, int|bool $multi ) ============================================================================================ Prints out HTML form date elements for editing post or comment publish date. `$edit` int|bool Optional Accepts `1|true` for editing the date, `0|false` for adding the date. Default: `1` `$for_post` int|bool Optional Accepts `1|true` for applying the date to a post, `0|false` for a comment. Default: `1` `$tab_index` int Required The tabindex attribute to add. Default 0. `$multi` int|bool Optional Whether the additional fields and buttons should be added. Default `0|false`. File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/) ``` function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) { global $wp_locale; $post = get_post(); if ( $for_post ) { $edit = ! ( in_array( $post->post_status, array( 'draft', 'pending' ), true ) && ( ! $post->post_date_gmt || '0000-00-00 00:00:00' === $post->post_date_gmt ) ); } $tab_index_attribute = ''; if ( (int) $tab_index > 0 ) { $tab_index_attribute = " tabindex=\"$tab_index\""; } // @todo Remove this? // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />'; $post_date = ( $for_post ) ? $post->post_date : get_comment()->comment_date; $jj = ( $edit ) ? mysql2date( 'd', $post_date, false ) : current_time( 'd' ); $mm = ( $edit ) ? mysql2date( 'm', $post_date, false ) : current_time( 'm' ); $aa = ( $edit ) ? mysql2date( 'Y', $post_date, false ) : current_time( 'Y' ); $hh = ( $edit ) ? mysql2date( 'H', $post_date, false ) : current_time( 'H' ); $mn = ( $edit ) ? mysql2date( 'i', $post_date, false ) : current_time( 'i' ); $ss = ( $edit ) ? mysql2date( 's', $post_date, false ) : current_time( 's' ); $cur_jj = current_time( 'd' ); $cur_mm = current_time( 'm' ); $cur_aa = current_time( 'Y' ); $cur_hh = current_time( 'H' ); $cur_mn = current_time( 'i' ); $month = '<label><span class="screen-reader-text">' . __( 'Month' ) . '</span><select class="form-required" ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n"; for ( $i = 1; $i < 13; $i = $i + 1 ) { $monthnum = zeroise( $i, 2 ); $monthtext = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ); $month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected( $monthnum, $mm, false ) . '>'; /* translators: 1: Month number (01, 02, etc.), 2: Month abbreviation. */ $month .= sprintf( __( '%1$s-%2$s' ), $monthnum, $monthtext ) . "</option>\n"; } $month .= '</select></label>'; $day = '<label><span class="screen-reader-text">' . __( 'Day' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>'; $year = '<label><span class="screen-reader-text">' . __( 'Year' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>'; $hour = '<label><span class="screen-reader-text">' . __( 'Hour' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>'; $minute = '<label><span class="screen-reader-text">' . __( 'Minute' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>'; echo '<div class="timestamp-wrap">'; /* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */ printf( __( '%1$s %2$s, %3$s at %4$s:%5$s' ), $month, $day, $year, $hour, $minute ); echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />'; if ( $multi ) { return; } echo "\n\n"; $map = array( 'mm' => array( $mm, $cur_mm ), 'jj' => array( $jj, $cur_jj ), 'aa' => array( $aa, $cur_aa ), 'hh' => array( $hh, $cur_hh ), 'mn' => array( $mn, $cur_mn ), ); foreach ( $map as $timeunit => $value ) { list( $unit, $curr ) = $value; echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $unit . '" />' . "\n"; $cur_timeunit = 'cur_' . $timeunit; echo '<input type="hidden" id="' . $cur_timeunit . '" name="' . $cur_timeunit . '" value="' . $curr . '" />' . "\n"; } ?> <p> <a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e( 'OK' ); ?></a> <a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a> </p> <?php } ``` | Uses | Description | | --- | --- | | [zeroise()](zeroise) wp-includes/formatting.php | Add leading zeros when necessary. | | [selected()](selected) wp-includes/general-template.php | Outputs the HTML selected attribute. | | [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. | | [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. | | [WP\_Locale::get\_month\_abbrev()](../classes/wp_locale/get_month_abbrev) wp-includes/class-wp-locale.php | Retrieves translated version of month abbreviation string. | | [WP\_Locale::get\_month()](../classes/wp_locale/get_month) wp-includes/class-wp-locale.php | Retrieves the full translated month by month number. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. | | Used By | Description | | --- | --- | | [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. | | [WP\_Posts\_List\_Table::inline\_edit()](../classes/wp_posts_list_table/inline_edit) wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Converted to use [get\_comment()](get_comment) instead of the global `$comment`. | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
programming_docs
wordpress dropdown_cats( int $optionall = 1, string $all = 'All', string $orderby = 'ID', string $order = 'asc', int $show_last_update, int $show_count, int $hide_empty = 1, bool $optionnone = false, int $selected, int $exclude ): string dropdown\_cats( int $optionall = 1, string $all = 'All', string $orderby = 'ID', string $order = 'asc', int $show\_last\_update, int $show\_count, int $hide\_empty = 1, bool $optionnone = false, int $selected, int $exclude ): string ======================================================================================================================================================================================================================================== This function has been deprecated. Use [wp\_dropdown\_categories()](wp_dropdown_categories) instead. Deprecated method for generating a drop-down of categories. * [wp\_dropdown\_categories()](wp_dropdown_categories) `$optionall` int Optional Default: `1` `$all` string Optional Default: `'All'` `$orderby` string Optional Default: `'ID'` `$order` string Optional Default: `'asc'` `$show_last_update` int Required `$show_count` int Required `$hide_empty` int Optional Default: `1` `$optionnone` bool Optional Default: `false` `$selected` int Required `$exclude` int Required string File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false, $selected = 0, $exclude = 0) { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_dropdown_categories()' ); $show_option_all = ''; if ( $optionall ) $show_option_all = $all; $show_option_none = ''; if ( $optionnone ) $show_option_none = __('None'); $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order', 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude'); $query = add_query_arg($vars, ''); return wp_dropdown_categories($query); } ``` | Uses | Description | | --- | --- | | [wp\_dropdown\_categories()](wp_dropdown_categories) wp-includes/category-template.php | Displays or retrieves the HTML dropdown list of categories. | | [\_\_()](__) 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. | | [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [wp\_dropdown\_categories()](wp_dropdown_categories) | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress rest_send_cors_headers( mixed $value ): mixed rest\_send\_cors\_headers( mixed $value ): mixed ================================================ Sends Cross-Origin Resource Sharing headers with API requests. `$value` mixed Required Response data. mixed Response data. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_send_cors_headers( $value ) { $origin = get_http_origin(); if ( $origin ) { // Requests from file:// and data: URLs send "Origin: null". if ( 'null' !== $origin ) { $origin = sanitize_url( $origin ); } header( 'Access-Control-Allow-Origin: ' . $origin ); header( 'Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE' ); header( 'Access-Control-Allow-Credentials: true' ); header( 'Vary: Origin', false ); } elseif ( ! headers_sent() && 'GET' === $_SERVER['REQUEST_METHOD'] && ! is_user_logged_in() ) { header( 'Vary: Origin', false ); } return $value; } ``` | Uses | Description | | --- | --- | | [get\_http\_origin()](get_http_origin) wp-includes/http.php | Get the HTTP Origin of the current request. | | [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. | | [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. | wordpress get_current_screen(): WP_Screen|null get\_current\_screen(): WP\_Screen|null ======================================= Get the current screen object [WP\_Screen](../classes/wp_screen)|null Current screen object or null when screen not defined. File: `wp-admin/includes/screen.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/screen.php/) ``` function get_current_screen() { global $current_screen; if ( ! isset( $current_screen ) ) { return null; } return $current_screen; } ``` | Used By | Description | | --- | --- | | [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\_Site\_Health::admin\_body\_class()](../classes/wp_site_health/admin_body_class) wp-admin/includes/class-wp-site-health.php | Adds a class to the body HTML tag. | | [WP\_Site\_Health::enqueue\_scripts()](../classes/wp_site_health/enqueue_scripts) wp-admin/includes/class-wp-site-health.php | Enqueues the site health scripts. | | [WP\_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\_privacy\_settings\_filter\_draft\_page\_titles()](_wp_privacy_settings_filter_draft_page_titles) wp-admin/includes/misc.php | Appends ‘(Draft)’ to draft page titles in the privacy page dropdown so that unpublished content is obvious. | | [WP\_Widget\_Custom\_HTML::add\_help\_text()](../classes/wp_widget_custom_html/add_help_text) wp-includes/widgets/class-wp-widget-custom-html.php | Add help text to widgets admin screen. | | [wp\_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\_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\_Screen::get()](../classes/wp_screen/get) wp-admin/includes/class-wp-screen.php | Fetches a screen object. | | [add\_screen\_option()](add_screen_option) wp-admin/includes/screen.php | Register and configure an admin screen option | | [screen\_layout()](screen_layout) wp-admin/includes/deprecated.php | Returns the screen layout options. | | [screen\_options()](screen_options) wp-admin/includes/deprecated.php | Returns the screen’s per-page options. | | [screen\_meta()](screen_meta) wp-admin/includes/deprecated.php | Renders the screen’s help. | | [wp\_plugin\_update\_row()](wp_plugin_update_row) wp-admin/includes/update.php | Displays update information for a plugin. | | [wp\_add\_dashboard\_widget()](wp_add_dashboard_widget) wp-admin/includes/dashboard.php | Adds a new dashboard widget. | | [wp\_dashboard()](wp_dashboard) wp-admin/includes/dashboard.php | Displays the dashboard. | | [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. | | [\_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. | | [add\_meta\_box()](add_meta_box) wp-admin/includes/template.php | Adds a meta box to one or more screens. | | [do\_meta\_boxes()](do_meta_boxes) wp-admin/includes/template.php | Meta-Box template function. | | [remove\_meta\_box()](remove_meta_box) wp-admin/includes/template.php | Removes a meta box from one or more screens. | | [do\_accordion\_sections()](do_accordion_sections) wp-admin/includes/template.php | Meta Box Accordion Template Function. | | [post\_comment\_meta\_box()](post_comment_meta_box) wp-admin/includes/meta-boxes.php | Displays comments for post. | | [page\_attributes\_meta\_box()](page_attributes_meta_box) wp-admin/includes/meta-boxes.php | Displays page attributes form fields. | | [Custom\_Image\_Header::help()](../classes/custom_image_header/help) wp-admin/includes/class-custom-image-header.php | Adds contextual help. | | [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\_auth\_check\_load()](wp_auth_check_load) wp-includes/functions.php | Loads the auth check for monitoring whether the user is still logged in. | | [wp\_admin\_bar\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress wp_check_term_meta_support_prefilter( mixed $check ): mixed wp\_check\_term\_meta\_support\_prefilter( mixed $check ): mixed ================================================================ Aborts calls to term meta if it is not supported. `$check` mixed Required Skip-value for whether to proceed term meta function execution. mixed Original value of $check, or false if term meta is not supported. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/) ``` function wp_check_term_meta_support_prefilter( $check ) { if ( get_option( 'db_version' ) < 34370 ) { return false; } return $check; } ``` | Uses | Description | | --- | --- | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [has\_term\_meta()](has_term_meta) wp-includes/taxonomy.php | Gets all meta data, including meta IDs, for the given term ID. | | Version | Description | | --- | --- | | [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. | wordpress force_ssl_login( string|bool $force = null ): bool force\_ssl\_login( string|bool $force = null ): bool ==================================================== This function has been deprecated. Use [force\_ssl\_admin()](force_ssl_admin) instead. Whether SSL login should be forced. * [force\_ssl\_admin()](force_ssl_admin) `$force` string|bool Optional Whether to force SSL login. Default: `null` bool True if forced, false if not forced. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function force_ssl_login( $force = null ) { _deprecated_function( __FUNCTION__, '4.4.0', 'force_ssl_admin()' ); return force_ssl_admin( $force ); } ``` | Uses | Description | | --- | --- | | [force\_ssl\_admin()](force_ssl_admin) wp-includes/functions.php | Determines whether to force SSL used for the Administration Screens. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Use [force\_ssl\_admin()](force_ssl_admin) | | [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. | wordpress _add_themes_utility_last() \_add\_themes\_utility\_last() ============================== This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Adds the ‘Theme File Editor’ menu item to the bottom of the Appearance (non-block themes) or Tools (block themes) menu. File: `wp-admin/menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/menu.php/) ``` function _add_themes_utility_last() { add_submenu_page( wp_is_block_theme() ? 'tools.php' : 'themes.php', __( 'Theme File Editor' ), __( 'Theme File Editor' ), 'edit_themes', 'theme-editor.php' ); } ``` | Uses | Description | | --- | --- | | [wp\_is\_block\_theme()](wp_is_block_theme) wp-includes/theme.php | Returns whether the active theme is a block-based theme or not. | | [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | Version | Description | | --- | --- | | [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Renamed 'Theme Editor' to 'Theme File Editor'. Relocates to Tools for block themes. | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress _load_remote_featured_patterns() \_load\_remote\_featured\_patterns() ==================================== Register `Featured` (category) patterns from wordpress.org/patterns. File: `wp-includes/block-patterns.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-patterns.php/) ``` function _load_remote_featured_patterns() { $supports_core_patterns = get_theme_support( 'core-block-patterns' ); /** This filter is documented in wp-includes/block-patterns.php */ $should_load_remote = apply_filters( 'should_load_remote_block_patterns', true ); if ( ! $should_load_remote || ! $supports_core_patterns ) { return; } $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' ); $featured_cat_id = 26; // This is the `Featured` category id from pattern directory. $request->set_param( 'category', $featured_cat_id ); $response = rest_do_request( $request ); if ( $response->is_error() ) { return; } $patterns = $response->get_data(); foreach ( $patterns as $pattern ) { $pattern_name = sanitize_title( $pattern['title'] ); $registry = WP_Block_Patterns_Registry::get_instance(); // Some patterns might be already registered as core patterns with the `core` prefix. $is_registered = $registry->is_registered( $pattern_name ) || $registry->is_registered( "core/$pattern_name" ); if ( ! $is_registered ) { register_block_pattern( $pattern_name, (array) $pattern ); } } } ``` [apply\_filters( 'should\_load\_remote\_block\_patterns', bool $should\_load\_remote )](../hooks/should_load_remote_block_patterns) Filter to disable remote block patterns. | Uses | Description | | --- | --- | | [WP\_Block\_Patterns\_Registry::get\_instance()](../classes/wp_block_patterns_registry/get_instance) wp-includes/class-wp-block-patterns-registry.php | Utility method to retrieve the main instance of the class. | | [register\_block\_pattern()](register_block_pattern) wp-includes/class-wp-block-patterns-registry.php | Registers a new block pattern. | | [rest\_do\_request()](rest_do_request) wp-includes/rest-api.php | Do a REST request. | | [WP\_REST\_Request::\_\_construct()](../classes/wp_rest_request/__construct) wp-includes/rest-api/class-wp-rest-request.php | Constructor. | | [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. | | [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [WP\_REST\_Block\_Patterns\_Controller::get\_items()](../classes/wp_rest_block_patterns_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php | Retrieves all block patterns. | | Version | Description | | --- | --- | | [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. | wordpress reset_password( WP_User $user, string $new_pass ) reset\_password( WP\_User $user, string $new\_pass ) ==================================================== Handles resetting the user’s password. `$user` [WP\_User](../classes/wp_user) Required The user `$new_pass` string Required New password for the user in plaintext File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function reset_password( $user, $new_pass ) { /** * Fires before the user's password is reset. * * @since 1.5.0 * * @param WP_User $user The user. * @param string $new_pass New user password. */ do_action( 'password_reset', $user, $new_pass ); wp_set_password( $new_pass, $user->ID ); update_user_meta( $user->ID, 'default_password_nag', false ); /** * Fires after the user's password is reset. * * @since 4.4.0 * * @param WP_User $user The user. * @param string $new_pass New user password. */ do_action( 'after_password_reset', $user, $new_pass ); } ``` [do\_action( 'after\_password\_reset', WP\_User $user, string $new\_pass )](../hooks/after_password_reset) Fires after the user’s password is reset. [do\_action( 'password\_reset', WP\_User $user, string $new\_pass )](../hooks/password_reset) Fires before the user’s password is reset. | Uses | Description | | --- | --- | | [wp\_set\_password()](wp_set_password) wp-includes/pluggable.php | Updates the user’s password with a new encrypted one. | | [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress update_archived( int $id, string $archived ): string update\_archived( int $id, string $archived ): string ===================================================== Update the ‘archived’ status of a particular blog. `$id` int Required Blog ID. `$archived` string Required The new status. string $archived File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/) ``` function update_archived( $id, $archived ) { update_blog_status( $id, 'archived', $archived ); return $archived; } ``` | Uses | Description | | --- | --- | | [update\_blog\_status()](update_blog_status) wp-includes/ms-blogs.php | Update a blog details field. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress wp_schedule_update_network_counts() wp\_schedule\_update\_network\_counts() ======================================= Schedules update of the network-wide counts for the current network. File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/) ``` function wp_schedule_update_network_counts() { if ( ! is_main_site() ) { return; } if ( ! wp_next_scheduled( 'update_network_counts' ) && ! wp_installing() ) { wp_schedule_event( time(), 'twicedaily', 'update_network_counts' ); } } ``` | Uses | Description | | --- | --- | | [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. | | [wp\_next\_scheduled()](wp_next_scheduled) wp-includes/cron.php | Retrieve the next timestamp for an event. | | [wp\_schedule\_event()](wp_schedule_event) wp-includes/cron.php | Schedules a recurring event. | | [is\_main\_site()](is_main_site) wp-includes/functions.php | Determines whether a site is the main site of the current network. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
programming_docs
wordpress wp_read_audio_metadata( string $file ): array|false wp\_read\_audio\_metadata( string $file ): array|false ====================================================== Retrieves metadata from an audio 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_audio_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 ( ! empty( $data['audio'] ) ) { unset( $data['audio']['streams'] ); $metadata = $data['audio']; } if ( ! empty( $data['fileformat'] ) ) { $metadata['fileformat'] = $data['fileformat']; } 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( $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 an audio file. * * In core, usually this selection is what is stored. * More complete data can be parsed from the `$data` parameter. * * @since 6.1.0 * * @param array $metadata Filtered audio metadata. * @param string $file Path to audio file. * @param string|null $file_format File format of audio, as analyzed by getID3. * Null if unknown. * @param array $data Raw metadata from getID3. */ return apply_filters( 'wp_read_audio_metadata', $metadata, $file, $file_format, $data ); } ``` [apply\_filters( 'wp\_read\_audio\_metadata', array $metadata, string $file, string|null $file\_format, array $data )](../hooks/wp_read_audio_metadata) Filters the array of metadata retrieved from an audio file. | 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. | | [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. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress get_term_meta( int $term_id, string $key = '', bool $single = false ): mixed get\_term\_meta( int $term\_id, string $key = '', bool $single = false ): mixed =============================================================================== Retrieves metadata for a term. `$term_id` int Required Term ID. `$key` string Optional The meta key to retrieve. By default, returns data for all keys. Default: `''` `$single` bool Optional Whether to return a single value. This parameter has no effect if `$key` is not specified. Default: `false` mixed An array of values if `$single` is false. The value of the meta field if `$single` is true. False for an invalid `$term_id` (non-numeric, zero, or negative value). An empty string if a valid but non-existing term ID is passed. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/) ``` function get_term_meta( $term_id, $key = '', $single = false ) { return get_metadata( 'term', $term_id, $key, $single ); } ``` | Uses | Description | | --- | --- | | [get\_metadata()](get_metadata) wp-includes/meta.php | Retrieves the value of a metadata field for the specified object type and ID. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. | wordpress get_comment_type( int|WP_Comment $comment_ID ): string get\_comment\_type( int|WP\_Comment $comment\_ID ): string ========================================================== Retrieves the comment type of the current comment. `$comment_ID` int|[WP\_Comment](../classes/wp_comment) Optional [WP\_Comment](../classes/wp_comment) or ID of the comment for which to get the type. Default current comment. string The comment type. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function get_comment_type( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); if ( '' === $comment->comment_type ) { $comment->comment_type = 'comment'; } /** * Filters the returned comment type. * * @since 1.5.0 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added. * * @param string $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'. * @param string $comment_ID The comment ID as a numeric string. * @param WP_Comment $comment The comment object. */ return apply_filters( 'get_comment_type', $comment->comment_type, $comment->comment_ID, $comment ); } ``` [apply\_filters( 'get\_comment\_type', string $comment\_type, string $comment\_ID, WP\_Comment $comment )](../hooks/get_comment_type) Filters the returned comment type. | Uses | Description | | --- | --- | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. | | Used By | Description | | --- | --- | | [WP\_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. | | [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. | | [comment\_type()](comment_type) wp-includes/comment-template.php | Displays the comment type 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 _show_post_preview() \_show\_post\_preview() ======================= This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Filters the latest content for preview from the post autosave. File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/) ``` function _show_post_preview() { if ( isset( $_GET['preview_id'] ) && isset( $_GET['preview_nonce'] ) ) { $id = (int) $_GET['preview_id']; if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) ) { wp_die( __( 'Sorry, you are not allowed to preview drafts.' ), 403 ); } add_filter( 'the_preview', '_set_preview' ); } } ``` | Uses | Description | | --- | --- | | [wp\_verify\_nonce()](wp_verify_nonce) wp-includes/pluggable.php | Verifies that a correct security nonce was used with time limit. | | [\_\_()](__) 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\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress sanitize_user( string $username, bool $strict = false ): string sanitize\_user( string $username, bool $strict = false ): string ================================================================ Sanitizes a username, stripping out unsafe characters. Removes tags, octets, entities, and if strict is enabled, will only keep alphanumeric, \_, space, ., -, @. After sanitizing, it passes the username, raw username (the username in the parameter), and the value of $strict as parameters for the [‘sanitize\_user’](../hooks/sanitize_user) filter. `$username` string Required The username to be sanitized. `$strict` bool Optional If set limits $username to specific characters. Default: `false` string The sanitized username, after passing through filters. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function sanitize_user( $username, $strict = false ) { $raw_username = $username; $username = wp_strip_all_tags( $username ); $username = remove_accents( $username ); // Kill octets. $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username ); // Kill entities. $username = preg_replace( '/&.+?;/', '', $username ); // If strict, reduce to ASCII for max portability. if ( $strict ) { $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username ); } $username = trim( $username ); // Consolidate contiguous whitespace. $username = preg_replace( '|\s+|', ' ', $username ); /** * Filters a sanitized username string. * * @since 2.0.1 * * @param string $username Sanitized username. * @param string $raw_username The username prior to sanitization. * @param bool $strict Whether to limit the sanitization to specific characters. */ return apply_filters( 'sanitize_user', $username, $raw_username, $strict ); } ``` [apply\_filters( 'sanitize\_user', string $username, string $raw\_username, bool $strict )](../hooks/sanitize_user) Filters a sanitized username string. | Uses | Description | | --- | --- | | [wp\_strip\_all\_tags()](wp_strip_all_tags) wp-includes/formatting.php | Properly strips all HTML tags including script and style | | [remove\_accents()](remove_accents) wp-includes/formatting.php | Converts all accent characters to ASCII characters. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [wp\_normalize\_site\_data()](wp_normalize_site_data) wp-includes/ms-site.php | Normalizes data for a site prior to inserting or updating in the database. | | [display\_setup\_form()](display_setup_form) wp-admin/install.php | Displays installer setup form. | | [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST | | [WP\_User::get\_data\_by()](../classes/wp_user/get_data_by) wp-includes/class-wp-user.php | Returns only the main user fields. | | [wp\_authenticate()](wp_authenticate) wp-includes/pluggable.php | Authenticates a user, confirming the login credentials are valid. | | [register\_new\_user()](register_new_user) wp-includes/user.php | Handles registering a new user. | | [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. | | [wpmu\_create\_user()](wpmu_create_user) wp-includes/ms-functions.php | Creates a user. | | [wpmu\_validate\_user\_signup()](wpmu_validate_user_signup) wp-includes/ms-functions.php | Sanitizes and validates data required for a user sign-up. | | [wpmu\_signup\_user()](wpmu_signup_user) wp-includes/ms-functions.php | Records user signup information for future activation. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress update_posts_count( string $deprecated = '' ) update\_posts\_count( string $deprecated = '' ) =============================================== Updates a blog’s post count. WordPress MS stores a blog’s post count as an option so as to avoid extraneous COUNTs when a blog’s details are fetched with [get\_site()](get_site) . This function is called when posts are published or unpublished to make sure the count stays current. `$deprecated` string Optional Not used. Default: `''` File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/) ``` function update_posts_count( $deprecated = '' ) { global $wpdb; update_option( 'post_count', (int) $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'" ) ); } ``` | Uses | Description | | --- | --- | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. | | Used By | Description | | --- | --- | | [\_update\_posts\_count\_on\_delete()](_update_posts_count_on_delete) wp-includes/ms-blogs.php | Handler for updating the current site’s posts count when a post is deleted. | | [\_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. | | [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress wp_sidebar_description( string $id ): string|void wp\_sidebar\_description( string $id ): string|void =================================================== Retrieve description for a sidebar. When registering sidebars a ‘description’ parameter can be included that describes the sidebar for display on the widget administration panel. `$id` string Required sidebar ID. string|void Sidebar description, if available. File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/) ``` function wp_sidebar_description( $id ) { if ( ! is_scalar( $id ) ) { return; } global $wp_registered_sidebars; if ( isset( $wp_registered_sidebars[ $id ]['description'] ) ) { return wp_kses( $wp_registered_sidebars[ $id ]['description'], 'sidebar_description' ); } } ``` | Uses | Description | | --- | --- | | [wp\_kses()](wp_kses) wp-includes/kses.php | Filters text content and strips out disallowed HTML. | | Used By | Description | | --- | --- | | [WP\_REST\_Sidebars\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_sidebars_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Prepares a single sidebar output for response. | | [wp\_list\_widget\_controls()](wp_list_widget_controls) wp-admin/includes/widgets.php | Show the widgets and their settings for a sidebar. | | Version | Description | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress _wp_menu_output( array $menu, array $submenu, bool $submenu_as_parent = true ) \_wp\_menu\_output( array $menu, array $submenu, bool $submenu\_as\_parent = true ) =================================================================================== This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Display menu. `$menu` array Required `$submenu` array Required `$submenu_as_parent` bool Optional Default: `true` File: `wp-admin/menu-header.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/menu-header.php/) ``` function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) { global $self, $parent_file, $submenu_file, $plugin_page, $typenow; $first = true; // 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes, 5 = hookname, 6 = icon_url. foreach ( $menu as $key => $item ) { $admin_is_parent = false; $class = array(); $aria_attributes = ''; $aria_hidden = ''; $is_separator = false; if ( $first ) { $class[] = 'wp-first-item'; $first = false; } $submenu_items = array(); if ( ! empty( $submenu[ $item[2] ] ) ) { $class[] = 'wp-has-submenu'; $submenu_items = $submenu[ $item[2] ]; } if ( ( $parent_file && $item[2] === $parent_file ) || ( empty( $typenow ) && $self === $item[2] ) ) { if ( ! empty( $submenu_items ) ) { $class[] = 'wp-has-current-submenu wp-menu-open'; } else { $class[] = 'current'; $aria_attributes .= 'aria-current="page"'; } } else { $class[] = 'wp-not-current-submenu'; if ( ! empty( $submenu_items ) ) { $aria_attributes .= 'aria-haspopup="true"'; } } if ( ! empty( $item[4] ) ) { $class[] = esc_attr( $item[4] ); } $class = $class ? ' class="' . implode( ' ', $class ) . '"' : ''; $id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : ''; $img = ''; $img_style = ''; $img_class = ' dashicons-before'; if ( false !== strpos( $class, 'wp-menu-separator' ) ) { $is_separator = true; } /* * If the string 'none' (previously 'div') is passed instead of a URL, don't output * the default menu image so an icon can be added to div.wp-menu-image as background * with CSS. Dashicons and base64-encoded data:image/svg_xml URIs are also handled * as special cases. */ if ( ! empty( $item[6] ) ) { $img = '<img src="' . esc_url( $item[6] ) . '" alt="" />'; if ( 'none' === $item[6] || 'div' === $item[6] ) { $img = '<br />'; } elseif ( 0 === strpos( $item[6], 'data:image/svg+xml;base64,' ) ) { $img = '<br />'; // The value is base64-encoded data, so esc_attr() is used here instead of esc_url(). $img_style = ' style="background-image:url(\'' . esc_attr( $item[6] ) . '\')"'; $img_class = ' svg'; } elseif ( 0 === strpos( $item[6], 'dashicons-' ) ) { $img = '<br />'; $img_class = ' dashicons-before ' . sanitize_html_class( $item[6] ); } } $arrow = '<div class="wp-menu-arrow"><div></div></div>'; $title = wptexturize( $item[0] ); // Hide separators from screen readers. if ( $is_separator ) { $aria_hidden = ' aria-hidden="true"'; } echo "\n\t<li$class$id$aria_hidden>"; if ( $is_separator ) { echo '<div class="separator"></div>'; } elseif ( $submenu_as_parent && ! empty( $submenu_items ) ) { $submenu_items = array_values( $submenu_items ); // Re-index. $menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] ); $menu_file = $submenu_items[0][2]; $pos = strpos( $menu_file, '?' ); if ( false !== $pos ) { $menu_file = substr( $menu_file, 0, $pos ); } if ( ! empty( $menu_hook ) || ( ( 'index.php' !== $submenu_items[0][2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { $admin_is_parent = true; echo "<a href='admin.php?page={$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style aria-hidden='true'>$img</div><div class='wp-menu-name'>$title</div></a>"; } else { echo "\n\t<a href='{$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style aria-hidden='true'>$img</div><div class='wp-menu-name'>$title</div></a>"; } } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { $menu_hook = get_plugin_page_hook( $item[2], 'admin.php' ); $menu_file = $item[2]; $pos = strpos( $menu_file, '?' ); if ( false !== $pos ) { $menu_file = substr( $menu_file, 0, $pos ); } if ( ! empty( $menu_hook ) || ( ( 'index.php' !== $item[2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { $admin_is_parent = true; echo "\n\t<a href='admin.php?page={$item[2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style aria-hidden='true'>$img</div><div class='wp-menu-name'>{$item[0]}</div></a>"; } else { echo "\n\t<a href='{$item[2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style aria-hidden='true'>$img</div><div class='wp-menu-name'>{$item[0]}</div></a>"; } } if ( ! empty( $submenu_items ) ) { echo "\n\t<ul class='wp-submenu wp-submenu-wrap'>"; echo "<li class='wp-submenu-head' aria-hidden='true'>{$item[0]}</li>"; $first = true; // 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes. foreach ( $submenu_items as $sub_key => $sub_item ) { if ( ! current_user_can( $sub_item[1] ) ) { continue; } $class = array(); $aria_attributes = ''; if ( $first ) { $class[] = 'wp-first-item'; $first = false; } $menu_file = $item[2]; $pos = strpos( $menu_file, '?' ); if ( false !== $pos ) { $menu_file = substr( $menu_file, 0, $pos ); } // Handle current for post_type=post|page|foo pages, which won't match $self. $self_type = ! empty( $typenow ) ? $self . '?post_type=' . $typenow : 'nothing'; if ( isset( $submenu_file ) ) { if ( $submenu_file === $sub_item[2] ) { $class[] = 'current'; $aria_attributes .= ' aria-current="page"'; } // If plugin_page is set the parent must either match the current page or not physically exist. // This allows plugin pages with the same hook to exist under different parents. } elseif ( ( ! isset( $plugin_page ) && $self === $sub_item[2] ) || ( isset( $plugin_page ) && $plugin_page === $sub_item[2] && ( $item[2] === $self_type || $item[2] === $self || file_exists( $menu_file ) === false ) ) ) { $class[] = 'current'; $aria_attributes .= ' aria-current="page"'; } if ( ! empty( $sub_item[4] ) ) { $class[] = esc_attr( $sub_item[4] ); } $class = $class ? ' class="' . implode( ' ', $class ) . '"' : ''; $menu_hook = get_plugin_page_hook( $sub_item[2], $item[2] ); $sub_file = $sub_item[2]; $pos = strpos( $sub_file, '?' ); if ( false !== $pos ) { $sub_file = substr( $sub_file, 0, $pos ); } $title = wptexturize( $sub_item[0] ); if ( ! empty( $menu_hook ) || ( ( 'index.php' !== $sub_item[2] ) && file_exists( WP_PLUGIN_DIR . "/$sub_file" ) && ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) ) ) { // If admin.php is the current page or if the parent exists as a file in the plugins or admin directory. if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) ) { $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] ); } else { $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), 'admin.php' ); } $sub_item_url = esc_url( $sub_item_url ); echo "<li$class><a href='$sub_item_url'$class$aria_attributes>$title</a></li>"; } else { echo "<li$class><a href='{$sub_item[2]}'$class$aria_attributes>$title</a></li>"; } } echo '</ul>'; } echo '</li>'; } echo '<li id="collapse-menu" class="hide-if-no-js">' . '<button type="button" id="collapse-button" aria-label="' . esc_attr__( 'Collapse Main menu' ) . '" aria-expanded="true">' . '<span class="collapse-button-icon" aria-hidden="true"></span>' . '<span class="collapse-button-label">' . __( 'Collapse menu' ) . '</span>' . '</button></li>'; } ``` | Uses | Description | | --- | --- | | [get\_plugin\_page\_hook()](get_plugin_page_hook) wp-admin/includes/plugin.php | Gets the hook attached to the administrative page of a plugin. | | [esc\_attr\_\_()](esc_attr__) wp-includes/l10n.php | Retrieves the translation of $text and escapes it for safe use in an attribute. | | [sanitize\_html\_class()](sanitize_html_class) wp-includes/formatting.php | Sanitizes an HTML classname to ensure it only contains valid characters. | | [wptexturize()](wptexturize) wp-includes/formatting.php | Replaces common plain text characters with formatted entities. | | [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. | | [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. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
programming_docs
wordpress wp_register_script( string $handle, string|false $src, string[] $deps = array(), string|bool|null $ver = false, bool $in_footer = false ): bool wp\_register\_script( string $handle, string|false $src, string[] $deps = array(), string|bool|null $ver = false, bool $in\_footer = false ): bool ================================================================================================================================================== Register a new script. Registers a script to be enqueued later using the [wp\_enqueue\_script()](wp_enqueue_script) function. * [WP\_Dependencies::add()](../classes/wp_dependencies/add) * [WP\_Dependencies::add\_data()](../classes/wp_dependencies/add_data) `$handle` string Required Name of the script. Should be unique. `$src` string|false Required Full URL of the script, or path of the script relative to the WordPress root directory. If source is set to false, script is an alias of other scripts it depends on. `$deps` string[] Optional An array of registered script handles this script depends on. Default: `array()` `$ver` string|bool|null Optional String specifying script version number, if it has one, which is added to the URL as a query string for cache busting purposes. If version is set to false, a version number is automatically added equal to current installed WordPress version. If set to null, no version is added. Default: `false` `$in_footer` bool Optional Whether to enqueue the script before `</body>` instead of in the `<head>`. Default `'false'`. Default: `false` bool Whether the script has been registered. True on success, false on failure. Scripts that have been pre-registered using [wp\_register\_script()](wp_register_script) **do not** need to be manually enqueued using [[wp\_enqueue\_script()](wp_enqueue_script)](wp_enqueue_script) if they are listed as a dependency of another script that is enqueued. WordPress will automatically include the registered script before it includes the enqueued script that lists the registered script’s handle as a dependency. ``` wp_register_script( $handle, $src, $deps, $ver, $in_footer ); ``` * Registering scripts is technically not necessary, but highly recommended nonetheless. * If the handle of a registered script is listed in the `$deps` array of dependencies of another script that is enqueued with `wp_enqueue_script()`, that script will be automatically loaded prior to loading the enqueued script. This greatly simplifies the process of ensuring that a script has all the dependencies it needs. See below for a simple example. * So, the main purpose of the register functions is to allow you to simplify your code by removing the need to duplicate code if you enqueue the same script or style in more than one section of code. The benefits of this are many and probably don’t need to be listed here. * The function should be called using the `wp_enqueue_scripts` or `init` action hook if you want to call it on the front-end of the site. To call it on the administration screens, use the `admin_enqueue_scripts` action hook. For the login screen, use the `login_enqueue_scripts` action hook. Calling it outside of an action hook can often lead to unexpected results and should be avoided. * If attempt to register or enqueue an already registered handle with different parameters, the new parameters will be ignored. Instead, use `wp_deregister_script()` and register the script again with the new parameters. * jQuery UI Effects is not included with the `jquery-ui-core` handle By default, WordPress bundles many popular scripts commonly used by web developers besides the scripts used by core itself. Below is an (incomplete) list of the handles and paths of these scripts. | **Handle** | **Path in WordPress** | | --- | --- | | utils | */wp-includes/js/utils.js* | | common | */wp-admin/js/common.js* | | sack | */wp-includes/js/tw-sack.js* | | quicktags | */wp-includes/js/quicktags.js* | | colorpicker | */wp-includes/js/colorpicker.js* | | editor | */wp-admin/js/editor.js* | | wp-fullscreen | */wp-admin/js/wp-fullscreen.js* | | wp-ajax-response | */wp-includes/js/wp-ajax-response.js* | | wp-pointer | */wp-includes/js/wp-pointer.js* | | autosave | */wp-includes/js/autosave.js* | | heartbeat | */wp-includes/js/heartbeat.js* | | wp-auth-check | */wp-includes/js/wp-auth-check.js* | | wp-lists | */wp-includes/js*/wp-lists.js | | | | prototype | external: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js | | scriptaculous-root | external: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js | | scriptaculous-builder | external: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/builder.js | | scriptaculous-dragdrop | external: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/dragdrop.js | | scriptaculous-effects | external: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/effects.js | | scriptaculous-slider | external: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/slider.js | | scriptaculous-sound | external: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/sound.js | | scriptaculous-controls | external: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/controls.js | | scriptaculous | scriptaculous-dragdrop, scriptaculous-slider, scriptaculous-controls | | cropper | */wp-includes/js/crop/cropper.js* | | | | jquery (v1.10.2 as of WP 3.8) | jquery-core, jquery-migrate | | jquery-core | */wp-includes/js/jquery/jquery.js* | | jquery-migrate | */wp-includes/js/jquery/jquery-migrate.js* (v1.10.2 as of WP 3.8) | | jquery-ui-core | */wp-includes/js/jquery/ui/jquery.ui.core.min.js* | | jquery-effects-core | */wp-includes/js/jquery/ui/jquery.ui.effect.min.js* | | jquery-effects-blind | */wp-includes/js/jquery/ui/jquery.ui.effect-blind.min.js* | | jquery-effects-bounce | */wp-includes/js/jquery/ui/jquery.ui.effect-bounce.min.js* | | jquery-effects-clip | */wp-includes/js/jquery/ui/jquery.ui.effect-clip.min.js* | | jquery-effects-drop | */wp-includes/js/jquery/ui/jquery.ui.effect-drop.min.js* | | jquery-effects-explode | */wp-includes/js/jquery/ui/jquery.ui.effect-explode.min.js* | | jquery-effects-fade | */wp-includes/js/jquery/ui/jquery.ui.effect-fade.min.js* | | jquery-effects-fold | */wp-includes/js/jquery/ui/jquery.ui.effect-fold.min.js* | | jquery-effects-highlight | */wp-includes/js/jquery/ui/jquery.ui.effect-highlight.min.js* | | jquery-effects-pulsate | */wp-includes/js/jquery/ui/jquery.ui.effect-pulsate.min.js* | | jquery-effects-scale | */wp-includes/js/jquery/ui/jquery.ui.effect-scale.min.js* | | jquery-effects-shake | */wp-includes/js/jquery/ui/jquery.ui.effect-shake.min.js* | | jquery-effects-slide | */wp-includes/js/jquery/ui/jquery.ui.effect-slide.min.js* | | jquery-effects-transfer | */wp-includes/js/jquery/ui/jquery.ui.effect-transfer.min.js* | | jquery-ui-accordion | */wp-includes/js/jquery/ui/jquery.ui.accordion.min.js* | | jquery-ui-autocomplete | */wp-includes/js/jquery/ui/jquery.ui.autocomplete.min.js* | | jquery-ui-button | */wp-includes/js/jquery/ui/jquery.ui.button.min.js* | | jquery-ui-datepicker | */wp-includes/js/jquery/ui/jquery.ui.datepicker.min.js* | | jquery-ui-dialog | */wp-includes/js/jquery/ui/jquery.ui.dialog.min.js* | | jquery-ui-draggable | */wp-includes/js/jquery/ui/jquery.ui.draggable.min.js* | | jquery-ui-droppable | */wp-includes/js/jquery/ui/jquery.ui.droppable.min.js* | | jquery-ui-menu | */wp-includes/js/jquery/ui/jquery.ui.menu.min.js* | | jquery-ui-mouse | */wp-includes/js/jquery/ui/jquery.ui.mouse.min.js* | | jquery-ui-position | */wp-includes/js/jquery/ui/jquery.ui.position.min.js* | | jquery-ui-progressbar | */wp-includes/js/jquery/ui/jquery.ui.progressbar.min.js* | | jquery-ui-resizable | */wp-includes/js/jquery/ui/jquery.ui.resizable.min.js* | | jquery-ui-selectable | */wp-includes/js/jquery/ui/jquery.ui.selectable.min.js* | | jquery-ui-slider | */wp-includes/js/jquery/ui/jquery.ui.slider.min.js* | | jquery-ui-sortable | */wp-includes/js/jquery/ui/jquery.ui.sortable.min.js* | | jquery-ui-spinner | */wp-includes/js/jquery/ui/jquery.ui.spinner.min.js* | | jquery-ui-tabs | */wp-includes/js/jquery/ui/jquery.ui.tabs.min.js* | | jquery-ui-tooltip | */wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js* | | jquery-ui-widget | */wp-includes/js/jquery/ui/jquery.ui.widget.min.js* | | jquery-form | */wp-includes/js/jquery/jquery.form.js* | | jquery-color | */wp-includes/js/jquery/jquery.color.min.js* | | suggest | */wp-includes/js/jquery/suggest.js* | | schedule | */wp-includes/js/jquery/jquery.schedule.js* | | jquery-query | */wp-includes/js/jquery/jquery.query.js* | | jquery-serialize-object | */wp-includes/js/jquery/jquery.serialize-object.js* | | jquery-hotkeys | */wp-includes/js/jquery/jquery.hotkeys.js* | | jquery-table-hotkeys | */wp-includes/js/jquery/jquery.table-hotkeys.js* | | jquery-touch-punch | */wp-includes/js/jquery/jquery.ui.touch-punch.js* | | jquery-masonry | */wp-includes/js/jquery/jquery.masonry.min.js* | | | | thickbox | */wp-includes/js/thickbox/thickbox.js* | | jcrop | */wp-includes/js/jcrop/jquery.Jcrop.js* | | swfobject | */wp-includes/js/swfobject.js* | | plupload | */wp-includes/js/plupload/plupload.js* | | plupload-html5 | wp-includes/js/plupload/plupload.html5.js | | plupload-flash | */wp-includes/js/plupload/plupload.flash.js*“ | | plupload-silverlight | */wp-includes/js/plupload/plupload.silverlight.js* | | plupload-html4 | */wp-includes/js/plupload/plupload.html4.js* | | plupload-all | plupload, plupload-html5, plupload-flash, plupload-silverlight, plupload-html4 | | plupload-handlers | */wp-includes/js/plupload/handlers.js* | | wp-plupload | */wp-includes/js/plupload/wp-plupload.js* | | swfupload | */wp-includes/js/swfupload/swfupload.js* | | swfupload-swfobject | */wp-includes/js/swfupload/plugins/swfupload.swfobject.js* | | swfupload-queue | */wp-includes/js/swfupload/plugins/swfupload.queue.js* | | swfupload-speed | */wp-includes/js/swfupload/plugins/swfupload.speed.js* | | swfupload-all | */wp-includes/js/swfupload/swfupload-all.js* | | swfupload-handlers | */wp-includes/js/swfupload/handlers.js* | | comment-reply | */wp-includes/js/comment-reply.js* | | json2 | */wp-includes/js/json2.js* | | underscore | */wp-includes/js/underscore.min.js* | | backbone | */wp-includes/js/backbone.min.js* | | wp-util | */wp-includes/js/wp-util.js* | | wp-backbone | */wp-includes/js/wp-backbone.js* | | revisions | */wp-admin/js/revisions.js* | | imgareaselect | */wp-includes/js/imgareaselect/jquery.imgareaselect.js* | | mediaelement | /wp-includes/js/mediaelement/mediaelement-and-player.min.js | | wp-mediaelement | /wp-includes/js/mediaelement/wp-mediaelement.js | | zxcvbn-async | /wp-includes/js/zxcvbn-async.js | | password-strength-meter | */wp-admin/js/password-strength-meter.js* | | user-profile | */wp-admin/js/user-profile.js* | | user-suggest | */wp-admin/js/user-suggest.js* | | admin-bar | */wp-includes/js/admin-bar.js* | | wplink | */wp-includes/js/wplink.js* | | wpdialogs | */wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.js* | | wpdialogs-popup | */wp-includes/js/tinymce/plugins/wpdialogs/js/popup.js* | | word-count | */wp-admin/js/word-count.js* | | media-upload | */wp-admin/js/media-upload.js* | | hoverIntent | */wp-includes/js/hoverIntent.js* | | customize-base | */wp-includes/js/customize-base.js* | | customize-loader | | | customize-preview | | | customize-controls | | | accordion | | | shortcode | | | media-models | | | media-views | | | media-editor | | | mce-view | | | admin-tags | | | admin-comments | | | xfn | | | postbox | | | post | | | link | | | comment | | | admin-gallery | | | admin-widgets | | | theme | | | theme-install | | | inline-edit-post | | | inline-edit-tax | | | plugin-install | | | farbtastic | | | iris | | | wp-color-picker | | | dashboard | | | list-revisions | | | media | | | image-edit | | | set-post-thumbnail | | | nav-menu | | | custom-header | | | custom-background | | | media-gallery | | | svg-painter | File: `wp-includes/functions.wp-scripts.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-scripts.php/) ``` function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); $wp_scripts = wp_scripts(); $registered = $wp_scripts->add( $handle, $src, $deps, $ver ); if ( $in_footer ) { $wp_scripts->add_data( $handle, 'group', 1 ); } return $registered; } ``` | Uses | Description | | --- | --- | | [wp\_scripts()](wp_scripts) wp-includes/functions.wp-scripts.php | Initialize $wp\_scripts if it has not been set. | | 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. | | [enqueue\_editor\_block\_styles\_assets()](enqueue_editor_block_styles_assets) wp-includes/script-loader.php | Function responsible for enqueuing the assets required for block styles functionality on the editor. | | Version | Description | | --- | --- | | [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | A return value was added. | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress get_user_details( string $username ) get\_user\_details( string $username ) ====================================== This function has been deprecated. Use [get\_user\_by()](get_user_by) instead. Deprecated functionality to retrieve user information. * [get\_user\_by()](get_user_by) `$username` string Required Username. File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/) ``` function get_user_details( $username ) { _deprecated_function( __FUNCTION__, '3.0.0', 'get_user_by()' ); return get_user_by('login', $username); } ``` | Uses | Description | | --- | --- | | [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.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [get\_user\_by()](get_user_by) | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress restore_current_blog(): bool restore\_current\_blog(): bool ============================== Restore the current blog, after calling [switch\_to\_blog()](switch_to_blog) . * [switch\_to\_blog()](switch_to_blog) bool True on success, false if we're already on the current blog. `restore_current_blog()` should be called after every `switch_to_blog()`. If not, a global variable which monitors the switching, `$GLOBALS['_wp_switched_stack']`, will not be empty even if you use `switch_to_blog()` to return to the original blog. If `$GLOBALS['_wp_switched_stack']` is not empty, WP will think it is in a switched state and can potentially return the wrong URL for the site via `wp_upload_dir()`. See <http://wordpress.stackexchange.com/a/123516/27757> When calling `switch_to_blog()` repeatedly, either call `restore_current_blog()` each time, or save the original blog ID until the end and `call switch_to_blog()` with that and do: `$GLOBALS['_wp_switched_stack'] = array(); $GLOBALS['switched'] = false;` The former is probably preferable, as it is not a hack. File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/) ``` function restore_current_blog() { global $wpdb; if ( empty( $GLOBALS['_wp_switched_stack'] ) ) { return false; } $new_blog_id = array_pop( $GLOBALS['_wp_switched_stack'] ); $prev_blog_id = get_current_blog_id(); if ( $new_blog_id == $prev_blog_id ) { /** This filter is documented in wp-includes/ms-blogs.php */ do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' ); // If we still have items in the switched stack, consider ourselves still 'switched'. $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] ); return true; } $wpdb->set_blog_id( $new_blog_id ); $GLOBALS['blog_id'] = $new_blog_id; $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix(); if ( function_exists( 'wp_cache_switch_to_blog' ) ) { wp_cache_switch_to_blog( $new_blog_id ); } else { global $wp_object_cache; if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) { $global_groups = $wp_object_cache->global_groups; } else { $global_groups = false; } wp_cache_init(); if ( function_exists( 'wp_cache_add_global_groups' ) ) { if ( is_array( $global_groups ) ) { wp_cache_add_global_groups( $global_groups ); } else { wp_cache_add_global_groups( array( 'blog-details', 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', 'networks', 'sites', 'site-details', 'site-options', 'site-transient', 'rss', 'users', 'useremail', 'userlogins', 'usermeta', 'user_meta', 'userslugs', ) ); } wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) ); } } /** This filter is documented in wp-includes/ms-blogs.php */ do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' ); // If we still have items in the switched stack, consider ourselves still 'switched'. $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] ); return true; } ``` [do\_action( 'switch\_blog', int $new\_blog\_id, int $prev\_blog\_id, string $context )](../hooks/switch_blog) Fires when the blog is switched. | Uses | Description | | --- | --- | | [wp\_cache\_switch\_to\_blog()](wp_cache_switch_to_blog) wp-includes/cache.php | Switches the internal blog ID. | | [wp\_cache\_init()](wp_cache_init) wp-includes/cache.php | Sets up Object Cache Global and assigns it. | | [wp\_cache\_add\_global\_groups()](wp_cache_add_global_groups) wp-includes/cache.php | Adds a group or set of groups to the list of global groups. | | [wp\_cache\_add\_non\_persistent\_groups()](wp_cache_add_non_persistent_groups) wp-includes/cache.php | Adds a group or set of groups to the list of non-persistent groups. | | [wpdb::set\_blog\_id()](../classes/wpdb/set_blog_id) wp-includes/class-wpdb.php | Sets blog ID. | | [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. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | Used By | Description | | --- | --- | | [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. | | [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\_Site::get\_details()](../classes/wp_site/get_details) wp-includes/class-wp-site.php | Retrieves the details for this site. | | [has\_custom\_logo()](has_custom_logo) wp-includes/general-template.php | Determines whether the site has a custom logo. | | [get\_custom\_logo()](get_custom_logo) wp-includes/general-template.php | Returns a custom logo, linked to home unless the theme supports removing the link on the home page. | | [wp\_get\_users\_with\_no\_role()](wp_get_users_with_no_role) wp-includes/user.php | Gets the user IDs of all users with no role on this site. | | [get\_site\_icon\_url()](get_site_icon_url) wp-includes/general-template.php | Returns the Site Icon URL. | | [WP\_MS\_Sites\_List\_Table::column\_blogname()](../classes/wp_ms_sites_list_table/column_blogname) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the site name column output. | | [confirm\_another\_blog\_signup()](confirm_another_blog_signup) wp-signup.php | Shows a message confirming that the new site has been created. | | [wpmu\_delete\_user()](wpmu_delete_user) wp-admin/includes/ms.php | Delete a user from the network and remove from all sites. | | [upload\_space\_setting()](upload_space_setting) wp-admin/includes/ms.php | Displays the site upload space quota setting form on the Edit Site Settings screen. | | [wpmu\_delete\_blog()](wpmu_delete_blog) wp-admin/includes/ms.php | Delete a site. | | [WP\_Users\_List\_Table::get\_views()](../classes/wp_users_list_table/get_views) wp-admin/includes/class-wp-users-list-table.php | Return an associative array listing all the views that can be used with this table. | | [WP\_User::get\_role\_caps()](../classes/wp_user/get_role_caps) wp-includes/class-wp-user.php | Retrieves all of the capabilities of the user’s roles, and merges them with individual user capabilities. | | [current\_user\_can\_for\_blog()](current_user_can_for_blog) wp-includes/capabilities.php | Returns whether the current user has the specified capability for a given site. | | [WP\_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\_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\_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. | | [count\_users()](count_users) wp-includes/user.php | Counts number of users who have each of the user roles. | | [newblog\_notify\_siteadmin()](newblog_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new site has been activated. | | [create\_empty\_blog()](create_empty_blog) wp-includes/ms-deprecated.php | Create an empty blog. | | [get\_blog\_post()](get_blog_post) wp-includes/ms-functions.php | Gets a blog post from any site on the network. | | [add\_user\_to\_blog()](add_user_to_blog) wp-includes/ms-functions.php | Adds a user to a blog, along with specifying the user’s role. | | [remove\_user\_from\_blog()](remove_user_from_blog) wp-includes/ms-functions.php | Removes a user from a blog. | | [get\_blog\_permalink()](get_blog_permalink) wp-includes/ms-functions.php | Gets the permalink for a post on another blog. | | [get\_blog\_option()](get_blog_option) wp-includes/ms-blogs.php | Retrieve option value for a given blog id based on name of option. | | [add\_blog\_option()](add_blog_option) wp-includes/ms-blogs.php | Add a new option for a given blog ID. | | [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. | | [update\_blog\_option()](update_blog_option) wp-includes/ms-blogs.php | Update an option for a particular blog. | | [get\_blog\_details()](get_blog_details) wp-includes/ms-blogs.php | Retrieve the details for a blog from the blogs table and blog options. | | [wp\_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 | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
programming_docs
wordpress clean_page_cache( int $id ) clean\_page\_cache( int $id ) ============================= This function has been deprecated. Use [clean\_post\_cache()](clean_post_cache) instead. Will clean the page in the cache. Clean (read: delete) page from cache that matches $id. Will also clean cache associated with ‘all\_page\_ids’ and ‘get\_pages’. * [clean\_post\_cache()](clean_post_cache) `$id` int Required Page ID to clean File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function clean_page_cache( $id ) { _deprecated_function( __FUNCTION__, '3.4.0', 'clean_post_cache()' ); clean_post_cache( $id ); } ``` | Uses | Description | | --- | --- | | [clean\_post\_cache()](clean_post_cache) wp-includes/post.php | Will clean the post in the cache. | | [\_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 clean\_post\_cache | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress list_plugin_updates() list\_plugin\_updates() ======================= Display the upgrade plugins form. File: `wp-admin/update-core.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/update-core.php/) ``` function list_plugin_updates() { $wp_version = get_bloginfo( 'version' ); $cur_wp_version = preg_replace( '/-.*$/', '', $wp_version ); require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; $plugins = get_plugin_updates(); if ( empty( $plugins ) ) { echo '<h2>' . __( 'Plugins' ) . '</h2>'; echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>'; return; } $form_action = 'update-core.php?action=do-plugin-upgrade'; $core_updates = get_core_updates(); if ( ! isset( $core_updates[0]->response ) || 'latest' === $core_updates[0]->response || 'development' === $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=' ) ) { $core_update_version = false; } else { $core_update_version = $core_updates[0]->current; } $plugins_count = count( $plugins ); ?> <h2> <?php printf( '%s <span class="count">(%d)</span>', __( 'Plugins' ), number_format_i18n( $plugins_count ) ); ?> </h2> <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.' ); ?></p> <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade"> <?php wp_nonce_field( 'upgrade-core' ); ?> <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p> <table class="widefat updates-table" id="update-plugins-table"> <thead> <tr> <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td> <td class="manage-column"><label for="plugins-select-all"><?php _e( 'Select All' ); ?></label></td> </tr> </thead> <tbody class="plugins"> <?php $auto_updates = array(); if ( wp_is_auto_update_enabled_for_type( 'plugin' ) ) { $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); $auto_update_notice = ' | ' . wp_get_auto_update_message(); } foreach ( (array) $plugins as $plugin_file => $plugin_data ) { $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); $icon = '<span class="dashicons dashicons-admin-plugins"></span>'; $preferred_icons = array( 'svg', '2x', '1x', 'default' ); foreach ( $preferred_icons as $preferred_icon ) { if ( ! empty( $plugin_data->update->icons[ $preferred_icon ] ) ) { $icon = '<img src="' . esc_url( $plugin_data->update->icons[ $preferred_icon ] ) . '" alt="" />'; break; } } // Get plugin compat for running version of WordPress. if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $cur_wp_version, '>=' ) ) { /* translators: %s: WordPress version. */ $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $cur_wp_version ); } else { /* translators: %s: WordPress version. */ $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $cur_wp_version ); } // Get plugin compat for updated version of WordPress. if ( $core_update_version ) { if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) { /* translators: %s: WordPress version. */ $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $core_update_version ); } else { /* translators: %s: WordPress version. */ $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $core_update_version ); } } $requires_php = isset( $plugin_data->update->requires_php ) ? $plugin_data->update->requires_php : null; $compatible_php = is_php_version_compatible( $requires_php ); if ( ! $compatible_php && current_user_can( 'update_php' ) ) { $compat .= '<br>' . __( 'This update does not work with your version of PHP.' ) . '&nbsp;'; $compat .= sprintf( /* translators: %s: URL to Update PHP page. */ __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) ); $annotation = wp_get_update_php_annotation(); if ( $annotation ) { $compat .= '</p><p><em>' . $annotation . '</em>'; } } // Get the upgrade notice for the new plugin version. if ( isset( $plugin_data->update->upgrade_notice ) ) { $upgrade_notice = '<br />' . strip_tags( $plugin_data->update->upgrade_notice ); } else { $upgrade_notice = ''; } $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '&section=changelog&TB_iframe=true&width=640&height=662' ); $details = sprintf( '<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>', esc_url( $details_url ), /* translators: 1: Plugin name, 2: Version number. */ esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ), /* translators: %s: Plugin version. */ sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version ) ); $checkbox_id = 'checkbox_' . md5( $plugin_file ); ?> <tr> <td class="check-column"> <?php if ( $compatible_php ) : ?> <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" /> <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"> <?php /* translators: %s: Plugin name. */ printf( __( 'Select %s' ), $plugin_data->Name ); ?> </label> <?php endif; ?> </td> <td class="plugin-title"><p> <?php echo $icon; ?> <strong><?php echo $plugin_data->Name; ?></strong> <?php printf( /* translators: 1: Plugin version, 2: New version. */ __( 'You have version %1$s installed. Update to %2$s.' ), $plugin_data->Version, $plugin_data->update->new_version ); echo ' ' . $details . $compat . $upgrade_notice; if ( in_array( $plugin_file, $auto_updates, true ) ) { echo $auto_update_notice; } ?> </p></td> </tr> <?php } ?> </tbody> <tfoot> <tr> <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td> <td class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></td> </tr> </tfoot> </table> <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p> </form> <?php } ``` | Uses | Description | | --- | --- | | [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. | | [is\_php\_version\_compatible()](is_php_version_compatible) wp-includes/functions.php | Checks compatibility with the current PHP version. | | [wp\_get\_update\_php\_annotation()](wp_get_update_php_annotation) wp-includes/functions.php | Returns the default annotation for the web hosting altering the “Update PHP” page URL. | | [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. | | [get\_plugin\_updates()](get_plugin_updates) wp-admin/includes/update.php | Retrieves plugins with updates available. | | [get\_core\_updates()](get_core_updates) wp-admin/includes/update.php | Gets available core updates. | | [\_get\_plugin\_data\_markup\_translate()](_get_plugin_data_markup_translate) wp-admin/includes/plugin.php | Sanitizes plugin data, optionally adds markup, optionally translates. | | [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\_get\_auto\_update\_message()](wp_get_auto_update_message) wp-admin/includes/update.php | Determines the appropriate auto-update message to be displayed. | | [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\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. | | [\_\_()](__) 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. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [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 | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress _wp_dashboard_recent_comments_row( WP_Comment $comment, bool $show_date = true ) \_wp\_dashboard\_recent\_comments\_row( WP\_Comment $comment, bool $show\_date = true ) ======================================================================================= This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Outputs a row for the Recent Comments widget. `$comment` [WP\_Comment](../classes/wp_comment) Required The current comment. `$show_date` bool Optional Whether to display the date. Default: `true` 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_row( &$comment, $show_date = true ) { $GLOBALS['comment'] = clone $comment; if ( $comment->comment_post_ID > 0 ) { $comment_post_title = _draft_or_post_title( $comment->comment_post_ID ); $comment_post_url = get_the_permalink( $comment->comment_post_ID ); $comment_post_link = '<a href="' . esc_url( $comment_post_url ) . '">' . $comment_post_title . '</a>'; } else { $comment_post_link = ''; } $actions_string = ''; if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) { // Pre-order it: Approve | Reply | Edit | Spam | Trash. $actions = array( 'approve' => '', 'unapprove' => '', 'reply' => '', 'edit' => '', 'spam' => '', 'trash' => '', 'delete' => '', 'view' => '', ); $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); $approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); $unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); $spam_url = esc_url( "comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); $trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); $delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); $actions['approve'] = sprintf( '<a href="%s" data-wp-lists="%s" class="vim-a aria-button-if-js" aria-label="%s">%s</a>', $approve_url, "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved", esc_attr__( 'Approve this comment' ), __( 'Approve' ) ); $actions['unapprove'] = sprintf( '<a href="%s" data-wp-lists="%s" class="vim-u aria-button-if-js" aria-label="%s">%s</a>', $unapprove_url, "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved", esc_attr__( 'Unapprove this comment' ), __( 'Unapprove' ) ); $actions['edit'] = sprintf( '<a href="%s" aria-label="%s">%s</a>', "comment.php?action=editcomment&amp;c={$comment->comment_ID}", esc_attr__( 'Edit this comment' ), __( 'Edit' ) ); $actions['reply'] = sprintf( '<button type="button" onclick="window.commentReply && commentReply.open(\'%s\',\'%s\');" class="vim-r button-link hide-if-no-js" aria-label="%s">%s</button>', $comment->comment_ID, $comment->comment_post_ID, esc_attr__( 'Reply to this comment' ), __( 'Reply' ) ); $actions['spam'] = sprintf( '<a href="%s" data-wp-lists="%s" class="vim-s vim-destructive aria-button-if-js" aria-label="%s">%s</a>', $spam_url, "delete:the-comment-list:comment-{$comment->comment_ID}::spam=1", esc_attr__( 'Mark this comment as spam' ), /* translators: "Mark as spam" link. */ _x( 'Spam', 'verb' ) ); if ( ! EMPTY_TRASH_DAYS ) { $actions['delete'] = sprintf( '<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>', $delete_url, "delete:the-comment-list:comment-{$comment->comment_ID}::trash=1", esc_attr__( 'Delete this comment permanently' ), __( 'Delete Permanently' ) ); } else { $actions['trash'] = sprintf( '<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>', $trash_url, "delete:the-comment-list:comment-{$comment->comment_ID}::trash=1", esc_attr__( 'Move this comment to the Trash' ), _x( 'Trash', 'verb' ) ); } $actions['view'] = sprintf( '<a class="comment-link" href="%s" aria-label="%s">%s</a>', esc_url( get_comment_link( $comment ) ), esc_attr__( 'View this comment' ), __( 'View' ) ); /** * Filters the action links displayed for each comment in the 'Recent Comments' * dashboard widget. * * @since 2.6.0 * * @param string[] $actions An array of comment actions. Default actions include: * 'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam', * 'Delete', and 'Trash'. * @param WP_Comment $comment The comment object. */ $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); $i = 0; foreach ( $actions as $action => $link ) { ++$i; if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) { $separator = ''; } else { $separator = ' | '; } // Reply and quickedit need a hide-if-no-js span. if ( 'reply' === $action || 'quickedit' === $action ) { $action .= ' hide-if-no-js'; } if ( 'view' === $action && '1' !== $comment->comment_approved ) { $action .= ' hidden'; } $actions_string .= "<span class='$action'>{$separator}{$link}</span>"; } } ?> <li id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status( $comment ) ), $comment ); ?>> <?php $comment_row_class = ''; if ( get_option( 'show_avatars' ) ) { echo get_avatar( $comment, 50, 'mystery' ); $comment_row_class .= ' has-avatar'; } ?> <?php if ( ! $comment->comment_type || 'comment' === $comment->comment_type ) : ?> <div class="dashboard-comment-wrap has-row-actions <?php echo $comment_row_class; ?>"> <p class="comment-meta"> <?php // Comments might not have a post they relate to, e.g. programmatically created ones. if ( $comment_post_link ) { printf( /* translators: 1: Comment author, 2: Post link, 3: Notification if the comment is pending. */ __( 'From %1$s on %2$s %3$s' ), '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>', $comment_post_link, '<span class="approve">' . __( '[Pending]' ) . '</span>' ); } else { printf( /* translators: 1: Comment author, 2: Notification if the comment is pending. */ __( 'From %1$s %2$s' ), '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>', '<span class="approve">' . __( '[Pending]' ) . '</span>' ); } ?> </p> <?php else : switch ( $comment->comment_type ) { case 'pingback': $type = __( 'Pingback' ); break; case 'trackback': $type = __( 'Trackback' ); break; default: $type = ucwords( $comment->comment_type ); } $type = esc_html( $type ); ?> <div class="dashboard-comment-wrap has-row-actions"> <p class="comment-meta"> <?php // Pingbacks, Trackbacks or custom comment types might not have a post they relate to, e.g. programmatically created ones. if ( $comment_post_link ) { printf( /* translators: 1: Type of comment, 2: Post link, 3: Notification if the comment is pending. */ _x( '%1$s on %2$s %3$s', 'dashboard' ), "<strong>$type</strong>", $comment_post_link, '<span class="approve">' . __( '[Pending]' ) . '</span>' ); } else { printf( /* translators: 1: Type of comment, 2: Notification if the comment is pending. */ _x( '%1$s %2$s', 'dashboard' ), "<strong>$type</strong>", '<span class="approve">' . __( '[Pending]' ) . '</span>' ); } ?> </p> <p class="comment-author"><?php comment_author_link( $comment ); ?></p> <?php endif; // comment_type ?> <blockquote><p><?php comment_excerpt( $comment ); ?></p></blockquote> <?php if ( $actions_string ) : ?> <p class="row-actions"><?php echo $actions_string; ?></p> <?php endif; ?> </div> </li> <?php $GLOBALS['comment'] = null; } ``` [apply\_filters( 'comment\_row\_actions', string[] $actions, WP\_Comment $comment )](../hooks/comment_row_actions) Filters the action links displayed for each comment in the ‘Recent Comments’ dashboard widget. | Uses | Description | | --- | --- | | [\_draft\_or\_post\_title()](_draft_or_post_title) wp-admin/includes/template.php | Gets the post title. | | [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. | | [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. | | [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. | | [comment\_excerpt()](comment_excerpt) wp-includes/comment-template.php | Displays the excerpt of the current comment. | | [comment\_class()](comment_class) wp-includes/comment-template.php | Generates semantic classes for each comment element. | | [get\_comment\_link()](get_comment_link) wp-includes/comment-template.php | Retrieves the link to a given comment. | | [get\_the\_permalink()](get_the_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [esc\_attr\_\_()](esc_attr__) wp-includes/l10n.php | Retrieves the translation of $text and escapes it for safe use in an attribute. | | [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. | | [wp\_get\_comment\_status()](wp_get_comment_status) wp-includes/comment.php | Retrieves the status of a comment by comment ID. | | [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. | | [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. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | Used By | Description | | --- | --- | | [wp\_dashboard\_recent\_comments()](wp_dashboard_recent_comments) wp-admin/includes/dashboard.php | Show Comments section. | | [wp\_ajax\_replyto\_comment()](wp_ajax_replyto_comment) wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
programming_docs
wordpress _register_core_block_patterns_and_categories() \_register\_core\_block\_patterns\_and\_categories() ==================================================== 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 core block patterns and categories. File: `wp-includes/block-patterns.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-patterns.php/) ``` function _register_core_block_patterns_and_categories() { $should_register_core_patterns = get_theme_support( 'core-block-patterns' ); if ( $should_register_core_patterns ) { $core_block_patterns = array( 'query-standard-posts', 'query-medium-posts', 'query-small-posts', 'query-grid-posts', 'query-large-title-posts', 'query-offset-posts', 'social-links-shared-background-color', ); foreach ( $core_block_patterns as $core_block_pattern ) { register_block_pattern( 'core/' . $core_block_pattern, require __DIR__ . '/block-patterns/' . $core_block_pattern . '.php' ); } } register_block_pattern_category( 'buttons', array( 'label' => _x( 'Buttons', 'Block pattern category' ) ) ); register_block_pattern_category( 'columns', array( 'label' => _x( 'Columns', 'Block pattern category' ) ) ); register_block_pattern_category( 'featured', array( 'label' => _x( 'Featured', 'Block pattern category' ) ) ); register_block_pattern_category( 'footer', array( 'label' => _x( 'Footers', 'Block pattern category' ) ) ); register_block_pattern_category( 'gallery', array( 'label' => _x( 'Gallery', 'Block pattern category' ) ) ); register_block_pattern_category( 'header', array( 'label' => _x( 'Headers', 'Block pattern category' ) ) ); register_block_pattern_category( 'text', array( 'label' => _x( 'Text', 'Block pattern category' ) ) ); register_block_pattern_category( 'query', array( 'label' => _x( 'Query', 'Block pattern category' ) ) ); } ``` | Uses | Description | | --- | --- | | [register\_block\_pattern()](register_block_pattern) wp-includes/class-wp-block-patterns-registry.php | Registers a new block pattern. | | [register\_block\_pattern\_category()](register_block_pattern_category) wp-includes/class-wp-block-pattern-categories-registry.php | Registers a new pattern category. | | [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | Version | Description | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. | wordpress category_exists( int|string $cat_name, int $category_parent = null ): string|null category\_exists( int|string $cat\_name, int $category\_parent = null ): string|null ==================================================================================== Checks whether a category exists. * [term\_exists()](term_exists) `$cat_name` int|string Required Category name. `$category_parent` int Optional ID of parent category. Default: `null` string|null Returns the category ID as a numeric string if the pairing exists, null if not. File: `wp-admin/includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/taxonomy.php/) ``` function category_exists( $cat_name, $category_parent = null ) { $id = term_exists( $cat_name, 'category', $category_parent ); if ( is_array( $id ) ) { $id = $id['term_id']; } return $id; } ``` | Uses | Description | | --- | --- | | [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. | | Used By | Description | | --- | --- | | [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\_create\_categories()](wp_create_categories) wp-admin/includes/taxonomy.php | Creates categories for the given post. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress media_upload_max_image_resize() media\_upload\_max\_image\_resize() =================================== Displays the checkbox to scale images. File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/) ``` function media_upload_max_image_resize() { $checked = get_user_setting( 'upload_resize' ) ? ' checked="true"' : ''; $a = ''; $end = ''; if ( current_user_can( 'manage_options' ) ) { $a = '<a href="' . esc_url( admin_url( 'options-media.php' ) ) . '" target="_blank">'; $end = '</a>'; } ?> <p class="hide-if-no-js"><label> <input name="image_resize" type="checkbox" id="image_resize" value="true"<?php echo $checked; ?> /> <?php /* translators: 1: Link start tag, 2: Link end tag, 3: Width, 4: Height. */ printf( __( 'Scale images to match the large size selected in %1$simage options%2$s (%3$d &times; %4$d).' ), $a, $end, (int) get_option( 'large_size_w', '1024' ), (int) get_option( 'large_size_h', '1024' ) ); ?> </label></p> <?php } ``` | Uses | Description | | --- | --- | | [get\_user\_setting()](get_user_setting) wp-includes/option.php | Retrieves user interface setting value based on setting name. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Version | Description | | --- | --- | | [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. | wordpress wp_generate_block_templates_export_file(): WP_Error|string wp\_generate\_block\_templates\_export\_file(): WP\_Error|string ================================================================ Creates an export of the current templates and template parts from the site editor at the specified path in a ZIP file. [WP\_Error](../classes/wp_error)|string Path of the ZIP file or error on failure. File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/) ``` function wp_generate_block_templates_export_file() { if ( ! class_exists( 'ZipArchive' ) ) { return new WP_Error( 'missing_zip_package', __( 'Zip Export not supported.' ) ); } $obscura = wp_generate_password( 12, false, false ); $theme_name = basename( get_stylesheet() ); $filename = get_temp_dir() . $theme_name . $obscura . '.zip'; $zip = new ZipArchive(); if ( true !== $zip->open( $filename, ZipArchive::CREATE | ZipArchive::OVERWRITE ) ) { return new WP_Error( 'unable_to_create_zip', __( 'Unable to open export file (archive) for writing.' ) ); } $zip->addEmptyDir( 'templates' ); $zip->addEmptyDir( 'parts' ); // Get path of the theme. $theme_path = wp_normalize_path( get_stylesheet_directory() ); // Create recursive directory iterator. $theme_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $theme_path ), RecursiveIteratorIterator::LEAVES_ONLY ); // Make a copy of the current theme. foreach ( $theme_files as $file ) { // Skip directories as they are added automatically. if ( ! $file->isDir() ) { // Get real and relative path for current file. $file_path = wp_normalize_path( $file ); $relative_path = substr( $file_path, strlen( $theme_path ) + 1 ); if ( ! wp_is_theme_directory_ignored( $relative_path ) ) { $zip->addFile( $file_path, $relative_path ); } } } // Load templates into the zip file. $templates = get_block_templates(); foreach ( $templates as $template ) { $template->content = _remove_theme_attribute_in_block_template_content( $template->content ); $zip->addFromString( 'templates/' . $template->slug . '.html', $template->content ); } // Load template parts into the zip file. $template_parts = get_block_templates( array(), 'wp_template_part' ); foreach ( $template_parts as $template_part ) { $zip->addFromString( 'parts/' . $template_part->slug . '.html', $template_part->content ); } // Load theme.json into the zip file. $tree = WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) ); // Merge with user data. $tree->merge( WP_Theme_JSON_Resolver::get_user_data() ); $theme_json_raw = $tree->get_data(); // If a version is defined, add a schema. if ( $theme_json_raw['version'] ) { global $wp_version; $theme_json_version = 'wp/' . substr( $wp_version, 0, 3 ); $schema = array( '$schema' => 'https://schemas.wp.org/' . $theme_json_version . '/theme.json' ); $theme_json_raw = array_merge( $schema, $theme_json_raw ); } // Convert to a string. $theme_json_encoded = wp_json_encode( $theme_json_raw, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); // Replace 4 spaces with a tab. $theme_json_tabbed = preg_replace( '~(?:^|\G)\h{4}~m', "\t", $theme_json_encoded ); // Add the theme.json file to the zip. $zip->addFromString( 'theme.json', $theme_json_tabbed ); // Save changes to the zip file. $zip->close(); return $filename; } ``` | Uses | Description | | --- | --- | | [wp\_is\_theme\_directory\_ignored()](wp_is_theme_directory_ignored) wp-includes/block-template-utils.php | Determines whether a theme directory should be ignored during export. | | [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. | | [\_remove\_theme\_attribute\_in\_block\_template\_content()](_remove_theme_attribute_in_block_template_content) wp-includes/block-template-utils.php | Parses a block template and removes the theme attribute from each template part. | | [WP\_Theme\_JSON\_Resolver::get\_theme\_data()](../classes/wp_theme_json_resolver/get_theme_data) wp-includes/class-wp-theme-json-resolver.php | Returns the theme’s data. | | [get\_block\_templates()](get_block_templates) wp-includes/block-template-utils.php | Retrieves a list of unified template objects based on a query. | | [get\_stylesheet\_directory()](get_stylesheet_directory) wp-includes/theme.php | Retrieves stylesheet directory path for the active theme. | | [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. | | [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. | | [get\_temp\_dir()](get_temp_dir) wp-includes/functions.php | Determines a writable directory for temporary files. | | [wp\_normalize\_path()](wp_normalize_path) wp-includes/functions.php | Normalizes a filesystem path. | | [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. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Used By | Description | | --- | --- | | [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. | | Version | Description | | --- | --- | | [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Adds the whole theme to the export archive. | | [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. | wordpress wp_enqueue_stored_styles( array $options = array() ): void wp\_enqueue\_stored\_styles( array $options = array() ): void ============================================================= Fetches, processes and compiles stored core styles, then combines and renders them to the page. Styles are stored via the style engine API. `$options` array Optional An array of options to pass to [wp\_style\_engine\_get\_stylesheet\_from\_context()](wp_style_engine_get_stylesheet_from_context) . * `optimize`boolWhether to optimize the CSS output, e.g., combine rules. Default is `false`. * `prettify`boolWhether to add new lines and indents to output. Default is the test of whether the global constant `SCRIPT_DEBUG` is defined. More Arguments from wp\_style\_engine\_get\_stylesheet\_from\_context( ... $options ) An array of options. * `optimize`boolWhether to optimize the CSS output, e.g., combine rules. Default is `false`. * `prettify`boolWhether to add new lines and indents to output. Default is the test of whether the global constant `SCRIPT_DEBUG` is defined. Default: `array()` void File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/) ``` function wp_enqueue_stored_styles( $options = array() ) { $is_block_theme = wp_is_block_theme(); $is_classic_theme = ! $is_block_theme; /* * For block themes, this function prints stored styles in the header. * For classic themes, in the footer. */ if ( ( $is_block_theme && doing_action( 'wp_footer' ) ) || ( $is_classic_theme && doing_action( 'wp_enqueue_scripts' ) ) ) { return; } $core_styles_keys = array( 'block-supports' ); $compiled_core_stylesheet = ''; $style_tag_id = 'core'; // Adds comment if code is prettified to identify core styles sections in debugging. $should_prettify = isset( $options['prettify'] ) ? true === $options['prettify'] : defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG; foreach ( $core_styles_keys as $style_key ) { if ( $should_prettify ) { $compiled_core_stylesheet .= "/**\n * Core styles: $style_key\n */\n"; } // Chains core store ids to signify what the styles contain. $style_tag_id .= '-' . $style_key; $compiled_core_stylesheet .= wp_style_engine_get_stylesheet_from_context( $style_key, $options ); } // Combines Core styles. if ( ! empty( $compiled_core_stylesheet ) ) { wp_register_style( $style_tag_id, false, array(), true, true ); wp_add_inline_style( $style_tag_id, $compiled_core_stylesheet ); wp_enqueue_style( $style_tag_id ); } // Prints out any other stores registered by themes or otherwise. $additional_stores = WP_Style_Engine_CSS_Rules_Store::get_stores(); foreach ( array_keys( $additional_stores ) as $store_name ) { if ( in_array( $store_name, $core_styles_keys, true ) ) { continue; } $styles = wp_style_engine_get_stylesheet_from_context( $store_name, $options ); if ( ! empty( $styles ) ) { $key = "wp-style-engine-$store_name"; wp_register_style( $key, false, array(), true, true ); wp_add_inline_style( $key, $styles ); wp_enqueue_style( $key ); } } } ``` | Uses | Description | | --- | --- | | [WP\_Style\_Engine\_CSS\_Rules\_Store::get\_stores()](../classes/wp_style_engine_css_rules_store/get_stores) wp-includes/style-engine/class-wp-style-engine-css-rules-store.php | Gets an array of all available stores. | | [wp\_style\_engine\_get\_stylesheet\_from\_context()](wp_style_engine_get_stylesheet_from_context) wp-includes/style-engine.php | Returns compiled CSS from a store, if found. | | [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\_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. | | Version | Description | | --- | --- | | [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. | wordpress wp_print_editor_js() wp\_print\_editor\_js() ======================= This function has been deprecated. Use [wp\_editor()](wp_editor) instead. Prints TinyMCE editor JS. * [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_print_editor_js() { _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 update_metadata_by_mid( string $meta_type, int $meta_id, string $meta_value, string|false $meta_key = false ): bool update\_metadata\_by\_mid( string $meta\_type, int $meta\_id, string $meta\_value, string|false $meta\_key = false ): bool ========================================================================================================================== Updates 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. `$meta_value` string Required Metadata value. Must be serializable if non-scalar. `$meta_key` string|false Optional You can provide a meta key to update it. Default: `false` bool True on successful update, false on failure. File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/) ``` function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key = false ) { 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; } $column = sanitize_key( $meta_type . '_id' ); $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id'; /** * Short-circuits updating 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: * * - `update_post_metadata_by_mid` * - `update_comment_metadata_by_mid` * - `update_term_metadata_by_mid` * - `update_user_metadata_by_mid` * * @since 5.0.0 * * @param null|bool $check Whether to allow updating metadata for the given type. * @param int $meta_id Meta ID. * @param mixed $meta_value Meta value. Must be serializable if non-scalar. * @param string|false $meta_key Meta key, if provided. */ $check = apply_filters( "update_{$meta_type}_metadata_by_mid", null, $meta_id, $meta_value, $meta_key ); 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 ) { $original_key = $meta->meta_key; $object_id = $meta->{$column}; // If a new meta_key (last parameter) was specified, change the meta key, // otherwise use the original key in the update statement. if ( false === $meta_key ) { $meta_key = $original_key; } elseif ( ! is_string( $meta_key ) ) { return false; } $meta_subtype = get_object_subtype( $meta_type, $object_id ); // Sanitize the meta. $_meta_value = $meta_value; $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type, $meta_subtype ); $meta_value = maybe_serialize( $meta_value ); // Format the data query arguments. $data = array( 'meta_key' => $meta_key, 'meta_value' => $meta_value, ); // Format the where query arguments. $where = array(); $where[ $id_column ] = $meta_id; /** This action is documented in wp-includes/meta.php */ do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { /** This action is documented in wp-includes/meta.php */ do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value ); } // Run the update query, all fields in $data are %s, $where is a %d. $result = $wpdb->update( $table, $data, $where, '%s', '%d' ); if ( ! $result ) { return false; } // Clear the caches. wp_cache_delete( $object_id, $meta_type . '_meta' ); /** This action is documented in wp-includes/meta.php */ do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { /** This action is documented in wp-includes/meta.php */ do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value ); } return true; } // And if the meta was not found. return false; } ``` [do\_action( 'updated\_postmeta', int $meta\_id, int $object\_id, string $meta\_key, mixed $meta\_value )](../hooks/updated_postmeta) Fires immediately after updating a post’s metadata. [do\_action( "updated\_{$meta\_type}\_meta", int $meta\_id, int $object\_id, string $meta\_key, mixed $\_meta\_value )](../hooks/updated_meta_type_meta) Fires immediately after updating metadata of a specific type. [do\_action( 'update\_postmeta', int $meta\_id, int $object\_id, string $meta\_key, mixed $meta\_value )](../hooks/update_postmeta) Fires immediately before updating a post’s metadata. [do\_action( "update\_{$meta\_type}\_meta", int $meta\_id, int $object\_id, string $meta\_key, mixed $\_meta\_value )](../hooks/update_meta_type_meta) Fires immediately before updating metadata of a specific type. [apply\_filters( "update\_{$meta\_type}\_metadata\_by\_mid", null|bool $check, int $meta\_id, mixed $meta\_value, string|false $meta\_key )](../hooks/update_meta_type_metadata_by_mid) Short-circuits updating metadata of a specific type by meta ID. | Uses | Description | | --- | --- | | [get\_object\_subtype()](get_object_subtype) wp-includes/meta.php | Returns the object subtype for a given object ID of a specific type. | | [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. | | [maybe\_serialize()](maybe_serialize) wp-includes/functions.php | Serializes data, if needed. | | [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. | | [\_get\_meta\_table()](_get_meta_table) wp-includes/meta.php | Retrieves the name of the metadata table for the specified object type. | | [sanitize\_meta()](sanitize_meta) wp-includes/meta.php | Sanitizes meta value. | | [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\_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. | | [update\_meta()](update_meta) wp-admin/includes/post.php | Updates 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\_xmlrpc\_server::set\_custom\_fields()](../classes/wp_xmlrpc_server/set_custom_fields) wp-includes/class-wp-xmlrpc-server.php | Set custom fields for post. | | Version | Description | | --- | --- | | [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
programming_docs
wordpress wp_get_user_request_data( int $request_id ): WP_User_Request|false wp\_get\_user\_request\_data( int $request\_id ): WP\_User\_Request|false ========================================================================= This function has been deprecated. Use [wp\_get\_user\_request()](wp_get_user_request) instead. Return the user request object for the specified request ID. * [wp\_get\_user\_request()](wp_get_user_request) `$request_id` int Required The ID of the user request. [WP\_User\_Request](../classes/wp_user_request)|false File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function wp_get_user_request_data( $request_id ) { _deprecated_function( __FUNCTION__, '5.4.0', 'wp_get_user_request()' ); return wp_get_user_request( $request_id ); } ``` | Uses | Description | | --- | --- | | [wp\_get\_user\_request()](wp_get_user_request) wp-includes/user.php | Returns the user request object for the specified request ID. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Use [wp\_get\_user\_request()](wp_get_user_request) | | [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. | wordpress _wp_privacy_resend_request( int $request_id ): true|WP_Error \_wp\_privacy\_resend\_request( int $request\_id ): true|WP\_Error ================================================================== This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Resend an existing request and return the result. `$request_id` int Required Request ID. true|[WP\_Error](../classes/wp_error) Returns true if sending the email was successful, or a [WP\_Error](../classes/wp_error) object. File: `wp-admin/includes/privacy-tools.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/privacy-tools.php/) ``` function _wp_privacy_resend_request( $request_id ) { $request_id = absint( $request_id ); $request = get_post( $request_id ); if ( ! $request || 'user_request' !== $request->post_type ) { return new WP_Error( 'privacy_request_error', __( 'Invalid personal data request.' ) ); } $result = wp_send_user_request( $request_id ); if ( is_wp_error( $result ) ) { return $result; } elseif ( ! $result ) { return new WP_Error( 'privacy_request_error', __( 'Unable to initiate confirmation for personal data request.' ) ); } return true; } ``` | Uses | Description | | --- | --- | | [wp\_send\_user\_request()](wp_send_user_request) wp-includes/user.php | Send a confirmation request email to confirm an action. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | [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\_Privacy\_Requests\_Table::process\_bulk\_action()](../classes/wp_privacy_requests_table/process_bulk_action) wp-admin/includes/class-wp-privacy-requests-table.php | Process bulk actions. | | [\_wp\_personal\_data\_handle\_actions()](_wp_personal_data_handle_actions) wp-admin/includes/privacy-tools.php | Handle list table actions. | | Version | Description | | --- | --- | | [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. | wordpress esc_html_e( string $text, string $domain = 'default' ) esc\_html\_e( string $text, string $domain = 'default' ) ======================================================== Displays translated text that has been escaped for safe use in HTML output. If there is no translation, or the text domain isn’t loaded, the original text is escaped and displayed. If you need the value for use in PHP, use [esc\_html\_\_()](esc_html__) . `$text` string Required Text to translate. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings. Default `'default'`. Default: `'default'` File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/) ``` function esc_html_e( $text, $domain = 'default' ) { echo esc_html( translate( $text, $domain ) ); } ``` | Uses | Description | | --- | --- | | [translate()](translate) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | Used By | Description | | --- | --- | | [the\_block\_template\_skip\_link()](the_block_template_skip_link) wp-includes/theme-templates.php | Prints the skip-link script & styles. | | [WP\_Privacy\_Data\_Removal\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_removal_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Next steps column. | | [WP\_Privacy\_Data\_Export\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_export_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php | Displays the next steps column. | | [WP\_Widget\_Custom\_HTML::render\_control\_template\_scripts()](../classes/wp_widget_custom_html/render_control_template_scripts) wp-includes/widgets/class-wp-widget-custom-html.php | Render form template scripts. | | [WP\_Customize\_Date\_Time\_Control::content\_template()](../classes/wp_customize_date_time_control/content_template) wp-includes/customize/class-wp-customize-date-time-control.php | Renders a JS template for the content of date time control. | | [WP\_Widget\_Text::render\_control\_template\_scripts()](../classes/wp_widget_text/render_control_template_scripts) wp-includes/widgets/class-wp-widget-text.php | Render form template scripts. | | [WP\_Widget\_Media::render\_control\_template\_scripts()](../classes/wp_widget_media/render_control_template_scripts) wp-includes/widgets/class-wp-widget-media.php | Render form template scripts. | | [WP\_Widget\_Media\_Image::render\_control\_template\_scripts()](../classes/wp_widget_media_image/render_control_template_scripts) wp-includes/widgets/class-wp-widget-media-image.php | Render form template scripts. | | [print\_embed\_sharing\_dialog()](print_embed_sharing_dialog) wp-includes/embed.php | Prints the necessary markup for the embed sharing dialog. | | [WP\_Customize\_Manager::render\_control\_templates()](../classes/wp_customize_manager/render_control_templates) wp-includes/class-wp-customize-manager.php | Renders JS templates for all registered control types. | | [wp\_print\_revision\_templates()](wp_print_revision_templates) wp-admin/includes/revision.php | Print JavaScript templates required for the revisions experience. | | [WP\_Media\_List\_Table::views()](../classes/wp_media_list_table/views) wp-admin/includes/class-wp-media-list-table.php | Override parent views so we can use the filter bar display. | | [network\_step1()](network_step1) wp-admin/includes/network.php | Prints step 1 for Network installation process. | | [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. | | [wp\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. | | [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.php | | | [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress wp_map_nav_menu_locations( array $new_nav_menu_locations, array $old_nav_menu_locations ): array wp\_map\_nav\_menu\_locations( array $new\_nav\_menu\_locations, array $old\_nav\_menu\_locations ): array ========================================================================================================== Maps nav menu locations according to assignments in previously active theme. `$new_nav_menu_locations` array Required New nav menu locations assignments. `$old_nav_menu_locations` array Required Old nav menu locations assignments. array Nav menus mapped to new nav menu locations. File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/) ``` function wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locations ) { $registered_nav_menus = get_registered_nav_menus(); $new_nav_menu_locations = array_intersect_key( $new_nav_menu_locations, $registered_nav_menus ); // Short-circuit if there are no old nav menu location assignments to map. if ( empty( $old_nav_menu_locations ) ) { return $new_nav_menu_locations; } // If old and new theme have just one location, map it and we're done. if ( 1 === count( $old_nav_menu_locations ) && 1 === count( $registered_nav_menus ) ) { $new_nav_menu_locations[ key( $registered_nav_menus ) ] = array_pop( $old_nav_menu_locations ); return $new_nav_menu_locations; } $old_locations = array_keys( $old_nav_menu_locations ); // Map locations with the same slug. foreach ( $registered_nav_menus as $location => $name ) { if ( in_array( $location, $old_locations, true ) ) { $new_nav_menu_locations[ $location ] = $old_nav_menu_locations[ $location ]; unset( $old_nav_menu_locations[ $location ] ); } } // If there are no old nav menu locations left, then we're done. if ( empty( $old_nav_menu_locations ) ) { return $new_nav_menu_locations; } /* * If old and new theme both have locations that contain phrases * from within the same group, make an educated guess and map it. */ $common_slug_groups = array( array( 'primary', 'menu-1', 'main', 'header', 'navigation', 'top' ), array( 'secondary', 'menu-2', 'footer', 'subsidiary', 'bottom' ), array( 'social' ), ); // Go through each group... foreach ( $common_slug_groups as $slug_group ) { // ...and see if any of these slugs... foreach ( $slug_group as $slug ) { // ...and any of the new menu locations... foreach ( $registered_nav_menus as $new_location => $name ) { // ...actually match! if ( is_string( $new_location ) && false === stripos( $new_location, $slug ) && false === stripos( $slug, $new_location ) ) { continue; } elseif ( is_numeric( $new_location ) && $new_location !== $slug ) { continue; } // Then see if any of the old locations... foreach ( $old_nav_menu_locations as $location => $menu_id ) { // ...and any slug in the same group... foreach ( $slug_group as $slug ) { // ... have a match as well. if ( is_string( $location ) && false === stripos( $location, $slug ) && false === stripos( $slug, $location ) ) { continue; } elseif ( is_numeric( $location ) && $location !== $slug ) { continue; } // Make sure this location wasn't mapped and removed previously. if ( ! empty( $old_nav_menu_locations[ $location ] ) ) { // We have a match that can be mapped! $new_nav_menu_locations[ $new_location ] = $old_nav_menu_locations[ $location ]; // Remove the mapped location so it can't be mapped again. unset( $old_nav_menu_locations[ $location ] ); // Go back and check the next new menu location. continue 3; } } // End foreach ( $slug_group as $slug ). } // End foreach ( $old_nav_menu_locations as $location => $menu_id ). } // End foreach foreach ( $registered_nav_menus as $new_location => $name ). } // End foreach ( $slug_group as $slug ). } // End foreach ( $common_slug_groups as $slug_group ). return $new_nav_menu_locations; } ``` | Uses | Description | | --- | --- | | [stripos()](stripos) wp-includes/class-pop3.php | | | [get\_registered\_nav\_menus()](get_registered_nav_menus) wp-includes/nav-menu.php | Retrieves all registered navigation menu locations in a theme. | | Used By | Description | | --- | --- | | [\_wp\_menus\_changed()](_wp_menus_changed) wp-includes/nav-menu.php | Handles menu config after theme change. | | [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. | | Version | Description | | --- | --- | | [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. | wordpress wp_pre_kses_less_than( string $text ): string wp\_pre\_kses\_less\_than( string $text ): string ================================================= Converts lone less than signs. KSES already converts lone greater than signs. `$text` string Required Text to be converted. string Converted text. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function wp_pre_kses_less_than( $text ) { return preg_replace_callback( '%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text ); } ``` | Used By | Description | | --- | --- | | [\_sanitize\_text\_fields()](_sanitize_text_fields) wp-includes/formatting.php | Internal helper function to sanitize a string from user input or from the database. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress wp_ajax_save_widget() wp\_ajax\_save\_widget() ======================== Ajax handler for saving a widget. File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/) ``` function wp_ajax_save_widget() { global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates; check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' ); if ( ! current_user_can( 'edit_theme_options' ) || ! isset( $_POST['id_base'] ) ) { wp_die( -1 ); } unset( $_POST['savewidgets'], $_POST['action'] ); /** * Fires early when editing the widgets displayed in sidebars. * * @since 2.8.0 */ do_action( 'load-widgets.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores /** * Fires early when editing the widgets displayed in sidebars. * * @since 2.8.0 */ do_action( 'widgets.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores /** This action is documented in wp-admin/widgets.php */ do_action( 'sidebar_admin_setup' ); $id_base = wp_unslash( $_POST['id_base'] ); $widget_id = wp_unslash( $_POST['widget-id'] ); $sidebar_id = $_POST['sidebar']; $multi_number = ! empty( $_POST['multi_number'] ) ? (int) $_POST['multi_number'] : 0; $settings = isset( $_POST[ 'widget-' . $id_base ] ) && is_array( $_POST[ 'widget-' . $id_base ] ) ? $_POST[ 'widget-' . $id_base ] : false; $error = '<p>' . __( 'An error has occurred. Please reload the page and try again.' ) . '</p>'; $sidebars = wp_get_sidebars_widgets(); $sidebar = isset( $sidebars[ $sidebar_id ] ) ? $sidebars[ $sidebar_id ] : array(); // Delete. if ( isset( $_POST['delete_widget'] ) && $_POST['delete_widget'] ) { if ( ! isset( $wp_registered_widgets[ $widget_id ] ) ) { wp_die( $error ); } $sidebar = array_diff( $sidebar, array( $widget_id ) ); $_POST = array( 'sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1', ); /** This action is documented in wp-admin/widgets.php */ do_action( 'delete_widget', $widget_id, $sidebar_id, $id_base ); } elseif ( $settings && preg_match( '/__i__|%i%/', key( $settings ) ) ) { if ( ! $multi_number ) { wp_die( $error ); } $_POST[ 'widget-' . $id_base ] = array( $multi_number => reset( $settings ) ); $widget_id = $id_base . '-' . $multi_number; $sidebar[] = $widget_id; } $_POST['widget-id'] = $sidebar; foreach ( (array) $wp_registered_widget_updates as $name => $control ) { if ( $name == $id_base ) { if ( ! is_callable( $control['callback'] ) ) { continue; } ob_start(); call_user_func_array( $control['callback'], $control['params'] ); ob_end_clean(); break; } } if ( isset( $_POST['delete_widget'] ) && $_POST['delete_widget'] ) { $sidebars[ $sidebar_id ] = $sidebar; wp_set_sidebars_widgets( $sidebars ); echo "deleted:$widget_id"; wp_die(); } if ( ! empty( $_POST['add_new'] ) ) { wp_die(); } $form = $wp_registered_widget_controls[ $widget_id ]; if ( $form ) { call_user_func_array( $form['callback'], $form['params'] ); } wp_die(); } ``` [do\_action( 'delete\_widget', string $widget\_id, string $sidebar\_id, string $id\_base )](../hooks/delete_widget) Fires immediately after a widget has been marked for deletion. [do\_action( 'load-widgets.php' )](../hooks/load-widgets-php) Fires early when editing the widgets displayed in sidebars. [do\_action( 'sidebar\_admin\_setup' )](../hooks/sidebar_admin_setup) Fires early before the Widgets administration screen loads, after scripts are enqueued. [do\_action( 'widgets.php' )](../hooks/widgets-php) Fires early when editing the widgets displayed in sidebars. | Uses | Description | | --- | --- | | [wp\_get\_sidebars\_widgets()](wp_get_sidebars_widgets) wp-includes/widgets.php | Retrieve full list of sidebars and their widget instance IDs. | | [wp\_set\_sidebars\_widgets()](wp_set_sidebars_widgets) wp-includes/widgets.php | Set the sidebar widget option to update sidebars. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. | | [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. | | [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress is_locale_switched(): bool is\_locale\_switched(): bool ============================ Determines whether [switch\_to\_locale()](switch_to_locale) is in effect. bool True if the locale has been switched, false otherwise. File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/) ``` function is_locale_switched() { /* @var WP_Locale_Switcher $wp_locale_switcher */ global $wp_locale_switcher; return $wp_locale_switcher->is_switched(); } ``` | Uses | Description | | --- | --- | | [WP\_Locale\_Switcher::is\_switched()](../classes/wp_locale_switcher/is_switched) wp-includes/class-wp-locale-switcher.php | Whether [switch\_to\_locale()](switch_to_locale) is in effect. | | Version | Description | | --- | --- | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
programming_docs
wordpress get_comments_pagenum_link( int $pagenum = 1, int $max_page ): string get\_comments\_pagenum\_link( int $pagenum = 1, int $max\_page ): string ======================================================================== Retrieves the comments page number link. `$pagenum` int Optional Page number. Default: `1` `$max_page` int Optional The maximum number of comment pages. Default 0. string The comments page number link URL. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) { global $wp_rewrite; $pagenum = (int) $pagenum; $result = get_permalink(); if ( 'newest' === get_option( 'default_comments_page' ) ) { if ( $pagenum != $max_page ) { if ( $wp_rewrite->using_permalinks() ) { $result = user_trailingslashit( trailingslashit( $result ) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged' ); } else { $result = add_query_arg( 'cpage', $pagenum, $result ); } } } elseif ( $pagenum > 1 ) { if ( $wp_rewrite->using_permalinks() ) { $result = user_trailingslashit( trailingslashit( $result ) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged' ); } else { $result = add_query_arg( 'cpage', $pagenum, $result ); } } $result .= '#comments'; /** * Filters the comments page number link for the current request. * * @since 2.7.0 * * @param string $result The comments page number link. */ return apply_filters( 'get_comments_pagenum_link', $result ); } ``` [apply\_filters( 'get\_comments\_pagenum\_link', string $result )](../hooks/get_comments_pagenum_link) Filters the comments page number link for the current request. | Uses | Description | | --- | --- | | [WP\_Rewrite::using\_permalinks()](../classes/wp_rewrite/using_permalinks) wp-includes/class-wp-rewrite.php | Determines whether permalinks are being used. | | [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. | | [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. | | [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\_canonical\_url()](wp_get_canonical_url) wp-includes/link-template.php | Returns the canonical URL for a post. | | [get\_next\_comments\_link()](get_next_comments_link) wp-includes/link-template.php | Retrieves the link to the next comments page. | | [get\_previous\_comments\_link()](get_previous_comments_link) wp-includes/link-template.php | Retrieves the link to the previous comments page. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress network_step2( false|WP_Error $errors = false ) network\_step2( false|WP\_Error $errors = false ) ================================================= Prints step 2 for Network installation process. `$errors` false|[WP\_Error](../classes/wp_error) Optional Error object. Default: `false` File: `wp-admin/includes/network.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/network.php/) ``` function network_step2( $errors = false ) { global $wpdb, $is_nginx; $hostname = get_clean_basedomain(); $slashed_home = trailingslashit( get_option( 'home' ) ); $base = parse_url( $slashed_home, PHP_URL_PATH ); $document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) ); $abspath_fix = str_replace( '\\', '/', ABSPATH ); $home_path = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path(); $wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix ); $rewrite_base = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : ''; $location_of_wp_config = $abspath_fix; if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) { $location_of_wp_config = dirname( $abspath_fix ); } $location_of_wp_config = trailingslashit( $location_of_wp_config ); // Wildcard DNS message. if ( is_wp_error( $errors ) ) { echo '<div class="error">' . $errors->get_error_message() . '</div>'; } if ( $_POST ) { if ( allow_subdomain_install() ) { $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true; } else { $subdomain_install = false; } } else { if ( is_multisite() ) { $subdomain_install = is_subdomain_install(); ?> <p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p> <?php } else { $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" ); ?> <div class="error"><p><strong><?php _e( 'Warning:' ); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div> <p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p> <?php } } $subdir_match = $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?'; $subdir_replacement_01 = $subdomain_install ? '' : '$1'; $subdir_replacement_12 = $subdomain_install ? '$1' : '$2'; if ( $_POST || ! is_multisite() ) { ?> <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3> <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p> <div class="notice notice-warning inline"><p> <?php if ( file_exists( $home_path . '.htaccess' ) ) { echo '<strong>' . __( 'Caution:' ) . '</strong> '; printf( /* translators: 1: wp-config.php, 2: .htaccess */ __( 'You should back up your existing %1$s and %2$s files.' ), '<code>wp-config.php</code>', '<code>.htaccess</code>' ); } elseif ( file_exists( $home_path . 'web.config' ) ) { echo '<strong>' . __( 'Caution:' ) . '</strong> '; printf( /* translators: 1: wp-config.php, 2: web.config */ __( 'You should back up your existing %1$s and %2$s files.' ), '<code>wp-config.php</code>', '<code>web.config</code>' ); } else { echo '<strong>' . __( 'Caution:' ) . '</strong> '; printf( /* translators: %s: wp-config.php */ __( 'You should back up your existing %s file.' ), '<code>wp-config.php</code>' ); } ?> </p></div> <?php } ?> <ol> <li><p id="network-wpconfig-rules-description"> <?php printf( /* translators: 1: wp-config.php, 2: Location of wp-config file, 3: Translated version of "That's all, stop editing! Happy publishing." */ __( 'Add the following to your %1$s file in %2$s <strong>above</strong> the line reading %3$s:' ), '<code>wp-config.php</code>', '<code>' . $location_of_wp_config . '</code>', /* * translators: This string should only be translated if wp-config-sample.php is localized. * You can check the localized release package or * https://i18n.svn.wordpress.org/<locale code>/branches/<wp version>/dist/wp-config-sample.php */ '<code>/* ' . __( 'That&#8217;s all, stop editing! Happy publishing.' ) . ' */</code>' ); ?> </p> <p class="configuration-rules-label"><label for="network-wpconfig-rules"> <?php printf( /* translators: %s: File name (wp-config.php, .htaccess or web.config). */ __( 'Network configuration rules for %s' ), '<code>wp-config.php</code>' ); ?> </label></p> <textarea id="network-wpconfig-rules" class="code" readonly="readonly" cols="100" rows="7" aria-describedby="network-wpconfig-rules-description"> define( 'MULTISITE', true ); define( 'SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?> ); define( 'DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>' ); define( 'PATH_CURRENT_SITE', '<?php echo $base; ?>' ); define( 'SITE_ID_CURRENT_SITE', 1 ); define( 'BLOG_ID_CURRENT_SITE', 1 ); </textarea> <?php $keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '', ); foreach ( $keys_salts as $c => $v ) { if ( defined( $c ) ) { unset( $keys_salts[ $c ] ); } } if ( ! empty( $keys_salts ) ) { $keys_salts_str = ''; $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); if ( is_wp_error( $from_api ) ) { foreach ( $keys_salts as $c => $v ) { $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );"; } } else { $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) ); foreach ( $keys_salts as $c => $v ) { $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );"; } } $num_keys_salts = count( $keys_salts ); ?> <p id="network-wpconfig-authentication-description"> <?php if ( 1 === $num_keys_salts ) { printf( /* translators: %s: wp-config.php */ __( 'This unique authentication key is also missing from your %s file.' ), '<code>wp-config.php</code>' ); } else { printf( /* translators: %s: wp-config.php */ __( 'These unique authentication keys are also missing from your %s file.' ), '<code>wp-config.php</code>' ); } ?> <?php _e( 'To make your installation more secure, you should also add:' ); ?> </p> <p class="configuration-rules-label"><label for="network-wpconfig-authentication"><?php _e( 'Network configuration authentication keys' ); ?></label></p> <textarea id="network-wpconfig-authentication" class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>" aria-describedby="network-wpconfig-authentication-description"><?php echo esc_textarea( $keys_salts_str ); ?></textarea> <?php } ?> </li> <?php if ( iis7_supports_permalinks() ) : // IIS doesn't support RewriteBase, all your RewriteBase are belong to us. $iis_subdir_match = ltrim( $base, '/' ) . $subdir_match; $iis_rewrite_base = ltrim( $base, '/' ) . $rewrite_base; $iis_subdir_replacement = $subdomain_install ? '' : '{R:1}'; $web_config_file = '<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="WordPress Rule 1" stopProcessing="true"> <match url="^index\.php$" ignoreCase="false" /> <action type="None" /> </rule>'; if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { $web_config_file .= ' <rule name="WordPress Rule for Files" stopProcessing="true"> <match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" /> <action type="Rewrite" url="' . $iis_rewrite_base . WPINC . '/ms-files.php?file={R:1}" appendQueryString="false" /> </rule>'; } $web_config_file .= ' <rule name="WordPress Rule 2" stopProcessing="true"> <match url="^' . $iis_subdir_match . 'wp-admin$" ignoreCase="false" /> <action type="Redirect" url="' . $iis_subdir_replacement . 'wp-admin/" redirectType="Permanent" /> </rule> <rule name="WordPress Rule 3" stopProcessing="true"> <match url="^" ignoreCase="false" /> <conditions logicalGrouping="MatchAny"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> </conditions> <action type="None" /> </rule> <rule name="WordPress Rule 4" stopProcessing="true"> <match url="^' . $iis_subdir_match . '(wp-(content|admin|includes).*)" ignoreCase="false" /> <action type="Rewrite" url="' . $iis_rewrite_base . '{R:1}" /> </rule> <rule name="WordPress Rule 5" stopProcessing="true"> <match url="^' . $iis_subdir_match . '([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> <action type="Rewrite" url="' . $iis_rewrite_base . '{R:2}" /> </rule> <rule name="WordPress Rule 6" stopProcessing="true"> <match url="." ignoreCase="false" /> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> </system.webServer> </configuration> '; echo '<li><p id="network-webconfig-rules-description">'; printf( /* translators: 1: File name (.htaccess or web.config), 2: File path. */ __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ), '<code>web.config</code>', '<code>' . $home_path . '</code>' ); echo '</p>'; if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) { echo '<p><strong>' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; } ?> <p class="configuration-rules-label"><label for="network-webconfig-rules"> <?php printf( /* translators: %s: File name (wp-config.php, .htaccess or web.config). */ __( 'Network configuration rules for %s' ), '<code>web.config</code>' ); ?> </label></p> <textarea id="network-webconfig-rules" class="code" readonly="readonly" cols="100" rows="20" aria-describedby="network-webconfig-rules-description"><?php echo esc_textarea( $web_config_file ); ?></textarea> </li> </ol> <?php elseif ( $is_nginx ) : // End iis7_supports_permalinks(). Link to Nginx documentation instead: echo '<li><p>'; printf( /* translators: %s: Documentation URL. */ __( 'It seems your network is running with Nginx web server. <a href="%s">Learn more about further configuration</a>.' ), __( 'https://wordpress.org/support/article/nginx/' ) ); echo '</p></li>'; else : // End $is_nginx. Construct an .htaccess file instead: $ms_files_rewriting = ''; if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^"; $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n"; } $htaccess_file = <<<EOF RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase {$base} RewriteRule ^index\.php$ - [L] {$ms_files_rewriting} # add a trailing slash to /wp-admin RewriteRule ^{$subdir_match}wp-admin$ {$subdir_replacement_01}wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^{$subdir_match}(wp-(content|admin|includes).*) {$rewrite_base}{$subdir_replacement_12} [L] RewriteRule ^{$subdir_match}(.*\.php)$ {$rewrite_base}$subdir_replacement_12 [L] RewriteRule . index.php [L] EOF; echo '<li><p id="network-htaccess-rules-description">'; printf( /* translators: 1: File name (.htaccess or web.config), 2: File path. */ __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ), '<code>.htaccess</code>', '<code>' . $home_path . '</code>' ); echo '</p>'; if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) { echo '<p><strong>' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; } ?> <p class="configuration-rules-label"><label for="network-htaccess-rules"> <?php printf( /* translators: %s: File name (wp-config.php, .htaccess or web.config). */ __( 'Network configuration rules for %s' ), '<code>.htaccess</code>' ); ?> </label></p> <textarea id="network-htaccess-rules" class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>" aria-describedby="network-htaccess-rules-description"><?php echo esc_textarea( $htaccess_file ); ?></textarea> </li> </ol> <?php endif; // End IIS/Nginx/Apache code branches. if ( ! is_multisite() ) { ?> <p><?php _e( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.' ); ?> <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log In' ); ?></a></p> <?php } } ``` | Uses | Description | | --- | --- | | [get\_clean\_basedomain()](get_clean_basedomain) wp-admin/includes/network.php | Get base domain of network. | | [allow\_subdomain\_install()](allow_subdomain_install) wp-admin/includes/network.php | Allow subdomain installation | | [is\_subdomain\_install()](is_subdomain_install) wp-includes/ms-load.php | Whether a subdomain configuration is enabled. | | [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. | | [iis7\_supports\_permalinks()](iis7_supports_permalinks) wp-includes/functions.php | Checks if IIS 7+ supports pretty permalinks. | | [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. | | [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. | | [esc\_textarea()](esc_textarea) wp-includes/formatting.php | Escaping for textarea values. | | [esc\_html\_e()](esc_html_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in HTML output. | | [get\_home\_path()](get_home_path) wp-admin/includes/file.php | Gets the absolute filesystem path to the root of the WordPress installation. | | [allow\_subdirectory\_install()](allow_subdirectory_install) wp-admin/includes/network.php | Allow subdirectory installation. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [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. | | [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. | | [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 wp_map_sidebars_widgets( array $existing_sidebars_widgets ): array wp\_map\_sidebars\_widgets( array $existing\_sidebars\_widgets ): array ======================================================================= Compares a list of sidebars with their widgets against an allowed list. `$existing_sidebars_widgets` array Required List of sidebars and their widget instance IDs. array Mapped sidebars widgets. File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/) ``` function wp_map_sidebars_widgets( $existing_sidebars_widgets ) { global $wp_registered_sidebars; $new_sidebars_widgets = array( 'wp_inactive_widgets' => array(), ); // Short-circuit if there are no sidebars to map. if ( ! is_array( $existing_sidebars_widgets ) || empty( $existing_sidebars_widgets ) ) { return $new_sidebars_widgets; } foreach ( $existing_sidebars_widgets as $sidebar => $widgets ) { if ( 'wp_inactive_widgets' === $sidebar || 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) { $new_sidebars_widgets['wp_inactive_widgets'] = array_merge( $new_sidebars_widgets['wp_inactive_widgets'], (array) $widgets ); unset( $existing_sidebars_widgets[ $sidebar ] ); } } // If old and new theme have just one sidebar, map it and we're done. if ( 1 === count( $existing_sidebars_widgets ) && 1 === count( $wp_registered_sidebars ) ) { $new_sidebars_widgets[ key( $wp_registered_sidebars ) ] = array_pop( $existing_sidebars_widgets ); return $new_sidebars_widgets; } // Map locations with the same slug. $existing_sidebars = array_keys( $existing_sidebars_widgets ); foreach ( $wp_registered_sidebars as $sidebar => $name ) { if ( in_array( $sidebar, $existing_sidebars, true ) ) { $new_sidebars_widgets[ $sidebar ] = $existing_sidebars_widgets[ $sidebar ]; unset( $existing_sidebars_widgets[ $sidebar ] ); } elseif ( ! array_key_exists( $sidebar, $new_sidebars_widgets ) ) { $new_sidebars_widgets[ $sidebar ] = array(); } } // If there are more sidebars, try to map them. if ( ! empty( $existing_sidebars_widgets ) ) { /* * If old and new theme both have sidebars that contain phrases * from within the same group, make an educated guess and map it. */ $common_slug_groups = array( array( 'sidebar', 'primary', 'main', 'right' ), array( 'second', 'left' ), array( 'sidebar-2', 'footer', 'bottom' ), array( 'header', 'top' ), ); // Go through each group... foreach ( $common_slug_groups as $slug_group ) { // ...and see if any of these slugs... foreach ( $slug_group as $slug ) { // ...and any of the new sidebars... foreach ( $wp_registered_sidebars as $new_sidebar => $args ) { // ...actually match! if ( false === stripos( $new_sidebar, $slug ) && false === stripos( $slug, $new_sidebar ) ) { continue; } // Then see if any of the existing sidebars... foreach ( $existing_sidebars_widgets as $sidebar => $widgets ) { // ...and any slug in the same group... foreach ( $slug_group as $slug ) { // ... have a match as well. if ( false === stripos( $sidebar, $slug ) && false === stripos( $slug, $sidebar ) ) { continue; } // Make sure this sidebar wasn't mapped and removed previously. if ( ! empty( $existing_sidebars_widgets[ $sidebar ] ) ) { // We have a match that can be mapped! $new_sidebars_widgets[ $new_sidebar ] = array_merge( $new_sidebars_widgets[ $new_sidebar ], $existing_sidebars_widgets[ $sidebar ] ); // Remove the mapped sidebar so it can't be mapped again. unset( $existing_sidebars_widgets[ $sidebar ] ); // Go back and check the next new sidebar. continue 3; } } // End foreach ( $slug_group as $slug ). } // End foreach ( $existing_sidebars_widgets as $sidebar => $widgets ). } // End foreach ( $wp_registered_sidebars as $new_sidebar => $args ). } // End foreach ( $slug_group as $slug ). } // End foreach ( $common_slug_groups as $slug_group ). } // Move any left over widgets to inactive sidebar. foreach ( $existing_sidebars_widgets as $widgets ) { if ( is_array( $widgets ) && ! empty( $widgets ) ) { $new_sidebars_widgets['wp_inactive_widgets'] = array_merge( $new_sidebars_widgets['wp_inactive_widgets'], $widgets ); } } // Sidebars_widgets settings from when this theme was previously active. $old_sidebars_widgets = get_theme_mod( 'sidebars_widgets' ); $old_sidebars_widgets = isset( $old_sidebars_widgets['data'] ) ? $old_sidebars_widgets['data'] : false; if ( is_array( $old_sidebars_widgets ) ) { // Remove empty sidebars, no need to map those. $old_sidebars_widgets = array_filter( $old_sidebars_widgets ); // Only check sidebars that are empty or have not been mapped to yet. foreach ( $new_sidebars_widgets as $new_sidebar => $new_widgets ) { if ( array_key_exists( $new_sidebar, $old_sidebars_widgets ) && ! empty( $new_widgets ) ) { unset( $old_sidebars_widgets[ $new_sidebar ] ); } } // Remove orphaned widgets, we're only interested in previously active sidebars. foreach ( $old_sidebars_widgets as $sidebar => $widgets ) { if ( 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) { unset( $old_sidebars_widgets[ $sidebar ] ); } } $old_sidebars_widgets = _wp_remove_unregistered_widgets( $old_sidebars_widgets ); if ( ! empty( $old_sidebars_widgets ) ) { // Go through each remaining sidebar... foreach ( $old_sidebars_widgets as $old_sidebar => $old_widgets ) { // ...and check every new sidebar... foreach ( $new_sidebars_widgets as $new_sidebar => $new_widgets ) { // ...for every widget we're trying to revive. foreach ( $old_widgets as $key => $widget_id ) { $active_key = array_search( $widget_id, $new_widgets, true ); // If the widget is used elsewhere... if ( false !== $active_key ) { // ...and that elsewhere is inactive widgets... if ( 'wp_inactive_widgets' === $new_sidebar ) { // ...remove it from there and keep the active version... unset( $new_sidebars_widgets['wp_inactive_widgets'][ $active_key ] ); } else { // ...otherwise remove it from the old sidebar and keep it in the new one. unset( $old_sidebars_widgets[ $old_sidebar ][ $key ] ); } } // End if ( $active_key ). } // End foreach ( $old_widgets as $key => $widget_id ). } // End foreach ( $new_sidebars_widgets as $new_sidebar => $new_widgets ). } // End foreach ( $old_sidebars_widgets as $old_sidebar => $old_widgets ). } // End if ( ! empty( $old_sidebars_widgets ) ). // Restore widget settings from when theme was previously active. $new_sidebars_widgets = array_merge( $new_sidebars_widgets, $old_sidebars_widgets ); } return $new_sidebars_widgets; } ``` | Uses | Description | | --- | --- | | [stripos()](stripos) wp-includes/class-pop3.php | | | [\_wp\_remove\_unregistered\_widgets()](_wp_remove_unregistered_widgets) wp-includes/widgets.php | Compares a list of sidebars with their widgets against an allowed list. | | [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. | | Used By | Description | | --- | --- | | [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 | | --- | --- | | [4.9.2](https://developer.wordpress.org/reference/since/4.9.2/) | Always tries to restore widget assignments from previous data, not just if sidebars needed mapping. | | [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
programming_docs
wordpress wp_admin_bar_my_account_item( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_my\_account\_item( WP\_Admin\_Bar $wp\_admin\_bar ) =================================================================== Adds the “My Account” item. `$wp_admin_bar` [WP\_Admin\_Bar](../classes/wp_admin_bar) Required The [WP\_Admin\_Bar](../classes/wp_admin_bar) instance. File: `wp-includes/admin-bar.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/admin-bar.php/) ``` function wp_admin_bar_my_account_item( $wp_admin_bar ) { $user_id = get_current_user_id(); $current_user = wp_get_current_user(); if ( ! $user_id ) { return; } if ( current_user_can( 'read' ) ) { $profile_url = get_edit_profile_url( $user_id ); } elseif ( is_multisite() ) { $profile_url = get_dashboard_url( $user_id, 'profile.php' ); } else { $profile_url = false; } $avatar = get_avatar( $user_id, 26 ); /* translators: %s: Current user's display name. */ $howdy = sprintf( __( 'Howdy, %s' ), '<span class="display-name">' . $current_user->display_name . '</span>' ); $class = empty( $avatar ) ? '' : 'with-avatar'; $wp_admin_bar->add_node( array( 'id' => 'my-account', 'parent' => 'top-secondary', 'title' => $howdy . $avatar, 'href' => $profile_url, 'meta' => array( 'class' => $class, ), ) ); } ``` | Uses | Description | | --- | --- | | [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. | | [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. | | [get\_edit\_profile\_url()](get_edit_profile_url) wp-includes/link-template.php | Retrieves the URL to the user’s profile editor. | | [get\_dashboard\_url()](get_dashboard_url) wp-includes/link-template.php | Retrieves the URL to the user’s dashboard. | | [WP\_Admin\_Bar::add\_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_install_defaults( int $user_id ) wp\_install\_defaults( int $user\_id ) ====================================== Creates the initial content for a newly-installed site. Adds the default "Uncategorized" category, the first post (with comment), first page, and default widgets for default theme for the current version. `$user_id` int Required User ID. File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/) ``` function wp_install_defaults( $user_id ) { global $wpdb, $wp_rewrite, $table_prefix; // Default category. $cat_name = __( 'Uncategorized' ); /* translators: Default category slug. */ $cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) ); $cat_id = 1; $wpdb->insert( $wpdb->terms, array( 'term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0, ) ); $wpdb->insert( $wpdb->term_taxonomy, array( 'term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1, ) ); $cat_tt_id = $wpdb->insert_id; // First post. $now = current_time( 'mysql' ); $now_gmt = current_time( 'mysql', 1 ); $first_post_guid = get_option( 'home' ) . '/?p=1'; if ( is_multisite() ) { $first_post = get_site_option( 'first_post' ); if ( ! $first_post ) { $first_post = "<!-- wp:paragraph -->\n<p>" . /* translators: First post content. %s: Site link. */ __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ) . "</p>\n<!-- /wp:paragraph -->"; } $first_post = sprintf( $first_post, sprintf( '<a href="%s">%s</a>', esc_url( network_home_url() ), get_network()->site_name ) ); // Back-compat for pre-4.4. $first_post = str_replace( 'SITE_URL', esc_url( network_home_url() ), $first_post ); $first_post = str_replace( 'SITE_NAME', get_network()->site_name, $first_post ); } else { $first_post = "<!-- wp:paragraph -->\n<p>" . /* translators: First post content. %s: Site link. */ __( 'Welcome to WordPress. This is your first post. Edit or delete it, then start writing!' ) . "</p>\n<!-- /wp:paragraph -->"; } $wpdb->insert( $wpdb->posts, array( 'post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $first_post, 'post_excerpt' => '', 'post_title' => __( 'Hello world!' ), /* translators: Default post slug. */ 'post_name' => sanitize_title( _x( 'hello-world', 'Default post slug' ) ), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $first_post_guid, 'comment_count' => 1, 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => '', ) ); if ( is_multisite() ) { update_posts_count(); } $wpdb->insert( $wpdb->term_relationships, array( 'term_taxonomy_id' => $cat_tt_id, 'object_id' => 1, ) ); // Default comment. if ( is_multisite() ) { $first_comment_author = get_site_option( 'first_comment_author' ); $first_comment_email = get_site_option( 'first_comment_email' ); $first_comment_url = get_site_option( 'first_comment_url', network_home_url() ); $first_comment = get_site_option( 'first_comment' ); } $first_comment_author = ! empty( $first_comment_author ) ? $first_comment_author : __( 'A WordPress Commenter' ); $first_comment_email = ! empty( $first_comment_email ) ? $first_comment_email : '[email protected]'; $first_comment_url = ! empty( $first_comment_url ) ? $first_comment_url : esc_url( __( 'https://wordpress.org/' ) ); $first_comment = ! empty( $first_comment ) ? $first_comment : sprintf( /* translators: %s: Gravatar URL. */ __( 'Hi, this is a comment. To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard. Commenter avatars come from <a href="%s">Gravatar</a>.' ), esc_url( __( 'https://en.gravatar.com/' ) ) ); $wpdb->insert( $wpdb->comments, array( 'comment_post_ID' => 1, 'comment_author' => $first_comment_author, 'comment_author_email' => $first_comment_email, 'comment_author_url' => $first_comment_url, 'comment_date' => $now, 'comment_date_gmt' => $now_gmt, 'comment_content' => $first_comment, 'comment_type' => 'comment', ) ); // First page. if ( is_multisite() ) { $first_page = get_site_option( 'first_page' ); } if ( empty( $first_page ) ) { $first_page = "<!-- wp:paragraph -->\n<p>"; /* translators: First page content. */ $first_page .= __( "This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:" ); $first_page .= "</p>\n<!-- /wp:paragraph -->\n\n"; $first_page .= "<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\"><p>"; /* translators: First page content. */ $first_page .= __( "Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like pi&#241;a coladas. (And gettin' caught in the rain.)" ); $first_page .= "</p></blockquote>\n<!-- /wp:quote -->\n\n"; $first_page .= "<!-- wp:paragraph -->\n<p>"; /* translators: First page content. */ $first_page .= __( '...or something like this:' ); $first_page .= "</p>\n<!-- /wp:paragraph -->\n\n"; $first_page .= "<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\"><p>"; /* translators: First page content. */ $first_page .= __( 'The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.' ); $first_page .= "</p></blockquote>\n<!-- /wp:quote -->\n\n"; $first_page .= "<!-- wp:paragraph -->\n<p>"; $first_page .= sprintf( /* translators: First page content. %s: Site admin URL. */ __( 'As a new WordPress user, you should go to <a href="%s">your dashboard</a> to delete this page and create new pages for your content. Have fun!' ), admin_url() ); $first_page .= "</p>\n<!-- /wp:paragraph -->"; } $first_post_guid = get_option( 'home' ) . '/?page_id=2'; $wpdb->insert( $wpdb->posts, array( 'post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $first_page, 'post_excerpt' => '', 'comment_status' => 'closed', 'post_title' => __( 'Sample Page' ), /* translators: Default page slug. */ 'post_name' => __( 'sample-page' ), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $first_post_guid, 'post_type' => 'page', 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => '', ) ); $wpdb->insert( $wpdb->postmeta, array( 'post_id' => 2, 'meta_key' => '_wp_page_template', 'meta_value' => 'default', ) ); // Privacy Policy page. if ( is_multisite() ) { // Disable by default unless the suggested content is provided. $privacy_policy_content = get_site_option( 'default_privacy_policy_content' ); } else { if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) { include_once ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php'; } $privacy_policy_content = WP_Privacy_Policy_Content::get_default_content(); } if ( ! empty( $privacy_policy_content ) ) { $privacy_policy_guid = get_option( 'home' ) . '/?page_id=3'; $wpdb->insert( $wpdb->posts, array( 'post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $privacy_policy_content, 'post_excerpt' => '', 'comment_status' => 'closed', 'post_title' => __( 'Privacy Policy' ), /* translators: Privacy Policy page slug. */ 'post_name' => __( 'privacy-policy' ), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $privacy_policy_guid, 'post_type' => 'page', 'post_status' => 'draft', 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => '', ) ); $wpdb->insert( $wpdb->postmeta, array( 'post_id' => 3, 'meta_key' => '_wp_page_template', 'meta_value' => 'default', ) ); update_option( 'wp_page_for_privacy_policy', 3 ); } // Set up default widgets for default theme. update_option( 'widget_block', array( 2 => array( 'content' => '<!-- wp:search /-->' ), 3 => array( 'content' => '<!-- wp:group --><div class="wp-block-group"><!-- wp:heading --><h2>' . __( 'Recent Posts' ) . '</h2><!-- /wp:heading --><!-- wp:latest-posts /--></div><!-- /wp:group -->' ), 4 => array( 'content' => '<!-- wp:group --><div class="wp-block-group"><!-- wp:heading --><h2>' . __( 'Recent Comments' ) . '</h2><!-- /wp:heading --><!-- wp:latest-comments {"displayAvatar":false,"displayDate":false,"displayExcerpt":false} /--></div><!-- /wp:group -->' ), 5 => array( 'content' => '<!-- wp:group --><div class="wp-block-group"><!-- wp:heading --><h2>' . __( 'Archives' ) . '</h2><!-- /wp:heading --><!-- wp:archives /--></div><!-- /wp:group -->' ), 6 => array( 'content' => '<!-- wp:group --><div class="wp-block-group"><!-- wp:heading --><h2>' . __( 'Categories' ) . '</h2><!-- /wp:heading --><!-- wp:categories /--></div><!-- /wp:group -->' ), '_multiwidget' => 1, ) ); update_option( 'sidebars_widgets', array( 'wp_inactive_widgets' => array(), 'sidebar-1' => array( 0 => 'block-2', 1 => 'block-3', 2 => 'block-4', ), 'sidebar-2' => array( 0 => 'block-5', 1 => 'block-6', ), 'array_version' => 3, ) ); if ( ! is_multisite() ) { update_user_meta( $user_id, 'show_welcome_panel', 1 ); } elseif ( ! is_super_admin( $user_id ) && ! metadata_exists( 'user', $user_id, 'show_welcome_panel' ) ) { update_user_meta( $user_id, 'show_welcome_panel', 2 ); } if ( is_multisite() ) { // Flush rules to pick up the new page. $wp_rewrite->init(); $wp_rewrite->flush_rules(); $user = new WP_User( $user_id ); $wpdb->update( $wpdb->options, array( 'option_value' => $user->user_email ), array( 'option_name' => 'admin_email' ) ); // Remove all perms except for the login user. $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'user_level' ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'capabilities' ) ); // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) // TODO: Get previous_blog_id. if ( ! is_super_admin( $user_id ) && 1 != $user_id ) { $wpdb->delete( $wpdb->usermeta, array( 'user_id' => $user_id, 'meta_key' => $wpdb->base_prefix . '1_capabilities', ) ); } } } ``` | Uses | Description | | --- | --- | | [WP\_Privacy\_Policy\_Content::get\_default\_content()](../classes/wp_privacy_policy_content/get_default_content) wp-admin/includes/class-wp-privacy-policy-content.php | Return the default suggested privacy policy content. | | [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. | | [wpdb::delete()](../classes/wpdb/delete) wp-includes/class-wpdb.php | Deletes a row in the table. | | [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. | | [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. | | [wpdb::insert()](../classes/wpdb/insert) wp-includes/class-wpdb.php | Inserts a row into the table. | | [update\_posts\_count()](update_posts_count) wp-includes/ms-functions.php | Updates a blog’s post count. | | [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::init()](../classes/wp_rewrite/init) wp-includes/class-wp-rewrite.php | Sets up the object’s properties. | | [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. | | [metadata\_exists()](metadata_exists) wp-includes/meta.php | Determines if a meta field with the given key exists for the given object ID. | | [network\_home\_url()](network_home_url) wp-includes/link-template.php | Retrieves the home URL for the current network. | | [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. | | [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. | | [is\_super\_admin()](is_super_admin) wp-includes/capabilities.php | Determines whether user is a site admin. | | [WP\_User::\_\_construct()](../classes/wp_user/__construct) wp-includes/class-wp-user.php | Constructor. | | [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. | | [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\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. | | [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\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. | | [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. | | [install\_blog\_defaults()](install_blog_defaults) wp-includes/ms-deprecated.php | Set blog defaults. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress logIO( string $io, string $msg ) logIO( string $io, string $msg ) ================================ This function has been deprecated. Use [error\_log()](https://www.php.net/manual/en/function.error-log.php) instead. [logIO()](logio) – Writes logging info to a file. * [error\_log()](https://www.php.net/manual/en/function.error-log.php) `$io` string Required Whether input or output `$msg` string Required Information describing logging reason. File: `xmlrpc.php`. [View all references](https://developer.wordpress.org/reference/files/xmlrpc.php/) ``` function logIO( $io, $msg ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) { error_log( $io . ' - ' . $msg ); } } ``` | 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/) | Introduced. | wordpress get_comment_author_url_link( string $linktext = '', string $before = '', string $after = '', int|WP_Comment $comment ): string get\_comment\_author\_url\_link( string $linktext = '', string $before = '', string $after = '', int|WP\_Comment $comment ): string =================================================================================================================================== Retrieves the HTML link of the URL of the author of the current comment. $linktext parameter is only used if the URL does not exist for the comment author. If the URL does exist then the URL will be used and the $linktext will be ignored. Encapsulate the HTML link between the $before and $after. So it will appear in the order of $before, link, and finally $after. `$linktext` string Optional The text to display instead of the comment author's email address. Default: `''` `$before` string Optional The text or HTML to display before the email link. Default: `''` `$after` string Optional The 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. string The HTML link between the $before and $after parameters. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function get_comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) { $url = get_comment_author_url( $comment ); $display = ( '' !== $linktext ) ? $linktext : $url; $display = str_replace( 'http://www.', '', $display ); $display = str_replace( 'http://', '', $display ); if ( '/' === substr( $display, -1 ) ) { $display = substr( $display, 0, -1 ); } $return = "$before<a href='$url' rel='external'>$display</a>$after"; /** * Filters the comment author's returned URL link. * * @since 1.5.0 * * @param string $return The HTML-formatted comment author URL link. */ return apply_filters( 'get_comment_author_url_link', $return ); } ``` [apply\_filters( 'get\_comment\_author\_url\_link', string $return )](../hooks/get_comment_author_url_link) Filters the comment author’s returned URL link. | Uses | Description | | --- | --- | | [get\_comment\_author\_url()](get_comment_author_url) wp-includes/comment-template.php | Retrieves the URL of the author of the current comment, not linked. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [comment\_author\_url\_link()](comment_author_url_link) wp-includes/comment-template.php | Displays the HTML link of the URL of the author of the current comment. | | Version | Description | | --- | --- | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Added the `$comment` parameter. | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
programming_docs
wordpress install_plugins_upload() install\_plugins\_upload() ========================== Displays a form to upload plugins from zip files. File: `wp-admin/includes/plugin-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin-install.php/) ``` function install_plugins_upload() { ?> <div class="upload-plugin"> <p class="install-help"><?php _e( 'If you have a plugin in a .zip format, you may install or update it by uploading it here.' ); ?></p> <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo esc_url( self_admin_url( 'update.php?action=upload-plugin' ) ); ?>"> <?php wp_nonce_field( 'plugin-upload' ); ?> <label class="screen-reader-text" for="pluginzip"><?php _e( 'Plugin zip file' ); ?></label> <input type="file" id="pluginzip" name="pluginzip" accept=".zip" /> <?php submit_button( __( 'Install Now' ), '', 'install-plugin-submit', false ); ?> </form> </div> <?php } ``` | Uses | Description | | --- | --- | | [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. | | [self\_admin\_url()](self_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for either the current site or the network depending on context. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress get_post_format_slugs(): string[] get\_post\_format\_slugs(): string[] ==================================== Retrieves the array of post format slugs. string[] The array of post format slugs as both keys and values. File: `wp-includes/post-formats.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-formats.php/) ``` function get_post_format_slugs() { $slugs = array_keys( get_post_format_strings() ); return array_combine( $slugs, $slugs ); } ``` | Uses | Description | | --- | --- | | [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 | | Used By | Description | | --- | --- | | [create\_initial\_theme\_features()](create_initial_theme_features) wp-includes/theme.php | Creates the initial theme features when the ‘setup\_theme’ action is fired. | | [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. | | [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. | | [set\_post\_format()](set_post_format) wp-includes/post-formats.php | Assign a format to a post | | [\_post\_format\_request()](_post_format_request) wp-includes/post-formats.php | Filters the request to allow for the format prefix. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress esc_url( string $url, string[] $protocols = null, string $_context = 'display' ): string esc\_url( string $url, string[] $protocols = null, string $\_context = 'display' ): string ========================================================================================== Checks and cleans a URL. A number of characters are removed from the URL. If the URL is for displaying (the default behaviour) ampersands are also replaced. The [‘clean\_url’](../hooks/clean_url) filter is applied to the returned cleaned URL. `$url` string Required The URL to be cleaned. `$protocols` string[] Optional An array of acceptable protocols. Defaults to return value of [wp\_allowed\_protocols()](wp_allowed_protocols) . Default: `null` `$_context` string Optional Private. Use [sanitize\_url()](sanitize_url) for database usage. Default: `'display'` string The cleaned URL after the ['clean\_url'](../hooks/clean_url) filter is applied. An empty string is returned if `$url` specifies a protocol other than those in `$protocols`, or if `$url` contains an empty string. Always use esc\_url when sanitizing URLs (in text nodes, attribute nodes or anywhere else). Rejects URLs that do not have one of the provided whitelisted protocols (defaulting to http, https, ftp, ftps, mailto, news, irc, gopher, nntp, feed, and telnet), eliminates invalid characters and removes dangerous characters. This function encodes characters as HTML entities: use it when generating an (X)HTML or XML document. Encodes ampersands (&) and single quotes (‘) as numeric entity references (&#038, &#039). If the URL appears to be an absolute link that does not contain a scheme, prepends `http://`. Please note that relative urls (/my-url/parameter2/), as well as anchors (#myanchor) and parameter items (?myparam=yes) are also allowed and filtered as a special case, without prepending the default protocol to the filtered url. Replaces the deprecated [clean\_url()](clean_url) . File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function esc_url( $url, $protocols = null, $_context = 'display' ) { $original_url = $url; if ( '' === $url ) { return $url; } $url = str_replace( ' ', '%20', ltrim( $url ) ); $url = preg_replace( '|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url ); if ( '' === $url ) { return $url; } if ( 0 !== stripos( $url, 'mailto:' ) ) { $strip = array( '%0d', '%0a', '%0D', '%0A' ); $url = _deep_replace( $strip, $url ); } $url = str_replace( ';//', '://', $url ); /* * If the URL doesn't appear to contain a scheme, we presume * it needs http:// prepended (unless it's a relative link * starting with /, # or ?, or a PHP file). */ if ( strpos( $url, ':' ) === false && ! in_array( $url[0], array( '/', '#', '?' ), true ) && ! preg_match( '/^[a-z0-9-]+?\.php/i', $url ) ) { $url = 'http://' . $url; } // Replace ampersands and single quotes only when displaying. if ( 'display' === $_context ) { $url = wp_kses_normalize_entities( $url ); $url = str_replace( '&amp;', '&#038;', $url ); $url = str_replace( "'", '&#039;', $url ); } if ( ( false !== strpos( $url, '[' ) ) || ( false !== strpos( $url, ']' ) ) ) { $parsed = wp_parse_url( $url ); $front = ''; if ( isset( $parsed['scheme'] ) ) { $front .= $parsed['scheme'] . '://'; } elseif ( '/' === $url[0] ) { $front .= '//'; } if ( isset( $parsed['user'] ) ) { $front .= $parsed['user']; } if ( isset( $parsed['pass'] ) ) { $front .= ':' . $parsed['pass']; } if ( isset( $parsed['user'] ) || isset( $parsed['pass'] ) ) { $front .= '@'; } if ( isset( $parsed['host'] ) ) { $front .= $parsed['host']; } if ( isset( $parsed['port'] ) ) { $front .= ':' . $parsed['port']; } $end_dirty = str_replace( $front, '', $url ); $end_clean = str_replace( array( '[', ']' ), array( '%5B', '%5D' ), $end_dirty ); $url = str_replace( $end_dirty, $end_clean, $url ); } if ( '/' === $url[0] ) { $good_protocol_url = $url; } else { if ( ! is_array( $protocols ) ) { $protocols = wp_allowed_protocols(); } $good_protocol_url = wp_kses_bad_protocol( $url, $protocols ); if ( strtolower( $good_protocol_url ) != strtolower( $url ) ) { return ''; } } /** * Filters a string cleaned and escaped for output as a URL. * * @since 2.3.0 * * @param string $good_protocol_url The cleaned URL to be returned. * @param string $original_url The URL prior to cleaning. * @param string $_context If 'display', replace ampersands and single quotes only. */ return apply_filters( 'clean_url', $good_protocol_url, $original_url, $_context ); } ``` [apply\_filters( 'clean\_url', string $good\_protocol\_url, string $original\_url, string $\_context )](../hooks/clean_url) Filters a string cleaned and escaped for output as a URL. | Uses | Description | | --- | --- | | [stripos()](stripos) wp-includes/class-pop3.php | | | [wp\_parse\_url()](wp_parse_url) wp-includes/http.php | A wrapper for PHP’s parse\_url() function that handles consistency in the return values across PHP versions. | | [\_deep\_replace()](_deep_replace) wp-includes/formatting.php | Performs a deep string replace operation to ensure the values in $search are no longer present. | | [wp\_kses\_normalize\_entities()](wp_kses_normalize_entities) wp-includes/kses.php | Converts and fixes HTML entities. | | [wp\_kses\_bad\_protocol()](wp_kses_bad_protocol) wp-includes/kses.php | Sanitizes a string and removed disallowed URL protocols. | | [wp\_allowed\_protocols()](wp_allowed_protocols) wp-includes/functions.php | Retrieves a list of protocols to allow in 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\_preload\_resources()](wp_preload_resources) wp-includes/general-template.php | Prints resource preloads directives to browsers. | | [WP\_Site\_Health::get\_test\_persistent\_object\_cache()](../classes/wp_site_health/get_test_persistent_object_cache) wp-admin/includes/class-wp-site-health.php | Tests if the site uses persistent object cache and recommends to use it if not. | | [WP\_List\_Table::get\_views\_links()](../classes/wp_list_table/get_views_links) wp-admin/includes/class-wp-list-table.php | Generates views links. | | [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\_list\_users()](wp_list_users) wp-includes/user.php | Lists all the users of the site, with several options available. | | [deactivated\_plugins\_notice()](deactivated_plugins_notice) wp-admin/includes/plugin.php | Renders an admin notice when a plugin was deactivated during an update. | | [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\_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\_Sitemaps::add\_robots()](../classes/wp_sitemaps/add_robots) wp-includes/sitemaps/class-wp-sitemaps.php | Adds the sitemap index to robots.txt. | | [WP\_Sitemaps\_Renderer::get\_sitemap\_index\_xml()](../classes/wp_sitemaps_renderer/get_sitemap_index_xml) wp-includes/sitemaps/class-wp-sitemaps-renderer.php | Gets XML for a sitemap index. | | [WP\_Sitemaps\_Renderer::get\_sitemap\_xml()](../classes/wp_sitemaps_renderer/get_sitemap_xml) wp-includes/sitemaps/class-wp-sitemaps-renderer.php | Gets XML for a sitemap. | | [WP\_Sitemaps\_Renderer::\_\_construct()](../classes/wp_sitemaps_renderer/__construct) wp-includes/sitemaps/class-wp-sitemaps-renderer.php | [WP\_Sitemaps\_Renderer](../classes/wp_sitemaps_renderer) constructor. | | [WP\_Sitemaps\_Stylesheet::get\_sitemap\_stylesheet()](../classes/wp_sitemaps_stylesheet/get_sitemap_stylesheet) wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php | Returns the escaped XSL for all sitemaps, except index. | | [WP\_Sitemaps\_Stylesheet::get\_sitemap\_index\_stylesheet()](../classes/wp_sitemaps_stylesheet/get_sitemap_index_stylesheet) wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php | Returns the escaped XSL for the index sitemaps. | | [WP\_Automatic\_Updater::send\_plugin\_theme\_email()](../classes/wp_automatic_updater/send_plugin_theme_email) wp-admin/includes/class-wp-automatic-updater.php | Sends an email upon the completion or failure of a plugin or theme background update. | | [wp\_dashboard\_site\_health()](wp_dashboard_site_health) wp-admin/includes/dashboard.php | Displays the Site Health Status widget. | | [wp\_credits\_section\_list()](wp_credits_section_list) wp-admin/includes/credits.php | Displays a list of contributors for a given group. | | [WP\_Privacy\_Data\_Removal\_Requests\_List\_Table::column\_email()](../classes/wp_privacy_data_removal_requests_list_table/column_email) wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Actions column. | | [WP\_Privacy\_Data\_Removal\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_removal_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Next steps column. | | [WP\_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\_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. | | [paused\_themes\_notice()](paused_themes_notice) wp-admin/includes/theme.php | Renders an admin notice in case some themes have been paused due to errors. | | [wp\_recovery\_mode\_nag()](wp_recovery_mode_nag) wp-admin/includes/update.php | Displays a notice when the user is in recovery mode. | | [WP\_Site\_Health::get\_test\_wordpress\_version()](../classes/wp_site_health/get_test_wordpress_version) wp-admin/includes/class-wp-site-health.php | Tests for WordPress version and outputs it. | | [WP\_Site\_Health::get\_test\_plugin\_version()](../classes/wp_site_health/get_test_plugin_version) wp-admin/includes/class-wp-site-health.php | Tests if plugins are outdated, or unnecessary. | | [WP\_Site\_Health::get\_test\_theme\_version()](../classes/wp_site_health/get_test_theme_version) wp-admin/includes/class-wp-site-health.php | Tests if themes are outdated, or unnecessary. | | [WP\_Site\_Health::get\_test\_php\_version()](../classes/wp_site_health/get_test_php_version) wp-admin/includes/class-wp-site-health.php | Tests if the supplied PHP version is supported. | | [WP\_Site\_Health::get\_test\_php\_extensions()](../classes/wp_site_health/get_test_php_extensions) wp-admin/includes/class-wp-site-health.php | Tests if required PHP modules are installed on the host. | | [WP\_Site\_Health::get\_test\_sql\_server()](../classes/wp_site_health/get_test_sql_server) wp-admin/includes/class-wp-site-health.php | Tests if the SQL server is up to date. | | [WP\_Site\_Health::get\_test\_dotorg\_communication()](../classes/wp_site_health/get_test_dotorg_communication) wp-admin/includes/class-wp-site-health.php | Tests if the site can communicate with WordPress.org. | | [WP\_Site\_Health::get\_test\_is\_in\_debug\_mode()](../classes/wp_site_health/get_test_is_in_debug_mode) wp-admin/includes/class-wp-site-health.php | Tests if debug information is enabled. | | [WP\_Site\_Health::get\_test\_https\_status()](../classes/wp_site_health/get_test_https_status) wp-admin/includes/class-wp-site-health.php | Tests if the site is serving content over HTTPS. | | [paused\_plugins\_notice()](paused_plugins_notice) wp-admin/includes/plugin.php | Renders an admin notice in case some plugins have been paused due to errors. | | [validate\_plugin\_requirements()](validate_plugin_requirements) wp-admin/includes/plugin.php | Validates the plugin requirements for WordPress version and PHP version. | | [wp\_direct\_php\_update\_button()](wp_direct_php_update_button) wp-includes/functions.php | Displays a button directly linking to a PHP update process. | | [wp\_dashboard\_php\_nag()](wp_dashboard_php_nag) wp-admin/includes/dashboard.php | Displays the PHP update nag. | | [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. | | [the\_block\_editor\_meta\_boxes()](the_block_editor_meta_boxes) wp-admin/includes/post.php | Renders the meta boxes forms. | | [the\_block\_editor\_meta\_box\_post\_form\_hidden\_fields()](the_block_editor_meta_box_post_form_hidden_fields) wp-admin/includes/post.php | Renders the hidden form required for the meta boxes form. | | [wp\_comments\_personal\_data\_exporter()](wp_comments_personal_data_exporter) wp-includes/comment.php | Finds and exports personal data associated with an email address from the comments table. | | [get\_the\_privacy\_policy\_link()](get_the_privacy_policy_link) wp-includes/link-template.php | Returns the privacy policy link with formatting, when applicable. | | [WP\_Privacy\_Policy\_Content::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\_privacy\_generate\_personal\_data\_export\_group\_html()](wp_privacy_generate_personal_data_export_group_html) wp-admin/includes/privacy-tools.php | Generate a single group for the personal data export report. | | [WP\_Privacy\_Requests\_Table::column\_email()](../classes/wp_privacy_requests_table/column_email) wp-admin/includes/class-wp-privacy-requests-table.php | Actions column. Overridden by children. | | [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\_Custom\_HTML::add\_help\_text()](../classes/wp_widget_custom_html/add_help_text) wp-includes/widgets/class-wp-widget-custom-html.php | Add help text to widgets admin screen. | | [update\_network\_option\_new\_admin\_email()](update_network_option_new_admin_email) wp-includes/ms-functions.php | Sends a confirmation request email when a change of network admin email address is attempted. | | [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. | | [get\_term\_parents\_list()](get_term_parents_list) wp-includes/category-template.php | Retrieves term parents with separator. | | [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::render\_media()](../classes/wp_widget_media_image/render_media) wp-includes/widgets/class-wp-widget-media-image.php | Render the media on the frontend. | | [WP\_Widget\_Media\_Image::\_\_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\_dashboard\_events\_news()](wp_dashboard_events_news) wp-admin/includes/dashboard.php | Renders the Events and News dashboard widget. | | [the\_header\_video\_url()](the_header_video_url) wp-includes/theme.php | Displays header video URL. | | [wp\_resource\_hints()](wp_resource_hints) wp-includes/general-template.php | Prints resource hints to browsers for pre-fetching, pre-rendering and pre-connecting to web sites. | | [network\_edit\_site\_nav()](network_edit_site_nav) wp-admin/includes/ms.php | Outputs the HTML for a network’s “Edit Site” tabular interface. | | [the\_embed\_site\_title()](the_embed_site_title) wp-includes/embed.php | Prints the necessary markup for the site title in an embed template. | | [get\_custom\_logo()](get_custom_logo) wp-includes/general-template.php | Returns a custom logo, linked to home unless the theme supports removing the link on the home page. | | [WP\_Customize\_Site\_Icon\_Control::content\_template()](../classes/wp_customize_site_icon_control/content_template) wp-includes/customize/class-wp-customize-site-icon-control.php | Renders a JS template for the content of the site icon control. | | [rest\_output\_rsd()](rest_output_rsd) wp-includes/rest-api.php | Adds the REST API URL to the WP RSD endpoint. | | [rest\_output\_link\_wp\_head()](rest_output_link_wp_head) wp-includes/rest-api.php | Outputs the REST API link tag into page header. | | [wp\_filter\_oembed\_result()](wp_filter_oembed_result) wp-includes/embed.php | Filters the given oEmbed HTML. | | [wp\_embed\_excerpt\_more()](wp_embed_excerpt_more) wp-includes/embed.php | Filters the string in the ‘more’ link displayed after a trimmed excerpt. | | [wp\_oembed\_add\_discovery\_links()](wp_oembed_add_discovery_links) wp-includes/embed.php | Adds oEmbed discovery links in the head element of the website. | | [get\_post\_embed\_html()](get_post_embed_html) wp-includes/embed.php | Retrieves the embed code for a specific post. | | [get\_the\_author\_posts\_link()](get_the_author_posts_link) wp-includes/author-template.php | Retrieves an HTML link to the author page of the current post’s author. | | [the\_post\_thumbnail\_url()](the_post_thumbnail_url) wp-includes/post-thumbnail-template.php | Displays the post thumbnail URL. | | [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\_site\_icon()](wp_site_icon) wp-includes/general-template.php | Displays site icon meta tags. | | [site\_icon\_url()](site_icon_url) wp-includes/general-template.php | Displays the Site Icon URL. | | [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\_Sites\_List\_Table::column\_blogname()](../classes/wp_ms_sites_list_table/column_blogname) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the site name column output. | | [WP\_MS\_Sites\_List\_Table::column\_users()](../classes/wp_ms_sites_list_table/column_users) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the users column output. | | [WP\_Terms\_List\_Table::handle\_row\_actions()](../classes/wp_terms_list_table/handle_row_actions) wp-admin/includes/class-wp-terms-list-table.php | Generates and displays row action links. | | [WP\_MS\_Users\_List\_Table::handle\_row\_actions()](../classes/wp_ms_users_list_table/handle_row_actions) wp-admin/includes/class-wp-ms-users-list-table.php | Generates and displays row action links. | | [WP\_MS\_Users\_List\_Table::column\_username()](../classes/wp_ms_users_list_table/column_username) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the username column output. | | [WP\_MS\_Users\_List\_Table::column\_email()](../classes/wp_ms_users_list_table/column_email) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the email column output. | | [WP\_MS\_Users\_List\_Table::column\_blogs()](../classes/wp_ms_users_list_table/column_blogs) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the sites column output. | | [WP\_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\_default()](../classes/wp_media_list_table/column_default) wp-admin/includes/class-wp-media-list-table.php | Handles output for the default column. | | [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\_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\_Customize\_Manager::remove\_panel()](../classes/wp_customize_manager/remove_panel) wp-includes/class-wp-customize-manager.php | Removes a customize panel. | | [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. | | [confirm\_another\_blog\_signup()](confirm_another_blog_signup) wp-signup.php | Shows a message confirming that the new site has been created. | | [network\_step1()](network_step1) wp-admin/includes/network.php | Prints step 1 for Network installation process. | | [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. | | [wp\_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\_Screen::render\_screen\_meta()](../classes/wp_screen/render_screen_meta) wp-admin/includes/class-wp-screen.php | Renders the screen’s help section. | | [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | | | [WP\_Plugins\_List\_Table::no\_items()](../classes/wp_plugins_list_table/no_items) wp-admin/includes/class-wp-plugins-list-table.php | | | [install\_themes\_upload()](install_themes_upload) wp-admin/includes/theme-install.php | Displays a form to upload themes from zip files. | | [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. | | [\_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. | | [site\_admin\_notice()](site_admin_notice) wp-admin/includes/ms.php | Displays an admin notice to upgrade all sites after a core upgrade. | | [choose\_primary\_blog()](choose_primary_blog) wp-admin/includes/ms.php | Handles the display of choosing a user’s primary site. | | [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\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. | | [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 | | | [admin\_color\_scheme\_picker()](admin_color_scheme_picker) wp-admin/includes/misc.php | Displays the default admin color scheme picker (Used in user-edit.php). | | [WP\_Theme\_Install\_List\_Table::install\_theme\_info()](../classes/wp_theme_install_list_table/install_theme_info) wp-admin/includes/class-wp-theme-install-list-table.php | Prints the info for a theme (to be used in the theme installer modal). | | [WP\_Theme\_Install\_List\_Table::single\_row()](../classes/wp_theme_install_list_table/single_row) wp-admin/includes/class-wp-theme-install-list-table.php | Prints a theme from the WordPress.org API. | | [WP\_Theme\_Install\_List\_Table::theme\_installer\_single()](../classes/wp_theme_install_list_table/theme_installer_single) wp-admin/includes/class-wp-theme-install-list-table.php | Prints the wrapper for the theme installer with a provided theme’s data. | | [update\_nag()](update_nag) wp-admin/includes/update.php | Returns core update notification message. | | [wp\_plugin\_update\_row()](wp_plugin_update_row) wp-admin/includes/update.php | Displays update information for a plugin. | | [wp\_theme\_update\_row()](wp_theme_update_row) wp-admin/includes/update.php | Displays update information for a theme. | | [wp\_welcome\_panel()](wp_welcome_panel) wp-admin/includes/dashboard.php | Displays a welcome panel to introduce users to WordPress. | | [install\_dashboard()](install_dashboard) wp-admin/includes/plugin-install.php | Displays the Featured tab of Add Plugins screen. | | [install\_plugins\_upload()](install_plugins_upload) wp-admin/includes/plugin-install.php | Displays a form to upload plugins from zip files. | | [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. | | [wp\_dashboard\_quota()](wp_dashboard_quota) wp-admin/includes/dashboard.php | Displays file upload quota on dashboard. | | [wp\_dashboard\_browser\_nag()](wp_dashboard_browser_nag) wp-admin/includes/dashboard.php | Displays the browser update nag. | | [wp\_dashboard\_plugins\_output()](wp_dashboard_plugins_output) wp-admin/includes/deprecated.php | Display plugins text for the WordPress news widget. | | [wp\_add\_dashboard\_widget()](wp_add_dashboard_widget) wp-admin/includes/dashboard.php | Adds a new dashboard widget. | | [wp\_network\_dashboard\_right\_now()](wp_network_dashboard_right_now) wp-admin/includes/dashboard.php | | | [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press) wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. | | [wp\_dashboard\_recent\_drafts()](wp_dashboard_recent_drafts) wp-admin/includes/dashboard.php | Show recent drafts of the user on the dashboard. | | [\_wp\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. | | [wp\_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. | | [\_get\_plugin\_data\_markup\_translate()](_get_plugin_data_markup_translate) wp-admin/includes/plugin.php | Sanitizes plugin data, optionally adds markup, optionally translates. | | [WP\_Plugin\_Install\_List\_Table::display\_rows()](../classes/wp_plugin_install_list_table/display_rows) wp-admin/includes/class-wp-plugin-install-list-table.php | | | [wp\_import\_upload\_form()](wp_import_upload_form) wp-admin/includes/template.php | Outputs the form used by the importers to accept the data to be imported. | | [WP\_Themes\_List\_Table::display\_rows()](../classes/wp_themes_list_table/display_rows) wp-admin/includes/class-wp-themes-list-table.php | | | [WP\_Users\_List\_Table::single\_row()](../classes/wp_users_list_table/single_row) wp-admin/includes/class-wp-users-list-table.php | Generate HTML for a single row on the users.php admin panel. | | [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\_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\_max\_image\_resize()](media_upload_max_image_resize) wp-admin/includes/media.php | Displays the checkbox to scale images. | | [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor | | [attachment\_submitbox\_metadata()](attachment_submitbox_metadata) wp-admin/includes/media.php | Displays non-editable attachment metadata in the publish meta box. | | [wp\_media\_upload\_handler()](wp_media_upload_handler) wp-admin/includes/media.php | Handles the process of uploading media. | | [image\_link\_input\_fields()](image_link_input_fields) wp-admin/includes/media.php | Retrieves HTML for the Link URL buttons with the default link type as specified. | | [the\_media\_upload\_tabs()](the_media_upload_tabs) wp-admin/includes/media.php | Outputs the legacy media upload tabs UI. | | [get\_image\_send\_to\_editor()](get_image_send_to_editor) wp-admin/includes/media.php | Retrieves the image HTML to send to the editor. | | [get\_sample\_permalink\_html()](get_sample_permalink_html) wp-admin/includes/post.php | Returns the HTML of the sample permalink slug editor. | | [\_wp\_post\_thumbnail\_html()](_wp_post_thumbnail_html) wp-admin/includes/post.php | Returns HTML for the post thumbnail meta box. | | [\_admin\_notice\_post\_locked()](_admin_notice_post_locked) wp-admin/includes/post.php | Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post. | | [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. | | [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. | | [wp\_link\_manager\_disabled\_message()](wp_link_manager_disabled_message) wp-admin/includes/bookmark.php | Outputs the ‘disabled’ message for the WordPress Link Manager. | | [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. | | [edit\_link()](edit_link) wp-admin/includes/bookmark.php | Updates or inserts a link using values provided in $\_POST. | | [get\_default\_link\_to\_edit()](get_default_link_to_edit) wp-admin/includes/bookmark.php | Retrieves the default link for editing. | | [WP\_Media\_List\_Table::\_get\_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::column\_date()](../classes/wp_comments_list_table/column_date) 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\_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. | | [request\_filesystem\_credentials()](request_filesystem_credentials) wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. | | [wp\_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 | | | [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. | | [\_wp\_credits\_add\_profile\_link()](_wp_credits_add_profile_link) wp-admin/includes/credits.php | Retrieve the link to a contributor’s WordPress.org profile page. | | [\_wp\_credits\_build\_object\_link()](_wp_credits_build_object_link) wp-admin/includes/credits.php | Retrieve the link to an external library used in WordPress. | | [Custom\_Image\_Header::step\_1()](../classes/custom_image_header/step_1) wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. | | [Custom\_Image\_Header::step\_2()](../classes/custom_image_header/step_2) wp-admin/includes/class-custom-image-header.php | Display second step of custom header image page. | | [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.php | | | [list\_core\_update()](list_core_update) wp-admin/update-core.php | Lists available core updates. | | [core\_upgrade\_preamble()](core_upgrade_preamble) wp-admin/update-core.php | Display upgrade WordPress for downloading latest or upgrading automatically form. | | [list\_plugin\_updates()](list_plugin_updates) wp-admin/update-core.php | Display the upgrade plugins form. | | [list\_theme\_updates()](list_theme_updates) wp-admin/update-core.php | Display the upgrade themes form. | | [list\_translation\_updates()](list_translation_updates) wp-admin/update-core.php | Display the update translations form. | | [do\_core\_upgrade()](do_core_upgrade) wp-admin/update-core.php | Upgrade WordPress core display. | | [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. | | [\_wp\_menu\_output()](_wp_menu_output) wp-admin/menu-header.php | Display menu. | | [WP\_Customize\_Manager::register\_controls()](../classes/wp_customize_manager/register_controls) wp-includes/class-wp-customize-manager.php | Registers some default controls. | | [WP\_Styles::\_css\_href()](../classes/wp_styles/_css_href) wp-includes/class-wp-styles.php | Generates an enqueued style’s fully-qualified URL. | | [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. | | [wp\_generate\_tag\_cloud()](wp_generate_tag_cloud) wp-includes/category-template.php | Generates a tag cloud (heatmap) from provided data. | | [wp\_customize\_url()](wp_customize_url) wp-includes/theme.php | Returns a URL to load the Customizer. | | [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\_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. | | [header\_image()](header_image) wp-includes/theme.php | Displays header image URL. | | [\_make\_url\_clickable\_cb()](_make_url_clickable_cb) wp-includes/formatting.php | Callback to convert URI match to HTML A element. | | [\_make\_web\_ftp\_clickable\_cb()](_make_web_ftp_clickable_cb) wp-includes/formatting.php | Callback to convert URL match to HTML A element. | | [translate\_smiley()](translate_smiley) wp-includes/formatting.php | Converts one smiley code to the icon graphic file equivalent. | | [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. | | [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. | | [wp\_admin\_css()](wp_admin_css) wp-includes/general-template.php | Enqueues or directly prints a stylesheet link to the specified CSS file. | | [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. | | [rsd\_link()](rsd_link) wp-includes/general-template.php | Displays the link to the Really Simple Discovery service endpoint. | | [get\_archives\_link()](get_archives_link) wp-includes/general-template.php | Retrieves archive link content based on predefined or custom code. | | [wp\_loginout()](wp_loginout) wp-includes/general-template.php | Displays the Log In/Out link. | | [wp\_login\_form()](wp_login_form) wp-includes/general-template.php | Provides a simple login form for use anywhere within WordPress. | | [wp\_register()](wp_register) wp-includes/general-template.php | Displays the Registration or Admin link. | | [get\_search\_form()](get_search_form) wp-includes/general-template.php | Displays search form. | | [get\_index\_rel\_link()](get_index_rel_link) wp-includes/deprecated.php | Get site index relational link. | | [clean\_url()](clean_url) wp-includes/deprecated.php | Checks and cleans a URL. | | [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. | | [comments\_rss()](comments_rss) wp-includes/deprecated.php | Return link to the post RSS feed. | | [get\_links()](get_links) wp-includes/deprecated.php | Gets the links associated with category by ID. | | [WP\_Theme::markup\_header()](../classes/wp_theme/markup_header) wp-includes/class-wp-theme.php | Marks up a theme header. | | [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\_ays()](wp_nonce_ays) wp-includes/functions.php | Displays “Are You Sure” message to confirm the action being taken. | | [\_default\_wp\_die\_handler()](_default_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. | | [wp\_referer\_field()](wp_referer_field) wp-includes/functions.php | Retrieves or displays referer hidden field for forms. | | [WP\_Widget\_RSS::widget()](../classes/wp_widget_rss/widget) wp-includes/widgets/class-wp-widget-rss.php | Outputs the content for the current RSS widget instance. | | [WP\_Widget\_Recent\_Comments::widget()](../classes/wp_widget_recent_comments/widget) wp-includes/widgets/class-wp-widget-recent-comments.php | Outputs the content for the current Recent Comments widget instance. | | [WP\_Widget\_Categories::widget()](../classes/wp_widget_categories/widget) wp-includes/widgets/class-wp-widget-categories.php | Outputs the content for the current Categories widget instance. | | [WP\_Widget\_Meta::widget()](../classes/wp_widget_meta/widget) wp-includes/widgets/class-wp-widget-meta.php | Outputs the content for the current Meta widget instance. | | [wp\_widget\_rss\_output()](wp_widget_rss_output) wp-includes/widgets.php | Display the RSS entries in a list. | | [wp\_widget\_rss\_form()](wp_widget_rss_form) wp-includes/widgets.php | Display RSS widget options form. | | [wp\_widget\_rss\_process()](wp_widget_rss_process) wp-includes/widgets.php | Process RSS feed widget data and optionally retrieve feed items. | | [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::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). | | [rel\_canonical()](rel_canonical) wp-includes/link-template.php | Outputs rel=canonical for singular queries. | | [wp\_shortlink\_wp\_head()](wp_shortlink_wp_head) wp-includes/link-template.php | Injects rel=shortlink into the head if a shortlink is defined for the current page. | | [the\_shortlink()](the_shortlink) wp-includes/link-template.php | Displays the shortlink for a post. | | [get\_next\_comments\_link()](get_next_comments_link) wp-includes/link-template.php | Retrieves the link to the next comments page. | | [get\_previous\_comments\_link()](get_previous_comments_link) wp-includes/link-template.php | Retrieves the link to the previous comments page. | | [get\_pagenum\_link()](get_pagenum_link) wp-includes/link-template.php | Retrieves the link for a page number. | | [next\_posts()](next_posts) wp-includes/link-template.php | Displays or retrieves the next posts page link. | | [previous\_posts()](previous_posts) wp-includes/link-template.php | Displays or retrieves the previous posts page link. | | [edit\_post\_link()](edit_post_link) wp-includes/link-template.php | Displays the edit post link for post. | | [edit\_comment\_link()](edit_comment_link) wp-includes/link-template.php | Displays the edit comment link with formatting. | | [edit\_bookmark\_link()](edit_bookmark_link) wp-includes/link-template.php | Displays the edit bookmark link anchor content. | | [the\_feed\_link()](the_feed_link) wp-includes/link-template.php | Displays the permalink for the feed type. | | [post\_comments\_feed\_link()](post_comments_feed_link) wp-includes/link-template.php | Displays the comment feed link for a post. | | [WP\_Admin\_Bar::\_render()](../classes/wp_admin_bar/_render) wp-includes/class-wp-admin-bar.php | | | [WP\_Admin\_Bar::\_render\_item()](../classes/wp_admin_bar/_render_item) wp-includes/class-wp-admin-bar.php | | | [the\_permalink()](the_permalink) wp-includes/link-template.php | Displays the permalink for the current post. | | [wp\_version\_check()](wp_version_check) wp-includes/update.php | Checks WordPress version against the newest version. | | [WP\_oEmbed::data2html()](../classes/wp_oembed/data2html) wp-includes/class-wp-oembed.php | Converts a data object from [WP\_oEmbed::fetch()](../classes/wp_oembed/fetch) and returns the HTML. | | [wp\_admin\_bar\_my\_sites\_menu()](wp_admin_bar_my_sites_menu) wp-includes/admin-bar.php | Adds the “My Sites/[Site Name]” menu and all submenus. | | [wp\_admin\_bar\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. | | [wp\_admin\_bar\_search\_menu()](wp_admin_bar_search_menu) wp-includes/admin-bar.php | Adds search form. | | [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. | | [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\_guid()](comment_guid) wp-includes/feed.php | Displays the feed GUID for the current comment. | | [comment\_link()](comment_link) wp-includes/feed.php | Displays the link to the comments. | | [sanitize\_user\_field()](sanitize_user_field) wp-includes/user.php | Sanitizes user field based on context. | | [\_walk\_bookmarks()](_walk_bookmarks) wp-includes/bookmark-template.php | The formatted output of a list of bookmarks. | | [Walker\_Nav\_Menu::start\_el()](../classes/walker_nav_menu/start_el) wp-includes/class-walker-nav-menu.php | Starts the element output. | | [Walker\_Page::start\_el()](../classes/walker_page/start_el) wp-includes/class-walker-page.php | Outputs the beginning of the current element in the tree. | | [wp\_get\_attachment\_link()](wp_get_attachment_link) wp-includes/post-template.php | Retrieves an attachment page link using an image or icon, if possible. | | [get\_the\_password\_form()](get_the_password_form) wp-includes/post-template.php | Retrieves protected post password form content. | | [\_wp\_link\_page()](_wp_link_page) wp-includes/post-template.php | Helper function for [wp\_link\_pages()](wp_link_pages) . | | [wp\_page\_menu()](wp_page_menu) wp-includes/post-template.php | Displays or retrieves a list of pages with an optional home link. | | [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\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video 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\_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. | | [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\_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\_most\_active\_blogs()](get_most_active_blogs) wp-includes/ms-deprecated.php | Deprecated functionality to retrieve a list of the most active sites. | | [WP\_Scripts::do\_item()](../classes/wp_scripts/do_item) wp-includes/class-wp-scripts.php | Processes a script dependency. | | [get\_the\_author\_link()](get_the_author_link) wp-includes/author-template.php | Retrieves either author’s link or author’s name. | | [wp\_list\_authors()](wp_list_authors) wp-includes/author-template.php | Lists all the authors of the site, with several options available. | | [get\_blogaddress\_by\_id()](get_blogaddress_by_id) wp-includes/ms-blogs.php | Get a full blog URL, given a blog ID. | | [get\_blogaddress\_by\_name()](get_blogaddress_by_name) wp-includes/ms-blogs.php | Get a full blog URL, given a blog name. | | [wp\_rss()](wp_rss) wp-includes/rss.php | Display all RSS items in a HTML ordered list. | | [Walker\_Comment::comment()](../classes/walker_comment/comment) wp-includes/class-walker-comment.php | Outputs a single comment. | | [Walker\_Comment::html5\_comment()](../classes/walker_comment/html5_comment) wp-includes/class-walker-comment.php | Outputs a comment in the HTML5 format. | | [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. | | [comments\_template()](comments_template) wp-includes/comment-template.php | Loads the comment template specified in $file. | | [get\_comment\_reply\_link()](get_comment_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to comment link. | | [comments\_link()](comments_link) wp-includes/comment-template.php | Displays the link to the current post comments. | | [get\_comment\_text()](get_comment_text) wp-includes/comment-template.php | Retrieves the text of the current 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\_url()](get_comment_author_url) wp-includes/comment-template.php | Retrieves the URL of the author of the current comment, not linked. | | [wp\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. | | [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. | | [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
programming_docs
wordpress maybe_serialize( string|array|object $data ): mixed maybe\_serialize( string|array|object $data ): mixed ==================================================== Serializes data, if needed. `$data` string|array|object Required Data that might be serialized. mixed A scalar data. * Data might need to be serialized to allow it to be successfully stored and retrieved from a database in a form that PHP can understand. * Confusingly, strings that contain already serialized values are serialized again, resulting in a nested serialization. Other strings are unmodified. * A possible solution to prevent nested serialization is to check if a variable is serialized using [is\_serialized()](is_serialized) ``` if( !is_serialized( $data ) ) { $data = maybe_serialize($data); } ``` File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function maybe_serialize( $data ) { if ( is_array( $data ) || is_object( $data ) ) { return serialize( $data ); } /* * Double serialization is required for backward compatibility. * See https://core.trac.wordpress.org/ticket/12930 * Also the world will end. See WP 3.6.1. */ if ( is_serialized( $data, false ) ) { return serialize( $data ); } return $data; } ``` | Uses | Description | | --- | --- | | [is\_serialized()](is_serialized) wp-includes/functions.php | Checks value to find if it was serialized. | | 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. | | [update\_network\_option()](update_network_option) wp-includes/option.php | Updates the value of a network option that was already added. | | [add\_network\_option()](add_network_option) wp-includes/option.php | Adds a new network option. | | [update\_usermeta()](update_usermeta) wp-includes/deprecated.php | Update metadata of user. | | [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\_metadata()](delete_metadata) wp-includes/meta.php | Deletes metadata for the specified object. | | [update\_metadata\_by\_mid()](update_metadata_by_mid) wp-includes/meta.php | Updates metadata by meta ID. | | [add\_metadata()](add_metadata) wp-includes/meta.php | Adds metadata for the specified object. | | [update\_metadata()](update_metadata) wp-includes/meta.php | Updates metadata for the specified object. If no value already exists for the specified object ID and metadata key, the metadata will be added. | | Version | Description | | --- | --- | | [2.0.5](https://developer.wordpress.org/reference/since/2.0.5/) | Introduced. | wordpress update_blog_details( int $blog_id, array $details = array() ): bool update\_blog\_details( int $blog\_id, array $details = array() ): bool ====================================================================== Update the details for a blog. Updates the blogs table for a given blog ID. `$blog_id` int Required Blog ID. `$details` array Optional Array of details keyed by blogs table field names. Default: `array()` bool True if update succeeds, false otherwise. File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/) ``` function update_blog_details( $blog_id, $details = array() ) { global $wpdb; if ( empty( $details ) ) { return false; } if ( is_object( $details ) ) { $details = get_object_vars( $details ); } $site = wp_update_site( $blog_id, $details ); if ( is_wp_error( $site ) ) { return false; } return true; } ``` | Uses | Description | | --- | --- | | [wp\_update\_site()](wp_update_site) wp-includes/ms-site.php | Updates a site in the database. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [wpmu\_update\_blogs\_date()](wpmu_update_blogs_date) wp-includes/ms-blogs.php | Update the last\_updated field for the current site. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress comment_author_rss() comment\_author\_rss() ====================== Displays the current comment author in the feed. File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/) ``` function comment_author_rss() { echo get_comment_author_rss(); } ``` | Uses | Description | | --- | --- | | [get\_comment\_author\_rss()](get_comment_author_rss) wp-includes/feed.php | Retrieves the current comment author for use in the feeds. | | Version | Description | | --- | --- | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. | wordpress wp_remote_get( string $url, array $args = array() ): array|WP_Error wp\_remote\_get( string $url, array $args = array() ): array|WP\_Error ====================================================================== Performs an HTTP request using the GET method and returns its response. * [wp\_remote\_request()](wp_remote_request) : For more information on the response array format. * [WP\_Http::request()](../classes/wp_http/request): For default arguments information. `$url` string Required URL to retrieve. `$args` array Optional Request arguments. Default: `array()` array|[WP\_Error](../classes/wp_error) The response or [WP\_Error](../classes/wp_error) on failure. Use [wp\_remote\_retrieve\_body( $response )](wp_remote_retrieve_body "Function Reference/wp remote retrieve body") to get the response body. Use [wp\_remote\_retrieve\_response\_code( $response )](https://codex.wordpress.org/Function_Reference/wp_remote_retrieve_response_code "Function Reference/wp remote retrieve response code") to get the HTTP status code for the response. Use related functions in `[wp-includes/http.php](https://core.trac.wordpress.org/browser/tags/4.5.3/src/wp-includes/http.php#L207)` to get other parameters such as headers. See [WP\_Http\_Streams::request()](../classes/wp_http_streams/request) method located in `[wp-includes/class-wp-http-streams.php](https://core.trac.wordpress.org/browser/tags/4.5.3/src/wp-includes/class-wp-http-streams.php#L287)` for the format of the array returned by [wp\_remote\_get()](wp_remote_get) . File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/) ``` function wp_remote_get( $url, $args = array() ) { $http = _wp_http_get_object(); return $http->get( $url, $args ); } ``` | Uses | Description | | --- | --- | | [\_wp\_http\_get\_object()](_wp_http_get_object) wp-includes/http.php | Returns the initialized [WP\_Http](../classes/wp_http) Object | | Used By | Description | | --- | --- | | [WP\_Site\_Health::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\_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\_block\_editor\_theme\_styles()](get_block_editor_theme_styles) wp-includes/block-editor.php | Creates an array of theme styles to load into the block editor. | | [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\_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\_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\_dotorg\_communication()](../classes/wp_site_health/get_test_dotorg_communication) wp-admin/includes/class-wp-site-health.php | Tests if the site can communicate with WordPress.org. | | [wp\_check\_php\_version()](wp_check_php_version) wp-admin/includes/misc.php | Checks if the user needs to update 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\_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\_install\_maybe\_enable\_pretty\_permalinks()](wp_install_maybe_enable_pretty_permalinks) wp-admin/includes/upgrade.php | Maybe enable pretty permalinks on installation. | | [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. | | [themes\_api()](themes_api) wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. | | [populate\_network()](populate_network) wp-admin/includes/schema.php | Populate network settings. | | [get\_core\_checksums()](get_core_checksums) wp-admin/includes/update.php | Gets and caches the checksums for the given version of WordPress. | | [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. | | [url\_is\_accessable\_via\_ssl()](url_is_accessable_via_ssl) wp-includes/deprecated.php | Determines if the URL can be accessed over SSL. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress the_embed_site_title() the\_embed\_site\_title() ========================= Prints the necessary markup for the site title in an embed template. File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/) ``` function the_embed_site_title() { $site_title = sprintf( '<a href="%s" target="_top"><img src="%s" srcset="%s 2x" width="32" height="32" alt="" class="wp-embed-site-icon" /><span>%s</span></a>', esc_url( home_url() ), esc_url( get_site_icon_url( 32, includes_url( 'images/w-logo-blue.png' ) ) ), esc_url( get_site_icon_url( 64, includes_url( 'images/w-logo-blue.png' ) ) ), esc_html( get_bloginfo( 'name' ) ) ); $site_title = '<div class="wp-embed-site-title">' . $site_title . '</div>'; /** * Filters the site title HTML in the embed footer. * * @since 4.4.0 * * @param string $site_title The site title HTML. */ echo apply_filters( 'embed_site_title_html', $site_title ); } ``` [apply\_filters( 'embed\_site\_title\_html', string $site\_title )](../hooks/embed_site_title_html) Filters the site title HTML in the embed footer. | Uses | Description | | --- | --- | | [get\_site\_icon\_url()](get_site_icon_url) wp-includes/general-template.php | Returns the Site Icon URL. | | [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. | | [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\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Version | Description | | --- | --- | | [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. | wordpress wp_oembed_get( string $url, array|string $args = '' ): string|false wp\_oembed\_get( string $url, array|string $args = '' ): string|false ===================================================================== Attempts to fetch the embed HTML for a provided URL using oEmbed. * [WP\_oEmbed](../classes/wp_oembed) `$url` string Required The URL that should be embedded. `$args` array|string Optional Additional arguments for retrieving embed HTML. * `width`int|stringOptional. The `maxwidth` value passed to the provider URL. * `height`int|stringOptional. The `maxheight` value passed to the provider URL. * `discover`boolOptional. Determines whether to attempt to discover link tags at the given URL for an oEmbed provider when the provider URL is not found in the built-in providers list. Default true. Default: `''` string|false The embed HTML on success, false on failure. File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/) ``` function wp_oembed_get( $url, $args = '' ) { $oembed = _wp_oembed_get_object(); return $oembed->get_html( $url, $args ); } ``` | Uses | Description | | --- | --- | | [\_wp\_oembed\_get\_object()](_wp_oembed_get_object) wp-includes/embed.php | Returns the initialized [WP\_oEmbed](../classes/wp_oembed) object. | | Used By | Description | | --- | --- | | [WP\_Widget\_Media\_Video::render\_media()](../classes/wp_widget_media_video/render_media) wp-includes/widgets/class-wp-widget-media-video.php | Render the media on the frontend. | | [WP\_Embed::shortcode()](../classes/wp_embed/shortcode) wp-includes/class-wp-embed.php | The [do\_shortcode()](do_shortcode) callback function. | | Version | Description | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress trackback_url( bool $deprecated_echo = true ): void|string trackback\_url( bool $deprecated\_echo = true ): void|string ============================================================ Displays the current post’s trackback URL. `$deprecated_echo` bool Optional Not used. Default: `true` void|string Should only be used to echo the trackback URL, use [get\_trackback\_url()](get_trackback_url) for the result instead. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function trackback_url( $deprecated_echo = true ) { if ( true !== $deprecated_echo ) { _deprecated_argument( __FUNCTION__, '2.5.0', sprintf( /* translators: %s: get_trackback_url() */ __( 'Use %s instead if you do not want the value echoed.' ), '<code>get_trackback_url()</code>' ) ); } if ( $deprecated_echo ) { echo get_trackback_url(); } else { return get_trackback_url(); } } ``` | Uses | Description | | --- | --- | | [get\_trackback\_url()](get_trackback_url) wp-includes/comment-template.php | Retrieves the current post’s trackback URL. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress the_content_rss( string $more_link_text = '(more...)', int $stripteaser, string $more_file = '', int $cut, int $encode_html ) the\_content\_rss( string $more\_link\_text = '(more...)', int $stripteaser, string $more\_file = '', int $cut, int $encode\_html ) =================================================================================================================================== This function has been deprecated. Use [the\_content\_feed()](the_content_feed) instead. Display the post content for the feed. For encoding the HTML or the $encode\_html parameter, there are three possible values: * ‘0’ will make urls footnotes and use [make\_url\_footnote()](make_url_footnote) . * ‘1’ will encode special characters and automatically display all of the content. * ‘2’ will strip all HTML tags from the content. Also note that you cannot set the amount of words and not set the HTML encoding. If that is the case, then the HTML encoding will default to 2, which will strip all HTML tags. To restrict the amount of words of the content, you can use the cut parameter. If the content is less than the amount, then there won’t be any dots added to the end. If there is content left over, then dots will be added and the rest of the content will be removed. * [the\_content\_feed()](the_content_feed) `$more_link_text` string Optional Text to display when more content is available but not displayed. Default `'(more...)'`. Default: `'(more...)'` `$stripteaser` int Optional Default 0. `$more_file` string Optional Default: `''` `$cut` int Optional Amount of words to keep for the content. `$encode_html` int Optional How to encode the content. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { _deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed()' ); $content = get_the_content($more_link_text, $stripteaser); /** * Filters the post content in the context of an RSS feed. * * @since 0.71 * * @param string $content Content of the current post. */ $content = apply_filters('the_content_rss', $content); if ( $cut && !$encode_html ) $encode_html = 2; if ( 1== $encode_html ) { $content = esc_html($content); $cut = 0; } elseif ( 0 == $encode_html ) { $content = make_url_footnote($content); } elseif ( 2 == $encode_html ) { $content = strip_tags($content); } if ( $cut ) { $blah = explode(' ', $content); if ( count($blah) > $cut ) { $k = $cut; $use_dotdotdot = 1; } else { $k = count($blah); $use_dotdotdot = 0; } /** @todo Check performance, might be faster to use array slice instead. */ for ( $i=0; $i<$k; $i++ ) $excerpt .= $blah[$i].' '; $excerpt .= ($use_dotdotdot) ? '...' : ''; $content = $excerpt; } $content = str_replace(']]>', ']]&gt;', $content); echo $content; } ``` [apply\_filters( 'the\_content\_rss', string $content )](../hooks/the_content_rss) Filters the post content in the context of an RSS feed. | Uses | Description | | --- | --- | | [make\_url\_footnote()](make_url_footnote) wp-includes/deprecated.php | Strip HTML and put links at the bottom of stripped content. | | [get\_the\_content()](get_the_content) wp-includes/post-template.php | Retrieves the post content. | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | [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/) | Use [the\_content\_feed()](the_content_feed) | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
programming_docs
wordpress wp_maybe_load_widgets() wp\_maybe\_load\_widgets() ========================== Determines if Widgets library should be loaded. Checks to make sure that the widgets library hasn’t already been loaded. If it hasn’t, then it will load the widgets library and run an action hook. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp_maybe_load_widgets() { /** * Filters whether to load the Widgets library. * * Returning a falsey value from the filter will effectively short-circuit * the Widgets library from loading. * * @since 2.8.0 * * @param bool $wp_maybe_load_widgets Whether to load the Widgets library. * Default true. */ if ( ! apply_filters( 'load_default_widgets', true ) ) { return; } require_once ABSPATH . WPINC . '/default-widgets.php'; add_action( '_admin_menu', 'wp_widgets_add_menu' ); } ``` [apply\_filters( 'load\_default\_widgets', bool $wp\_maybe\_load\_widgets )](../hooks/load_default_widgets) Filters whether to load the Widgets library. | Uses | Description | | --- | --- | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. | | Version | Description | | --- | --- | | [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. | wordpress wp_network_dashboard_right_now() wp\_network\_dashboard\_right\_now() ==================================== File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/) ``` function wp_network_dashboard_right_now() { $actions = array(); if ( current_user_can( 'create_sites' ) ) { $actions['create-site'] = '<a href="' . network_admin_url( 'site-new.php' ) . '">' . __( 'Create a New Site' ) . '</a>'; } if ( current_user_can( 'create_users' ) ) { $actions['create-user'] = '<a href="' . network_admin_url( 'user-new.php' ) . '">' . __( 'Create a New User' ) . '</a>'; } $c_users = get_user_count(); $c_blogs = get_blog_count(); /* translators: %s: Number of users on the network. */ $user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) ); /* translators: %s: Number of sites on the network. */ $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) ); /* translators: 1: Text indicating the number of sites on the network, 2: Text indicating the number of users on the network. */ $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text ); if ( $actions ) { echo '<ul class="subsubsub">'; foreach ( $actions as $class => $action ) { $actions[ $class ] = "\t<li class='$class'>$action"; } echo implode( " |</li>\n", $actions ) . "</li>\n"; echo '</ul>'; } ?> <br class="clear" /> <p class="youhave"><?php echo $sentence; ?></p> <?php /** * Fires in the Network Admin 'Right Now' dashboard widget * just before the user and site search form fields. * * @since MU (3.0.0) */ do_action( 'wpmuadminresult' ); ?> <form action="<?php echo esc_url( network_admin_url( 'users.php' ) ); ?>" method="get"> <p> <label class="screen-reader-text" for="search-users"><?php _e( 'Search Users' ); ?></label> <input type="search" name="s" value="" size="30" autocomplete="off" id="search-users" /> <?php submit_button( __( 'Search Users' ), '', false, false, array( 'id' => 'submit_users' ) ); ?> </p> </form> <form action="<?php echo esc_url( network_admin_url( 'sites.php' ) ); ?>" method="get"> <p> <label class="screen-reader-text" for="search-sites"><?php _e( 'Search Sites' ); ?></label> <input type="search" name="s" value="" size="30" autocomplete="off" id="search-sites" /> <?php submit_button( __( 'Search Sites' ), '', false, false, array( 'id' => 'submit_sites' ) ); ?> </p> </form> <?php /** * Fires at the end of the 'Right Now' widget in the Network Admin dashboard. * * @since MU (3.0.0) */ do_action( 'mu_rightnow_end' ); /** * Fires at the end of the 'Right Now' widget in the Network Admin dashboard. * * @since MU (3.0.0) */ do_action( 'mu_activity_box_end' ); } ``` [do\_action( 'mu\_activity\_box\_end' )](../hooks/mu_activity_box_end) Fires at the end of the ‘Right Now’ widget in the Network Admin dashboard. [do\_action( 'mu\_rightnow\_end' )](../hooks/mu_rightnow_end) Fires at the end of the ‘Right Now’ widget in the Network Admin dashboard. [do\_action( 'wpmuadminresult' )](../hooks/wpmuadminresult) Fires in the Network Admin ‘Right Now’ dashboard widget just before the user and site search form fields. | Uses | Description | | --- | --- | | [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). | | [\_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. | | [get\_user\_count()](get_user_count) wp-includes/user.php | Returns the number of active users in your installation. | | [get\_blog\_count()](get_blog_count) wp-includes/ms-functions.php | Gets the number of active sites on the installation. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress list_theme_updates() list\_theme\_updates() ====================== Display the upgrade themes form. File: `wp-admin/update-core.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/update-core.php/) ``` function list_theme_updates() { $themes = get_theme_updates(); if ( empty( $themes ) ) { echo '<h2>' . __( 'Themes' ) . '</h2>'; echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>'; return; } $form_action = 'update-core.php?action=do-theme-upgrade'; $themes_count = count( $themes ); ?> <h2> <?php printf( '%s <span class="count">(%d)</span>', __( 'Themes' ), number_format_i18n( $themes_count ) ); ?> </h2> <p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click &#8220;Update Themes&#8221;.' ); ?></p> <p> <?php printf( /* translators: %s: Link to documentation on child themes. */ __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ) ); ?> </p> <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade"> <?php wp_nonce_field( 'upgrade-core' ); ?> <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e( 'Update Themes' ); ?>" name="upgrade" /></p> <table class="widefat updates-table" id="update-themes-table"> <thead> <tr> <td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td> <td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td> </tr> </thead> <tbody class="plugins"> <?php $auto_updates = array(); if ( wp_is_auto_update_enabled_for_type( 'theme' ) ) { $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); $auto_update_notice = ' | ' . wp_get_auto_update_message(); } foreach ( $themes as $stylesheet => $theme ) { $requires_wp = isset( $theme->update['requires'] ) ? $theme->update['requires'] : null; $requires_php = isset( $theme->update['requires_php'] ) ? $theme->update['requires_php'] : null; $compatible_wp = is_wp_version_compatible( $requires_wp ); $compatible_php = is_php_version_compatible( $requires_php ); $compat = ''; if ( ! $compatible_wp && ! $compatible_php ) { $compat .= '<br>' . __( 'This update does not work with your versions of WordPress and PHP.' ) . '&nbsp;'; if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { $compat .= sprintf( /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), esc_url( self_admin_url( 'update-core.php' ) ), esc_url( wp_get_update_php_url() ) ); $annotation = wp_get_update_php_annotation(); if ( $annotation ) { $compat .= '</p><p><em>' . $annotation . '</em>'; } } elseif ( current_user_can( 'update_core' ) ) { $compat .= sprintf( /* translators: %s: URL to WordPress Updates screen. */ __( '<a href="%s">Please update WordPress</a>.' ), esc_url( self_admin_url( 'update-core.php' ) ) ); } elseif ( current_user_can( 'update_php' ) ) { $compat .= sprintf( /* translators: %s: URL to Update PHP page. */ __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) ); $annotation = wp_get_update_php_annotation(); if ( $annotation ) { $compat .= '</p><p><em>' . $annotation . '</em>'; } } } elseif ( ! $compatible_wp ) { $compat .= '<br>' . __( 'This update does not work with your version of WordPress.' ) . '&nbsp;'; if ( current_user_can( 'update_core' ) ) { $compat .= sprintf( /* translators: %s: URL to WordPress Updates screen. */ __( '<a href="%s">Please update WordPress</a>.' ), esc_url( self_admin_url( 'update-core.php' ) ) ); } } elseif ( ! $compatible_php ) { $compat .= '<br>' . __( 'This update does not work with your version of PHP.' ) . '&nbsp;'; if ( current_user_can( 'update_php' ) ) { $compat .= sprintf( /* translators: %s: URL to Update PHP page. */ __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) ); $annotation = wp_get_update_php_annotation(); if ( $annotation ) { $compat .= '</p><p><em>' . $annotation . '</em>'; } } } $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); ?> <tr> <td class="check-column"> <?php if ( $compatible_wp && $compatible_php ) : ?> <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" /> <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"> <?php /* translators: %s: Theme name. */ printf( __( 'Select %s' ), $theme->display( 'Name' ) ); ?> </label> <?php endif; ?> </td> <td class="plugin-title"><p> <img src="<?php echo esc_url( $theme->get_screenshot() . '?ver=' . $theme->version ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" /> <strong><?php echo $theme->display( 'Name' ); ?></strong> <?php printf( /* translators: 1: Theme version, 2: New version. */ __( 'You have version %1$s installed. Update to %2$s.' ), $theme->display( 'Version' ), $theme->update['new_version'] ); echo ' ' . $compat; if ( in_array( $stylesheet, $auto_updates, true ) ) { echo $auto_update_notice; } ?> </p></td> </tr> <?php } ?> </tbody> <tfoot> <tr> <td class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td> <td class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></td> </tr> </tfoot> </table> <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Themes' ); ?>" name="upgrade" /></p> </form> <?php } ``` | Uses | Description | | --- | --- | | [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. | | [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. | | [is\_wp\_version\_compatible()](is_wp_version_compatible) wp-includes/functions.php | Checks compatibility with the current WordPress version. | | [is\_php\_version\_compatible()](is_php_version_compatible) wp-includes/functions.php | Checks compatibility with the current PHP version. | | [wp\_get\_update\_php\_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\_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. | | [get\_theme\_updates()](get_theme_updates) wp-admin/includes/update.php | Retrieves themes with updates available. | | [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\_get\_auto\_update\_message()](wp_get_auto_update_message) wp-admin/includes/update.php | Determines the appropriate auto-update message to be displayed. | | [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. | | [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. | | [\_\_()](__) 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. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [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 | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress add_cssclass( string $class_to_add, string $classes ): string add\_cssclass( string $class\_to\_add, string $classes ): string ================================================================ Adds a CSS class to a string. `$class_to_add` string Required The CSS class to add. `$classes` string Required The string to add the CSS class to. string The string with the CSS class added. File: `wp-admin/includes/menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/menu.php/) ``` function add_cssclass( $class_to_add, $classes ) { if ( empty( $classes ) ) { return $class_to_add; } return $classes . ' ' . $class_to_add; } ``` | Used By | Description | | --- | --- | | [add\_menu\_classes()](add_menu_classes) wp-admin/includes/menu.php | Adds CSS classes for top-level administration menu items. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress users_can_register_signup_filter(): bool users\_can\_register\_signup\_filter(): bool ============================================ Determines whether users can self-register, based on Network settings. bool File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/) ``` function users_can_register_signup_filter() { $registration = get_site_option( 'registration' ); return ( 'all' === $registration || 'user' === $registration ); } ``` | 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. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress rest_sanitize_boolean( bool|string|int $value ): bool rest\_sanitize\_boolean( bool|string|int $value ): bool ======================================================= Changes a boolean-like value into the proper boolean value. `$value` bool|string|int Required The value being evaluated. bool Returns the proper associated boolean value. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_sanitize_boolean( $value ) { // String values are translated to `true`; make sure 'false' is false. if ( is_string( $value ) ) { $value = strtolower( $value ); if ( in_array( $value, array( 'false', '0' ), true ) ) { $value = false; } } // Everything else will map nicely to boolean. return (bool) $value; } ``` | Used By | Description | | --- | --- | | [rest\_sanitize\_value\_from\_schema()](rest_sanitize_value_from_schema) wp-includes/rest-api.php | Sanitize a value based on a schema. | | Version | Description | | --- | --- | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. | wordpress rewind_posts() rewind\_posts() =============== Rewind the loop posts. File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/) ``` function rewind_posts() { global $wp_query; if ( ! isset( $wp_query ) ) { return; } $wp_query->rewind_posts(); } ``` | Uses | Description | | --- | --- | | [WP\_Query::rewind\_posts()](../classes/wp_query/rewind_posts) wp-includes/class-wp-query.php | Rewind the posts and reset post index. | | Version | Description | | --- | --- | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress delete_post_meta_by_key( string $post_meta_key ): bool delete\_post\_meta\_by\_key( string $post\_meta\_key ): bool ============================================================ Deletes everything from post meta matching the given meta key. `$post_meta_key` string Required Key to search for when deleting. bool Whether the post meta key was deleted from the database. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function delete_post_meta_by_key( $post_meta_key ) { return delete_metadata( 'post', null, $post_meta_key, '', true ); } ``` | Uses | Description | | --- | --- | | [delete\_metadata()](delete_metadata) wp-includes/meta.php | Deletes metadata for the specified object. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress atom_enclosure() atom\_enclosure() ================= Displays the atom enclosure for the current post. Uses the global $post to check whether the post requires a password and if the user has the password for the post. If not then it will return before displaying. Also uses the function [get\_post\_custom()](get_post_custom) to get the post’s ‘enclosure’ metadata field and parses the value to display the enclosure(s). The enclosure(s) consist of link HTML tag(s) with a URI and other attributes. File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/) ``` function atom_enclosure() { if ( post_password_required() ) { return; } foreach ( (array) get_post_custom() as $key => $val ) { if ( 'enclosure' === $key ) { foreach ( (array) $val as $enc ) { $enclosure = explode( "\n", $enc ); $url = ''; $type = ''; $length = 0; $mimes = get_allowed_mime_types(); // Parse URL. if ( isset( $enclosure[0] ) && is_string( $enclosure[0] ) ) { $url = trim( $enclosure[0] ); } // Parse length and type. for ( $i = 1; $i <= 2; $i++ ) { if ( isset( $enclosure[ $i ] ) ) { if ( is_numeric( $enclosure[ $i ] ) ) { $length = trim( $enclosure[ $i ] ); } elseif ( in_array( $enclosure[ $i ], $mimes, true ) ) { $type = trim( $enclosure[ $i ] ); } } } $html_link_tag = sprintf( "<link href=\"%s\" rel=\"enclosure\" length=\"%d\" type=\"%s\" />\n", esc_url( $url ), esc_attr( $length ), esc_attr( $type ) ); /** * Filters the atom enclosure HTML link tag for the current post. * * @since 2.2.0 * * @param string $html_link_tag The HTML link tag with a URI and other attributes. */ echo apply_filters( 'atom_enclosure', $html_link_tag ); } } } } ``` [apply\_filters( 'atom\_enclosure', string $html\_link\_tag )](../hooks/atom_enclosure) Filters the atom enclosure HTML link tag for the current post. | Uses | Description | | --- | --- | | [get\_allowed\_mime\_types()](get_allowed_mime_types) wp-includes/functions.php | Retrieves the list of allowed mime types and file extensions. | | [post\_password\_required()](post_password_required) wp-includes/post-template.php | Determines whether the post requires password and whether a correct password has been provided. | | [get\_post\_custom()](get_post_custom) wp-includes/post.php | Retrieves post meta fields, based on post ID. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Version | Description | | --- | --- | | [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
programming_docs
wordpress format_to_edit( string $content, bool $rich_text = false ): string format\_to\_edit( string $content, bool $rich\_text = false ): string ===================================================================== Acts on text which is about to be edited. The $content is run through [esc\_textarea()](esc_textarea) , which uses htmlspecialchars() to convert special characters to HTML entities. If `$richedit` is set to true, it is simply a holder for the [‘format\_to\_edit’](../hooks/format_to_edit) filter. `$content` string Required The text about to be edited. `$rich_text` bool Optional Whether `$content` should be considered rich text, in which case it would not be passed through [esc\_textarea()](esc_textarea) . Default: `false` string The text after the filter (and possibly htmlspecialchars()) has been run. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function format_to_edit( $content, $rich_text = false ) { /** * Filters the text to be formatted for editing. * * @since 1.2.0 * * @param string $content The text, prior to formatting for editing. */ $content = apply_filters( 'format_to_edit', $content ); if ( ! $rich_text ) { $content = esc_textarea( $content ); } return $content; } ``` [apply\_filters( 'format\_to\_edit', string $content )](../hooks/format_to_edit) Filters the text to be formatted for editing. | Uses | Description | | --- | --- | | [esc\_textarea()](esc_textarea) wp-includes/formatting.php | Escaping for textarea values. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor | | [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. | | [sanitize\_post\_field()](sanitize_post_field) wp-includes/post.php | Sanitizes a post field based on context. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `$richedit` parameter was renamed to `$rich_text` for clarity. | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress wp_print_scripts( string|bool|array $handles = false ): string[] wp\_print\_scripts( string|bool|array $handles = false ): string[] ================================================================== Prints scripts in document head that are in the $handles queue. Called by admin-header.php and [‘wp\_head’](../hooks/wp_head) hook. Since it is called by wp\_head on every page load, the function does not instantiate the [WP\_Scripts](../classes/wp_scripts) object unless script names are explicitly passed. Makes use of already-instantiated $wp\_scripts global if present. Use provided [‘wp\_print\_scripts’](../hooks/wp_print_scripts) hook to register/enqueue new scripts. * [WP\_Scripts::do\_item()](../classes/wp_scripts/do_item) `$handles` string|bool|array Optional Scripts 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-scripts.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-scripts.php/) ``` function wp_print_scripts( $handles = false ) { global $wp_scripts; /** * Fires before scripts in the $handles queue are printed. * * @since 2.1.0 */ do_action( 'wp_print_scripts' ); if ( '' === $handles ) { // For 'wp_head'. $handles = false; } _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { if ( ! $handles ) { return array(); // No need to instantiate if nothing is there. } } return wp_scripts()->do_items( $handles ); } ``` [do\_action( 'wp\_print\_scripts' )](../hooks/wp_print_scripts) Fires before scripts in the $handles queue are printed. | Uses | Description | | --- | --- | | [wp\_scripts()](wp_scripts) wp-includes/functions.wp-scripts.php | Initialize $wp\_scripts 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\_Editors::print\_tinymce\_scripts()](../classes/_wp_editors/print_tinymce_scripts) wp-includes/class-wp-editor.php | Print (output) the main TinyMCE scripts. | | [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\_Customize\_Manager::wp\_die()](../classes/wp_customize_manager/wp_die) wp-includes/class-wp-customize-manager.php | Custom wp\_die wrapper. Returns either the standard message for UI or the Ajax message. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress did_filter( string $hook_name ): int did\_filter( string $hook\_name ): int ====================================== Retrieves the number of times a filter has been applied during the current request. `$hook_name` string Required The name of the filter hook. int The number of times the filter hook has been applied. File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/) ``` function did_filter( $hook_name ) { global $wp_filters; if ( ! isset( $wp_filters[ $hook_name ] ) ) { return 0; } return $wp_filters[ $hook_name ]; } ``` | Version | Description | | --- | --- | | [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. | wordpress dynamic_sidebar( int|string $index = 1 ): bool dynamic\_sidebar( int|string $index = 1 ): bool =============================================== Display dynamic sidebar. By default this displays the default sidebar or ‘sidebar-1’. If your theme specifies the ‘id’ or ‘name’ parameter for its registered sidebars you can pass an ID or name as the $index parameter. Otherwise, you can pass in a numerical index to display the sidebar at that index. `$index` int|string Optional Index, name or ID of dynamic sidebar. Default: `1` bool True, if widget sidebar was found and called. False if not found or not called. File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/) ``` function dynamic_sidebar( $index = 1 ) { global $wp_registered_sidebars, $wp_registered_widgets; if ( is_int( $index ) ) { $index = "sidebar-$index"; } else { $index = sanitize_title( $index ); foreach ( (array) $wp_registered_sidebars as $key => $value ) { if ( sanitize_title( $value['name'] ) === $index ) { $index = $key; break; } } } $sidebars_widgets = wp_get_sidebars_widgets(); if ( empty( $wp_registered_sidebars[ $index ] ) || empty( $sidebars_widgets[ $index ] ) || ! is_array( $sidebars_widgets[ $index ] ) ) { /** This action is documented in wp-includes/widget.php */ do_action( 'dynamic_sidebar_before', $index, false ); /** This action is documented in wp-includes/widget.php */ do_action( 'dynamic_sidebar_after', $index, false ); /** This filter is documented in wp-includes/widget.php */ return apply_filters( 'dynamic_sidebar_has_widgets', false, $index ); } $sidebar = $wp_registered_sidebars[ $index ]; $sidebar['before_sidebar'] = sprintf( $sidebar['before_sidebar'], $sidebar['id'], $sidebar['class'] ); /** * Fires before widgets are rendered in a dynamic sidebar. * * Note: The action also fires for empty sidebars, and on both the front end * and back end, including the Inactive Widgets sidebar on the Widgets screen. * * @since 3.9.0 * * @param int|string $index Index, name, or ID of the dynamic sidebar. * @param bool $has_widgets Whether the sidebar is populated with widgets. * Default true. */ do_action( 'dynamic_sidebar_before', $index, true ); if ( ! is_admin() && ! empty( $sidebar['before_sidebar'] ) ) { echo $sidebar['before_sidebar']; } $did_one = false; foreach ( (array) $sidebars_widgets[ $index ] as $id ) { if ( ! isset( $wp_registered_widgets[ $id ] ) ) { continue; } $params = array_merge( array( array_merge( $sidebar, array( 'widget_id' => $id, 'widget_name' => $wp_registered_widgets[ $id ]['name'], ) ), ), (array) $wp_registered_widgets[ $id ]['params'] ); // Substitute HTML `id` and `class` attributes into `before_widget`. $classname_ = ''; foreach ( (array) $wp_registered_widgets[ $id ]['classname'] as $cn ) { if ( is_string( $cn ) ) { $classname_ .= '_' . $cn; } elseif ( is_object( $cn ) ) { $classname_ .= '_' . get_class( $cn ); } } $classname_ = ltrim( $classname_, '_' ); $params[0]['before_widget'] = sprintf( $params[0]['before_widget'], str_replace( '\\', '_', $id ), $classname_ ); /** * Filters the parameters passed to a widget's display callback. * * Note: The filter is evaluated on both the front end and back end, * including for the Inactive Widgets sidebar on the Widgets screen. * * @since 2.5.0 * * @see register_sidebar() * * @param array $params { * @type array $args { * An array of widget display arguments. * * @type string $name Name of the sidebar the widget is assigned to. * @type string $id ID of the sidebar the widget is assigned to. * @type string $description The sidebar description. * @type string $class CSS class applied to the sidebar container. * @type string $before_widget HTML markup to prepend to each widget in the sidebar. * @type string $after_widget HTML markup to append to each widget in the sidebar. * @type string $before_title HTML markup to prepend to the widget title when displayed. * @type string $after_title HTML markup to append to the widget title when displayed. * @type string $widget_id ID of the widget. * @type string $widget_name Name of the widget. * } * @type array $widget_args { * An array of multi-widget arguments. * * @type int $number Number increment used for multiples of the same widget. * } * } */ $params = apply_filters( 'dynamic_sidebar_params', $params ); $callback = $wp_registered_widgets[ $id ]['callback']; /** * Fires before a widget's display callback is called. * * Note: The action fires on both the front end and back end, including * for widgets in the Inactive Widgets sidebar on the Widgets screen. * * The action is not fired for empty sidebars. * * @since 3.0.0 * * @param array $widget { * An associative array of widget arguments. * * @type string $name Name of the widget. * @type string $id Widget ID. * @type callable $callback When the hook is fired on the front end, `$callback` is an array * containing the widget object. Fired on the back end, `$callback` * is 'wp_widget_control', see `$_callback`. * @type array $params An associative array of multi-widget arguments. * @type string $classname CSS class applied to the widget container. * @type string $description The widget description. * @type array $_callback When the hook is fired on the back end, `$_callback` is populated * with an array containing the widget object, see `$callback`. * } */ do_action( 'dynamic_sidebar', $wp_registered_widgets[ $id ] ); if ( is_callable( $callback ) ) { call_user_func_array( $callback, $params ); $did_one = true; } } if ( ! is_admin() && ! empty( $sidebar['after_sidebar'] ) ) { echo $sidebar['after_sidebar']; } /** * Fires after widgets are rendered in a dynamic sidebar. * * Note: The action also fires for empty sidebars, and on both the front end * and back end, including the Inactive Widgets sidebar on the Widgets screen. * * @since 3.9.0 * * @param int|string $index Index, name, or ID of the dynamic sidebar. * @param bool $has_widgets Whether the sidebar is populated with widgets. * Default true. */ do_action( 'dynamic_sidebar_after', $index, true ); /** * Filters whether a sidebar has widgets. * * Note: The filter is also evaluated for empty sidebars, and on both the front end * and back end, including the Inactive Widgets sidebar on the Widgets screen. * * @since 3.9.0 * * @param bool $did_one Whether at least one widget was rendered in the sidebar. * Default false. * @param int|string $index Index, name, or ID of the dynamic sidebar. */ return apply_filters( 'dynamic_sidebar_has_widgets', $did_one, $index ); } ``` [do\_action( 'dynamic\_sidebar', array $widget )](../hooks/dynamic_sidebar) Fires before a widget’s display callback is called. [do\_action( 'dynamic\_sidebar\_after', int|string $index, bool $has\_widgets )](../hooks/dynamic_sidebar_after) Fires after widgets are rendered in a dynamic sidebar. [do\_action( 'dynamic\_sidebar\_before', int|string $index, bool $has\_widgets )](../hooks/dynamic_sidebar_before) Fires before widgets are rendered in a dynamic sidebar. [apply\_filters( 'dynamic\_sidebar\_has\_widgets', bool $did\_one, int|string $index )](../hooks/dynamic_sidebar_has_widgets) Filters whether a sidebar has widgets. [apply\_filters( 'dynamic\_sidebar\_params', array $params )](../hooks/dynamic_sidebar_params) Filters the parameters passed to a widget’s display callback. | Uses | Description | | --- | --- | | [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. | | [wp\_get\_sidebars\_widgets()](wp_get_sidebars_widgets) wp-includes/widgets.php | Retrieve full list of sidebars and their widget instance IDs. | | [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. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [WP\_Customize\_Widgets::render\_widget\_partial()](../classes/wp_customize_widgets/render_widget_partial) wp-includes/class-wp-customize-widgets.php | Renders a specific widget using the supplied sidebar arguments. | | [wp\_list\_widget\_controls()](wp_list_widget_controls) wp-admin/includes/widgets.php | Show the widgets and their settings for a sidebar. | | Version | Description | | --- | --- | | [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. | wordpress email_exists( string $email ): int|false email\_exists( string $email ): int|false ========================================= Determines whether the given email exists. For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook. `$email` string Required The email to check for existence. int|false The user ID on success, false on failure. This function will check whether or not a given email address ($email) has already been registered to a username, and returns that users ID (or false if none exists). See also [username\_exists](username_exists "Function Reference/username exists"). This function is normally used when a user is registering, to ensure that the E-mail address the user is attempting to register with has not already been registered. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function email_exists( $email ) { $user = get_user_by( 'email', $email ); if ( $user ) { $user_id = $user->ID; } else { $user_id = false; } /** * Filters whether the given email exists. * * @since 5.6.0 * * @param int|false $user_id The user ID associated with the email, * or false if the email does not exist. * @param string $email The email to check for existence. */ return apply_filters( 'email_exists', $user_id, $email ); } ``` [apply\_filters( 'email\_exists', int|false $user\_id, string $email )](../hooks/email_exists) Filters whether the given email exists. | Uses | Description | | --- | --- | | [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [WP\_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. | | [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. | | [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST | | [register\_new\_user()](register_new_user) wp-includes/user.php | Handles registering a new user. | | [wp\_insert\_user()](wp_insert_user) wp-includes/user.php | Inserts a user into the database. | | [wpmu\_validate\_user\_signup()](wpmu_validate_user_signup) wp-includes/ms-functions.php | Sanitizes and validates data required for a user sign-up. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress get_comment_link( WP_Comment|int|null $comment = null, array $args = array() ): string get\_comment\_link( WP\_Comment|int|null $comment = null, array $args = array() ): string ========================================================================================= Retrieves the link to a given comment. * [get\_page\_of\_comment()](get_page_of_comment) `$comment` [WP\_Comment](../classes/wp_comment)|int|null Optional Comment to retrieve. Default current comment. Default: `null` `$args` array Optional An array of optional arguments to override the defaults. * `type`stringPassed to [get\_page\_of\_comment()](get_page_of_comment) . * `page`intCurrent page of comments, for calculating comment pagination. * `per_page`intPer-page value for comment pagination. * `max_depth`intPassed to [get\_page\_of\_comment()](get_page_of_comment) . * `cpage`int|stringValue to use for the comment's "comment-page" or "cpage" value. If provided, this value overrides any value calculated from `$page` and `$per_page`. More Arguments from get\_page\_of\_comment( ... $args ) Array of optional arguments. * `type`stringLimit paginated comments to those matching a given type. Accepts `'comment'`, `'trackback'`, `'pingback'`, `'pings'` (trackbacks and pingbacks), or `'all'`. Default `'all'`. * `per_page`intPer-page count to use when calculating pagination. Defaults to the value of the `'comments_per_page'` option. * `max_depth`int|stringIf greater than 1, comment page will be determined for the top-level parent `$comment_ID`. Defaults to the value of the `'thread_comments_depth'` option. Default: `array()` string The permalink to the given comment. The following default arguments are used unless found in the optional $args argument: page The zero-based index for the page where the comment should appear. Defaults to 0. **Note**: for backward compatibility the entire $args argument is treated as an integer and used for this argument if it is not found to be an array. type The type of comment (not used directly). Defaults to 'all'. per\_page Number of comments per page. Defaults to 0. max\_depth Maximum depth to be considered for comments, when threaded (not used directly). Defaults to '' File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function get_comment_link( $comment = null, $args = array() ) { global $wp_rewrite, $in_comment_loop; $comment = get_comment( $comment ); // Back-compat. if ( ! is_array( $args ) ) { $args = array( 'page' => $args ); } $defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '', 'cpage' => null, ); $args = wp_parse_args( $args, $defaults ); $link = get_permalink( $comment->comment_post_ID ); // The 'cpage' param takes precedence. if ( ! is_null( $args['cpage'] ) ) { $cpage = $args['cpage']; // No 'cpage' is provided, so we calculate one. } else { if ( '' === $args['per_page'] && get_option( 'page_comments' ) ) { $args['per_page'] = get_option( 'comments_per_page' ); } if ( empty( $args['per_page'] ) ) { $args['per_page'] = 0; $args['page'] = 0; } $cpage = $args['page']; if ( '' == $cpage ) { if ( ! empty( $in_comment_loop ) ) { $cpage = get_query_var( 'cpage' ); } else { // Requires a database hit, so we only do it when we can't figure out from context. $cpage = get_page_of_comment( $comment->comment_ID, $args ); } } /* * If the default page displays the oldest comments, the permalinks for comments on the default page * do not need a 'cpage' query var. */ if ( 'oldest' === get_option( 'default_comments_page' ) && 1 === $cpage ) { $cpage = ''; } } if ( $cpage && get_option( 'page_comments' ) ) { if ( $wp_rewrite->using_permalinks() ) { if ( $cpage ) { $link = trailingslashit( $link ) . $wp_rewrite->comments_pagination_base . '-' . $cpage; } $link = user_trailingslashit( $link, 'comment' ); } elseif ( $cpage ) { $link = add_query_arg( 'cpage', $cpage, $link ); } } if ( $wp_rewrite->using_permalinks() ) { $link = user_trailingslashit( $link, 'comment' ); } $link = $link . '#comment-' . $comment->comment_ID; /** * Filters the returned single comment permalink. * * @since 2.8.0 * @since 4.4.0 Added the `$cpage` parameter. * * @see get_page_of_comment() * * @param string $link The comment permalink with '#comment-$id' appended. * @param WP_Comment $comment The current comment object. * @param array $args An array of arguments to override the defaults. * @param int $cpage The calculated 'cpage' value. */ return apply_filters( 'get_comment_link', $link, $comment, $args, $cpage ); } ``` [apply\_filters( 'get\_comment\_link', string $link, WP\_Comment $comment, array $args, int $cpage )](../hooks/get_comment_link) Filters the returned single comment permalink. | Uses | Description | | --- | --- | | [get\_query\_var()](get_query_var) wp-includes/query.php | Retrieves the value of a query variable in the [WP\_Query](../classes/wp_query) class. | | [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. | | [WP\_Rewrite::using\_permalinks()](../classes/wp_rewrite/using_permalinks) wp-includes/class-wp-rewrite.php | Determines whether permalinks are being used. | | [get\_page\_of\_comment()](get_page_of_comment) wp-includes/comment.php | Calculates what page number a comment will appear on for comment paging. | | [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. | | Used By | Description | | --- | --- | | [wp\_comments\_personal\_data\_exporter()](wp_comments_personal_data_exporter) wp-includes/comment.php | Finds and exports personal data associated with an email address from the comments table. | | [WP\_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\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. | | [\_wp\_ajax\_delete\_comment\_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\_Comments\_List\_Table::column\_date()](../classes/wp_comments_list_table/column_date) wp-admin/includes/class-wp-comments-list-table.php | | | [WP\_Comments\_List\_Table::column\_comment()](../classes/wp_comments_list_table/column_comment) wp-admin/includes/class-wp-comments-list-table.php | | | [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\_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. | | [comment\_link()](comment_link) wp-includes/feed.php | Displays the link to the comments. | | [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. | | [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. | | [get\_comment\_reply\_link()](get_comment_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to comment link. | | [get\_comment\_text()](get_comment_text) wp-includes/comment-template.php | Retrieves the text of the current comment. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the ability for `$comment` to also accept a [WP\_Comment](../classes/wp_comment) object. Added `$cpage` argument. | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
programming_docs
wordpress media_upload_library_form( array $errors ) media\_upload\_library\_form( array $errors ) ============================================= Outputs the legacy media upload form for the media library. `$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_library_form( $errors ) { global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types; media_upload_header(); $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&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'; } $q = $_GET; $q['posts_per_page'] = 10; $q['paged'] = isset( $q['paged'] ) ? (int) $q['paged'] : 0; if ( $q['paged'] < 1 ) { $q['paged'] = 1; } $q['offset'] = ( $q['paged'] - 1 ) * 10; if ( $q['offset'] < 1 ) { $q['offset'] = 0; } list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query( $q ); ?> <form id="filter" method="get"> <input type="hidden" name="type" value="<?php echo esc_attr( $type ); ?>" /> <input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" /> <input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" /> <input type="hidden" name="post_mime_type" value="<?php echo isset( $_GET['post_mime_type'] ) ? esc_attr( $_GET['post_mime_type'] ) : ''; ?>" /> <input type="hidden" name="context" value="<?php echo isset( $_GET['context'] ) ? esc_attr( $_GET['context'] ) : ''; ?>" /> <p id="media-search" class="search-box"> <label class="screen-reader-text" for="media-search-input"><?php _e( 'Search Media' ); ?>:</label> <input type="search" id="media-search-input" name="s" value="<?php the_search_query(); ?>" /> <?php submit_button( __( 'Search Media' ), '', '', false ); ?> </p> <ul class="subsubsub"> <?php $type_links = array(); $_num_posts = (array) wp_count_attachments(); $matches = wp_match_mime_types( array_keys( $post_mime_types ), array_keys( $_num_posts ) ); foreach ( $matches as $_type => $reals ) { foreach ( $reals as $real ) { if ( isset( $num_posts[ $_type ] ) ) { $num_posts[ $_type ] += $_num_posts[ $real ]; } else { $num_posts[ $_type ] = $_num_posts[ $real ]; } } } // If available type specified by media button clicked, filter by that type. if ( empty( $_GET['post_mime_type'] ) && ! empty( $num_posts[ $type ] ) ) { $_GET['post_mime_type'] = $type; list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); } if ( empty( $_GET['post_mime_type'] ) || 'all' === $_GET['post_mime_type'] ) { $class = ' class="current"'; } else { $class = ''; } $type_links[] = '<li><a href="' . esc_url( add_query_arg( array( 'post_mime_type' => 'all', 'paged' => false, 'm' => false, ) ) ) . '"' . $class . '>' . __( 'All Types' ) . '</a>'; foreach ( $post_mime_types as $mime_type => $label ) { $class = ''; if ( ! wp_match_mime_types( $mime_type, $avail_post_mime_types ) ) { continue; } if ( isset( $_GET['post_mime_type'] ) && wp_match_mime_types( $mime_type, $_GET['post_mime_type'] ) ) { $class = ' class="current"'; } $type_links[] = '<li><a href="' . esc_url( add_query_arg( array( 'post_mime_type' => $mime_type, 'paged' => false, ) ) ) . '"' . $class . '>' . sprintf( translate_nooped_plural( $label[2], $num_posts[ $mime_type ] ), '<span id="' . $mime_type . '-counter">' . number_format_i18n( $num_posts[ $mime_type ] ) . '</span>' ) . '</a>'; } /** * Filters the media upload mime type list items. * * Returned values should begin with an `<li>` tag. * * @since 3.1.0 * * @param string[] $type_links An array of list items containing mime type link HTML. */ echo implode( ' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>'; unset( $type_links ); ?> </ul> <div class="tablenav"> <?php $page_links = paginate_links( array( 'base' => add_query_arg( 'paged', '%#%' ), 'format' => '', 'prev_text' => __( '&laquo;' ), 'next_text' => __( '&raquo;' ), 'total' => ceil( $wp_query->found_posts / 10 ), 'current' => $q['paged'], ) ); if ( $page_links ) { echo "<div class='tablenav-pages'>$page_links</div>"; } ?> <div class="alignleft actions"> <?php $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC"; $arc_result = $wpdb->get_results( $arc_query ); $month_count = count( $arc_result ); $selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0; if ( $month_count && ! ( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?> <select name='m'> <option<?php selected( $selected_month, 0 ); ?> value='0'><?php _e( 'All dates' ); ?></option> <?php foreach ( $arc_result as $arc_row ) { if ( 0 == $arc_row->yyear ) { continue; } $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 ); if ( $arc_row->yyear . $arc_row->mmonth == $selected_month ) { $default = ' selected="selected"'; } else { $default = ''; } echo "<option$default value='" . esc_attr( $arc_row->yyear . $arc_row->mmonth ) . "'>"; echo esc_html( $wp_locale->get_month( $arc_row->mmonth ) . " $arc_row->yyear" ); echo "</option>\n"; } ?> </select> <?php } ?> <?php submit_button( __( 'Filter &#187;' ), '', 'post-query-submit', false ); ?> </div> <br class="clear" /> </div> </form> <form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="library-form"> <?php wp_nonce_field( 'media-form' ); ?> <script type="text/javascript"> jQuery(function($){ var preloaded = $(".media-item.preloaded"); if ( preloaded.length > 0 ) { preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');}); updateMediaForm(); } }); </script> <div id="media-items"> <?php add_filter( 'attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2 ); ?> <?php echo get_media_items( null, $errors ); ?> </div> <p class="ml-submit"> <?php submit_button( __( 'Save all changes' ), 'savebutton', 'save', false ); ?> <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> </p> </form> <?php } ``` [apply\_filters( 'media\_upload\_form\_url', string $form\_action\_url, string $type )](../hooks/media_upload_form_url) Filters the media upload form action URL. [apply\_filters( 'media\_upload\_mime\_type\_links', string[] $type\_links )](../hooks/media_upload_mime_type_links) Filters the media upload mime type list items. | Uses | Description | | --- | --- | | [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). | | [selected()](selected) wp-includes/general-template.php | Outputs the HTML selected attribute. | | [wp\_count\_attachments()](wp_count_attachments) wp-includes/post.php | Counts number of attachments for the mime type(s). | | [wp\_match\_mime\_types()](wp_match_mime_types) wp-includes/post.php | Checks a MIME-Type against a list. | | [get\_user\_setting()](get_user_setting) wp-includes/option.php | Retrieves user interface setting value based on setting name. | | [WP\_Locale::get\_month()](../classes/wp_locale/get_month) wp-includes/class-wp-locale.php | Retrieves the full translated month by month number. | | [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. | | [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. | | [media\_upload\_header()](media_upload_header) wp-admin/includes/media.php | Outputs the legacy media upload header. | | [the\_search\_query()](the_search_query) wp-includes/general-template.php | Displays the contents of the search query variable. | | [zeroise()](zeroise) wp-includes/formatting.php | Add leading zeros when necessary. | | [translate\_nooped\_plural()](translate_nooped_plural) wp-includes/l10n.php | Translates and returns the singular or plural form of a string that’s been registered with [\_n\_noop()](_n_noop) or [\_nx\_noop()](_nx_noop) . | | [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. | | [get\_media\_items()](get_media_items) wp-admin/includes/media.php | Retrieves HTML for media items of post gallery. | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [\_\_()](__) 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. | | [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. | | [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. | | [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 | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress _wp_privacy_action_request_types(): string[] \_wp\_privacy\_action\_request\_types(): 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 all personal data request types. string[] List of core privacy action types. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function _wp_privacy_action_request_types() { return array( 'export_personal_data', 'remove_personal_data', ); } ``` | Used By | Description | | --- | --- | | [\_wp\_privacy\_account\_request\_confirmed\_message()](_wp_privacy_account_request_confirmed_message) wp-includes/user.php | Returns request confirmation message HTML. | | [wp\_create\_user\_request()](wp_create_user_request) wp-includes/user.php | Creates and logs a user request to perform a specific action. | | [\_wp\_personal\_data\_handle\_actions()](_wp_personal_data_handle_actions) wp-admin/includes/privacy-tools.php | Handle list table actions. | | Version | Description | | --- | --- | | [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. | wordpress get_the_password_form( int|WP_Post $post ): string get\_the\_password\_form( int|WP\_Post $post ): string ====================================================== Retrieves protected post password form content. `$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global $post. string HTML content for password form for password protected post. File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/) ``` function get_the_password_form( $post = 0 ) { $post = get_post( $post ); $label = 'pwbox-' . ( empty( $post->ID ) ? rand() : $post->ID ); $output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="post-password-form" method="post"> <p>' . __( 'This content is password protected. To view it please enter your password below:' ) . '</p> <p><label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr_x( 'Enter', 'post password form' ) . '" /></p></form> '; /** * Filters the HTML output for the protected post password form. * * If modifying the password field, please note that the core database schema * limits the password field to 20 characters regardless of the value of the * size attribute in the form input. * * @since 2.7.0 * @since 5.8.0 Added the `$post` parameter. * * @param string $output The password form HTML output. * @param WP_Post $post Post object. */ return apply_filters( 'the_password_form', $output, $post ); } ``` [apply\_filters( 'the\_password\_form', string $output, WP\_Post $post )](../hooks/the_password_form) Filters the HTML output for the protected post password 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. | | [site\_url()](site_url) wp-includes/link-template.php | Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Used By | Description | | --- | --- | | [get\_the\_content()](get_the_content) wp-includes/post-template.php | Retrieves the post content. | | Version | Description | | --- | --- | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. | wordpress is_archived( int $id ): string is\_archived( int $id ): string =============================== Check if a particular blog is archived. `$id` int Required Blog ID. string Whether the blog is archived or not. File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/) ``` function is_archived( $id ) { return get_blog_status( $id, 'archived' ); } ``` | Uses | Description | | --- | --- | | [get\_blog\_status()](get_blog_status) wp-includes/ms-blogs.php | Get a blog details field. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress wp_kses_bad_protocol_once( string $string, string[] $allowed_protocols, int $count = 1 ): string wp\_kses\_bad\_protocol\_once( string $string, string[] $allowed\_protocols, int $count = 1 ): string ===================================================================================================== Sanitizes content from bad protocols and other characters. This function searches for URL protocols at the beginning of the string, while handling whitespace and HTML entities. `$string` string Required Content to check for bad protocols. `$allowed_protocols` string[] Required Array of allowed URL protocols. `$count` int Optional Depth of call recursion to this function. Default: `1` string Sanitized content. File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/) ``` function wp_kses_bad_protocol_once( $string, $allowed_protocols, $count = 1 ) { $string = preg_replace( '/(&#0*58(?![;0-9])|&#x0*3a(?![;a-f0-9]))/i', '$1;', $string ); $string2 = preg_split( '/:|&#0*58;|&#x0*3a;|&colon;/i', $string, 2 ); if ( isset( $string2[1] ) && ! preg_match( '%/\?%', $string2[0] ) ) { $string = trim( $string2[1] ); $protocol = wp_kses_bad_protocol_once2( $string2[0], $allowed_protocols ); if ( 'feed:' === $protocol ) { if ( $count > 2 ) { return ''; } $string = wp_kses_bad_protocol_once( $string, $allowed_protocols, ++$count ); if ( empty( $string ) ) { return $string; } } $string = $protocol . $string; } return $string; } ``` | Uses | Description | | --- | --- | | [wp\_kses\_bad\_protocol\_once()](wp_kses_bad_protocol_once) wp-includes/kses.php | Sanitizes content from bad protocols and other characters. | | Used By | Description | | --- | --- | | [wp\_kses\_bad\_protocol()](wp_kses_bad_protocol) wp-includes/kses.php | Sanitizes a string and removed disallowed URL protocols. | | [wp\_kses\_bad\_protocol\_once()](wp_kses_bad_protocol_once) wp-includes/kses.php | Sanitizes content from bad protocols and other characters. | | Version | Description | | --- | --- | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. | wordpress the_author_description() the\_author\_description() ========================== This function has been deprecated. Use [the\_author\_meta()](the_author_meta) instead. Display the description 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_description() { _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'description\')' ); the_author_meta('description'); } ``` | 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) | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. | wordpress wp_cache_get_last_changed( string $group ): string wp\_cache\_get\_last\_changed( string $group ): string ====================================================== Gets last changed date for the specified cache group. `$group` string Required Where the cache contents are grouped. string UNIX timestamp with microseconds representing when the group was last changed. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp_cache_get_last_changed( $group ) { $last_changed = wp_cache_get( 'last_changed', $group ); if ( ! $last_changed ) { $last_changed = microtime(); wp_cache_set( 'last_changed', $last_changed, $group ); } return $last_changed; } ``` | Uses | Description | | --- | --- | | [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. | | [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. | | Used By | Description | | --- | --- | | [WP\_Query::generate\_cache\_key()](../classes/wp_query/generate_cache_key) wp-includes/class-wp-query.php | Generate cache key. | | [\_find\_post\_by\_old\_slug()](_find_post_by_old_slug) wp-includes/query.php | Find the post ID for redirecting an old slug. | | [\_find\_post\_by\_old\_date()](_find_post_by_old_date) wp-includes/query.php | Find the post ID for redirecting an old date. | | [WP\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. | | [WP\_Network\_Query::get\_networks()](../classes/wp_network_query/get_networks) wp-includes/class-wp-network-query.php | Gets a list of networks matching the query vars. | | [WP\_Site\_Query::get\_sites()](../classes/wp_site_query/get_sites) wp-includes/class-wp-site-query.php | Retrieves a list of sites matching the query vars. | | [WP\_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\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. | | [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\_objects\_in\_term()](get_objects_in_term) wp-includes/taxonomy.php | Retrieves object IDs of valid taxonomy and term. | | [get\_page\_by\_path()](get_page_by_path) wp-includes/post.php | Retrieves a page given its path. | | [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). | | Version | Description | | --- | --- | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
programming_docs
wordpress unregister_block_pattern( string $pattern_name ): bool unregister\_block\_pattern( string $pattern\_name ): bool ========================================================= Unregisters a block pattern. `$pattern_name` string Required Block pattern name including namespace. bool True if the pattern was unregistered with success and false otherwise. File: `wp-includes/class-wp-block-patterns-registry.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-block-patterns-registry.php/) ``` function unregister_block_pattern( $pattern_name ) { return WP_Block_Patterns_Registry::get_instance()->unregister( $pattern_name ); } ``` | 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. | | Version | Description | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. | wordpress has_meta( int $postid ): array[] has\_meta( int $postid ): array[] ================================= Returns meta data for the given post ID. `$postid` int Required A post ID. array[] Array of meta data arrays for the given post ID. * `...$0`array Associative array of meta data. + `meta_key`stringMeta key. + `meta_value`mixedMeta value. + `meta_id`stringMeta ID as a numeric string. + `post_id`stringPost ID as a numeric string. File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/) ``` function has_meta( $postid ) { global $wpdb; return $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value, meta_id, post_id FROM $wpdb->postmeta WHERE post_id = %d ORDER BY meta_key,meta_id", $postid ), ARRAY_A ); } ``` | Uses | Description | | --- | --- | | [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 | | --- | --- | | [post\_custom\_meta\_box()](post_custom_meta_box) wp-admin/includes/meta-boxes.php | Displays custom fields form fields. | | [wp\_xmlrpc\_server::get\_custom\_fields()](../classes/wp_xmlrpc_server/get_custom_fields) wp-includes/class-wp-xmlrpc-server.php | Retrieve custom fields for post. | | Version | Description | | --- | --- | | [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. | wordpress wp_delete_auto_drafts() wp\_delete\_auto\_drafts() ========================== Deletes auto-drafts for new posts that are > 7 days old. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function wp_delete_auto_drafts() { global $wpdb; // Cleanup old auto-drafts more than 7 days old. $old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" ); foreach ( (array) $old_posts as $delete ) { // Force delete. wp_delete_post( $delete, true ); } } ``` | Uses | Description | | --- | --- | | [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. | | [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. | | Version | Description | | --- | --- | | [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. | wordpress wp_dropdown_languages( string|array $args = array() ): string wp\_dropdown\_languages( string|array $args = array() ): string =============================================================== Displays or returns a Language selector. * [get\_available\_languages()](get_available_languages) * [wp\_get\_available\_translations()](wp_get_available_translations) `$args` string|array Optional Array or string of arguments for outputting the language selector. * `id`stringID attribute of the select element. Default `'locale'`. * `name`stringName attribute of the select element. Default `'locale'`. * `languages`arrayList of installed languages, contain only the locales. * `translations`arrayList of available translations. Default result of [wp\_get\_available\_translations()](wp_get_available_translations) . * `selected`stringLanguage which should be selected. * `echo`bool|intWhether to echo the generated markup. Accepts 0, 1, or their boolean equivalents. Default 1. * `show_available_translations`boolWhether to show available translations. Default true. * `show_option_site_default`boolWhether to show an option to fall back to the site's locale. Default false. * `show_option_en_us`boolWhether to show an option for English (United States). Default true. * `explicit_option_en_us`boolWhether the English (United States) option uses an explicit value of en\_US instead of an empty value. Default false. Default: `array()` string HTML dropdown list of languages. File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/) ``` function wp_dropdown_languages( $args = array() ) { $parsed_args = wp_parse_args( $args, array( 'id' => 'locale', 'name' => 'locale', 'languages' => array(), 'translations' => array(), 'selected' => '', 'echo' => 1, 'show_available_translations' => true, 'show_option_site_default' => false, 'show_option_en_us' => true, 'explicit_option_en_us' => false, ) ); // Bail if no ID or no name. if ( ! $parsed_args['id'] || ! $parsed_args['name'] ) { return; } // English (United States) uses an empty string for the value attribute. if ( 'en_US' === $parsed_args['selected'] && ! $parsed_args['explicit_option_en_us'] ) { $parsed_args['selected'] = ''; } $translations = $parsed_args['translations']; if ( empty( $translations ) ) { require_once ABSPATH . 'wp-admin/includes/translation-install.php'; $translations = wp_get_available_translations(); } /* * $parsed_args['languages'] should only contain the locales. Find the locale in * $translations to get the native name. Fall back to locale. */ $languages = array(); foreach ( $parsed_args['languages'] as $locale ) { if ( isset( $translations[ $locale ] ) ) { $translation = $translations[ $locale ]; $languages[] = array( 'language' => $translation['language'], 'native_name' => $translation['native_name'], 'lang' => current( $translation['iso'] ), ); // Remove installed language from available translations. unset( $translations[ $locale ] ); } else { $languages[] = array( 'language' => $locale, 'native_name' => $locale, 'lang' => '', ); } } $translations_available = ( ! empty( $translations ) && $parsed_args['show_available_translations'] ); // Holds the HTML markup. $structure = array(); // List installed languages. if ( $translations_available ) { $structure[] = '<optgroup label="' . esc_attr_x( 'Installed', 'translations' ) . '">'; } // Site default. if ( $parsed_args['show_option_site_default'] ) { $structure[] = sprintf( '<option value="site-default" data-installed="1"%s>%s</option>', selected( 'site-default', $parsed_args['selected'], false ), _x( 'Site Default', 'default site language' ) ); } if ( $parsed_args['show_option_en_us'] ) { $value = ( $parsed_args['explicit_option_en_us'] ) ? 'en_US' : ''; $structure[] = sprintf( '<option value="%s" lang="en" data-installed="1"%s>English (United States)</option>', esc_attr( $value ), selected( '', $parsed_args['selected'], false ) ); } // List installed languages. foreach ( $languages as $language ) { $structure[] = sprintf( '<option value="%s" lang="%s"%s data-installed="1">%s</option>', esc_attr( $language['language'] ), esc_attr( $language['lang'] ), selected( $language['language'], $parsed_args['selected'], false ), esc_html( $language['native_name'] ) ); } if ( $translations_available ) { $structure[] = '</optgroup>'; } // List available translations. if ( $translations_available ) { $structure[] = '<optgroup label="' . esc_attr_x( 'Available', 'translations' ) . '">'; foreach ( $translations as $translation ) { $structure[] = sprintf( '<option value="%s" lang="%s"%s>%s</option>', esc_attr( $translation['language'] ), esc_attr( current( $translation['iso'] ) ), selected( $translation['language'], $parsed_args['selected'], false ), esc_html( $translation['native_name'] ) ); } $structure[] = '</optgroup>'; } // Combine the output string. $output = sprintf( '<select name="%s" id="%s">', esc_attr( $parsed_args['name'] ), esc_attr( $parsed_args['id'] ) ); $output .= implode( "\n", $structure ); $output .= '</select>'; if ( $parsed_args['echo'] ) { echo $output; } return $output; } ``` | Uses | Description | | --- | --- | | [wp\_get\_available\_translations()](wp_get_available_translations) wp-admin/includes/translation-install.php | Get available translations from the WordPress.org API. | | [esc\_attr\_x()](esc_attr_x) wp-includes/l10n.php | Translates string with gettext context, and escapes it for safe use in an attribute. | | [selected()](selected) wp-includes/general-template.php | Outputs the HTML selected attribute. | | [\_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. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | Used By | Description | | --- | --- | | [login\_footer()](login_footer) wp-login.php | Outputs the footer for the login page. | | [show\_blog\_form()](show_blog_form) wp-signup.php | Generates and displays the Sign-up and Create Site forms. | | Version | Description | | --- | --- | | [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced the `explicit_option_en_us` argument. | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced the `show_option_en_us` argument. | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced the `show_option_site_default` argument. | | [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced the `echo` argument. | | [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. | wordpress wp_body_open() wp\_body\_open() ================ Fires the wp\_body\_open action. See [‘wp\_body\_open’](../hooks/wp_body_open). File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function wp_body_open() { /** * Triggered after the opening body tag. * * @since 5.2.0 */ do_action( 'wp_body_open' ); } ``` [do\_action( 'wp\_body\_open' )](../hooks/wp_body_open) Triggered after the opening body tag. | 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.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. | wordpress get_linkobjectsbyname( string $cat_name = "noname", string $orderby = 'name', int $limit = -1 ): array get\_linkobjectsbyname( string $cat\_name = "noname", string $orderby = 'name', int $limit = -1 ): array ======================================================================================================== This function has been deprecated. Use [get\_bookmarks()](get_bookmarks) instead. Gets an array of link objects associated with category $cat\_name. $links = get\_linkobjectsbyname( ‘fred’ ); foreach ( $links as $link ) { echo ‘ - ‘ . $link->link\_name . ‘ ‘; } * [get\_bookmarks()](get_bookmarks) `$cat_name` string Optional The category name to use. If no match is found, uses all. Default `'noname'`. Default: `"noname"` `$orderby` string Optional The order to output the links. E.g. `'id'`, `'name'`, `'url'`, `'description'`, `'rating'`, or `'owner'`. Default `'name'`. If you start the name with an underscore, the order will be reversed. Specifying `'rand'` as the order will return links in a random order. Default: `'name'` `$limit` int Optional Limit to X entries. If not specified, all entries are shown. Default: `-1` array File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); $cat_id = -1; $cat = get_term_by('name', $cat_name, 'link_category'); if ( $cat ) $cat_id = $cat->term_id; return get_linkobjects($cat_id, $orderby, $limit); } ``` | Uses | Description | | --- | --- | | [get\_linkobjects()](get_linkobjects) wp-includes/deprecated.php | Gets an array of link objects associated with category n. | | [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [get\_bookmarks()](get_bookmarks) | | [1.0.1](https://developer.wordpress.org/reference/since/1.0.1/) | Introduced. | wordpress wp_schedule_single_event( int $timestamp, string $hook, array $args = array(), bool $wp_error = false ): bool|WP_Error wp\_schedule\_single\_event( int $timestamp, string $hook, array $args = array(), bool $wp\_error = false ): bool|WP\_Error =========================================================================================================================== Schedules an event to run only once. Schedules a hook which will be triggered by WordPress at the specified UTC time. The action will trigger when someone visits your WordPress site if the scheduled time has passed. Note that scheduling an event to occur within 10 minutes of an existing event with the same action hook will be ignored unless you pass unique `$args` values for each scheduled event. Use [wp\_next\_scheduled()](wp_next_scheduled) to prevent duplicate events. Use [wp\_schedule\_event()](wp_schedule_event) to schedule a recurring event. `$timestamp` int Required Unix timestamp (UTC) for when to next run the event. `$hook` string Required Action hook to execute when the event is run. `$args` array Optional Array containing arguments to pass to the hook's callback function. Each value in the array is passed to the callback as an individual parameter. The array keys are ignored. Default: `array()` `$wp_error` bool Optional Whether to return a [WP\_Error](../classes/wp_error) on failure. Default: `false` bool|[WP\_Error](../classes/wp_error) True if event successfully scheduled. False or [WP\_Error](../classes/wp_error) on failure. File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/) ``` function wp_schedule_single_event( $timestamp, $hook, $args = array(), $wp_error = false ) { // Make sure timestamp is a positive integer. if ( ! is_numeric( $timestamp ) || $timestamp <= 0 ) { if ( $wp_error ) { return new WP_Error( 'invalid_timestamp', __( 'Event timestamp must be a valid Unix timestamp.' ) ); } return false; } $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => false, 'args' => $args, ); /** * Filter to preflight or hijack scheduling an event. * * Returning a non-null value will short-circuit adding the event to the * cron array, causing the function to return the filtered value instead. * * Both single events and recurring events are passed through this filter; * single events have `$event->schedule` as false, whereas recurring events * have this set to a recurrence from wp_get_schedules(). Recurring * events also have the integer recurrence interval set as `$event->interval`. * * For plugins replacing wp-cron, it is recommended you check for an * identical event within ten minutes and apply the {@see 'schedule_event'} * filter to check if another plugin has disallowed the event before scheduling. * * Return true if the event was scheduled, false or a WP_Error if not. * * @since 5.1.0 * @since 5.7.0 The `$wp_error` parameter was added, and a `WP_Error` object can now be returned. * * @param null|bool|WP_Error $pre Value to return instead. Default null to continue adding the event. * @param stdClass $event { * An object containing an event's data. * * @type string $hook Action hook to execute when the event is run. * @type int $timestamp Unix timestamp (UTC) for when to next run the event. * @type string|false $schedule How often the event should subsequently recur. * @type array $args Array containing each separate argument to pass to the hook's callback function. * @type int $interval The interval time in seconds for the schedule. Only present for recurring events. * } * @param bool $wp_error Whether to return a WP_Error on failure. */ $pre = apply_filters( 'pre_schedule_event', null, $event, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_schedule_event_false', __( 'A plugin prevented the event from being scheduled.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } /* * Check for a duplicated event. * * Don't schedule an event if there's already an identical event * within 10 minutes. * * When scheduling events within ten minutes of the current time, * all past identical events are considered duplicates. * * When scheduling an event with a past timestamp (ie, before the * current time) all events scheduled within the next ten minutes * are considered duplicates. */ $crons = _get_cron_array(); $key = md5( serialize( $event->args ) ); $duplicate = false; if ( $event->timestamp < time() + 10 * MINUTE_IN_SECONDS ) { $min_timestamp = 0; } else { $min_timestamp = $event->timestamp - 10 * MINUTE_IN_SECONDS; } if ( $event->timestamp < time() ) { $max_timestamp = time() + 10 * MINUTE_IN_SECONDS; } else { $max_timestamp = $event->timestamp + 10 * MINUTE_IN_SECONDS; } foreach ( $crons as $event_timestamp => $cron ) { if ( $event_timestamp < $min_timestamp ) { continue; } if ( $event_timestamp > $max_timestamp ) { break; } if ( isset( $cron[ $event->hook ][ $key ] ) ) { $duplicate = true; break; } } if ( $duplicate ) { if ( $wp_error ) { return new WP_Error( 'duplicate_event', __( 'A duplicate event already exists.' ) ); } return false; } /** * Modify an event before it is scheduled. * * @since 3.1.0 * * @param stdClass|false $event { * An object containing an event's data, or boolean false to prevent the event from being scheduled. * * @type string $hook Action hook to execute when the event is run. * @type int $timestamp Unix timestamp (UTC) for when to next run the event. * @type string|false $schedule How often the event should subsequently recur. * @type array $args Array containing each separate argument to pass to the hook's callback function. * @type int $interval The interval time in seconds for the schedule. Only present for recurring events. * } */ $event = apply_filters( 'schedule_event', $event ); // A plugin disallowed this event. if ( ! $event ) { if ( $wp_error ) { return new WP_Error( 'schedule_event_false', __( 'A plugin disallowed this event.' ) ); } return false; } $crons[ $event->timestamp ][ $event->hook ][ $key ] = array( 'schedule' => $event->schedule, 'args' => $event->args, ); uksort( $crons, 'strnatcasecmp' ); return _set_cron_array( $crons, $wp_error ); } ``` [apply\_filters( 'pre\_schedule\_event', null|bool|WP\_Error $pre, stdClass $event, bool $wp\_error )](../hooks/pre_schedule_event) Filter to preflight or hijack scheduling an event. [apply\_filters( 'schedule\_event', stdClass|false $event )](../hooks/schedule_event) Modify an event before it is scheduled. | Uses | Description | | --- | --- | | [\_get\_cron\_array()](_get_cron_array) wp-includes/cron.php | Retrieve cron info array option. | | [\_set\_cron\_array()](_set_cron_array) wp-includes/cron.php | Updates the cron option with the new cron array. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Used By | Description | | --- | --- | | [\_wp\_batch\_update\_comment\_type()](_wp_batch_update_comment_type) wp-includes/comment.php | Updates the comment type for a batch of comments. | | [\_wp\_batch\_split\_terms()](_wp_batch_split_terms) wp-includes/taxonomy.php | Splits a batch of shared taxonomy terms. | | [WP\_Automatic\_Updater::after\_core\_update()](../classes/wp_automatic_updater/after_core_update) wp-admin/includes/class-wp-automatic-updater.php | If we tried to perform a core update, check if we should send an email, and if we need to avoid processing future updates. | | [File\_Upload\_Upgrader::\_\_construct()](../classes/file_upload_upgrader/__construct) wp-admin/includes/class-file-upload-upgrader.php | Construct the upgrader for a form. | | [wp\_import\_handle\_upload()](wp_import_handle_upload) wp-admin/includes/import.php | Handles importer uploading and adds attachment. | | [wp\_version\_check()](wp_version_check) wp-includes/update.php | Checks WordPress version against the newest version. | | [\_future\_post\_hook()](_future_post_hook) wp-includes/post.php | Hook used to schedule publication for a post marked for the future. | | [\_publish\_post\_hook()](_publish_post_hook) wp-includes/post.php | Hook to schedule pings and enclosures when a post is published. | | [check\_and\_publish\_future\_post()](check_and_publish_future_post) wp-includes/post.php | Publishes future post and make sure post ID has future post status. | | Version | Description | | --- | --- | | [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | The `$wp_error` parameter was added. | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Return value modified to boolean indicating success or failure, ['pre\_schedule\_event'](../hooks/pre_schedule_event) filter added to short-circuit the function. | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
programming_docs
wordpress the_author_link() the\_author\_link() =================== Displays either author’s link or author’s name. If the author has a home page set, echo an HTML link, otherwise just echo the author’s name. File: `wp-includes/author-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/author-template.php/) ``` function the_author_link() { echo get_the_author_link(); } ``` | Uses | Description | | --- | --- | | [get\_the\_author\_link()](get_the_author_link) wp-includes/author-template.php | Retrieves either author’s link or author’s name. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress get_attachment_taxonomies( int|array|object $attachment, string $output = 'names' ): string[]|WP_Taxonomy[] get\_attachment\_taxonomies( int|array|object $attachment, string $output = 'names' ): string[]|WP\_Taxonomy[] ============================================================================================================== Retrieves taxonomies attached to given the attachment. `$attachment` int|array|object Required Attachment ID, data array, or data object. `$output` string Optional Output type. `'names'` to return an array of taxonomy names, or `'objects'` to return an array of taxonomy objects. Default is `'names'`. Default: `'names'` string[]|[WP\_Taxonomy](../classes/wp_taxonomy)[] List of taxonomies or taxonomy names. Empty array on failure. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/) ``` function get_attachment_taxonomies( $attachment, $output = 'names' ) { if ( is_int( $attachment ) ) { $attachment = get_post( $attachment ); } elseif ( is_array( $attachment ) ) { $attachment = (object) $attachment; } if ( ! is_object( $attachment ) ) { return array(); } $file = get_attached_file( $attachment->ID ); $filename = wp_basename( $file ); $objects = array( 'attachment' ); if ( false !== strpos( $filename, '.' ) ) { $objects[] = 'attachment:' . substr( $filename, strrpos( $filename, '.' ) + 1 ); } if ( ! empty( $attachment->post_mime_type ) ) { $objects[] = 'attachment:' . $attachment->post_mime_type; if ( false !== strpos( $attachment->post_mime_type, '/' ) ) { foreach ( explode( '/', $attachment->post_mime_type ) as $token ) { if ( ! empty( $token ) ) { $objects[] = "attachment:$token"; } } } } $taxonomies = array(); foreach ( $objects as $object ) { $taxes = get_object_taxonomies( $object, $output ); if ( $taxes ) { $taxonomies = array_merge( $taxonomies, $taxes ); } } if ( 'names' === $output ) { $taxonomies = array_unique( $taxonomies ); } return $taxonomies; } ``` | 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\_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(). | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | 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. | | [get\_compat\_media\_markup()](get_compat_media_markup) wp-admin/includes/media.php | | | [media\_upload\_form\_handler()](media_upload_form_handler) wp-admin/includes/media.php | Handles form submissions for the legacy media uploader. | | [wp\_ajax\_save\_attachment\_compat()](wp_ajax_save_attachment_compat) wp-admin/includes/ajax-actions.php | Ajax handler for saving backward compatible attachment attributes. | | [get\_object\_taxonomies()](get_object_taxonomies) wp-includes/taxonomy.php | Returns the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name. | | Version | Description | | --- | --- | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced the `$output` parameter. | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress wp_nonce_ays( string $action ) wp\_nonce\_ays( string $action ) ================================ Displays “Are You Sure” message to confirm the action being taken. If the action has the nonce explain message, then it will be displayed along with the "Are you sure?" message. `$action` string Required The nonce action. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp_nonce_ays( $action ) { // Default title and response code. $title = __( 'Something went wrong.' ); $response_code = 403; if ( 'log-out' === $action ) { $title = sprintf( /* translators: %s: Site title. */ __( 'You are attempting to log out of %s' ), get_bloginfo( 'name' ) ); $html = $title; $html .= '</p><p>'; $redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; $html .= sprintf( /* translators: %s: Logout URL. */ __( 'Do you really want to <a href="%s">log out</a>?' ), wp_logout_url( $redirect_to ) ); } else { $html = __( 'The link you followed has expired.' ); if ( wp_get_referer() ) { $wp_http_referer = remove_query_arg( 'updated', wp_get_referer() ); $wp_http_referer = wp_validate_redirect( esc_url_raw( $wp_http_referer ) ); $html .= '</p><p>'; $html .= sprintf( '<a href="%s">%s</a>', esc_url( $wp_http_referer ), __( 'Please try again.' ) ); } } wp_die( $html, $title, $response_code ); } ``` | Uses | Description | | --- | --- | | [esc\_url\_raw()](esc_url_raw) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. | | [wp\_validate\_redirect()](wp_validate_redirect) wp-includes/pluggable.php | Validates a URL for use in a redirect. | | [wp\_logout\_url()](wp_logout_url) wp-includes/general-template.php | Retrieves the logout URL. | | [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. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. | | Used By | Description | | --- | --- | | [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. | | Version | Description | | --- | --- | | [2.0.4](https://developer.wordpress.org/reference/since/2.0.4/) | Introduced. | wordpress edit_tag_link( string $link = '', string $before = '', string $after = '', WP_Term $tag = null ) edit\_tag\_link( string $link = '', string $before = '', string $after = '', WP\_Term $tag = null ) =================================================================================================== Displays or retrieves the edit link for a tag with formatting. `$link` string Optional Anchor text. If empty, default is 'Edit This'. Default: `''` `$before` string Optional Display before edit link. Default: `''` `$after` string Optional Display after edit link. Default: `''` `$tag` [WP\_Term](../classes/wp_term) Optional Term object. If null, the queried object will be inspected. Default: `null` File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) { $link = edit_term_link( $link, '', '', $tag, false ); /** * Filters the anchor tag for the edit link for a tag (or term in another taxonomy). * * @since 2.7.0 * * @param string $link The anchor tag for the edit link. */ echo $before . apply_filters( 'edit_tag_link', $link ) . $after; } ``` [apply\_filters( 'edit\_tag\_link', string $link )](../hooks/edit_tag_link) Filters the anchor tag for the edit link for a tag (or term in another taxonomy). | Uses | Description | | --- | --- | | [edit\_term\_link()](edit_term_link) wp-includes/link-template.php | Displays or retrieves the edit term link with formatting. | | [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 cache_javascript_headers() cache\_javascript\_headers() ============================ Sets the headers for caching for 10 days with JavaScript content type. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function cache_javascript_headers() { $expiresOffset = 10 * DAY_IN_SECONDS; header( 'Content-Type: text/javascript; charset=' . get_bloginfo( 'charset' ) ); header( 'Vary: Accept-Encoding' ); // Handle proxies. header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expiresOffset ) . ' GMT' ); } ``` | Uses | Description | | --- | --- | | [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress rest_get_authenticated_app_password(): string|null rest\_get\_authenticated\_app\_password(): string|null ====================================================== Gets the Application Password used for authenticating the request. string|null The Application Password UUID, or null if Application Passwords was not used. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_get_authenticated_app_password() { global $wp_rest_application_password_uuid; return $wp_rest_application_password_uuid; } ``` | Used By | Description | | --- | --- | | [WP\_REST\_Application\_Passwords\_Controller::get\_current\_item()](../classes/wp_rest_application_passwords_controller/get_current_item) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Retrieves the application password being currently used for authentication of a user. | | Version | Description | | --- | --- | | [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. | wordpress wp_dashboard_browser_nag() wp\_dashboard\_browser\_nag() ============================= Displays the browser update nag. File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/) ``` function wp_dashboard_browser_nag() { global $is_IE; $notice = ''; $response = wp_check_browser_version(); if ( $response ) { if ( $is_IE ) { $msg = __( 'Internet Explorer does not give you the best WordPress experience. Switch to Microsoft Edge, or another more modern browser to get the most from your site.' ); } elseif ( $response['insecure'] ) { $msg = sprintf( /* translators: %s: Browser name and link. */ __( "It looks like you're using an insecure version of %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser." ), sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) ); } else { $msg = sprintf( /* translators: %s: Browser name and link. */ __( "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." ), sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) ); } $browser_nag_class = ''; if ( ! empty( $response['img_src'] ) ) { $img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) ) ? $response['img_src_ssl'] : $response['img_src']; $notice .= '<div class="alignright browser-icon"><img src="' . esc_url( $img_src ) . '" alt="" /></div>'; $browser_nag_class = ' has-browser-icon'; } $notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>"; $browsehappy = 'https://browsehappy.com/'; $locale = get_user_locale(); if ( 'en_US' !== $locale ) { $browsehappy = add_query_arg( 'locale', $locale, $browsehappy ); } if ( $is_IE ) { $msg_browsehappy = sprintf( /* translators: %s: Browse Happy URL. */ __( 'Learn how to <a href="%s" class="update-browser-link">browse happy</a>' ), esc_url( $browsehappy ) ); } else { $msg_browsehappy = sprintf( /* translators: 1: Browser update URL, 2: Browser name, 3: Browse Happy URL. */ __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ); } $notice .= '<p>' . $msg_browsehappy . '</p>'; $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="' . esc_attr__( 'Dismiss the browser warning panel' ) . '">' . __( 'Dismiss' ) . '</a></p>'; $notice .= '<div class="clear"></div>'; } /** * Filters the notice output for the 'Browse Happy' nag meta box. * * @since 3.2.0 * * @param string $notice The notice content. * @param array|false $response An array containing web browser information, or * false on failure. See wp_check_browser_version(). */ echo apply_filters( 'browse-happy-notice', $notice, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores } ``` [apply\_filters( 'browse-happy-notice', string $notice, array|false $response )](../hooks/browse-happy-notice) Filters the notice output for the ‘Browse Happy’ nag meta box. | Uses | Description | | --- | --- | | [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. | | [wp\_check\_browser\_version()](wp_check_browser_version) wp-admin/includes/dashboard.php | Checks if the user needs a browser update. | | [esc\_attr\_\_()](esc_attr__) wp-includes/l10n.php | Retrieves the translation of $text and escapes it for safe use in an attribute. | | [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [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 | | --- | --- | | [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Added a special message for Internet Explorer users. | | [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. | wordpress esc_attr_e( string $text, string $domain = 'default' ) esc\_attr\_e( string $text, string $domain = 'default' ) ======================================================== Displays translated text that has been escaped for safe use in an attribute. Encodes `< > & " '` (less than, greater than, ampersand, double quote, single quote). Will never double encode entities. If you need the value for use in PHP, use [esc\_attr\_\_()](esc_attr__) . `$text` string Required Text to translate. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings. Default `'default'`. Default: `'default'` File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/) ``` function esc_attr_e( $text, $domain = 'default' ) { echo esc_attr( translate( $text, $domain ) ); } ``` | Uses | Description | | --- | --- | | [translate()](translate) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | Used By | Description | | --- | --- | | [WP\_Customize\_Themes\_Panel::render\_template()](../classes/wp_customize_themes_panel/render_template) wp-includes/customize/class-wp-customize-themes-panel.php | An Underscore (JS) template for rendering this panel’s container. | | [WP\_Customize\_Themes\_Section::render\_template()](../classes/wp_customize_themes_section/render_template) wp-includes/customize/class-wp-customize-themes-section.php | Render a themes section as a JS template. | | [WP\_Customize\_Themes\_Section::filter\_bar\_content\_template()](../classes/wp_customize_themes_section/filter_bar_content_template) wp-includes/customize/class-wp-customize-themes-section.php | Render the filter bar portion of a themes section as a JS template. | | [wp\_print\_community\_events\_markup()](wp_print_community_events_markup) wp-admin/includes/dashboard.php | Prints the markup for the Community Events section of the Events and News Dashboard widget. | | [WP\_Customize\_Nav\_Menus::print\_custom\_links\_available\_menu\_item()](../classes/wp_customize_nav_menus/print_custom_links_available_menu_item) wp-includes/class-wp-customize-nav-menus.php | Prints the markup for available menu item custom links. | | [WP\_Plugins\_List\_Table::search\_box()](../classes/wp_plugins_list_table/search_box) wp-admin/includes/class-wp-plugins-list-table.php | Displays the search box. | | [WP\_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. | | [print\_embed\_sharing\_button()](print_embed_sharing_button) wp-includes/embed.php | Prints the necessary markup for the embed sharing button. | | [print\_embed\_sharing\_dialog()](print_embed_sharing_dialog) wp-includes/embed.php | Prints the necessary markup for the embed sharing dialog. | | [WP\_Customize\_Nav\_Menu\_Location\_Control::render\_content()](../classes/wp_customize_nav_menu_location_control/render_content) wp-includes/customize/class-wp-customize-nav-menu-location-control.php | Render content just like a normal select control. | | [WP\_Customize\_Nav\_Menu\_Control::content\_template()](../classes/wp_customize_nav_menu_control/content_template) wp-includes/customize/class-wp-customize-nav-menu-control.php | JS/Underscore template for the control UI. | | [WP\_Customize\_Nav\_Menus::available\_items\_template()](../classes/wp_customize_nav_menus/available_items_template) wp-includes/class-wp-customize-nav-menus.php | Prints the HTML template used to render the add-menu-item frame. | | [WP\_Customize\_Manager::render\_control\_templates()](../classes/wp_customize_manager/render_control_templates) wp-includes/class-wp-customize-manager.php | Renders JS templates for all registered control types. | | [wp\_print\_revision\_templates()](wp_print_revision_templates) wp-admin/includes/revision.php | Print JavaScript templates required for the revisions experience. | | [login\_footer()](login_footer) wp-login.php | Outputs the footer for the login page. | | [signup\_another\_blog()](signup_another_blog) wp-signup.php | Shows a form for returning users to sign up for another site. | | [signup\_user()](signup_user) wp-signup.php | Shows a form for a visitor to sign up for a new user account. | | [signup\_blog()](signup_blog) wp-signup.php | Shows a form for a user or visitor to sign up for a new site. | | [display\_setup\_form()](display_setup_form) wp-admin/install.php | Displays installer setup form. | | [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\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. | | [WP\_Theme\_Install\_List\_Table::theme\_installer()](../classes/wp_theme_install_list_table/theme_installer) wp-admin/includes/class-wp-theme-install-list-table.php | Prints the wrapper for the theme installer. | | [install\_search\_form()](install_search_form) wp-admin/includes/plugin-install.php | Displays a search form for searching plugins. | | [install\_plugins\_favorites\_form()](install_plugins_favorites_form) wp-admin/includes/plugin-install.php | Shows a username form for the favorites page. | | [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press) wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. | | [find\_posts\_div()](find_posts_div) wp-admin/includes/template.php | Outputs the modal window used for attaching media to posts or pages in the media-listing screen. | | [media\_upload\_gallery\_form()](media_upload_gallery_form) wp-admin/includes/media.php | Adds gallery form to upload iframe. | | [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. | | [link\_submit\_meta\_box()](link_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays link create form fields. | | [link\_categories\_meta\_box()](link_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays link categories form fields. | | [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\_nav\_menu\_item\_link\_meta\_box()](wp_nav_menu_item_link_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for the custom links menu item. | | [wp\_nav\_menu\_item\_post\_type\_meta\_box()](wp_nav_menu_item_post_type_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for a post type menu item. | | [wp\_nav\_menu\_item\_taxonomy\_meta\_box()](wp_nav_menu_item_taxonomy_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for a taxonomy menu item. | | [request\_filesystem\_credentials()](request_filesystem_credentials) wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. | | [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. | | [list\_plugin\_updates()](list_plugin_updates) wp-admin/update-core.php | Display the upgrade plugins form. | | [list\_theme\_updates()](list_theme_updates) wp-admin/update-core.php | Display the upgrade themes form. | | [list\_translation\_updates()](list_translation_updates) wp-admin/update-core.php | Display the update translations form. | | [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. | | [WP\_Admin\_Bar::\_render()](../classes/wp_admin_bar/_render) wp-includes/class-wp-admin-bar.php | | | [WP\_Customize\_Header\_Image\_Control::render\_content()](../classes/wp_customize_header_image_control/render_content) wp-includes/customize/class-wp-customize-header-image-control.php | | | [WP\_Widget\_Area\_Customize\_Control::render\_content()](../classes/wp_widget_area_customize_control/render_content) wp-includes/customize/class-wp-widget-area-customize-control.php | Renders the control’s content. | | [WP\_Customize\_Control::render\_content()](../classes/wp_customize_control/render_content) wp-includes/class-wp-customize-control.php | Render the control’s content. | | [WP\_Customize\_Widgets::output\_widget\_control\_templates()](../classes/wp_customize_widgets/output_widget_control_templates) wp-includes/class-wp-customize-widgets.php | Renders the widget form control templates into the DOM. | | [\_WP\_Editors::wp\_link\_dialog()](../classes/_wp_editors/wp_link_dialog) wp-includes/class-wp-editor.php | Dialog for internal linking. | | [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
programming_docs
wordpress _wp_sidebars_changed() \_wp\_sidebars\_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. Handle sidebars config after theme change File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/) ``` function _wp_sidebars_changed() { global $sidebars_widgets; if ( ! is_array( $sidebars_widgets ) ) { $sidebars_widgets = wp_get_sidebars_widgets(); } retrieve_widgets( true ); } ``` | Uses | Description | | --- | --- | | [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. | | [wp\_get\_sidebars\_widgets()](wp_get_sidebars_widgets) wp-includes/widgets.php | Retrieve full list of sidebars and their widget instance IDs. | | Version | Description | | --- | --- | | [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. | wordpress get_adjacent_post( bool $in_same_term = false, int[]|string $excluded_terms = '', bool $previous = true, string $taxonomy = 'category' ): WP_Post|null|string get\_adjacent\_post( bool $in\_same\_term = false, int[]|string $excluded\_terms = '', bool $previous = true, string $taxonomy = 'category' ): WP\_Post|null|string =================================================================================================================================================================== Retrieves the adjacent post. Can either be next or previous 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: `''` `$previous` bool Optional Whether to retrieve previous post. Default true Default: `true` `$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_adjacent_post( $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) { global $wpdb; $post = get_post(); if ( ! $post || ! taxonomy_exists( $taxonomy ) ) { return null; } $current_post_date = $post->post_date; $join = ''; $where = ''; $adjacent = $previous ? 'previous' : 'next'; if ( ! empty( $excluded_terms ) && ! is_array( $excluded_terms ) ) { // Back-compat, $excluded_terms used to be $excluded_categories with IDs separated by " and ". if ( false !== strpos( $excluded_terms, ' and ' ) ) { _deprecated_argument( __FUNCTION__, '3.3.0', sprintf( /* translators: %s: The word 'and'. */ __( 'Use commas instead of %s to separate excluded terms.' ), "'and'" ) ); $excluded_terms = explode( ' and ', $excluded_terms ); } else { $excluded_terms = explode( ',', $excluded_terms ); } $excluded_terms = array_map( 'intval', $excluded_terms ); } /** * Filters the IDs of terms excluded from adjacent post queries. * * The dynamic portion of the hook name, `$adjacent`, refers to the type * of adjacency, 'next' or 'previous'. * * Possible hook names include: * * - `get_next_post_excluded_terms` * - `get_previous_post_excluded_terms` * * @since 4.4.0 * * @param int[]|string $excluded_terms Array of excluded term IDs. Empty string if none were provided. */ $excluded_terms = apply_filters( "get_{$adjacent}_post_excluded_terms", $excluded_terms ); if ( $in_same_term || ! empty( $excluded_terms ) ) { if ( $in_same_term ) { $join .= " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id"; $where .= $wpdb->prepare( 'AND tt.taxonomy = %s', $taxonomy ); if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) ) { return ''; } $term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); // Remove any exclusions from the term array to include. $term_array = array_diff( $term_array, (array) $excluded_terms ); $term_array = array_map( 'intval', $term_array ); if ( ! $term_array || is_wp_error( $term_array ) ) { return ''; } $where .= ' AND tt.term_id IN (' . implode( ',', $term_array ) . ')'; } if ( ! empty( $excluded_terms ) ) { $where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (" . implode( ',', array_map( 'intval', $excluded_terms ) ) . ') )'; } } // 'post_status' clause depends on the current user. if ( is_user_logged_in() ) { $user_id = get_current_user_id(); $post_type_object = get_post_type_object( $post->post_type ); if ( empty( $post_type_object ) ) { $post_type_cap = $post->post_type; $read_private_cap = 'read_private_' . $post_type_cap . 's'; } else { $read_private_cap = $post_type_object->cap->read_private_posts; } /* * Results should include private posts belonging to the current user, or private posts where the * current user has the 'read_private_posts' cap. */ $private_states = get_post_stati( array( 'private' => true ) ); $where .= " AND ( p.post_status = 'publish'"; foreach ( $private_states as $state ) { if ( current_user_can( $read_private_cap ) ) { $where .= $wpdb->prepare( ' OR p.post_status = %s', $state ); } else { $where .= $wpdb->prepare( ' OR (p.post_author = %d AND p.post_status = %s)', $user_id, $state ); } } $where .= ' )'; } else { $where .= " AND p.post_status = 'publish'"; } $op = $previous ? '<' : '>'; $order = $previous ? 'DESC' : 'ASC'; /** * Filters the JOIN clause in the SQL for an adjacent post query. * * The dynamic portion of the hook name, `$adjacent`, refers to the type * of adjacency, 'next' or 'previous'. * * Possible hook names include: * * - `get_next_post_join` * - `get_previous_post_join` * * @since 2.5.0 * @since 4.4.0 Added the `$taxonomy` and `$post` parameters. * * @param string $join The JOIN clause in the SQL. * @param bool $in_same_term Whether post should be in a same taxonomy term. * @param int[]|string $excluded_terms Array of excluded term IDs. Empty string if none were provided. * @param string $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true. * @param WP_Post $post WP_Post object. */ $join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy, $post ); /** * Filters the WHERE clause in the SQL for an adjacent post query. * * The dynamic portion of the hook name, `$adjacent`, refers to the type * of adjacency, 'next' or 'previous'. * * Possible hook names include: * * - `get_next_post_where` * - `get_previous_post_where` * * @since 2.5.0 * @since 4.4.0 Added the `$taxonomy` and `$post` parameters. * * @param string $where The `WHERE` clause in the SQL. * @param bool $in_same_term Whether post should be in a same taxonomy term. * @param int[]|string $excluded_terms Array of excluded term IDs. Empty string if none were provided. * @param string $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true. * @param WP_Post $post WP_Post object. */ $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p.post_type = %s $where", $current_post_date, $post->post_type ), $in_same_term, $excluded_terms, $taxonomy, $post ); /** * Filters the ORDER BY clause in the SQL for an adjacent post query. * * The dynamic portion of the hook name, `$adjacent`, refers to the type * of adjacency, 'next' or 'previous'. * * Possible hook names include: * * - `get_next_post_sort` * - `get_previous_post_sort` * * @since 2.5.0 * @since 4.4.0 Added the `$post` parameter. * @since 4.9.0 Added the `$order` parameter. * * @param string $order_by The `ORDER BY` clause in the SQL. * @param WP_Post $post WP_Post object. * @param string $order Sort order. 'DESC' for previous post, 'ASC' for next. */ $sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post, $order ); $query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort"; $query_key = 'adjacent_post_' . md5( $query ); $result = wp_cache_get( $query_key, 'counts' ); if ( false !== $result ) { if ( $result ) { $result = get_post( $result ); } return $result; } $result = $wpdb->get_var( $query ); if ( null === $result ) { $result = ''; } wp_cache_set( $query_key, $result, 'counts' ); if ( $result ) { $result = get_post( $result ); } return $result; } ``` [apply\_filters( "get\_{$adjacent}\_post\_excluded\_terms", int[]|string $excluded\_terms )](../hooks/get_adjacent_post_excluded_terms) Filters the IDs of terms excluded from adjacent post queries. [apply\_filters( "get\_{$adjacent}\_post\_join", string $join, bool $in\_same\_term, int[]|string $excluded\_terms, string $taxonomy, WP\_Post $post )](../hooks/get_adjacent_post_join) Filters the JOIN clause in the SQL for an adjacent post query. [apply\_filters( "get\_{$adjacent}\_post\_sort", string $order\_by, WP\_Post $post, string $order )](../hooks/get_adjacent_post_sort) Filters the ORDER BY clause in the SQL for an adjacent post query. [apply\_filters( "get\_{$adjacent}\_post\_where", string $where, bool $in\_same\_term, int[]|string $excluded\_terms, string $taxonomy, WP\_Post $post )](../hooks/get_adjacent_post_where) Filters the WHERE clause in the SQL for an adjacent post query. | Uses | Description | | --- | --- | | [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. | | [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. | | [get\_post\_stati()](get_post_stati) wp-includes/post.php | Gets a list of post statuses. | | [is\_object\_in\_taxonomy()](is_object_in_taxonomy) wp-includes/taxonomy.php | Determines if the given object type is associated with the given taxonomy. | | [wp\_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\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. | | [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. | | [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. | | [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. | | [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. | | [\_\_()](__) 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 | | --- | --- | | [get\_adjacent\_post\_link()](get_adjacent_post_link) wp-includes/link-template.php | Retrieves the adjacent post link. | | [get\_previous\_post()](get_previous_post) wp-includes/link-template.php | Retrieves the previous post that is adjacent to the current post. | | [get\_next\_post()](get_next_post) wp-includes/link-template.php | Retrieves the next post that is adjacent to the current post. | | [get\_adjacent\_post\_rel\_link()](get_adjacent_post_rel_link) wp-includes/link-template.php | Retrieves the adjacent post relational link. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress get_status_header_desc( int $code ): string get\_status\_header\_desc( int $code ): string ============================================== Retrieves the description for the HTTP status. `$code` int Required HTTP status code. string Status description if found, an empty string otherwise. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function get_status_header_desc( $code ) { global $wp_header_to_desc; $code = absint( $code ); if ( ! isset( $wp_header_to_desc ) ) { $wp_header_to_desc = array( 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 103 => 'Early Hints', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', 226 => 'IM Used', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Reserved', 307 => 'Temporary Redirect', 308 => 'Permanent Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 421 => 'Misdirected Request', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 451 => 'Unavailable For Legal Reasons', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 510 => 'Not Extended', 511 => 'Network Authentication Required', ); } if ( isset( $wp_header_to_desc[ $code ] ) ) { return $wp_header_to_desc[ $code ]; } else { return ''; } } ``` | Uses | Description | | --- | --- | | [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. | | Used By | Description | | --- | --- | | [WP\_oEmbed\_Controller::get\_proxy\_item()](../classes/wp_oembed_controller/get_proxy_item) wp-includes/class-wp-oembed-controller.php | Callback for the proxy API endpoint. | | [WP\_HTTP\_Requests\_Response::to\_array()](../classes/wp_http_requests_response/to_array) wp-includes/class-wp-http-requests-response.php | Converts the object to a [WP\_Http](../classes/wp_http) response array. | | [\_oembed\_rest\_pre\_serve\_request()](_oembed_rest_pre_serve_request) wp-includes/embed.php | Hooks into the REST API output to print XML instead of JSON. | | [WP\_oEmbed\_Controller::get\_item()](../classes/wp_oembed_controller/get_item) wp-includes/class-wp-oembed-controller.php | Callback for the embed API endpoint. | | [status\_header()](status_header) wp-includes/functions.php | Sets HTTP status header. | | Version | Description | | --- | --- | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Added status code 103. | | [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Added status codes 308, 421, and 451. | | [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Added status codes 418, 428, 429, 431, and 511. | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress get_theme_update_available( WP_Theme $theme ): string|false get\_theme\_update\_available( WP\_Theme $theme ): string|false =============================================================== Retrieves the update link if there is a theme update available. Will return a link if there is an update available. `$theme` [WP\_Theme](../classes/wp_theme) Required [WP\_Theme](../classes/wp_theme) object. string|false HTML for the update link, or false if invalid info was passed. File: `wp-admin/includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme.php/) ``` function get_theme_update_available( $theme ) { static $themes_update = null; if ( ! current_user_can( 'update_themes' ) ) { return false; } if ( ! isset( $themes_update ) ) { $themes_update = get_site_transient( 'update_themes' ); } if ( ! ( $theme instanceof WP_Theme ) ) { return false; } $stylesheet = $theme->get_stylesheet(); $html = ''; if ( isset( $themes_update->response[ $stylesheet ] ) ) { $update = $themes_update->response[ $stylesheet ]; $theme_name = $theme->display( 'Name' ); $details_url = add_query_arg( array( 'TB_iframe' => 'true', 'width' => 1024, 'height' => 800, ), $update['url'] ); // Theme browser inside WP? Replace this. Also, theme preview JS will override this on the available list. $update_url = wp_nonce_url( admin_url( 'update.php?action=upgrade-theme&amp;theme=' . urlencode( $stylesheet ) ), 'upgrade-theme_' . $stylesheet ); if ( ! is_multisite() ) { if ( ! current_user_can( 'update_themes' ) ) { $html = sprintf( /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number. */ '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.' ) . '</strong></p>', $theme_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', /* translators: 1: Theme name, 2: Version number. */ esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) ), $update['new_version'] ); } elseif ( empty( $update['package'] ) ) { $html = sprintf( /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number. */ '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>' ) . '</strong></p>', $theme_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', /* translators: 1: Theme name, 2: Version number. */ esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) ), $update['new_version'] ); } else { $html = sprintf( /* translators: 1: Theme name, 2: Theme details URL, 3: Additional link attributes, 4: Version number, 5: Update URL, 6: Additional link attributes. */ '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.' ) . '</strong></p>', $theme_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', /* translators: 1: Theme name, 2: Version number. */ esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) ), $update['new_version'], $update_url, sprintf( 'aria-label="%s" id="update-theme" data-slug="%s"', /* translators: %s: Theme name. */ esc_attr( sprintf( _x( 'Update %s now', 'theme' ), $theme_name ) ), $stylesheet ) ); } } } return $html; } ``` | Uses | Description | | --- | --- | | [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. | | [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. | | Used By | Description | | --- | --- | | [wp\_prepare\_themes\_for\_js()](wp_prepare_themes_for_js) wp-admin/includes/theme.php | Prepares themes for JavaScript. | | [theme\_update\_available()](theme_update_available) wp-admin/includes/theme.php | Check if there is an update for a theme available. | | Version | Description | | --- | --- | | [3.8.0](https://developer.wordpress.org/reference/since/3.8.0/) | Introduced. |
programming_docs
wordpress is_main_site( int $site_id = null, int $network_id = null ): bool is\_main\_site( int $site\_id = null, int $network\_id = null ): bool ===================================================================== Determines whether a site is the main site of the current network. `$site_id` int Optional Site ID to test. Defaults to current site. Default: `null` `$network_id` int Optional Network ID of the network to check for. Defaults to current network. Default: `null` bool True if $site\_id is the main site of the network, or if not running Multisite. Replaces function `is_main_blog()`, deprecated since 3.0.0. (wp-includes/ms-deprecated.php) File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function is_main_site( $site_id = null, $network_id = null ) { if ( ! is_multisite() ) { return true; } if ( ! $site_id ) { $site_id = get_current_blog_id(); } $site_id = (int) $site_id; return get_main_site_id( $network_id ) === $site_id; } ``` | Uses | Description | | --- | --- | | [get\_main\_site\_id()](get_main_site_id) wp-includes/functions.php | Gets the main site ID. | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. | | Used By | Description | | --- | --- | | [wp\_schedule\_update\_user\_counts()](wp_schedule_update_user_counts) wp-includes/user.php | Schedules a recurring recalculation of the total count of users. | | [WP\_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\_Site\_Health\_Auto\_Updates::test\_wp\_version\_check\_attached()](../classes/wp_site_health_auto_updates/test_wp_version_check_attached) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if updates are intercepted by a filter. | | [delete\_expired\_transients()](delete_expired_transients) wp-includes/option.php | Deletes all expired transients. | | [wp\_load\_press\_this()](wp_load_press_this) wp-admin/press-this.php | | | [\_wp\_upload\_dir()](_wp_upload_dir) wp-includes/functions.php | A non-filtered, non-cached version of [wp\_upload\_dir()](wp_upload_dir) that doesn’t check the path. | | [WP\_MS\_Sites\_List\_Table::column\_cb()](../classes/wp_ms_sites_list_table/column_cb) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the checkbox column output. | | [wp\_should\_upgrade\_global\_tables()](wp_should_upgrade_global_tables) wp-admin/includes/upgrade.php | Determine if global tables should be upgraded. | | [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. | | [avoid\_blog\_page\_permalink\_collision()](avoid_blog_page_permalink_collision) wp-admin/includes/ms.php | Avoids a collision between a site slug and a permalink slug. | | [wpmu\_delete\_blog()](wpmu_delete_blog) wp-admin/includes/ms.php | Delete a site. | | [wp\_upgrade()](wp_upgrade) wp-admin/includes/upgrade.php | Runs WordPress Upgrade functions. | | [WP\_Rewrite::rewrite\_rules()](../classes/wp_rewrite/rewrite_rules) wp-includes/class-wp-rewrite.php | Constructs rewrite matches and queries from permalink structure. | | [wp\_schedule\_update\_network\_counts()](wp_schedule_update_network_counts) wp-includes/ms-functions.php | Schedules update of the network-wide counts for the current network. | | [maybe\_redirect\_404()](maybe_redirect_404) wp-includes/ms-functions.php | Corrects 404 redirects when NOBLOGREDIRECT is defined. | | [get\_dirsize()](get_dirsize) wp-includes/functions.php | Gets the size of a directory. | | [is\_main\_blog()](is_main_blog) wp-includes/ms-deprecated.php | Deprecated functionality to determin if the current site is the main site. | | Version | Description | | --- | --- | | [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | The `$network_id` parameter was added. | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress _wp_personal_data_handle_actions() \_wp\_personal\_data\_handle\_actions() ======================================= 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. Handle list table actions. File: `wp-admin/includes/privacy-tools.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/privacy-tools.php/) ``` function _wp_personal_data_handle_actions() { if ( isset( $_POST['privacy_action_email_retry'] ) ) { check_admin_referer( 'bulk-privacy_requests' ); $request_id = absint( current( array_keys( (array) wp_unslash( $_POST['privacy_action_email_retry'] ) ) ) ); $result = _wp_privacy_resend_request( $request_id ); if ( is_wp_error( $result ) ) { add_settings_error( 'privacy_action_email_retry', 'privacy_action_email_retry', $result->get_error_message(), 'error' ); } else { add_settings_error( 'privacy_action_email_retry', 'privacy_action_email_retry', __( 'Confirmation request sent again successfully.' ), 'success' ); } } elseif ( isset( $_POST['action'] ) ) { $action = ! empty( $_POST['action'] ) ? sanitize_key( wp_unslash( $_POST['action'] ) ) : ''; switch ( $action ) { case 'add_export_personal_data_request': case 'add_remove_personal_data_request': check_admin_referer( 'personal-data-request' ); if ( ! isset( $_POST['type_of_action'], $_POST['username_or_email_for_privacy_request'] ) ) { add_settings_error( 'action_type', 'action_type', __( 'Invalid personal data action.' ), 'error' ); } $action_type = sanitize_text_field( wp_unslash( $_POST['type_of_action'] ) ); $username_or_email_address = sanitize_text_field( wp_unslash( $_POST['username_or_email_for_privacy_request'] ) ); $email_address = ''; $status = 'pending'; if ( ! isset( $_POST['send_confirmation_email'] ) ) { $status = 'confirmed'; } if ( ! in_array( $action_type, _wp_privacy_action_request_types(), true ) ) { add_settings_error( 'action_type', 'action_type', __( 'Invalid personal data action.' ), 'error' ); } if ( ! is_email( $username_or_email_address ) ) { $user = get_user_by( 'login', $username_or_email_address ); if ( ! $user instanceof WP_User ) { add_settings_error( 'username_or_email_for_privacy_request', 'username_or_email_for_privacy_request', __( 'Unable to add this request. A valid email address or username must be supplied.' ), 'error' ); } else { $email_address = $user->user_email; } } else { $email_address = $username_or_email_address; } if ( empty( $email_address ) ) { break; } $request_id = wp_create_user_request( $email_address, $action_type, array(), $status ); $message = ''; if ( is_wp_error( $request_id ) ) { $message = $request_id->get_error_message(); } elseif ( ! $request_id ) { $message = __( 'Unable to initiate confirmation request.' ); } if ( $message ) { add_settings_error( 'username_or_email_for_privacy_request', 'username_or_email_for_privacy_request', $message, 'error' ); break; } if ( 'pending' === $status ) { wp_send_user_request( $request_id ); $message = __( 'Confirmation request initiated successfully.' ); } elseif ( 'confirmed' === $status ) { $message = __( 'Request added successfully.' ); } if ( $message ) { add_settings_error( 'username_or_email_for_privacy_request', 'username_or_email_for_privacy_request', $message, 'success' ); break; } } } } ``` | Uses | Description | | --- | --- | | [wp\_create\_user\_request()](wp_create_user_request) wp-includes/user.php | Creates and logs a user request to perform a specific action. | | [wp\_send\_user\_request()](wp_send_user_request) wp-includes/user.php | Send a confirmation request email to confirm an action. | | [\_wp\_privacy\_action\_request\_types()](_wp_privacy_action_request_types) wp-includes/user.php | Gets all personal data request types. | | [\_wp\_privacy\_resend\_request()](_wp_privacy_resend_request) wp-admin/includes/privacy-tools.php | Resend an existing request and return the result. | | [add\_settings\_error()](add_settings_error) wp-admin/includes/template.php | Registers a settings error to be displayed to the user. | | [sanitize\_text\_field()](sanitize_text_field) wp-includes/formatting.php | Sanitizes a string from user input or from the database. | | [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. | | [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. | | [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. | | [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. | | [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. | wordpress wp_remote_retrieve_cookie( array|WP_Error $response, string $name ): WP_Http_Cookie|string wp\_remote\_retrieve\_cookie( array|WP\_Error $response, string $name ): WP\_Http\_Cookie|string ================================================================================================ Retrieve a single cookie 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. [WP\_Http\_Cookie](../classes/wp_http_cookie)|string The `WP_Http_Cookie` object, 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( $response, $name ) { $cookies = wp_remote_retrieve_cookies( $response ); if ( empty( $cookies ) ) { return ''; } foreach ( $cookies as $cookie ) { if ( $cookie->name === $name ) { return $cookie; } } return ''; } ``` | Uses | Description | | --- | --- | | [wp\_remote\_retrieve\_cookies()](wp_remote_retrieve_cookies) wp-includes/http.php | Retrieve only the cookies from the raw response. | | Used By | Description | | --- | --- | | [wp\_remote\_retrieve\_cookie\_value()](wp_remote_retrieve_cookie_value) wp-includes/http.php | Retrieve a single cookie’s value by name from the raw response. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. | wordpress wp_delete_nav_menu( int|string|WP_Term $menu ): bool|WP_Error wp\_delete\_nav\_menu( int|string|WP\_Term $menu ): bool|WP\_Error ================================================================== Deletes a navigation menu. `$menu` int|string|[WP\_Term](../classes/wp_term) Required Menu ID, slug, name, or object. bool|[WP\_Error](../classes/wp_error) True on success, false or [WP\_Error](../classes/wp_error) object on failure. File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/) ``` function wp_delete_nav_menu( $menu ) { $menu = wp_get_nav_menu_object( $menu ); if ( ! $menu ) { return false; } $menu_objects = get_objects_in_term( $menu->term_id, 'nav_menu' ); if ( ! empty( $menu_objects ) ) { foreach ( $menu_objects as $item ) { wp_delete_post( $item ); } } $result = wp_delete_term( $menu->term_id, 'nav_menu' ); // Remove this menu from any locations. $locations = get_nav_menu_locations(); foreach ( $locations as $location => $menu_id ) { if ( $menu_id == $menu->term_id ) { $locations[ $location ] = 0; } } set_theme_mod( 'nav_menu_locations', $locations ); if ( $result && ! is_wp_error( $result ) ) { /** * Fires after a navigation menu has been successfully deleted. * * @since 3.0.0 * * @param int $term_id ID of the deleted menu. */ do_action( 'wp_delete_nav_menu', $menu->term_id ); } return $result; } ``` [do\_action( 'wp\_delete\_nav\_menu', int $term\_id )](../hooks/wp_delete_nav_menu) Fires after a navigation menu has been successfully deleted. | Uses | Description | | --- | --- | | [set\_theme\_mod()](set_theme_mod) wp-includes/theme.php | Updates theme modification value for the active theme. | | [wp\_delete\_term()](wp_delete_term) wp-includes/taxonomy.php | Removes a term from the database. | | [get\_objects\_in\_term()](get_objects_in_term) wp-includes/taxonomy.php | Retrieves object IDs of valid taxonomy and term. | | [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. | | [wp\_get\_nav\_menu\_object()](wp_get_nav_menu_object) wp-includes/nav-menu.php | Returns a navigation menu object. | | [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. | | [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\_Menus\_Controller::delete\_item()](../classes/wp_rest_menus_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Deletes a single term from a taxonomy. | | [WP\_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. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress unregister_widget_control( int|string $id ) unregister\_widget\_control( int|string $id ) ============================================= This function has been deprecated. Use [wp\_unregister\_widget\_control()](wp_unregister_widget_control) instead. Alias of [wp\_unregister\_widget\_control()](wp_unregister_widget_control) . * [wp\_unregister\_widget\_control()](wp_unregister_widget_control) `$id` int|string Required Widget ID. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function unregister_widget_control($id) { _deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_widget_control()' ); return wp_unregister_widget_control($id); } ``` | Uses | Description | | --- | --- | | [wp\_unregister\_widget\_control()](wp_unregister_widget_control) wp-includes/widgets.php | Remove control callback for widget. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use [wp\_unregister\_widget\_control()](wp_unregister_widget_control) | | [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. | wordpress maybe_hash_hex_color( string $color ): string maybe\_hash\_hex\_color( string $color ): string ================================================ Ensures that any hex color is properly hashed. Otherwise, returns value untouched. This method should only be necessary if using [sanitize\_hex\_color\_no\_hash()](sanitize_hex_color_no_hash) . `$color` string Required string File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function maybe_hash_hex_color( $color ) { $unhashed = sanitize_hex_color_no_hash( $color ); if ( $unhashed ) { return '#' . $unhashed; } return $color; } ``` | Uses | Description | | --- | --- | | [sanitize\_hex\_color\_no\_hash()](sanitize_hex_color_no_hash) wp-includes/formatting.php | Sanitizes a hex color without a hash. Use [sanitize\_hex\_color()](sanitize_hex_color) when possible. | | Version | Description | | --- | --- | | [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. | wordpress get_post_timestamp( int|WP_Post $post = null, string $field = 'date' ): int|false get\_post\_timestamp( int|WP\_Post $post = null, string $field = 'date' ): int|false ==================================================================================== Retrieves post published or modified time as a Unix timestamp. Note that this function returns a true Unix timestamp, not summed with timezone offset like older WP functions. `$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Default is global `$post` object. Default: `null` `$field` string Optional Published or modified time to use from database. Accepts `'date'` or `'modified'`. Default `'date'`. Default: `'date'` int|false Unix timestamp on success, false on failure. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function get_post_timestamp( $post = null, $field = 'date' ) { $datetime = get_post_datetime( $post, $field ); if ( false === $datetime ) { return false; } return $datetime->getTimestamp(); } ``` | Uses | Description | | --- | --- | | [get\_post\_datetime()](get_post_datetime) wp-includes/general-template.php | Retrieves post published or modified time as a `DateTimeImmutable` object instance. | | Used By | Description | | --- | --- | | [WP\_Posts\_List\_Table::column\_date()](../classes/wp_posts_list_table/column_date) wp-admin/includes/class-wp-posts-list-table.php | Handles the post date column output. | | [WP\_Media\_List\_Table::column\_date()](../classes/wp_media_list_table/column_date) wp-admin/includes/class-wp-media-list-table.php | Handles the date column output. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. | wordpress wp_set_link_cats( int $link_id, int[] $link_categories = array() ) wp\_set\_link\_cats( int $link\_id, int[] $link\_categories = array() ) ======================================================================= Update link with the specified link categories. `$link_id` int Required ID of the link to update. `$link_categories` int[] Optional Array of link category IDs to add the link to. Default: `array()` File: `wp-admin/includes/bookmark.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/bookmark.php/) ``` function wp_set_link_cats( $link_id = 0, $link_categories = array() ) { // If $link_categories isn't already an array, make it one: if ( ! is_array( $link_categories ) || 0 === count( $link_categories ) ) { $link_categories = array( get_option( 'default_link_category' ) ); } $link_categories = array_map( 'intval', $link_categories ); $link_categories = array_unique( $link_categories ); wp_set_object_terms( $link_id, $link_categories, 'link_category' ); clean_bookmark_cache( $link_id ); } ``` | Uses | Description | | --- | --- | | [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. | | [clean\_bookmark\_cache()](clean_bookmark_cache) wp-includes/bookmark.php | Deletes the bookmark cache. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [wp\_insert\_link()](wp_insert_link) wp-admin/includes/bookmark.php | Inserts a link into the database, or updates an existing link. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
programming_docs
wordpress wp_destroy_other_sessions() wp\_destroy\_other\_sessions() ============================== Removes all but the current session token for the current user for the database. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function wp_destroy_other_sessions() { $token = wp_get_session_token(); if ( $token ) { $manager = WP_Session_Tokens::get_instance( get_current_user_id() ); $manager->destroy_others( $token ); } } ``` | 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. | | [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_get_post_cats( int $blogid = '1', int $post_ID ): array wp\_get\_post\_cats( int $blogid = '1', int $post\_ID ): array ============================================================== This function has been deprecated. Use [wp\_get\_post\_categories()](wp_get_post_categories) instead. Retrieves a list of post categories. * [wp\_get\_post\_categories()](wp_get_post_categories) `$blogid` int Optional Not Used Default: `'1'` `$post_ID` int Required array File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function wp_get_post_cats($blogid = '1', $post_ID = 0) { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' ); return wp_get_post_categories($post_ID); } ``` | Uses | Description | | --- | --- | | [wp\_get\_post\_categories()](wp_get_post_categories) wp-includes/post.php | Retrieves the list of categories for a post. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [wp\_get\_post\_categories()](wp_get_post_categories) | | [1.0.1](https://developer.wordpress.org/reference/since/1.0.1/) | Introduced. | wordpress get_day_link( int|false $year, int|false $month, int|false $day ): string get\_day\_link( int|false $year, int|false $month, int|false $day ): string =========================================================================== Retrieves the permalink for the day archives with year and month. `$year` int|false Required Integer of year. False for current year. `$month` int|false Required Integer of month. False for current month. `$day` int|false Required Integer of day. False for current day. string The permalink for the specified day, month, and year archive. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function get_day_link( $year, $month, $day ) { global $wp_rewrite; if ( ! $year ) { $year = current_time( 'Y' ); } if ( ! $month ) { $month = current_time( 'm' ); } if ( ! $day ) { $day = current_time( 'j' ); } $daylink = $wp_rewrite->get_day_permastruct(); if ( ! empty( $daylink ) ) { $daylink = str_replace( '%year%', $year, $daylink ); $daylink = str_replace( '%monthnum%', zeroise( (int) $month, 2 ), $daylink ); $daylink = str_replace( '%day%', zeroise( (int) $day, 2 ), $daylink ); $daylink = home_url( user_trailingslashit( $daylink, 'day' ) ); } else { $daylink = home_url( '?m=' . $year . zeroise( $month, 2 ) . zeroise( $day, 2 ) ); } /** * Filters the day archive permalink. * * @since 1.5.0 * * @param string $daylink Permalink for the day archive. * @param int $year Year for the archive. * @param int $month Month for the archive. * @param int $day The day for the archive. */ return apply_filters( 'day_link', $daylink, $year, $month, $day ); } ``` [apply\_filters( 'day\_link', string $daylink, int $year, int $month, int $day )](../hooks/day_link) Filters the day 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\_day\_permastruct()](../classes/wp_rewrite/get_day_permastruct) wp-includes/class-wp-rewrite.php | Retrieves the day permalink structure with month and 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 global_terms_enabled(): bool global\_terms\_enabled(): bool ============================== This function has been deprecated. Determines whether global terms are enabled. bool Always returns false. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function global_terms_enabled() { _deprecated_function( __FUNCTION__, '6.1.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 | | --- | --- | | [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 resolve_block_template( string $template_type, string[] $template_hierarchy, string $fallback_template ): WP_Block_Template|null resolve\_block\_template( string $template\_type, string[] $template\_hierarchy, string $fallback\_template ): WP\_Block\_Template|null ======================================================================================================================================= This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Returns the correct ‘wp\_template’ to render for the request template type. `$template_type` string Required The current template type. `$template_hierarchy` string[] Required The current template hierarchy, ordered by priority. `$fallback_template` string Required A PHP fallback template to use if no matching block template is found. [WP\_Block\_Template](../classes/wp_block_template)|null template A template object, or null if none could be found. File: `wp-includes/block-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template.php/) ``` function resolve_block_template( $template_type, $template_hierarchy, $fallback_template ) { if ( ! $template_type ) { return null; } if ( empty( $template_hierarchy ) ) { $template_hierarchy = array( $template_type ); } $slugs = array_map( '_strip_template_file_suffix', $template_hierarchy ); // Find all potential templates 'wp_template' post matching the hierarchy. $query = array( 'theme' => wp_get_theme()->get_stylesheet(), 'slug__in' => $slugs, ); $templates = get_block_templates( $query ); // Order these templates per slug priority. // Build map of template slugs to their priority in the current hierarchy. $slug_priorities = array_flip( $slugs ); usort( $templates, static function ( $template_a, $template_b ) use ( $slug_priorities ) { return $slug_priorities[ $template_a->slug ] - $slug_priorities[ $template_b->slug ]; } ); $theme_base_path = get_stylesheet_directory() . DIRECTORY_SEPARATOR; $parent_theme_base_path = get_template_directory() . DIRECTORY_SEPARATOR; // Is the active theme a child theme, and is the PHP fallback template part of it? if ( strpos( $fallback_template, $theme_base_path ) === 0 && strpos( $fallback_template, $parent_theme_base_path ) === false ) { $fallback_template_slug = substr( $fallback_template, // Starting position of slug. strpos( $fallback_template, $theme_base_path ) + strlen( $theme_base_path ), // Remove '.php' suffix. -4 ); // Is our candidate block template's slug identical to our PHP fallback template's? if ( count( $templates ) && $fallback_template_slug === $templates[0]->slug && 'theme' === $templates[0]->source ) { // Unfortunately, we cannot trust $templates[0]->theme, since it will always // be set to the active theme's slug by _build_block_template_result_from_file(), // even if the block template is really coming from the active theme's parent. // (The reason for this is that we want it to be associated with the active theme // -- not its parent -- once we edit it and store it to the DB as a wp_template CPT.) // Instead, we use _get_block_template_file() to locate the block template file. $template_file = _get_block_template_file( 'wp_template', $fallback_template_slug ); if ( $template_file && get_template() === $template_file['theme'] ) { // The block template is part of the parent theme, so we // have to give precedence to the child theme's PHP template. array_shift( $templates ); } } } return count( $templates ) ? $templates[0] : null; } ``` | Uses | 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()](get_block_templates) wp-includes/block-template-utils.php | Retrieves a list of unified template objects based on a query. | | [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. | | [get\_template()](get_template) wp-includes/theme.php | Retrieves name of the active theme. | | [WP\_Theme::get\_stylesheet()](../classes/wp_theme/get_stylesheet) wp-includes/class-wp-theme.php | Returns the directory name of the theme’s “stylesheet” files, inside the theme root. | | [wp\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. | | 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. | | [\_resolve\_home\_block\_template()](_resolve_home_block_template) wp-includes/block-template.php | Returns the correct template for the site’s home page. | | [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. | | Version | Description | | --- | --- | | [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Added the `$fallback_template` parameter. | | [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. | wordpress has_category( string|int|array $category = '', int|WP_Post $post = null ): bool has\_category( string|int|array $category = '', int|WP\_Post $post = null ): bool ================================================================================= Checks if the current post has any of given category. The given categories are checked against the post’s categories’ term\_ids, names and slugs. Categories given as integers will only be checked against the post’s categories’ term\_ids. If no categories are given, determines if post has any categories. `$category` string|int|array Optional The category name/term\_id/slug, or an array of them to check for. Default: `''` `$post` int|[WP\_Post](../classes/wp_post) Optional Post to check. Defaults to the current post. Default: `null` bool True if the current post has any of the given categories (or any category, if no category specified). False otherwise. File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/) ``` function has_category( $category = '', $post = null ) { return has_term( $category, 'category', $post ); } ``` | Uses | Description | | --- | --- | | [has\_term()](has_term) wp-includes/category-template.php | Checks if the current post has any of given terms. | | Used By | Description | | --- | --- | | [in\_category()](in_category) wp-includes/category-template.php | Checks if the current post is within any of the given categories. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress update_attached_file( int $attachment_id, string $file ): bool update\_attached\_file( int $attachment\_id, string $file ): bool ================================================================= Updates attachment file path based on attachment ID. Used to update the file path of the attachment, which uses post meta name ‘\_wp\_attached\_file’ to store the path of the attachment. `$attachment_id` int Required Attachment ID. `$file` string Required File path for the attachment. 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 update_attached_file( $attachment_id, $file ) { if ( ! get_post( $attachment_id ) ) { return false; } /** * Filters the path to the attached file to update. * * @since 2.1.0 * * @param string $file Path to the attached file to update. * @param int $attachment_id Attachment ID. */ $file = apply_filters( 'update_attached_file', $file, $attachment_id ); $file = _wp_relative_upload_path( $file ); if ( $file ) { return update_post_meta( $attachment_id, '_wp_attached_file', $file ); } else { return delete_post_meta( $attachment_id, '_wp_attached_file' ); } } ``` [apply\_filters( 'update\_attached\_file', string $file, int $attachment\_id )](../hooks/update_attached_file) Filters the path to the attached file to update. | 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. | | [\_wp\_relative\_upload\_path()](_wp_relative_upload_path) wp-includes/post.php | Returns relative path to an uploaded file. | | [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\_image\_meta\_replace\_original()](_wp_image_meta_replace_original) wp-admin/includes/image.php | Updates the attached file and image meta data when the original image was edited. | | [wp\_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\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress wp_remote_retrieve_body( array|WP_Error $response ): string wp\_remote\_retrieve\_body( array|WP\_Error $response ): string =============================================================== Retrieve only the body from the raw response. `$response` array|[WP\_Error](../classes/wp_error) Required HTTP response. string The body of the response. Empty string if no body or incorrect parameter given. File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/) ``` function wp_remote_retrieve_body( $response ) { if ( is_wp_error( $response ) || ! isset( $response['body'] ) ) { return ''; } return $response['body']; } ``` | 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\_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\_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\_block\_editor\_theme\_styles()](get_block_editor_theme_styles) wp-includes/block-editor.php | Creates an array of theme styles to load into the block editor. | | [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\_Site\_Health::wp\_cron\_scheduled\_check()](../classes/wp_site_health/wp_cron_scheduled_check) wp-admin/includes/class-wp-site-health.php | Runs the scheduled event to check and update the latest site health status for the website. | | [WP\_Site\_Health::get\_test\_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\_check\_php\_version()](wp_check_php_version) wp-admin/includes/misc.php | Checks if the user needs to update 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\_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. | | [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. | | [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. | | [download\_url()](download_url) wp-admin/includes/file.php | Downloads a URL to a local temporary file using the WordPress HTTP 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\_remote\_fopen()](wp_remote_fopen) wp-includes/functions.php | HTTP request for URI to retrieve content. | | [wp\_get\_http()](wp_get_http) wp-includes/deprecated.php | Perform a HTTP HEAD or GET request. | | [WP\_SimplePie\_File::\_\_construct()](../classes/wp_simplepie_file/__construct) wp-includes/class-wp-simplepie-file.php | Constructor. | | [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\_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\_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\_HTTP\_IXR\_Client::query()](../classes/wp_http_ixr_client/query) wp-includes/class-wp-http-ixr-client.php | | | [\_fetch\_remote\_file()](_fetch_remote_file) wp-includes/rss.php | Retrieve URL headers and content using WP HTTP Request API. | | [wp\_xmlrpc\_server::pingback\_ping()](../classes/wp_xmlrpc_server/pingback_ping) wp-includes/class-wp-xmlrpc-server.php | Retrieves a pingback and registers it. | | [discover\_pingback\_server\_uri()](discover_pingback_server_uri) wp-includes/comment.php | Finds a pingback server URI based on the given URL. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
programming_docs
wordpress wp_tempnam( string $filename = '', string $dir = '' ): string wp\_tempnam( string $filename = '', string $dir = '' ): string ============================================================== Returns a filename of a temporary unique file. Please note that the calling function must unlink() this itself. The filename is based off the passed parameter or defaults to the current unix timestamp, while the directory can either be passed as well, or by leaving it blank, default to a writable temporary directory. `$filename` string Optional Filename to base the Unique file off. Default: `''` `$dir` string Optional Directory to store the file in. Default: `''` string A writable filename. File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/) ``` function wp_tempnam( $filename = '', $dir = '' ) { if ( empty( $dir ) ) { $dir = get_temp_dir(); } if ( empty( $filename ) || in_array( $filename, array( '.', '/', '\\' ), true ) ) { $filename = uniqid(); } // Use the basename of the given file without the extension as the name for the temporary directory. $temp_filename = basename( $filename ); $temp_filename = preg_replace( '|\.[^.]*$|', '', $temp_filename ); // If the folder is falsey, use its parent directory name instead. if ( ! $temp_filename ) { return wp_tempnam( dirname( $filename ), $dir ); } // Suffix some random data to avoid filename conflicts. $temp_filename .= '-' . wp_generate_password( 6, false ); $temp_filename .= '.tmp'; $temp_filename = $dir . wp_unique_filename( $dir, $temp_filename ); $fp = @fopen( $temp_filename, 'x' ); if ( ! $fp && is_writable( $dir ) && file_exists( $temp_filename ) ) { return wp_tempnam( $filename, $dir ); } if ( $fp ) { fclose( $fp ); } return $temp_filename; } ``` | Uses | Description | | --- | --- | | [wp\_tempnam()](wp_tempnam) wp-admin/includes/file.php | Returns a filename of a temporary unique file. | | [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. | | [get\_temp\_dir()](get_temp_dir) wp-includes/functions.php | Determines a writable directory for temporary files. | | [wp\_unique\_filename()](wp_unique_filename) wp-includes/functions.php | Gets a filename that is sanitized and unique for the given directory. | | 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. | | [WP\_REST\_Attachments\_Controller::upload\_from\_data()](../classes/wp_rest_attachments_controller/upload_from_data) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Handles an upload via raw POST data. | | [WP\_Filesystem\_FTPext::get\_contents()](../classes/wp_filesystem_ftpext/get_contents) wp-admin/includes/class-wp-filesystem-ftpext.php | Reads entire file into a string. | | [WP\_Filesystem\_FTPext::put\_contents()](../classes/wp_filesystem_ftpext/put_contents) wp-admin/includes/class-wp-filesystem-ftpext.php | Writes a string to a file. | | [WP\_Filesystem\_ftpsockets::get\_contents()](../classes/wp_filesystem_ftpsockets/get_contents) wp-admin/includes/class-wp-filesystem-ftpsockets.php | Reads entire file into a string. | | [WP\_Filesystem\_ftpsockets::put\_contents()](../classes/wp_filesystem_ftpsockets/put_contents) wp-admin/includes/class-wp-filesystem-ftpsockets.php | Writes a string to a file. | | [wp\_tempnam()](wp_tempnam) wp-admin/includes/file.php | Returns a filename of a temporary unique file. | | [download\_url()](download_url) wp-admin/includes/file.php | Downloads a URL to a local temporary file using the WordPress HTTP API. | | Version | Description | | --- | --- | | [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. | wordpress is_customize_preview(): bool is\_customize\_preview(): bool ============================== Whether the site is being previewed in the Customizer. bool True if the site is being previewed in the Customizer, false otherwise. File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/) ``` function is_customize_preview() { global $wp_customize; return ( $wp_customize instanceof WP_Customize_Manager ) && $wp_customize->is_preview(); } ``` | Used By | Description | | --- | --- | | [WP\_Widget\_Text::render\_control\_template\_scripts()](../classes/wp_widget_text/render_control_template_scripts) wp-includes/widgets/class-wp-widget-text.php | Render form template scripts. | | [wp\_custom\_css\_cb()](wp_custom_css_cb) wp-includes/theme.php | Renders the Custom CSS style element. | | [get\_custom\_header\_markup()](get_custom_header_markup) wp-includes/theme.php | Retrieves the markup for a custom header. | | [the\_custom\_header\_markup()](the_custom_header_markup) wp-includes/theme.php | Prints the markup for a custom header. | | [get\_custom\_logo()](get_custom_logo) wp-includes/general-template.php | Returns a custom logo, linked to home unless the theme supports removing the link on the home page. | | [WP\_Customize\_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\_admin\_bar\_customize\_menu()](wp_admin_bar_customize_menu) wp-includes/admin-bar.php | Adds the “Customize” link to the Toolbar. | | [wp\_site\_icon()](wp_site_icon) wp-includes/general-template.php | Displays site icon meta tags. | | [\_custom\_background\_cb()](_custom_background_cb) wp-includes/theme.php | Default custom background callback. | | [WP\_Widget\_Recent\_Comments::\_\_construct()](../classes/wp_widget_recent_comments/__construct) wp-includes/widgets/class-wp-widget-recent-comments.php | Sets up a new Recent Comments widget instance. | | [\_wp\_menu\_item\_classes\_by\_context()](_wp_menu_item_classes_by_context) wp-includes/nav-menu-template.php | Adds the class property classes for the current context, if applicable. | | Version | Description | | --- | --- | | [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. | wordpress get_footer( string $name = null, array $args = array() ): void|false get\_footer( string $name = null, array $args = array() ): void|false ===================================================================== Loads footer template. Includes the footer template for a theme or if a name is specified then a specialised footer will be included. For the parameter, if the file is called "footer-special.php" then specify "special". `$name` string Optional The name of the specialised footer. Default: `null` `$args` array Optional Additional arguments passed to the footer 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_footer( $name = null, $args = array() ) { /** * Fires before the footer template file is loaded. * * @since 2.1.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 footer file to use. Null for the default footer. * @param array $args Additional arguments passed to the footer template. */ do_action( 'get_footer', $name, $args ); $templates = array(); $name = (string) $name; if ( '' !== $name ) { $templates[] = "footer-{$name}.php"; } $templates[] = 'footer.php'; if ( ! locate_template( $templates, true, true, $args ) ) { return false; } } ``` [do\_action( 'get\_footer', string|null $name, array $args )](../hooks/get_footer) Fires before the footer 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 get_singular_template(): string get\_singular\_template(): string ================================= Retrieves the path of the singular 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 ‘singular’. * [get\_query\_template()](get_query_template) string Full path to singular template file File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/) ``` function get_singular_template() { return get_query_template( 'singular' ); } ``` | Uses | Description | | --- | --- | | [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/) | Introduced. | wordpress wp_convert_widget_settings( string $base_name, string $option_name, array $settings ): array wp\_convert\_widget\_settings( string $base\_name, string $option\_name, array $settings ): array ================================================================================================= Converts the widget settings from single to multi-widget format. `$base_name` string Required Root ID for all widgets of this type. `$option_name` string Required Option name for this widget type. `$settings` array Required The array of widget instance settings. array The array of widget settings converted to multi-widget format. File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/) ``` function wp_convert_widget_settings( $base_name, $option_name, $settings ) { // This test may need expanding. $single = false; $changed = false; if ( empty( $settings ) ) { $single = true; } else { foreach ( array_keys( $settings ) as $number ) { if ( 'number' === $number ) { continue; } if ( ! is_numeric( $number ) ) { $single = true; break; } } } if ( $single ) { $settings = array( 2 => $settings ); // If loading from the front page, update sidebar in memory but don't save to options. if ( is_admin() ) { $sidebars_widgets = get_option( 'sidebars_widgets' ); } else { if ( empty( $GLOBALS['_wp_sidebars_widgets'] ) ) { $GLOBALS['_wp_sidebars_widgets'] = get_option( 'sidebars_widgets', array() ); } $sidebars_widgets = &$GLOBALS['_wp_sidebars_widgets']; } foreach ( (array) $sidebars_widgets as $index => $sidebar ) { if ( is_array( $sidebar ) ) { foreach ( $sidebar as $i => $name ) { if ( $base_name === $name ) { $sidebars_widgets[ $index ][ $i ] = "$name-2"; $changed = true; break 2; } } } } if ( is_admin() && $changed ) { update_option( 'sidebars_widgets', $sidebars_widgets ); } } $settings['_multiwidget'] = 1; if ( is_admin() ) { update_option( $option_name, $settings ); } return $settings; } ``` | Uses | Description | | --- | --- | | [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [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 | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress is_attachment( int|string|int[]|string[] $attachment = '' ): bool is\_attachment( int|string|int[]|string[] $attachment = '' ): bool ================================================================== Determines whether the query is for an existing attachment page. For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook. `$attachment` int|string|int[]|string[] Optional Attachment ID, title, slug, or array of such to check against. Default: `''` bool Whether the query is for an existing attachment page. * See Also: [is\_singular()](is_singular) * For more specific checking of the attachment see: [wp\_attachment\_is\_image()](wp_attachment_is_image) File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/) ``` function is_attachment( $attachment = '' ) { 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_attachment( $attachment ); } ``` | Uses | Description | | --- | --- | | [WP\_Query::is\_attachment()](../classes/wp_query/is_attachment) wp-includes/class-wp-query.php | Is the query for an existing attachment 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\_embed\_excerpt\_attachment()](wp_embed_excerpt_attachment) wp-includes/embed.php | Filters the post excerpt for the embed template. | | [get\_adjacent\_post\_link()](get_adjacent_post_link) wp-includes/link-template.php | Retrieves the adjacent post link. | | [get\_adjacent\_post\_rel\_link()](get_adjacent_post_rel_link) wp-includes/link-template.php | Retrieves the adjacent post relational link. | | [adjacent\_posts\_rel\_link\_wp\_head()](adjacent_posts_rel_link_wp_head) wp-includes/link-template.php | Displays relational links for the posts adjacent to the current post for single post pages. | | [get\_boundary\_post()](get_boundary_post) wp-includes/link-template.php | Retrieves the boundary post. | | [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\_post\_class()](get_post_class) wp-includes/post-template.php | Retrieves an array of the class names for the post container element. | | [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. | | [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress wp_ajax_nopriv_generate_password() wp\_ajax\_nopriv\_generate\_password() ====================================== Ajax handler for generating a password in the no-privilege context. File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/) ``` function wp_ajax_nopriv_generate_password() { wp_send_json_success( wp_generate_password( 24 ) ); } ``` | Uses | Description | | --- | --- | | [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. | | [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 get_linkrating( object $link ): mixed get\_linkrating( object $link ): mixed ====================================== This function has been deprecated. Use [sanitize\_bookmark\_field()](sanitize_bookmark_field) instead. Legacy function that retrieved the value of a link’s link\_rating field. * [sanitize\_bookmark\_field()](sanitize_bookmark_field) `$link` object Required Link object. mixed Value of the `'link_rating'` field, false otherwise. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_linkrating( $link ) { _deprecated_function( __FUNCTION__, '2.1.0', 'sanitize_bookmark_field()' ); return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); } ``` | Uses | Description | | --- | --- | | [sanitize\_bookmark\_field()](sanitize_bookmark_field) wp-includes/bookmark.php | Sanitizes a bookmark field. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Used By | Description | | --- | --- | | [get\_links()](get_links) wp-includes/deprecated.php | Gets the links associated with category by ID. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [sanitize\_bookmark\_field()](sanitize_bookmark_field) | | [1.0.1](https://developer.wordpress.org/reference/since/1.0.1/) | Introduced. | wordpress wp_force_plain_post_permalink( WP_Post|int|null $post = null, bool|null $sample = null ): bool wp\_force\_plain\_post\_permalink( WP\_Post|int|null $post = null, bool|null $sample = null ): bool =================================================================================================== Determine whether post should always use a plain permalink structure. `$post` [WP\_Post](../classes/wp_post)|int|null Optional Post ID or post object. Defaults to global $post. Default: `null` `$sample` bool|null Optional Whether to force consideration based on sample links. If omitted, a sample link is generated if a post object is passed with the filter property set to `'sample'`. Default: `null` bool Whether to use a plain permalink structure. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function wp_force_plain_post_permalink( $post = null, $sample = null ) { if ( null === $sample && is_object( $post ) && isset( $post->filter ) && 'sample' === $post->filter ) { $sample = true; } else { $post = get_post( $post ); $sample = null !== $sample ? $sample : false; } if ( ! $post ) { return true; } $post_status_obj = get_post_status_object( get_post_status( $post ) ); $post_type_obj = get_post_type_object( get_post_type( $post ) ); if ( ! $post_status_obj || ! $post_type_obj ) { return true; } if ( // Publicly viewable links never have plain permalinks. is_post_status_viewable( $post_status_obj ) || ( // Private posts don't have plain permalinks if the user can read them. $post_status_obj->private && current_user_can( 'read_post', $post->ID ) ) || // Protected posts don't have plain links if getting a sample URL. ( $post_status_obj->protected && $sample ) ) { return false; } return true; } ``` | Uses | Description | | --- | --- | | [is\_post\_status\_viewable()](is_post_status_viewable) wp-includes/post.php | Determines whether a post status is considered “viewable”. | | [get\_post\_status\_object()](get_post_status_object) wp-includes/post.php | Retrieves a post status object by name. | | [get\_post\_status()](get_post_status) wp-includes/post.php | Retrieves the post status based on the post ID. | | [get\_post\_type()](get_post_type) wp-includes/post.php | Retrieves the post type of the current post or of a given post. | | [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. | | [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. | | Used By | Description | | --- | --- | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [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. | | Version | Description | | --- | --- | | [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
programming_docs
wordpress wp_ajax_query_themes() wp\_ajax\_query\_themes() ========================= Ajax handler for getting themes from [themes\_api()](themes_api) . 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_query_themes() { global $themes_allowedtags, $theme_field_defaults; if ( ! current_user_can( 'install_themes' ) ) { wp_send_json_error(); } $args = wp_parse_args( wp_unslash( $_REQUEST['request'] ), array( 'per_page' => 20, 'fields' => array_merge( (array) $theme_field_defaults, array( 'reviews_url' => true, // Explicitly request the reviews URL to be linked from the Add Themes screen. ) ), ) ); if ( isset( $args['browse'] ) && 'favorites' === $args['browse'] && ! isset( $args['user'] ) ) { $user = get_user_option( 'wporg_favorites' ); if ( $user ) { $args['user'] = $user; } } $old_filter = isset( $args['browse'] ) ? $args['browse'] : 'search'; /** This filter is documented in wp-admin/includes/class-wp-theme-install-list-table.php */ $args = apply_filters( 'install_themes_table_api_args_' . $old_filter, $args ); $api = themes_api( 'query_themes', $args ); if ( is_wp_error( $api ) ) { wp_send_json_error(); } $update_php = network_admin_url( 'update.php?action=install-theme' ); $installed_themes = search_theme_directories(); if ( false === $installed_themes ) { $installed_themes = array(); } foreach ( $installed_themes as $theme_slug => $theme_data ) { // Ignore child themes. if ( str_contains( $theme_slug, '/' ) ) { unset( $installed_themes[ $theme_slug ] ); } } foreach ( $api->themes as &$theme ) { $theme->install_url = add_query_arg( array( 'theme' => $theme->slug, '_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug ), ), $update_php ); if ( current_user_can( 'switch_themes' ) ) { if ( is_multisite() ) { $theme->activate_url = add_query_arg( array( 'action' => 'enable', '_wpnonce' => wp_create_nonce( 'enable-theme_' . $theme->slug ), 'theme' => $theme->slug, ), network_admin_url( 'themes.php' ) ); } else { $theme->activate_url = add_query_arg( array( 'action' => 'activate', '_wpnonce' => wp_create_nonce( 'switch-theme_' . $theme->slug ), 'stylesheet' => $theme->slug, ), admin_url( 'themes.php' ) ); } } $is_theme_installed = array_key_exists( $theme->slug, $installed_themes ); // We only care about installed themes. $theme->block_theme = $is_theme_installed && wp_get_theme( $theme->slug )->is_block_theme(); if ( ! is_multisite() && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { $customize_url = $theme->block_theme ? admin_url( 'site-editor.php' ) : wp_customize_url( $theme->slug ); $theme->customize_url = add_query_arg( array( 'return' => urlencode( network_admin_url( 'theme-install.php', 'relative' ) ), ), $customize_url ); } $theme->name = wp_kses( $theme->name, $themes_allowedtags ); $theme->author = wp_kses( $theme->author['display_name'], $themes_allowedtags ); $theme->version = wp_kses( $theme->version, $themes_allowedtags ); $theme->description = wp_kses( $theme->description, $themes_allowedtags ); $theme->stars = wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings, 'echo' => false, ) ); $theme->num_ratings = number_format_i18n( $theme->num_ratings ); $theme->preview_url = set_url_scheme( $theme->preview_url ); $theme->compatible_wp = is_wp_version_compatible( $theme->requires ); $theme->compatible_php = is_php_version_compatible( $theme->requires_php ); } wp_send_json_success( $api ); } ``` | Uses | Description | | --- | --- | | [is\_wp\_version\_compatible()](is_wp_version_compatible) wp-includes/functions.php | Checks compatibility with the current WordPress version. | | [themes\_api()](themes_api) wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. | | [wp\_star\_rating()](wp_star_rating) wp-admin/includes/template.php | Outputs a HTML element with a star rating for a given rating. | | [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. | | [wp\_customize\_url()](wp_customize_url) wp-includes/theme.php | Returns a URL to load the Customizer. | | [search\_theme\_directories()](search_theme_directories) wp-includes/theme.php | Searches all registered theme directories for complete and valid themes. | | [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\_kses()](wp_kses) wp-includes/kses.php | Filters text content and strips out disallowed HTML. | | [is\_php\_version\_compatible()](is_php_version_compatible) wp-includes/functions.php | Checks compatibility with the current PHP version. | | [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the network. | | [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. | | [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. | | [wp\_send\_json\_success()](wp_send_json_success) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating success. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. | | [wp\_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. | | [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.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. | wordpress find_core_auto_update(): object|false find\_core\_auto\_update(): object|false ======================================== Gets the best available (and enabled) Auto-Update for WordPress core. If there’s 1.2.3 and 1.3 on offer, it’ll choose 1.3 if the installation allows it, else, 1.2.3. object|false The core update offering 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 find_core_auto_update() { $updates = get_site_transient( 'update_core' ); if ( ! $updates || empty( $updates->updates ) ) { return false; } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $auto_update = false; $upgrader = new WP_Automatic_Updater; foreach ( $updates->updates as $update ) { if ( 'autoupdate' !== $update->response ) { continue; } if ( ! $upgrader->should_update( 'core', $update, ABSPATH ) ) { continue; } if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) ) { $auto_update = $update; } } return $auto_update; } ``` | Uses | Description | | --- | --- | | [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. | | Used By | Description | | --- | --- | | [WP\_Automatic\_Updater::run()](../classes/wp_automatic_updater/run) wp-admin/includes/class-wp-automatic-updater.php | Kicks off the background update process, looping through all pending updates. | | Version | Description | | --- | --- | | [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. | wordpress esc_js( string $text ): string esc\_js( string $text ): string =============================== Escapes single quotes, `"`, , `&amp;`, and fixes line endings. Escapes text strings for echoing in JS. It is intended to be used for inline JS (in a tag attribute, for example `onclick="..."`). Note that the strings have to be in single quotes. The [‘js\_escape’](../hooks/js_escape) filter is also applied here. `$text` string Required The text to be escaped. string Escaped text. See [Data Validation](https://developer.wordpress.org/plugins/security/data-validation/) for more information on escaping and sanitization. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function esc_js( $text ) { $safe_text = wp_check_invalid_utf8( $text ); $safe_text = _wp_specialchars( $safe_text, ENT_COMPAT ); $safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) ); $safe_text = str_replace( "\r", '', $safe_text ); $safe_text = str_replace( "\n", '\\n', addslashes( $safe_text ) ); /** * Filters a string cleaned and escaped for output in JavaScript. * * Text passed to esc_js() is stripped of invalid or special characters, * and properly slashed for output. * * @since 2.0.6 * * @param string $safe_text The text after it has been escaped. * @param string $text The text prior to being escaped. */ return apply_filters( 'js_escape', $safe_text, $text ); } ``` [apply\_filters( 'js\_escape', string $safe\_text, string $text )](../hooks/js_escape) Filters a string cleaned and escaped for output in JavaScript. | Uses | Description | | --- | --- | | [wp\_check\_invalid\_utf8()](wp_check_invalid_utf8) wp-includes/formatting.php | Checks for invalid UTF8 in a string. | | [\_wp\_specialchars()](_wp_specialchars) wp-includes/formatting.php | Converts a number of special characters into their HTML entities. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [WP\_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\_Links\_List\_Table::handle\_row\_actions()](../classes/wp_links_list_table/handle_row_actions) wp-admin/includes/class-wp-links-list-table.php | Generates and displays row action links. | | [Bulk\_Upgrader\_Skin::before()](../classes/bulk_upgrader_skin/before) wp-admin/includes/class-bulk-upgrader-skin.php | | | [Bulk\_Upgrader\_Skin::after()](../classes/bulk_upgrader_skin/after) wp-admin/includes/class-bulk-upgrader-skin.php | | | [Bulk\_Upgrader\_Skin::error()](../classes/bulk_upgrader_skin/error) wp-admin/includes/class-bulk-upgrader-skin.php | | | [\_thickbox\_path\_admin\_subfolder()](_thickbox_path_admin_subfolder) wp-admin/includes/ms.php | Thickbox image paths for Network Admin. | | [wp\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. | | [iframe\_header()](iframe_header) wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. | | [WP\_Themes\_List\_Table::display\_rows()](../classes/wp_themes_list_table/display_rows) wp-admin/includes/class-wp-themes-list-table.php | | | [wp\_iframe()](wp_iframe) wp-admin/includes/media.php | Outputs the iframe to display the media upload page. | | [link\_submit\_meta\_box()](link_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays link create form fields. | | [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. | | [dismissed\_updates()](dismissed_updates) wp-admin/update-core.php | Display dismissed updates. | | [js\_escape()](js_escape) wp-includes/deprecated.php | Escape single quotes, specialchar double quotes, and fix line endings. | | [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\_Archives::widget()](../classes/wp_widget_archives/widget) wp-includes/widgets/class-wp-widget-archives.php | Outputs the content for the current Archives widget instance. | | [sanitize\_term\_field()](sanitize_term_field) wp-includes/taxonomy.php | Sanitizes the field value in the term based on the context. | | [WP\_Admin\_Bar::\_render\_item()](../classes/wp_admin_bar/_render_item) wp-includes/class-wp-admin-bar.php | | | [sanitize\_user\_field()](sanitize_user_field) wp-includes/user.php | Sanitizes user field based on context. | | [wp\_playlist\_scripts()](wp_playlist_scripts) wp-includes/media.php | Outputs and enqueues default scripts and styles for playlists. | | [sanitize\_post\_field()](sanitize_post_field) wp-includes/post.php | Sanitizes a post field based on context. | | [sanitize\_bookmark\_field()](sanitize_bookmark_field) wp-includes/bookmark.php | Sanitizes a bookmark field. | | [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress get_parent_post_rel_link( string $title = '%title' ): string get\_parent\_post\_rel\_link( string $title = '%title' ): string ================================================================ This function has been deprecated. Get parent post relational link. `$title` string Optional Link title format. Default `'%title'`. Default: `'%title'` string File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_parent_post_rel_link( $title = '%title' ) { _deprecated_function( __FUNCTION__, '3.3.0' ); if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) $post = get_post($GLOBALS['post']->post_parent); if ( empty($post) ) return; $date = mysql2date(get_option('date_format'), $post->post_date); $title = str_replace('%title', $post->post_title, $title); $title = str_replace('%date', $date, $title); $title = apply_filters('the_title', $title, $post->ID); $link = "<link rel='up' title='"; $link .= esc_attr( $title ); $link .= "' href='" . get_permalink($post) . "' />\n"; return apply_filters( "parent_post_rel_link", $link ); } ``` [apply\_filters( 'the\_title', string $post\_title, int $post\_id )](../hooks/the_title) Filters the post title. | Uses | Description | | --- | --- | | [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Used By | Description | | --- | --- | | [parent\_post\_rel\_link()](parent_post_rel_link) wp-includes/deprecated.php | Display relational link for parent item | | 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 admin_created_user_email( string $text ): string admin\_created\_user\_email( string $text ): string =================================================== `$text` string Required string File: `wp-admin/includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/user.php/) ``` function admin_created_user_email( $text ) { $roles = get_editable_roles(); $role = $roles[ $_REQUEST['role'] ]; if ( '' !== get_bloginfo( 'name' ) ) { $site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); } else { $site_title = parse_url( home_url(), PHP_URL_HOST ); } return sprintf( /* translators: 1: Site title, 2: Site URL, 3: User role. */ __( 'Hi, You\'ve been invited to join \'%1$s\' at %2$s with the role of %3$s. If you do not want to join this site please ignore this email. This invitation will expire in a few days. Please click the following link to activate your user account: %%s' ), $site_title, home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ) ); } ``` | Uses | Description | | --- | --- | | [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. | | [translate\_user\_role()](translate_user_role) wp-includes/l10n.php | Translates role name. | | [wp\_specialchars\_decode()](wp_specialchars_decode) wp-includes/formatting.php | Converts a number of HTML entities into their special characters. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress get_site_meta( int $site_id, string $key = '', bool $single = false ): mixed get\_site\_meta( int $site\_id, string $key = '', bool $single = false ): mixed =============================================================================== Retrieves metadata for a site. `$site_id` int Required Site ID. `$key` string Optional The meta key to retrieve. By default, returns data for all keys. Default: `''` `$single` bool Optional Whether to return a single value. This parameter has no effect if `$key` is not specified. Default: `false` mixed An array of values if `$single` is false. The value of meta data field if `$single` is true. False for an invalid `$site_id` (non-numeric, zero, or negative value). An empty string if a valid but non-existing site ID is passed. File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/) ``` function get_site_meta( $site_id, $key = '', $single = false ) { return get_metadata( 'blog', $site_id, $key, $single ); } ``` | Uses | Description | | --- | --- | | [get\_metadata()](get_metadata) wp-includes/meta.php | Retrieves the value of a metadata field for the specified object type and ID. | | Version | Description | | --- | --- | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
programming_docs
wordpress wp_auth_check_load() wp\_auth\_check\_load() ======================= Loads the auth check for monitoring whether the user is still logged in. Can be disabled with remove\_action( ‘admin\_enqueue\_scripts’, ‘wp\_auth\_check\_load’ ); This is disabled for certain screens where a login screen could cause an inconvenient interruption. A filter called [‘wp\_auth\_check\_load’](../hooks/wp_auth_check_load) can be used for fine-grained control. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp_auth_check_load() { if ( ! is_admin() && ! is_user_logged_in() ) { return; } if ( defined( 'IFRAME_REQUEST' ) ) { return; } $screen = get_current_screen(); $hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' ); $show = ! in_array( $screen->id, $hidden, true ); /** * Filters whether to load the authentication check. * * Returning a falsey value from the filter will effectively short-circuit * loading the authentication check. * * @since 3.6.0 * * @param bool $show Whether to load the authentication check. * @param WP_Screen $screen The current screen object. */ if ( apply_filters( 'wp_auth_check_load', $show, $screen ) ) { wp_enqueue_style( 'wp-auth-check' ); wp_enqueue_script( 'wp-auth-check' ); add_action( 'admin_print_footer_scripts', 'wp_auth_check_html', 5 ); add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 ); } } ``` [apply\_filters( 'wp\_auth\_check\_load', bool $show, WP\_Screen $screen )](../hooks/wp_auth_check_load) Filters whether to load the authentication check. | Uses | Description | | --- | --- | | [get\_current\_screen()](get_current_screen) wp-admin/includes/screen.php | Get the current screen 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. | | [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. | | [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress is_plugin_page(): bool is\_plugin\_page(): bool ======================== This function has been deprecated. Determines whether the current admin page is generated by a plugin. Use global $plugin\_page and/or [get\_plugin\_page\_hookname()](get_plugin_page_hookname) hooks. 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 File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function is_plugin_page() { _deprecated_function( __FUNCTION__, '3.1.0' ); global $plugin_page; if ( isset($plugin_page) ) return true; 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.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | This function has been deprecated. | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress wp_set_post_cats( int $blogid = '1', int $post_ID, array $post_categories = array() ): bool|mixed wp\_set\_post\_cats( int $blogid = '1', int $post\_ID, array $post\_categories = array() ): bool|mixed ====================================================================================================== This function has been deprecated. Use [wp\_set\_post\_categories()](wp_set_post_categories) instead. Sets the categories that the post ID belongs to. * [wp\_set\_post\_categories()](wp_set_post_categories) `$blogid` int Optional Not used Default: `'1'` `$post_ID` int Required `$post_categories` array Optional Default: `array()` bool|mixed File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_set_post_categories()' ); return wp_set_post_categories($post_ID, $post_categories); } ``` | Uses | Description | | --- | --- | | [wp\_set\_post\_categories()](wp_set_post_categories) wp-includes/post.php | Sets categories for a post. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | This function has been deprecated. Use [wp\_set\_post\_categories()](wp_set_post_categories) instead. | | [1.0.1](https://developer.wordpress.org/reference/since/1.0.1/) | Introduced. | wordpress esc_attr__( string $text, string $domain = 'default' ): string esc\_attr\_\_( string $text, string $domain = 'default' ): string ================================================================= Retrieves the translation of $text and escapes it for safe use in an attribute. If there is no translation, or the text domain isn’t loaded, the original text is returned. `$text` string Required Text to translate. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings. Default `'default'`. Default: `'default'` string Translated text on success, original text on failure. File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/) ``` function esc_attr__( $text, $domain = 'default' ) { return esc_attr( translate( $text, $domain ) ); } ``` | Uses | Description | | --- | --- | | [translate()](translate) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | Used By | Description | | --- | --- | | [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\_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\_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\_Screen::render\_screen\_options()](../classes/wp_screen/render_screen_options) wp-admin/includes/class-wp-screen.php | Renders the screen options tab. | | [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\_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. | | [update\_nag()](update_nag) wp-admin/includes/update.php | Returns core update notification message. | | [wp\_dashboard\_browser\_nag()](wp_dashboard_browser_nag) wp-admin/includes/dashboard.php | Displays the browser update nag. | | [\_wp\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. | | [wp\_media\_insert\_url\_form()](wp_media_insert_url_form) wp-admin/includes/media.php | Creates the form for external url. | | [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor | | [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. | | [WP\_Media\_List\_Table::get\_columns()](../classes/wp_media_list_table/get_columns) wp-admin/includes/class-wp-media-list-table.php | | | [WP\_Comments\_List\_Table::extra\_tablenav()](../classes/wp_comments_list_table/extra_tablenav) wp-admin/includes/class-wp-comments-list-table.php | | | [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\_Posts\_List\_Table::get\_columns()](../classes/wp_posts_list_table/get_columns) wp-admin/includes/class-wp-posts-list-table.php | | | [\_wp\_menu\_output()](_wp_menu_output) wp-admin/menu-header.php | Display menu. | | [wp\_timezone\_choice()](wp_timezone_choice) wp-includes/functions.php | Gives a nicely-formatted list of timezone strings. | | [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\_Customize\_Widgets::enqueue\_scripts()](../classes/wp_customize_widgets/enqueue_scripts) wp-includes/class-wp-customize-widgets.php | Enqueues scripts and styles for Customizer panel and export data to JavaScript. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress wp_get_link_cats( int $link_id ): int[] wp\_get\_link\_cats( int $link\_id ): int[] =========================================== Retrieves the link category IDs associated with the link specified. `$link_id` int Required Link ID to look up. int[] The IDs of the requested link's categories. File: `wp-admin/includes/bookmark.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/bookmark.php/) ``` function wp_get_link_cats( $link_id = 0 ) { $cats = wp_get_object_terms( $link_id, 'link_category', array( 'fields' => 'ids' ) ); return array_unique( $cats ); } ``` | 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. | | Used By | Description | | --- | --- | | [WP\_Links\_List\_Table::display\_rows()](../classes/wp_links_list_table/display_rows) wp-admin/includes/class-wp-links-list-table.php | | | [wp\_link\_category\_checklist()](wp_link_category_checklist) wp-admin/includes/template.php | Outputs a link category checklist element. | | [get\_linkcatname()](get_linkcatname) wp-includes/deprecated.php | Gets the name of category by ID. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress is_wpmu_sitewide_plugin( $file ) is\_wpmu\_sitewide\_plugin( $file ) =================================== This function has been deprecated. Use [is\_network\_only\_plugin()](is_network_only_plugin) instead. Deprecated functionality for determining if the current plugin is network-only. * [is\_network\_only\_plugin()](is_network_only_plugin) File: `wp-admin/includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms-deprecated.php/) ``` function is_wpmu_sitewide_plugin( $file ) { _deprecated_function( __FUNCTION__, '3.0.0', 'is_network_only_plugin()' ); return is_network_only_plugin( $file ); } ``` | Uses | Description | | --- | --- | | [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. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress get_comment_statuses(): string[] get\_comment\_statuses(): string[] ================================== Retrieves all of the WordPress supported comment statuses. Comments have a limited set of valid status values, this provides the comment status values and descriptions. string[] List of comment status labels keyed by status. File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/) ``` function get_comment_statuses() { $status = array( 'hold' => __( 'Unapproved' ), 'approve' => _x( 'Approved', 'comment status' ), 'spam' => _x( 'Spam', 'comment status' ), 'trash' => _x( 'Trash', 'comment status' ), ); return $status; } ``` | Uses | Description | | --- | --- | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | Used By | Description | | --- | --- | | [wp\_xmlrpc\_server::wp\_editComment()](../classes/wp_xmlrpc_server/wp_editcomment) wp-includes/class-wp-xmlrpc-server.php | Edit comment. | | [wp\_xmlrpc\_server::wp\_getCommentStatusList()](../classes/wp_xmlrpc_server/wp_getcommentstatuslist) wp-includes/class-wp-xmlrpc-server.php | Retrieve all of the comment status. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress comment_class( string|string[] $css_class = '', int|WP_Comment $comment = null, int|WP_Post $post = null, bool $display = true ): void|string comment\_class( string|string[] $css\_class = '', int|WP\_Comment $comment = null, int|WP\_Post $post = null, bool $display = true ): void|string ================================================================================================================================================= Generates semantic classes for each comment element. `$css_class` string|string[] Optional One or more classes to add to the class list. Default: `''` `$comment` int|[WP\_Comment](../classes/wp_comment) Optional Comment ID or [WP\_Comment](../classes/wp_comment) object. Default current comment. Default: `null` `$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default current post. Default: `null` `$display` bool Optional Whether to print or return the output. Default: `true` void|string Void if `$display` argument is true, comment classes if `$display` is false. [comment\_class()](comment_class) will apply the following classes, based on the following conditions: * comment\_type: for normal comments, adds class “comment”. For all other types, it adds the value of the comment\_type as the class * user\_id: if the comment was made by a registered user, then adds class “byuser” and “comment-author-” + the user\_nicename sanitized (i.e. spaces removed). Also, if the comment is by the original author of the post, the class “bypostauthor” is added. * Odd/Even: if the comment number is even, adds class “even”. Otherwise, adds class “alt” and “odd”. * Comment Depth: The class “depth=” + the comment depth is always added * Top-level Comments: If comment depth is top level (1), then adds “thread-even” or “thread-alt” and “thread-odd” depending on whether the comment number is even or odd. * If the optional class parameter is passed to [comment\_class()](comment_class) , then that class gets added to all the others. This is useful for defining your own custom comment class. [comment\_class()](comment_class) uses the following [global variables](https://developer.wordpress.org/apis/handbook/global-variables/). So these variables can be set prior to calling [comment\_class()](comment_class) to effect the output: * **`$comment_alt`** * **`$comment_depth`** * **`$comment_thread_alt`** For example, you can force `$comment_alt = FALSE` if you always want to start with the first comment being even. The [comment\_class()](comment_class) function will then alternate this variable for you. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function comment_class( $css_class = '', $comment = null, $post = null, $display = true ) { // Separates classes with a single space, collates classes for comment DIV. $css_class = 'class="' . implode( ' ', get_comment_class( $css_class, $comment, $post ) ) . '"'; if ( $display ) { echo $css_class; } else { return $css_class; } } ``` | Uses | Description | | --- | --- | | [get\_comment\_class()](get_comment_class) wp-includes/comment-template.php | Returns the classes for the comment div as an array. | | 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. | | [Walker\_Comment::comment()](../classes/walker_comment/comment) wp-includes/class-walker-comment.php | Outputs a single comment. | | [Walker\_Comment::html5\_comment()](../classes/walker_comment/html5_comment) wp-includes/class-walker-comment.php | Outputs a comment in the HTML5 format. | | [Walker\_Comment::ping()](../classes/walker_comment/ping) wp-includes/class-walker-comment.php | Outputs a pingback comment. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the ability for `$comment` to also accept a [WP\_Comment](../classes/wp_comment) object. | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress unload_textdomain( string $domain, bool $reloadable = false ): bool unload\_textdomain( string $domain, bool $reloadable = false ): bool ==================================================================== Unloads translations for a text domain. `$domain` string Required Text domain. Unique identifier for retrieving translated strings. `$reloadable` bool Optional Whether the text domain can be loaded just-in-time again. Default: `false` bool Whether textdomain was unloaded. File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/) ``` function unload_textdomain( $domain, $reloadable = false ) { global $l10n, $l10n_unloaded; $l10n_unloaded = (array) $l10n_unloaded; /** * Filters whether to override the text domain unloading. * * @since 3.0.0 * @since 6.1.0 Added the `$reloadable` parameter. * * @param bool $override Whether to override the text domain unloading. Default false. * @param string $domain Text domain. Unique identifier for retrieving translated strings. * @param bool $reloadable Whether the text domain can be loaded just-in-time again. */ $plugin_override = apply_filters( 'override_unload_textdomain', false, $domain, $reloadable ); if ( $plugin_override ) { if ( ! $reloadable ) { $l10n_unloaded[ $domain ] = true; } return true; } /** * Fires before the text domain is unloaded. * * @since 3.0.0 * @since 6.1.0 Added the `$reloadable` parameter. * * @param string $domain Text domain. Unique identifier for retrieving translated strings. * @param bool $reloadable Whether the text domain can be loaded just-in-time again. */ do_action( 'unload_textdomain', $domain, $reloadable ); if ( isset( $l10n[ $domain ] ) ) { unset( $l10n[ $domain ] ); if ( ! $reloadable ) { $l10n_unloaded[ $domain ] = true; } return true; } return false; } ``` [apply\_filters( 'override\_unload\_textdomain', bool $override, string $domain, bool $reloadable )](../hooks/override_unload_textdomain) Filters whether to override the text domain unloading. [do\_action( 'unload\_textdomain', string $domain, bool $reloadable )](../hooks/unload_textdomain) Fires before the text domain is unloaded. | Uses | Description | | --- | --- | | [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\_Locale\_Switcher::load\_translations()](../classes/wp_locale_switcher/load_translations) wp-includes/class-wp-locale-switcher.php | Load translations for a given locale. | | [load\_default\_textdomain()](load_default_textdomain) wp-includes/l10n.php | Loads default translated strings based on locale. | | [wp\_timezone\_choice()](wp_timezone_choice) wp-includes/functions.php | Gives a nicely-formatted list of timezone strings. | | Version | Description | | --- | --- | | [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Added the `$reloadable` parameter. | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
programming_docs
wordpress sanitize_textarea_field( string $str ): string sanitize\_textarea\_field( string $str ): string ================================================ Sanitizes a multiline string from user input or from the database. The function is like [sanitize\_text\_field()](sanitize_text_field) , but preserves new lines (\n) and other whitespace, which are legitimate input in textarea elements. * [sanitize\_text\_field()](sanitize_text_field) `$str` string Required String to sanitize. string Sanitized string. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function sanitize_textarea_field( $str ) { $filtered = _sanitize_text_fields( $str, true ); /** * Filters a sanitized textarea field string. * * @since 4.7.0 * * @param string $filtered The sanitized string. * @param string $str The string prior to being sanitized. */ return apply_filters( 'sanitize_textarea_field', $filtered, $str ); } ``` [apply\_filters( 'sanitize\_textarea\_field', string $filtered, string $str )](../hooks/sanitize_textarea_field) Filters a sanitized textarea field string. | Uses | Description | | --- | --- | | [\_sanitize\_text\_fields()](_sanitize_text_fields) wp-includes/formatting.php | Internal helper function to sanitize a string from user input or from the database. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [rest\_sanitize\_value\_from\_schema()](rest_sanitize_value_from_schema) wp-includes/rest-api.php | Sanitize a value based on a schema. | | Version | Description | | --- | --- | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. | wordpress get_the_terms( int|WP_Post $post, string $taxonomy ): WP_Term[]|false|WP_Error get\_the\_terms( int|WP\_Post $post, string $taxonomy ): WP\_Term[]|false|WP\_Error =================================================================================== Retrieves the terms of the taxonomy that are attached to the post. `$post` int|[WP\_Post](../classes/wp_post) Required Post ID or object. `$taxonomy` string Required Taxonomy name. [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. File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/) ``` function get_the_terms( $post, $taxonomy ) { $post = get_post( $post ); if ( ! $post ) { return false; } $terms = get_object_term_cache( $post->ID, $taxonomy ); if ( false === $terms ) { $terms = wp_get_object_terms( $post->ID, $taxonomy ); if ( ! is_wp_error( $terms ) ) { $term_ids = wp_list_pluck( $terms, 'term_id' ); wp_cache_add( $post->ID, $term_ids, $taxonomy . '_relationships' ); } } /** * Filters the list of terms attached to the given post. * * @since 3.1.0 * * @param WP_Term[]|WP_Error $terms Array of attached terms, or WP_Error on failure. * @param int $post_id Post ID. * @param string $taxonomy Name of the taxonomy. */ $terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy ); if ( empty( $terms ) ) { return false; } return $terms; } ``` [apply\_filters( 'get\_the\_terms', WP\_Term[]|WP\_Error $terms, int $post\_id, string $taxonomy )](../hooks/get_the_terms) Filters the list of terms attached to the given post. | Uses | Description | | --- | --- | | [wp\_cache\_add()](wp_cache_add) wp-includes/cache.php | Adds data to the cache, if the cache key doesn’t already exist. | | [wp\_list\_pluck()](wp_list_pluck) wp-includes/functions.php | Plucks a certain field out of each object or array in an array. | | [get\_object\_term\_cache()](get_object_term_cache) wp-includes/taxonomy.php | Retrieves the cached term objects for the given object ID. | | [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. | | [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. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [WP\_REST\_Menu\_Items\_Controller::prepare\_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\_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. | | [\_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\_filter\_wp\_template\_unique\_post\_slug()](wp_filter_wp_template_unique_post_slug) wp-includes/theme-templates.php | Generates a unique slug for templates. | | [WP\_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\_Posts\_List\_Table::column\_default()](../classes/wp_posts_list_table/column_default) wp-admin/includes/class-wp-posts-list-table.php | Handles the default column output. | | [WP\_Media\_List\_Table::column\_default()](../classes/wp_media_list_table/column_default) wp-admin/includes/class-wp-media-list-table.php | Handles output for the default column. | | [get\_the\_term\_list()](get_the_term_list) wp-includes/category-template.php | Retrieves a post’s terms as a list with specified format. | | [get\_the\_tags()](get_the_tags) wp-includes/category-template.php | Retrieves the tags for a post. | | [get\_the\_category()](get_the_category) wp-includes/category-template.php | Retrieves post categories. | | [get\_post\_class()](get_post_class) wp-includes/post-template.php | Retrieves an array of the class names for the post container element. | | [WP\_Post::\_\_get()](../classes/wp_post/__get) wp-includes/class-wp-post.php | Getter. | | [wp\_publish\_post()](wp_publish_post) wp-includes/post.php | Publishes a post by transitioning the post status. | | [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. | | [get\_post\_format()](get_post_format) wp-includes/post-formats.php | Retrieve the format slug for a post | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress wp_ajax_save_attachment_order() wp\_ajax\_save\_attachment\_order() =================================== Ajax handler for saving the attachment 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_save_attachment_order() { if ( ! isset( $_REQUEST['post_id'] ) ) { wp_send_json_error(); } $post_id = absint( $_REQUEST['post_id'] ); if ( ! $post_id ) { wp_send_json_error(); } if ( empty( $_REQUEST['attachments'] ) ) { wp_send_json_error(); } check_ajax_referer( 'update-post_' . $post_id, 'nonce' ); $attachments = $_REQUEST['attachments']; if ( ! current_user_can( 'edit_post', $post_id ) ) { wp_send_json_error(); } foreach ( $attachments as $attachment_id => $menu_order ) { if ( ! current_user_can( 'edit_post', $attachment_id ) ) { continue; } $attachment = get_post( $attachment_id ); if ( ! $attachment ) { continue; } if ( 'attachment' !== $attachment->post_type ) { continue; } wp_update_post( array( 'ID' => $attachment_id, 'menu_order' => $menu_order, ) ); } wp_send_json_success(); } ``` | Uses | Description | | --- | --- | | [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. | | [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 get_theme_feature_list( bool $api = true ): array get\_theme\_feature\_list( bool $api = true ): array ==================================================== Retrieves list of WordPress theme features (aka theme tags). `$api` bool Optional Whether try to fetch tags from the WordPress.org API. Defaults to true. Default: `true` array Array of features keyed by category with translations keyed by slug. File: `wp-admin/includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme.php/) ``` function get_theme_feature_list( $api = true ) { // Hard-coded list is used if API is not accessible. $features = array( __( 'Subject' ) => array( 'blog' => __( 'Blog' ), 'e-commerce' => __( 'E-Commerce' ), 'education' => __( 'Education' ), 'entertainment' => __( 'Entertainment' ), 'food-and-drink' => __( 'Food & Drink' ), 'holiday' => __( 'Holiday' ), 'news' => __( 'News' ), 'photography' => __( 'Photography' ), 'portfolio' => __( 'Portfolio' ), ), __( 'Features' ) => array( 'accessibility-ready' => __( 'Accessibility Ready' ), 'block-patterns' => __( 'Block Editor Patterns' ), 'block-styles' => __( 'Block Editor Styles' ), 'custom-background' => __( 'Custom Background' ), 'custom-colors' => __( 'Custom Colors' ), 'custom-header' => __( 'Custom Header' ), 'custom-logo' => __( 'Custom Logo' ), 'editor-style' => __( 'Editor Style' ), 'featured-image-header' => __( 'Featured Image Header' ), 'featured-images' => __( 'Featured Images' ), 'footer-widgets' => __( 'Footer Widgets' ), 'full-site-editing' => __( 'Full Site Editing' ), 'full-width-template' => __( 'Full Width Template' ), 'post-formats' => __( 'Post Formats' ), 'sticky-post' => __( 'Sticky Post' ), 'template-editing' => __( 'Template Editing' ), 'theme-options' => __( 'Theme Options' ), ), __( 'Layout' ) => array( 'grid-layout' => __( 'Grid Layout' ), 'one-column' => __( 'One Column' ), 'two-columns' => __( 'Two Columns' ), 'three-columns' => __( 'Three Columns' ), 'four-columns' => __( 'Four Columns' ), 'left-sidebar' => __( 'Left Sidebar' ), 'right-sidebar' => __( 'Right Sidebar' ), 'wide-blocks' => __( 'Wide Blocks' ), ), ); if ( ! $api || ! current_user_can( 'install_themes' ) ) { return $features; } $feature_list = get_site_transient( 'wporg_theme_feature_list' ); if ( ! $feature_list ) { set_site_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS ); } if ( ! $feature_list ) { $feature_list = themes_api( 'feature_list', array() ); if ( is_wp_error( $feature_list ) ) { return $features; } } if ( ! $feature_list ) { return $features; } set_site_transient( 'wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS ); $category_translations = array( 'Layout' => __( 'Layout' ), 'Features' => __( 'Features' ), 'Subject' => __( 'Subject' ), ); $wporg_features = array(); // Loop over the wp.org canonical list and apply translations. foreach ( (array) $feature_list as $feature_category => $feature_items ) { if ( isset( $category_translations[ $feature_category ] ) ) { $feature_category = $category_translations[ $feature_category ]; } $wporg_features[ $feature_category ] = array(); foreach ( $feature_items as $feature ) { if ( isset( $features[ $feature_category ][ $feature ] ) ) { $wporg_features[ $feature_category ][ $feature ] = $features[ $feature_category ][ $feature ]; } else { $wporg_features[ $feature_category ][ $feature ] = $feature; } } } return $wporg_features; } ``` | Uses | Description | | --- | --- | | [themes\_api()](themes_api) wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. | | [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. | | [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. | | [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\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [WP\_Customize\_Themes\_Section::filter\_drawer\_content\_template()](../classes/wp_customize_themes_section/filter_drawer_content_template) wp-includes/customize/class-wp-customize-themes-section.php | Render the filter drawer portion of a themes section as a JS template. | | [install\_themes\_dashboard()](install_themes_dashboard) wp-admin/includes/theme-install.php | Displays tags filter for themes. | | [WP\_Theme::translate\_header()](../classes/wp_theme/translate_header) wp-includes/class-wp-theme.php | Translates a theme header. | | Version | Description | | --- | --- | | [5.8.1](https://developer.wordpress.org/reference/since/5.8.1/) | Added 'Template Editing' feature. | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Added 'Wide Blocks' layout option. | | [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Removed `'BuddyPress'`, 'Custom Menu', 'Flexible Header', 'Front Page Posting', `'Microformats'`, 'RTL Language Support', 'Threaded Comments', and 'Translation Ready' features. | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Added `'Blog'`, `'E-Commerce'`, `'Education'`, `'Entertainment'`, 'Food & Drink', `'Holiday'`, `'News'`, `'Photography'`, and `'Portfolio'` subjects. Removed `'Photoblogging'` and `'Seasonal'` subjects. | | [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Combined `'Layout'` and `'Columns'` filters. | | [3.8.0](https://developer.wordpress.org/reference/since/3.8.0/) | Added 'Accessibility Ready' feature and 'Responsive Layout' option. | | [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Added 'Flexible Header' feature. | | [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Added `'Gray'` color and 'Featured Image Header', 'Featured Images', 'Full Width Template', and 'Post Formats' features. | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress utf8_uri_encode( string $utf8_string, int $length, bool $encode_ascii_characters = false ): string utf8\_uri\_encode( string $utf8\_string, int $length, bool $encode\_ascii\_characters = false ): string ======================================================================================================= Encodes the Unicode values to be used in the URI. `$utf8_string` string Required String to encode. `$length` int Required Max length of the string `$encode_ascii_characters` bool Optional Whether to encode ascii characters such as < " ' Default: `false` string String with Unicode encoded for URI. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function utf8_uri_encode( $utf8_string, $length = 0, $encode_ascii_characters = false ) { $unicode = ''; $values = array(); $num_octets = 1; $unicode_length = 0; mbstring_binary_safe_encoding(); $string_length = strlen( $utf8_string ); reset_mbstring_encoding(); for ( $i = 0; $i < $string_length; $i++ ) { $value = ord( $utf8_string[ $i ] ); if ( $value < 128 ) { $char = chr( $value ); $encoded_char = $encode_ascii_characters ? rawurlencode( $char ) : $char; $encoded_char_length = strlen( $encoded_char ); if ( $length && ( $unicode_length + $encoded_char_length ) > $length ) { break; } $unicode .= $encoded_char; $unicode_length += $encoded_char_length; } else { if ( count( $values ) == 0 ) { if ( $value < 224 ) { $num_octets = 2; } elseif ( $value < 240 ) { $num_octets = 3; } else { $num_octets = 4; } } $values[] = $value; if ( $length && ( $unicode_length + ( $num_octets * 3 ) ) > $length ) { break; } if ( count( $values ) == $num_octets ) { for ( $j = 0; $j < $num_octets; $j++ ) { $unicode .= '%' . dechex( $values[ $j ] ); } $unicode_length += $num_octets * 3; $values = array(); $num_octets = 1; } } } return $unicode; } ``` | Uses | Description | | --- | --- | | [mbstring\_binary\_safe\_encoding()](mbstring_binary_safe_encoding) wp-includes/functions.php | Sets the mbstring internal encoding to a binary safe encoding when func\_overload is enabled. | | [reset\_mbstring\_encoding()](reset_mbstring_encoding) wp-includes/functions.php | Resets the mbstring internal encoding to a users previously set encoding. | | Used By | Description | | --- | --- | | [sanitize\_title\_with\_dashes()](sanitize_title_with_dashes) wp-includes/formatting.php | Sanitizes a title, replacing whitespace and a few other characters with dashes. | | [\_truncate\_post\_slug()](_truncate_post_slug) wp-includes/post.php | Truncates a post slug. | | Version | Description | | --- | --- | | [5.8.3](https://developer.wordpress.org/reference/since/5.8.3/) | Added the `encode_ascii_characters` parameter. | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress add_new_user_to_blog( int $user_id, string $password, array $meta ) add\_new\_user\_to\_blog( int $user\_id, string $password, array $meta ) ======================================================================== Adds a newly created user to the appropriate blog To add a user in general, use [add\_user\_to\_blog()](add_user_to_blog) . This function is specifically hooked into the [‘wpmu\_activate\_user’](../hooks/wpmu_activate_user) action. * [add\_user\_to\_blog()](add_user_to_blog) `$user_id` int Required User ID. `$password` string Required User password. Ignored. `$meta` array Required Signup meta data. File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/) ``` function add_new_user_to_blog( $user_id, $password, $meta ) { if ( ! empty( $meta['add_to_blog'] ) ) { $blog_id = $meta['add_to_blog']; $role = $meta['new_role']; remove_user_from_blog( $user_id, get_network()->site_id ); // Remove user from main blog. $result = add_user_to_blog( $blog_id, $user_id, $role ); if ( ! is_wp_error( $result ) ) { update_user_meta( $user_id, 'primary_blog', $blog_id ); } } } ``` | Uses | Description | | --- | --- | | [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. | | [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. | | [remove\_user\_from\_blog()](remove_user_from_blog) wp-includes/ms-functions.php | Removes a user from a blog. | | [add\_user\_to\_blog()](add_user_to_blog) wp-includes/ms-functions.php | Adds a user to a blog, along with specifying the user’s role. | | [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. |
programming_docs
wordpress _wp_privacy_completed_request( int $request_id ): int|WP_Error \_wp\_privacy\_completed\_request( int $request\_id ): 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. Marks a request as completed by the admin and logs the current timestamp. `$request_id` int Required Request ID. int|[WP\_Error](../classes/wp_error) Request ID on success, or a [WP\_Error](../classes/wp_error) on failure. File: `wp-admin/includes/privacy-tools.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/privacy-tools.php/) ``` function _wp_privacy_completed_request( $request_id ) { // Get the request. $request_id = absint( $request_id ); $request = wp_get_user_request( $request_id ); if ( ! $request ) { return new WP_Error( 'privacy_request_error', __( 'Invalid personal data request.' ) ); } update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() ); $result = wp_update_post( array( 'ID' => $request_id, 'post_status' => 'request-completed', ) ); return $result; } ``` | Uses | Description | | --- | --- | | [wp\_get\_user\_request()](wp_get_user_request) wp-includes/user.php | Returns the user request object for the specified request ID. | | [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. | | [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Used By | Description | | --- | --- | | [wp\_privacy\_process\_personal\_data\_export\_page()](wp_privacy_process_personal_data_export_page) wp-admin/includes/privacy-tools.php | Intercept personal data exporter page Ajax responses in order to assemble the personal data export file. | | [WP\_Privacy\_Requests\_Table::process\_bulk\_action()](../classes/wp_privacy_requests_table/process_bulk_action) wp-admin/includes/class-wp-privacy-requests-table.php | Process bulk actions. | | [wp\_privacy\_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. | | Version | Description | | --- | --- | | [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. | wordpress atom_site_icon() atom\_site\_icon() ================== Displays Site Icon in atom feeds. * [get\_site\_icon\_url()](get_site_icon_url) File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/) ``` function atom_site_icon() { $url = get_site_icon_url( 32 ); if ( $url ) { echo '<icon>' . convert_chars( $url ) . "</icon>\n"; } } ``` | Uses | Description | | --- | --- | | [get\_site\_icon\_url()](get_site_icon_url) wp-includes/general-template.php | Returns the Site Icon URL. | | [convert\_chars()](convert_chars) wp-includes/formatting.php | Converts lone & characters into `&#038;` (a.k.a. `&amp;`) | | Version | Description | | --- | --- | | [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. | wordpress wp_customize_url( string $stylesheet = '' ): string wp\_customize\_url( string $stylesheet = '' ): string ===================================================== Returns a URL to load the Customizer. `$stylesheet` string Optional Theme to customize. Defaults to active theme. The theme's stylesheet will be urlencoded if necessary. Default: `''` string File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/) ``` function wp_customize_url( $stylesheet = '' ) { $url = admin_url( 'customize.php' ); if ( $stylesheet ) { $url .= '?theme=' . urlencode( $stylesheet ); } return esc_url( $url ); } ``` | Uses | Description | | --- | --- | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. | | Used By | Description | | --- | --- | | [wp\_ajax\_install\_theme()](wp_ajax_install_theme) wp-admin/includes/ajax-actions.php | Ajax handler for installing a theme. | | [wp\_admin\_bar\_customize\_menu()](wp_admin_bar_customize_menu) wp-includes/admin-bar.php | Adds the “Customize” link to the Toolbar. | | [wp\_prepare\_themes\_for\_js()](wp_prepare_themes_for_js) wp-admin/includes/theme.php | Prepares themes for JavaScript. | | [wp\_welcome\_panel()](wp_welcome_panel) wp-admin/includes/dashboard.php | Displays a welcome panel to introduce users to WordPress. | | [WP\_Themes\_List\_Table::display\_rows()](../classes/wp_themes_list_table/display_rows) wp-admin/includes/class-wp-themes-list-table.php | | | [wp\_ajax\_query\_themes()](wp_ajax_query_themes) wp-admin/includes/ajax-actions.php | Ajax handler for getting themes from [themes\_api()](themes_api) . | | [WP\_Customize\_Manager::wp\_die()](../classes/wp_customize_manager/wp_die) wp-includes/class-wp-customize-manager.php | Custom wp\_die wrapper. Returns either the standard message for UI or the Ajax message. | | Version | Description | | --- | --- | | [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. | wordpress wp_filter_nohtml_kses( string $data ): string wp\_filter\_nohtml\_kses( string $data ): string ================================================ Strips all HTML from a text string. This function expects slashed data. `$data` string Required Content to strip all HTML from. string Filtered content without any HTML. File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/) ``` function wp_filter_nohtml_kses( $data ) { return addslashes( wp_kses( stripslashes( $data ), 'strip' ) ); } ``` | Uses | Description | | --- | --- | | [wp\_kses()](wp_kses) wp-includes/kses.php | Filters text content and strips out disallowed HTML. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress undismiss_core_update( string $version, string $locale ): bool undismiss\_core\_update( string $version, string $locale ): bool ================================================================ Undismisses core update. `$version` string Required `$locale` string Required bool File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/) ``` function undismiss_core_update( $version, $locale ) { $dismissed = get_site_option( 'dismissed_update_core' ); $key = $version . '|' . $locale; if ( ! isset( $dismissed[ $key ] ) ) { return false; } unset( $dismissed[ $key ] ); return update_site_option( 'dismissed_update_core', $dismissed ); } ``` | Uses | Description | | --- | --- | | [update\_site\_option()](update_site_option) wp-includes/option.php | Updates the value of an option that was already added for the current network. | | [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. | | Used By | Description | | --- | --- | | [do\_undismiss\_core\_update()](do_undismiss_core_update) wp-admin/update-core.php | Undismiss a core update. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress validate_username( string $username ): bool validate\_username( string $username ): bool ============================================ Checks whether a username is valid. `$username` string Required Username. bool Whether username given is valid. This function attempts to sanitize the username, and if it “passes”, the name is considered valid. For additional logic, you can use the ‘`validate_username`‘ hook. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function validate_username( $username ) { $sanitized = sanitize_user( $username, true ); $valid = ( $sanitized == $username && ! empty( $sanitized ) ); /** * Filters whether the provided username is valid. * * @since 2.0.1 * * @param bool $valid Whether given username is valid. * @param string $username Username to check. */ return apply_filters( 'validate_username', $valid, $username ); } ``` [apply\_filters( 'validate\_username', bool $valid, string $username )](../hooks/validate_username) Filters whether the provided username is valid. | Uses | Description | | --- | --- | | [sanitize\_user()](sanitize_user) wp-includes/formatting.php | Sanitizes a username, stripping out unsafe characters. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [WP\_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. | | [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST | | [register\_new\_user()](register_new_user) wp-includes/user.php | Handles registering a new user. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Empty sanitized usernames are now considered invalid. | | [2.0.1](https://developer.wordpress.org/reference/since/2.0.1/) | Introduced. | wordpress wp_next_scheduled( string $hook, array $args = array() ): int|false wp\_next\_scheduled( string $hook, array $args = array() ): int|false ===================================================================== Retrieve the next timestamp for an event. `$hook` string Required Action hook of the event. `$args` array Optional Array containing each separate argument to pass to the hook's callback function. Although not passed to a callback, these arguments are used to uniquely identify the event, so they should be the same as those used when originally scheduling the event. Default: `array()` int|false The Unix timestamp of the next time the event will occur. False if the event doesn't exist. File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/) ``` function wp_next_scheduled( $hook, $args = array() ) { $next_event = wp_get_scheduled_event( $hook, $args ); if ( ! $next_event ) { return false; } return $next_event->timestamp; } ``` | Uses | Description | | --- | --- | | [wp\_get\_scheduled\_event()](wp_get_scheduled_event) wp-includes/cron.php | Retrieve a scheduled event. | | Used By | Description | | --- | --- | | [wp\_schedule\_update\_user\_counts()](wp_schedule_update_user_counts) wp-includes/user.php | Schedules a recurring recalculation of the total count of users. | | [wp\_schedule\_https\_detection()](wp_schedule_https_detection) wp-includes/https-detection.php | Schedules the Cron hook for detecting HTTPS support. | | [wp\_get\_auto\_update\_message()](wp_get_auto_update_message) wp-admin/includes/update.php | Determines the appropriate auto-update message to be displayed. | | [WP\_Site\_Health::maybe\_create\_scheduled\_event()](../classes/wp_site_health/maybe_create_scheduled_event) wp-admin/includes/class-wp-site-health.php | Creates a weekly cron event, if one does not already exist. | | [WP\_Recovery\_Mode::initialize()](../classes/wp_recovery_mode/initialize) wp-includes/class-wp-recovery-mode.php | Initialize recovery mode for the current request. | | [wp\_schedule\_delete\_old\_privacy\_export\_files()](wp_schedule_delete_old_privacy_export_files) wp-includes/functions.php | Schedules a `WP_Cron` job to delete expired export files. | | [get\_default\_post\_to\_edit()](get_default_post_to_edit) wp-admin/includes/post.php | Returns default post information to use when populating the “Write Post” form. | | [wp\_schedule\_update\_checks()](wp_schedule_update_checks) wp-includes/update.php | Schedules core, theme, and plugin update checks. | | [wp\_version\_check()](wp_version_check) wp-includes/update.php | Checks WordPress version against the newest version. | | [\_publish\_post\_hook()](_publish_post_hook) wp-includes/post.php | Hook to schedule pings and enclosures when a post is published. | | [wp\_schedule\_update\_network\_counts()](wp_schedule_update_network_counts) wp-includes/ms-functions.php | Schedules update of the network-wide counts for the current network. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress create_empty_blog( string $domain, string $path, string $weblog_title, int $site_id = 1 ): string|int create\_empty\_blog( string $domain, string $path, string $weblog\_title, int $site\_id = 1 ): string|int ========================================================================================================= This function has been deprecated. Create an empty blog. `$domain` string Required The new blog's domain. `$path` string Required The new blog's path. `$weblog_title` string Required The new blog's title. `$site_id` int Optional Defaults to 1. Default: `1` string|int The ID of the newly created blog File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/) ``` function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) { _deprecated_function( __FUNCTION__, '4.4.0' ); if ( empty($path) ) $path = '/'; // Check if the domain has been used already. We should return an error message. if ( domain_exists($domain, $path, $site_id) ) return __( '<strong>Error:</strong> Site URL you&#8217;ve entered is already taken.' ); /* * Need to back up wpdb table names, and create a new wp_blogs entry for new blog. * Need to get blog_id from wp_blogs, and create new table names. * Must restore table names at the end of function. */ if ( ! $blog_id = insert_blog($domain, $path, $site_id) ) return __( '<strong>Error:</strong> There was a problem creating site entry.' ); switch_to_blog($blog_id); install_blog($blog_id); restore_current_blog(); return $blog_id; } ``` | Uses | Description | | --- | --- | | [domain\_exists()](domain_exists) wp-includes/ms-functions.php | Checks whether a site name is already taken. | | [insert\_blog()](insert_blog) wp-includes/ms-deprecated.php | Store basic site info in the blogs table. | | [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. | | [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. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | This function has been deprecated. | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress load_child_theme_textdomain( string $domain, string|false $path = false ): bool load\_child\_theme\_textdomain( string $domain, string|false $path = false ): bool ================================================================================== Loads the child themes translated strings. If the current locale exists as a .mo file in the child themes root directory, it will be included in the translated strings by the $domain. The .mo files must be named based on the locale exactly. `$domain` string Required Text domain. Unique identifier for retrieving translated strings. `$path` string|false Optional Path to the directory containing the .mo file. Default: `false` bool True when the theme textdomain is successfully loaded, false otherwise. Internationalization and localization (other common spellings are internationalisation and localisation) are means of adapting computer software to different languages. * *l10n* is an abbreviation for *localization*. * *i18n* 18 stands for the number of letters between the first i and last n in *internationalization*. File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/) ``` function load_child_theme_textdomain( $domain, $path = false ) { if ( ! $path ) { $path = get_stylesheet_directory(); } return load_theme_textdomain( $domain, $path ); } ``` | Uses | Description | | --- | --- | | [get\_stylesheet\_directory()](get_stylesheet_directory) wp-includes/theme.php | Retrieves stylesheet directory path for the active theme. | | [load\_theme\_textdomain()](load_theme_textdomain) wp-includes/l10n.php | Loads the theme’s translated strings. | | Version | Description | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress wp_staticize_emoji_for_email( array $mail ): array wp\_staticize\_emoji\_for\_email( array $mail ): array ====================================================== Converts emoji in emails into static images. `$mail` array Required The email data array. array The email data array, with emoji in the message staticized. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function wp_staticize_emoji_for_email( $mail ) { if ( ! isset( $mail['message'] ) ) { return $mail; } /* * We can only transform the emoji into images if it's a `text/html` email. * To do that, here's a cut down version of the same process that happens * in wp_mail() - get the `Content-Type` from the headers, if there is one, * then pass it through the {@see 'wp_mail_content_type'} filter, in case * a plugin is handling changing the `Content-Type`. */ $headers = array(); if ( isset( $mail['headers'] ) ) { if ( is_array( $mail['headers'] ) ) { $headers = $mail['headers']; } else { $headers = explode( "\n", str_replace( "\r\n", "\n", $mail['headers'] ) ); } } foreach ( $headers as $header ) { if ( strpos( $header, ':' ) === false ) { continue; } // Explode them out. list( $name, $content ) = explode( ':', trim( $header ), 2 ); // Cleanup crew. $name = trim( $name ); $content = trim( $content ); if ( 'content-type' === strtolower( $name ) ) { if ( strpos( $content, ';' ) !== false ) { list( $type, $charset ) = explode( ';', $content ); $content_type = trim( $type ); } else { $content_type = trim( $content ); } break; } } // Set Content-Type if we don't have a content-type from the input headers. if ( ! isset( $content_type ) ) { $content_type = 'text/plain'; } /** This filter is documented in wp-includes/pluggable.php */ $content_type = apply_filters( 'wp_mail_content_type', $content_type ); if ( 'text/html' === $content_type ) { $mail['message'] = wp_staticize_emoji( $mail['message'] ); } return $mail; } ``` [apply\_filters( 'wp\_mail\_content\_type', string $content\_type )](../hooks/wp_mail_content_type) Filters the [wp\_mail()](wp_mail) content type. | Uses | Description | | --- | --- | | [wp\_staticize\_emoji()](wp_staticize_emoji) wp-includes/formatting.php | Converts emoji to a static img element. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Version | Description | | --- | --- | | [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
programming_docs
wordpress wp_credits_section_list( array $credits = array(), string $slug = '' ) wp\_credits\_section\_list( array $credits = array(), string $slug = '' ) ========================================================================= Displays a list of contributors for a given group. `$credits` array Optional The credits groups returned from the API. Default: `array()` `$slug` string Optional The current group to display. Default: `''` File: `wp-admin/includes/credits.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/credits.php/) ``` function wp_credits_section_list( $credits = array(), $slug = '' ) { $group_data = isset( $credits['groups'][ $slug ] ) ? $credits['groups'][ $slug ] : array(); $credits_data = $credits['data']; if ( ! count( $group_data ) ) { return; } if ( ! empty( $group_data['shuffle'] ) ) { shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt. } switch ( $group_data['type'] ) { case 'list': array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits_data['profiles'] ); echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n"; break; case 'libraries': array_walk( $group_data['data'], '_wp_credits_build_object_link' ); echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n"; break; default: $compact = 'compact' === $group_data['type']; $classes = 'wp-people-group ' . ( $compact ? 'compact' : '' ); echo '<ul class="' . $classes . '" id="wp-people-group-' . $slug . '">' . "\n"; foreach ( $group_data['data'] as $person_data ) { echo '<li class="wp-person" id="wp-person-' . esc_attr( $person_data[2] ) . '">' . "\n\t"; echo '<a href="' . esc_url( sprintf( $credits_data['profiles'], $person_data[2] ) ) . '" class="web">'; $size = $compact ? 80 : 160; $data = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) ); $data2x = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size * 2 ) ); echo '<span class="wp-person-avatar"><img src="' . esc_url( $data['url'] ) . '" srcset="' . esc_url( $data2x['url'] ) . ' 2x" class="gravatar" alt="" /></span>' . "\n"; echo esc_html( $person_data[0] ) . "</a>\n\t"; if ( ! $compact && ! empty( $person_data[3] ) ) { // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n"; } echo "</li>\n"; } echo "</ul>\n"; break; } } ``` | Uses | Description | | --- | --- | | [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. | | [translate()](translate) wp-includes/l10n.php | Retrieves the translation of $text. | | [wp\_sprintf()](wp_sprintf) wp-includes/formatting.php | WordPress implementation of PHP sprintf() with filters. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. | wordpress wp_transition_post_status( string $new_status, string $old_status, WP_Post $post ) wp\_transition\_post\_status( string $new\_status, string $old\_status, WP\_Post $post ) ======================================================================================== Fires actions related to the transitioning of a post’s status. When a post is saved, the post status is "transitioned" from one status to another, though this does not always mean the status has actually changed before and after the save. This function fires a number of action hooks related to that transition: the generic [‘transition\_post\_status’](../hooks/transition_post_status) action, as well as the dynamic hooks [‘$old\_status\_to\_$new\_status’](../hooks/old_status_to_new_status) and [‘$new\_status\_$post->post\_type’](../hooks/new_status_post-post_type). Note that the function does not transition the post object in the database. For instance: When publishing a post for the first time, the post status may transition from ‘draft’ – or some other status – to ‘publish’. However, if a post is already published and is simply being updated, the "old" and "new" statuses may both be ‘publish’ before and after the transition. `$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. * This function contains [do\_action()](do_action) calls for post status transition action hooks. The order of the words in the function name might be confusing – it does not change the status of posts, it only calls actions that can be hooked into by plugin developers. Although this function is already called where needed by core functions, it may be useful when a plugin updates a post by directly interacting with the database, thereby bypassing the usual post status transition actions. For the actions to be effective, the new status, old status and post object must be passed. * To transition the status of a post, rather than perform actions when a post status is transitioned, use [wp\_update\_post()](wp_update_post) or [wp\_publish\_post()](wp_publish_post) . * This function is already called where needed in core functions. You do not need to call this function when changing a post’s status with [wp\_update\_post()](wp_update_post) , for example. You *do* need to call this function in your plugin or theme when manually updating the status of a post. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function wp_transition_post_status( $new_status, $old_status, $post ) { /** * Fires when a post is transitioned from one status to another. * * @since 2.3.0 * * @param string $new_status New post status. * @param string $old_status Old post status. * @param WP_Post $post Post object. */ do_action( 'transition_post_status', $new_status, $old_status, $post ); /** * Fires when a post is transitioned from one status to another. * * The dynamic portions of the hook name, `$new_status` and `$old_status`, * refer to the old and new post statuses, respectively. * * Possible hook names include: * * - `draft_to_publish` * - `publish_to_trash` * - `pending_to_draft` * * @since 2.3.0 * * @param WP_Post $post Post object. */ do_action( "{$old_status}_to_{$new_status}", $post ); /** * Fires when a post is transitioned from one status to another. * * The dynamic portions of the hook name, `$new_status` and `$post->post_type`, * refer to the new post status and post type, respectively. * * Possible hook names include: * * - `draft_post` * - `future_post` * - `pending_post` * - `private_post` * - `publish_post` * - `trash_post` * - `draft_page` * - `future_page` * - `pending_page` * - `private_page` * - `publish_page` * - `trash_page` * - `publish_attachment` * - `trash_attachment` * * Please note: When this action is hooked using a particular post status (like * 'publish', as `publish_{$post->post_type}`), it will fire both when a post is * first transitioned to that status from something else, as well as upon * subsequent post updates (old and new status are both the same). * * Therefore, if you are looking to only fire a callback when a post is first * transitioned to a status, use the {@see 'transition_post_status'} hook instead. * * @since 2.3.0 * @since 5.9.0 Added `$old_status` parameter. * * @param int $post_id Post ID. * @param WP_Post $post Post object. * @param string $old_status Old post status. */ do_action( "{$new_status}_{$post->post_type}", $post->ID, $post, $old_status ); } ``` [do\_action( 'transition\_post\_status', string $new\_status, string $old\_status, WP\_Post $post )](../hooks/transition_post_status) Fires when a post is transitioned from one status to another. [do\_action( "{$new\_status}\_{$post->post\_type}", int $post\_id, WP\_Post $post, string $old\_status )](../hooks/new_status_post-post_type) Fires when a post is transitioned from one status to another. [do\_action( "{$old\_status}\_to\_{$new\_status}", WP\_Post $post )](../hooks/old_status_to_new_status) Fires when a post is transitioned from one status to another. | Uses | Description | | --- | --- | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | Used By | Description | | --- | --- | | [WP\_Customize\_Manager::trash\_changeset\_post()](../classes/wp_customize_manager/trash_changeset_post) wp-includes/class-wp-customize-manager.php | Trashes or deletes a changeset post. | | [wp\_publish\_post()](wp_publish_post) wp-includes/post.php | Publishes a post by transitioning the post status. | | [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress wp_default_editor(): string wp\_default\_editor(): string ============================= Finds out which editor should be displayed by default. Works out which of the two editors to display as the current editor for a user. The ‘html’ setting is for the "Text" editor tab. string Either `'tinymce'`, or `'html'`, or `'test'` File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function wp_default_editor() { $r = user_can_richedit() ? 'tinymce' : 'html'; // Defaults. if ( wp_get_current_user() ) { // Look for cookie. $ed = get_user_setting( 'editor', 'tinymce' ); $r = ( in_array( $ed, array( 'tinymce', 'html', 'test' ), true ) ) ? $ed : $r; } /** * Filters which editor should be displayed by default. * * @since 2.5.0 * * @param string $r Which editor should be displayed by default. Either 'tinymce', 'html', or 'test'. */ return apply_filters( 'wp_default_editor', $r ); } ``` [apply\_filters( 'wp\_default\_editor', string $r )](../hooks/wp_default_editor) Filters which editor should be displayed by default. | Uses | Description | | --- | --- | | [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. | | [user\_can\_richedit()](user_can_richedit) wp-includes/general-template.php | Determines whether the user can access the visual editor. | | [get\_user\_setting()](get_user_setting) wp-includes/option.php | Retrieves user interface setting value based on setting 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\_Editors::editor()](../classes/_wp_editors/editor) wp-includes/class-wp-editor.php | Outputs the HTML for a single instance of the editor. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress get_the_author_posts_link(): string get\_the\_author\_posts\_link(): string ======================================= Retrieves an HTML link to the author page of the current post’s author. Returns an HTML-formatted link using [get\_author\_posts\_url()](get_author_posts_url) . string An HTML link to the author page, or an empty string if $authordata isn't defined. File: `wp-includes/author-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/author-template.php/) ``` function get_the_author_posts_link() { global $authordata; if ( ! is_object( $authordata ) ) { return ''; } $link = sprintf( '<a href="%1$s" title="%2$s" rel="author">%3$s</a>', esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ), /* translators: %s: Author's display name. */ esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ), get_the_author() ); /** * Filters the link to the author page of the author of the current post. * * @since 2.9.0 * * @param string $link HTML link. */ return apply_filters( 'the_author_posts_link', $link ); } ``` [apply\_filters( 'the\_author\_posts\_link', string $link )](../hooks/the_author_posts_link) Filters the link to the author page of the author of the current post. | Uses | Description | | --- | --- | | [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\_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\_posts\_link()](the_author_posts_link) wp-includes/author-template.php | Displays an HTML link to the author page of the current post’s author. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. | wordpress link_pages( string $before = '<br />', string $after = '<br />', string $next_or_number = 'number', string $nextpagelink = 'next page', string $previouspagelink = 'previous page', string $pagelink = '%', string $more_file = '' ): string link\_pages( string $before = '<br />', string $after = '<br />', string $next\_or\_number = 'number', string $nextpagelink = 'next page', string $previouspagelink = 'previous page', string $pagelink = '%', string $more\_file = '' ): string ================================================================================================================================================================================================================================================ This function has been deprecated. Use [wp\_link\_pages()](wp_link_pages) instead. Print list of pages based on arguments. * [wp\_link\_pages()](wp_link_pages) `$before` string Optional Default: `'<br />'` `$after` string Optional Default: `'<br />'` `$next_or_number` string Optional Default: `'number'` `$nextpagelink` string Optional Default: `'next page'` `$previouspagelink` string Optional Default: `'previous page'` `$pagelink` string Optional Default: `'%'` `$more_file` string Optional Default: `''` string File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_link_pages()' ); $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); return wp_link_pages($args); } ``` | Uses | Description | | --- | --- | | [wp\_link\_pages()](wp_link_pages) wp-includes/post-template.php | The formatted output of a list of pages. | | [\_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\_link\_pages()](wp_link_pages) | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress rest_get_route_for_taxonomy_items( string $taxonomy ): string rest\_get\_route\_for\_taxonomy\_items( string $taxonomy ): string ================================================================== Gets the REST API route for a taxonomy. `$taxonomy` string Required Name of taxonomy. string The route path with a leading slash for the given taxonomy. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_get_route_for_taxonomy_items( $taxonomy ) { $taxonomy = get_taxonomy( $taxonomy ); if ( ! $taxonomy ) { return ''; } if ( ! $taxonomy->show_in_rest ) { return ''; } $namespace = ! empty( $taxonomy->rest_namespace ) ? $taxonomy->rest_namespace : 'wp/v2'; $rest_base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name; $route = sprintf( '/%s/%s', $namespace, $rest_base ); /** * Filters the REST API route for a taxonomy. * * @since 5.9.0 * * @param string $route The route path. * @param WP_Taxonomy $taxonomy The taxonomy object. */ return apply_filters( 'rest_route_for_taxonomy_items', $route, $taxonomy ); } ``` [apply\_filters( 'rest\_route\_for\_taxonomy\_items', string $route, WP\_Taxonomy $taxonomy )](../hooks/rest_route_for_taxonomy_items) Filters the REST API route for a taxonomy. | Uses | Description | | --- | --- | | [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [WP\_REST\_Taxonomies\_Controller::prepare\_links()](../classes/wp_rest_taxonomies_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Prepares links for the request. | | [rest\_get\_route\_for\_term()](rest_get_route_for_term) wp-includes/rest-api.php | Gets the REST API route for a term. | | [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. | | Version | Description | | --- | --- | | [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. | wordpress wp_use_widgets_block_editor(): bool wp\_use\_widgets\_block\_editor(): bool ======================================= 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. bool Whether to use the block editor to manage widgets. File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/) ``` function wp_use_widgets_block_editor() { /** * Filters whether to use the block editor to manage widgets. * * @since 5.8.0 * * @param bool $use_widgets_block_editor Whether to use the block editor to manage widgets. */ return apply_filters( 'use_widgets_block_editor', get_theme_support( 'widgets-block-editor' ) ); } ``` [apply\_filters( 'use\_widgets\_block\_editor', bool $use\_widgets\_block\_editor )](../hooks/use_widgets_block_editor) Filters whether to use the block editor to manage widgets. | Uses | Description | | --- | --- | | [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [WP\_Customize\_Widgets::should\_load\_block\_editor\_scripts\_and\_styles()](../classes/wp_customize_widgets/should_load_block_editor_scripts_and_styles) wp-includes/class-wp-customize-widgets.php | Tells the script loader to load the scripts and styles of custom blocks if the widgets block editor is enabled. | | [WP\_Customize\_Widgets::sanitize\_widget\_instance()](../classes/wp_customize_widgets/sanitize_widget_instance) wp-includes/class-wp-customize-widgets.php | Sanitizes a widget instance. | | [WP\_Customize\_Widgets::sanitize\_widget\_js\_instance()](../classes/wp_customize_widgets/sanitize_widget_js_instance) wp-includes/class-wp-customize-widgets.php | Converts a widget instance into JSON-representable format. | | [WP\_Customize\_Widgets::enqueue\_scripts()](../classes/wp_customize_widgets/enqueue_scripts) wp-includes/class-wp-customize-widgets.php | Enqueues scripts and styles for Customizer panel and export data to JavaScript. | | [WP\_Customize\_Widgets::customize\_register()](../classes/wp_customize_widgets/customize_register) wp-includes/class-wp-customize-widgets.php | Registers Customizer settings and controls for all sidebars and widgets. | | Version | Description | | --- | --- | | [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
programming_docs
wordpress user_can_create_draft( int $user_id, int $blog_id = 1, int $category_id = 'None' ): bool user\_can\_create\_draft( int $user\_id, int $blog\_id = 1, int $category\_id = 'None' ): bool ============================================================================================== This function has been deprecated. Use [current\_user\_can()](current_user_can) instead. Whether user can create a post. * [current\_user\_can()](current_user_can) `$user_id` int Required `$blog_id` int Optional Not Used Default: `1` `$category_id` int Optional Not Used Default: `'None'` bool File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') { _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); $author_data = get_userdata($user_id); return ($author_data->user_level >= 1); } ``` | Uses | Description | | --- | --- | | [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Use [current\_user\_can()](current_user_can) | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress wp_ajax_generate_password() wp\_ajax\_generate\_password() ============================== Ajax handler for generating a password. 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_generate_password() { wp_send_json_success( wp_generate_password( 24 ) ); } ``` | Uses | Description | | --- | --- | | [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. | | [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.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. | wordpress wp_post_mime_type_where( string|string[] $post_mime_types, string $table_alias = '' ): string wp\_post\_mime\_type\_where( string|string[] $post\_mime\_types, string $table\_alias = '' ): string ==================================================================================================== Converts MIME types into SQL. `$post_mime_types` string|string[] Required List of mime types or comma separated string of mime types. `$table_alias` string Optional Specify a table alias, if needed. Default: `''` string The SQL AND clause for mime searching. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function wp_post_mime_type_where( $post_mime_types, $table_alias = '' ) { $where = ''; $wildcards = array( '', '%', '%/%' ); if ( is_string( $post_mime_types ) ) { $post_mime_types = array_map( 'trim', explode( ',', $post_mime_types ) ); } $wheres = array(); foreach ( (array) $post_mime_types as $mime_type ) { $mime_type = preg_replace( '/\s/', '', $mime_type ); $slashpos = strpos( $mime_type, '/' ); if ( false !== $slashpos ) { $mime_group = preg_replace( '/[^-*.a-zA-Z0-9]/', '', substr( $mime_type, 0, $slashpos ) ); $mime_subgroup = preg_replace( '/[^-*.+a-zA-Z0-9]/', '', substr( $mime_type, $slashpos + 1 ) ); if ( empty( $mime_subgroup ) ) { $mime_subgroup = '*'; } else { $mime_subgroup = str_replace( '/', '', $mime_subgroup ); } $mime_pattern = "$mime_group/$mime_subgroup"; } else { $mime_pattern = preg_replace( '/[^-*.a-zA-Z0-9]/', '', $mime_type ); if ( false === strpos( $mime_pattern, '*' ) ) { $mime_pattern .= '/*'; } } $mime_pattern = preg_replace( '/\*+/', '%', $mime_pattern ); if ( in_array( $mime_type, $wildcards, true ) ) { return ''; } if ( false !== strpos( $mime_pattern, '%' ) ) { $wheres[] = empty( $table_alias ) ? "post_mime_type LIKE '$mime_pattern'" : "$table_alias.post_mime_type LIKE '$mime_pattern'"; } else { $wheres[] = empty( $table_alias ) ? "post_mime_type = '$mime_pattern'" : "$table_alias.post_mime_type = '$mime_pattern'"; } } if ( ! empty( $wheres ) ) { $where = ' AND (' . implode( ' OR ', $wheres ) . ') '; } return $where; } ``` | Used By | Description | | --- | --- | | [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. | | [wp\_count\_attachments()](wp_count_attachments) wp-includes/post.php | Counts number of attachments for the mime type(s). | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress wp_prepare_themes_for_js( WP_Theme[] $themes = null ): array wp\_prepare\_themes\_for\_js( WP\_Theme[] $themes = null ): array ================================================================= Prepares themes for JavaScript. `$themes` [WP\_Theme](../classes/wp_theme)[] Optional Array of theme objects to prepare. Defaults to all allowed themes. Default: `null` array An associative array of theme data, sorted by name. File: `wp-admin/includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme.php/) ``` function wp_prepare_themes_for_js( $themes = null ) { $current_theme = get_stylesheet(); /** * Filters theme data before it is prepared for JavaScript. * * Passing a non-empty array will result in wp_prepare_themes_for_js() returning * early with that value instead. * * @since 4.2.0 * * @param array $prepared_themes An associative array of theme data. Default empty array. * @param WP_Theme[]|null $themes An array of theme objects to prepare, if any. * @param string $current_theme The active theme slug. */ $prepared_themes = (array) apply_filters( 'pre_prepare_themes_for_js', array(), $themes, $current_theme ); if ( ! empty( $prepared_themes ) ) { return $prepared_themes; } // Make sure the active theme is listed first. $prepared_themes[ $current_theme ] = array(); if ( null === $themes ) { $themes = wp_get_themes( array( 'allowed' => true ) ); if ( ! isset( $themes[ $current_theme ] ) ) { $themes[ $current_theme ] = wp_get_theme(); } } $updates = array(); $no_updates = array(); if ( ! is_multisite() && current_user_can( 'update_themes' ) ) { $updates_transient = get_site_transient( 'update_themes' ); if ( isset( $updates_transient->response ) ) { $updates = $updates_transient->response; } if ( isset( $updates_transient->no_update ) ) { $no_updates = $updates_transient->no_update; } } WP_Theme::sort_by_name( $themes ); $parents = array(); $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); foreach ( $themes as $theme ) { $slug = $theme->get_stylesheet(); $encoded_slug = urlencode( $slug ); $parent = false; if ( $theme->parent() ) { $parent = $theme->parent(); $parents[ $slug ] = $parent->get_stylesheet(); $parent = $parent->display( 'Name' ); } $customize_action = null; $can_edit_theme_options = current_user_can( 'edit_theme_options' ); $can_customize = current_user_can( 'customize' ); $is_block_theme = $theme->is_block_theme(); if ( $is_block_theme && $can_edit_theme_options ) { $customize_action = esc_url( admin_url( 'site-editor.php' ) ); } elseif ( ! $is_block_theme && $can_customize && $can_edit_theme_options ) { $customize_action = esc_url( add_query_arg( array( 'return' => urlencode( sanitize_url( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ), ), wp_customize_url( $slug ) ) ); } $update_requires_wp = isset( $updates[ $slug ]['requires'] ) ? $updates[ $slug ]['requires'] : null; $update_requires_php = isset( $updates[ $slug ]['requires_php'] ) ? $updates[ $slug ]['requires_php'] : null; $auto_update = in_array( $slug, $auto_updates, true ); $auto_update_action = $auto_update ? 'disable-auto-update' : 'enable-auto-update'; if ( isset( $updates[ $slug ] ) ) { $auto_update_supported = true; $auto_update_filter_payload = (object) $updates[ $slug ]; } elseif ( isset( $no_updates[ $slug ] ) ) { $auto_update_supported = true; $auto_update_filter_payload = (object) $no_updates[ $slug ]; } else { $auto_update_supported = false; /* * Create the expected payload for the auto_update_theme filter, this is the same data * as contained within $updates or $no_updates but used when the Theme is not known. */ $auto_update_filter_payload = (object) array( 'theme' => $slug, 'new_version' => $theme->get( 'Version' ), 'url' => '', 'package' => '', 'requires' => $theme->get( 'RequiresWP' ), 'requires_php' => $theme->get( 'RequiresPHP' ), ); } $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, $auto_update_filter_payload ); $prepared_themes[ $slug ] = array( 'id' => $slug, 'name' => $theme->display( 'Name' ), 'screenshot' => array( $theme->get_screenshot() ), // @todo Multiple screenshots. 'description' => $theme->display( 'Description' ), 'author' => $theme->display( 'Author', false, true ), 'authorAndUri' => $theme->display( 'Author' ), 'tags' => $theme->display( 'Tags' ), 'version' => $theme->get( 'Version' ), 'compatibleWP' => is_wp_version_compatible( $theme->get( 'RequiresWP' ) ), 'compatiblePHP' => is_php_version_compatible( $theme->get( 'RequiresPHP' ) ), 'updateResponse' => array( 'compatibleWP' => is_wp_version_compatible( $update_requires_wp ), 'compatiblePHP' => is_php_version_compatible( $update_requires_php ), ), 'parent' => $parent, 'active' => $slug === $current_theme, 'hasUpdate' => isset( $updates[ $slug ] ), 'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ]['package'] ), 'update' => get_theme_update_available( $theme ), 'autoupdate' => array( 'enabled' => $auto_update || $auto_update_forced, 'supported' => $auto_update_supported, 'forced' => $auto_update_forced, ), 'actions' => array( 'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&amp;stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null, 'customize' => $customize_action, 'delete' => ( ! is_multisite() && current_user_can( 'delete_themes' ) ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&amp;stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null, 'autoupdate' => wp_is_auto_update_enabled_for_type( 'theme' ) && ! is_multisite() && current_user_can( 'update_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=' . $auto_update_action . '&amp;stylesheet=' . $encoded_slug ), 'updates' ) : null, ), 'blockTheme' => $theme->is_block_theme(), ); } // Remove 'delete' action if theme has an active child. if ( ! empty( $parents ) && array_key_exists( $current_theme, $parents ) ) { unset( $prepared_themes[ $parents[ $current_theme ] ]['actions']['delete'] ); } /** * Filters the themes prepared for JavaScript, for themes.php. * * Could be useful for changing the order, which is by name by default. * * @since 3.8.0 * * @param array $prepared_themes Array of theme data. */ $prepared_themes = apply_filters( 'wp_prepare_themes_for_js', $prepared_themes ); $prepared_themes = array_values( $prepared_themes ); return array_filter( $prepared_themes ); } ``` [apply\_filters( 'pre\_prepare\_themes\_for\_js', array $prepared\_themes, WP\_Theme[]|null $themes, string $current\_theme )](../hooks/pre_prepare_themes_for_js) Filters theme data before it is prepared for JavaScript. [apply\_filters( 'wp\_prepare\_themes\_for\_js', array $prepared\_themes )](../hooks/wp_prepare_themes_for_js) Filters the themes prepared for JavaScript, for themes.php. | Uses | Description | | --- | --- | | [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. | | [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. | | [is\_wp\_version\_compatible()](is_wp_version_compatible) wp-includes/functions.php | Checks compatibility with the current WordPress version. | | [is\_php\_version\_compatible()](is_php_version_compatible) wp-includes/functions.php | Checks compatibility with the current PHP version. | | [wp\_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. | | [get\_theme\_update\_available()](get_theme_update_available) wp-admin/includes/theme.php | Retrieves the update link if there is a theme update available. | | [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. | | [wp\_customize\_url()](wp_customize_url) wp-includes/theme.php | Returns a URL to load the Customizer. | | [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. | | [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\_is\_auto\_update\_enabled\_for\_type()](wp_is_auto_update_enabled_for_type) wp-admin/includes/update.php | Checks whether auto-updates are enabled. | | [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. | | [WP\_Theme::sort\_by\_name()](../classes/wp_theme/sort_by_name) wp-includes/class-wp-theme.php | Sorts themes by name. | | [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\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. | | [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. | | [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\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [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\_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. | | Version | Description | | --- | --- | | [3.8.0](https://developer.wordpress.org/reference/since/3.8.0/) | Introduced. | wordpress wp_add_trashed_suffix_to_post_name_for_trashed_posts( string $post_name, int $post_ID ) wp\_add\_trashed\_suffix\_to\_post\_name\_for\_trashed\_posts( string $post\_name, 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. Adds a suffix if any trashed posts have a given slug. Store its desired (i.e. current) slug so it can try to reclaim it if the post is untrashed. For internal use. `$post_name` string Required Post slug. `$post_ID` int Optional Post ID that should be ignored. Default 0. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID = 0 ) { $trashed_posts_with_desired_slug = get_posts( array( 'name' => $post_name, 'post_status' => 'trash', 'post_type' => 'any', 'nopaging' => true, 'post__not_in' => array( $post_ID ), ) ); if ( ! empty( $trashed_posts_with_desired_slug ) ) { foreach ( $trashed_posts_with_desired_slug as $_post ) { wp_add_trashed_suffix_to_post_name_for_post( $_post ); } } } ``` | Uses | Description | | --- | --- | | [wp\_add\_trashed\_suffix\_to\_post\_name\_for\_post()](wp_add_trashed_suffix_to_post_name_for_post) wp-includes/post.php | Adds a trashed suffix for a given post. | | [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. | | Used By | Description | | --- | --- | | [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. | | Version | Description | | --- | --- | | [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. | wordpress do_action_deprecated( string $hook_name, array $args, string $version, string $replacement = '', string $message = '' ) do\_action\_deprecated( string $hook\_name, array $args, string $version, string $replacement = '', string $message = '' ) ========================================================================================================================== Fires functions attached to a deprecated action hook. When an action hook is deprecated, the [do\_action()](do_action) call is replaced with [do\_action\_deprecated()](do_action_deprecated) , which triggers a deprecation notice and then fires the original hook. * [\_deprecated\_hook()](_deprecated_hook) `$hook_name` string Required The name of the action hook. `$args` array Required Array of additional function arguments to be passed to [do\_action()](do_action) . `$version` string Required The version of WordPress that deprecated the hook. `$replacement` string Optional The hook that should have been used. Default: `''` `$message` string Optional A message regarding the change. Default: `''` File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/) ``` function do_action_deprecated( $hook_name, $args, $version, $replacement = '', $message = '' ) { if ( ! has_action( $hook_name ) ) { return; } _deprecated_hook( $hook_name, $version, $replacement, $message ); do_action_ref_array( $hook_name, $args ); } ``` | Uses | Description | | --- | --- | | [\_deprecated\_hook()](_deprecated_hook) wp-includes/functions.php | Marks a deprecated action or filter hook as deprecated and throws a notice. | | [has\_action()](has_action) wp-includes/plugin.php | Checks if any action has been registered for a hook. | | [do\_action\_ref\_array()](do_action_ref_array) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook, specifying arguments in an array. | | Used By | 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\_insert\_site()](wp_insert_site) wp-includes/ms-site.php | Inserts a new site into the database. | | [wp\_delete\_site()](wp_delete_site) wp-includes/ms-site.php | Deletes a site from the database. | | [register\_and\_do\_post\_meta\_boxes()](register_and_do_post_meta_boxes) wp-admin/includes/meta-boxes.php | Registers the default post meta boxes, and runs the `do_meta_boxes` actions. | | [get\_password\_reset\_key()](get_password_reset_key) wp-includes/user.php | Creates, stores, then returns a password reset key for user. | | [wpmu\_delete\_blog()](wpmu_delete_blog) wp-admin/includes/ms.php | Delete a site. | | [\_transition\_post\_status()](_transition_post_status) wp-includes/post.php | Hook for managing future post transitions to published. | | [clean\_blog\_cache()](clean_blog_cache) wp-includes/ms-site.php | Clean the blog cache | | Version | Description | | --- | --- | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
programming_docs
wordpress wp_save_nav_menu_items( int $menu_id, array[] $menu_data = array() ): int[] wp\_save\_nav\_menu\_items( int $menu\_id, array[] $menu\_data = array() ): int[] ================================================================================= Save posted nav menu item data. `$menu_id` int Required The menu ID for which to save this item. Value of 0 makes a draft, orphaned menu item. Default 0. `$menu_data` array[] Optional The unsanitized POSTed menu item data. Default: `array()` int[] The database IDs of the items saved File: `wp-admin/includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/nav-menu.php/) ``` function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) { $menu_id = (int) $menu_id; $items_saved = array(); if ( 0 == $menu_id || is_nav_menu( $menu_id ) ) { // Loop through all the menu items' POST values. foreach ( (array) $menu_data as $_possible_db_id => $_item_object_data ) { if ( // Checkbox is not checked. empty( $_item_object_data['menu-item-object-id'] ) && ( // And item type either isn't set. ! isset( $_item_object_data['menu-item-type'] ) || // Or URL is the default. in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ), true ) || // Or it's not a custom menu item (but not the custom home page). ! ( 'custom' === $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || // Or it *is* a custom menu item that already exists. ! empty( $_item_object_data['menu-item-db-id'] ) ) ) { // Then this potential menu item is not getting added to this menu. continue; } // If this possible menu item doesn't actually have a menu database ID yet. if ( empty( $_item_object_data['menu-item-db-id'] ) || ( 0 > $_possible_db_id ) || $_possible_db_id != $_item_object_data['menu-item-db-id'] ) { $_actual_db_id = 0; } else { $_actual_db_id = (int) $_item_object_data['menu-item-db-id']; } $args = array( 'menu-item-db-id' => ( isset( $_item_object_data['menu-item-db-id'] ) ? $_item_object_data['menu-item-db-id'] : '' ), 'menu-item-object-id' => ( isset( $_item_object_data['menu-item-object-id'] ) ? $_item_object_data['menu-item-object-id'] : '' ), 'menu-item-object' => ( isset( $_item_object_data['menu-item-object'] ) ? $_item_object_data['menu-item-object'] : '' ), 'menu-item-parent-id' => ( isset( $_item_object_data['menu-item-parent-id'] ) ? $_item_object_data['menu-item-parent-id'] : '' ), 'menu-item-position' => ( isset( $_item_object_data['menu-item-position'] ) ? $_item_object_data['menu-item-position'] : '' ), 'menu-item-type' => ( isset( $_item_object_data['menu-item-type'] ) ? $_item_object_data['menu-item-type'] : '' ), 'menu-item-title' => ( isset( $_item_object_data['menu-item-title'] ) ? $_item_object_data['menu-item-title'] : '' ), 'menu-item-url' => ( isset( $_item_object_data['menu-item-url'] ) ? $_item_object_data['menu-item-url'] : '' ), 'menu-item-description' => ( isset( $_item_object_data['menu-item-description'] ) ? $_item_object_data['menu-item-description'] : '' ), 'menu-item-attr-title' => ( isset( $_item_object_data['menu-item-attr-title'] ) ? $_item_object_data['menu-item-attr-title'] : '' ), 'menu-item-target' => ( isset( $_item_object_data['menu-item-target'] ) ? $_item_object_data['menu-item-target'] : '' ), 'menu-item-classes' => ( isset( $_item_object_data['menu-item-classes'] ) ? $_item_object_data['menu-item-classes'] : '' ), 'menu-item-xfn' => ( isset( $_item_object_data['menu-item-xfn'] ) ? $_item_object_data['menu-item-xfn'] : '' ), ); $items_saved[] = wp_update_nav_menu_item( $menu_id, $_actual_db_id, $args ); } } return $items_saved; } ``` | Uses | Description | | --- | --- | | [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. | | [is\_nav\_menu()](is_nav_menu) wp-includes/nav-menu.php | Determines whether the given ID is a navigation menu. | | 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. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress wp_recursive_ksort( array $array ) wp\_recursive\_ksort( array $array ) ==================================== Sorts the keys of an array alphabetically. The array is passed by reference so it doesn’t get returned which mimics the behaviour of ksort. `$array` array Required The array to sort, passed by reference. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp_recursive_ksort( &$array ) { foreach ( $array as &$value ) { if ( is_array( $value ) ) { wp_recursive_ksort( $value ); } } ksort( $array ); } ``` | Uses | Description | | --- | --- | | [wp\_recursive\_ksort()](wp_recursive_ksort) wp-includes/functions.php | Sorts the keys of an array alphabetically. | | Used By | Description | | --- | --- | | [wp\_recursive\_ksort()](wp_recursive_ksort) wp-includes/functions.php | Sorts the keys of an array alphabetically. | | [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. | | Version | Description | | --- | --- | | [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. | wordpress _post_format_wp_get_object_terms( array $terms ): array \_post\_format\_wp\_get\_object\_terms( array $terms ): 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. Remove the post format prefix from the name property of the term objects created by [wp\_get\_object\_terms()](wp_get_object_terms) . `$terms` array Required array File: `wp-includes/post-formats.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-formats.php/) ``` function _post_format_wp_get_object_terms( $terms ) { foreach ( (array) $terms as $order => $term ) { if ( isset( $term->taxonomy ) && 'post_format' === $term->taxonomy ) { $terms[ $order ]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); } } return $terms; } ``` | Uses | Description | | --- | --- | | [get\_post\_format\_string()](get_post_format_string) wp-includes/post-formats.php | Returns a pretty, translated version of a post format slug | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress edit_user( int $user_id ): int|WP_Error edit\_user( int $user\_id ): int|WP\_Error ========================================== Edit user settings based on contents of $\_POST Used on user-edit.php and profile.php to manage and process user options, passwords etc. `$user_id` int Optional User ID. int|[WP\_Error](../classes/wp_error) User ID of the updated user or [WP\_Error](../classes/wp_error) on failure. File: `wp-admin/includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/user.php/) ``` function edit_user( $user_id = 0 ) { $wp_roles = wp_roles(); $user = new stdClass; $user_id = (int) $user_id; if ( $user_id ) { $update = true; $user->ID = $user_id; $userdata = get_userdata( $user_id ); $user->user_login = wp_slash( $userdata->user_login ); } else { $update = false; } if ( ! $update && isset( $_POST['user_login'] ) ) { $user->user_login = sanitize_user( wp_unslash( $_POST['user_login'] ), true ); } $pass1 = ''; $pass2 = ''; if ( isset( $_POST['pass1'] ) ) { $pass1 = trim( $_POST['pass1'] ); } if ( isset( $_POST['pass2'] ) ) { $pass2 = trim( $_POST['pass2'] ); } if ( isset( $_POST['role'] ) && current_user_can( 'promote_users' ) && ( ! $user_id || current_user_can( 'promote_user', $user_id ) ) ) { $new_role = sanitize_text_field( $_POST['role'] ); // If the new role isn't editable by the logged-in user die with error. $editable_roles = get_editable_roles(); if ( ! empty( $new_role ) && empty( $editable_roles[ $new_role ] ) ) { wp_die( __( 'Sorry, you are not allowed to give users that role.' ), 403 ); } $potential_role = isset( $wp_roles->role_objects[ $new_role ] ) ? $wp_roles->role_objects[ $new_role ] : false; /* * Don't let anyone with 'promote_users' edit their own role to something without it. * Multisite super admins can freely edit their roles, they possess all caps. */ if ( ( is_multisite() && current_user_can( 'manage_network_users' ) ) || get_current_user_id() !== $user_id || ( $potential_role && $potential_role->has_cap( 'promote_users' ) ) ) { $user->role = $new_role; } } if ( isset( $_POST['email'] ) ) { $user->user_email = sanitize_text_field( wp_unslash( $_POST['email'] ) ); } if ( isset( $_POST['url'] ) ) { if ( empty( $_POST['url'] ) || 'http://' === $_POST['url'] ) { $user->user_url = ''; } else { $user->user_url = sanitize_url( $_POST['url'] ); $protocols = implode( '|', array_map( 'preg_quote', wp_allowed_protocols() ) ); $user->user_url = preg_match( '/^(' . $protocols . '):/is', $user->user_url ) ? $user->user_url : 'http://' . $user->user_url; } } if ( isset( $_POST['first_name'] ) ) { $user->first_name = sanitize_text_field( $_POST['first_name'] ); } if ( isset( $_POST['last_name'] ) ) { $user->last_name = sanitize_text_field( $_POST['last_name'] ); } if ( isset( $_POST['nickname'] ) ) { $user->nickname = sanitize_text_field( $_POST['nickname'] ); } if ( isset( $_POST['display_name'] ) ) { $user->display_name = sanitize_text_field( $_POST['display_name'] ); } if ( isset( $_POST['description'] ) ) { $user->description = trim( $_POST['description'] ); } foreach ( wp_get_user_contact_methods( $user ) as $method => $name ) { if ( isset( $_POST[ $method ] ) ) { $user->$method = sanitize_text_field( $_POST[ $method ] ); } } if ( isset( $_POST['locale'] ) ) { $locale = sanitize_text_field( $_POST['locale'] ); if ( 'site-default' === $locale ) { $locale = ''; } elseif ( '' === $locale ) { $locale = 'en_US'; } elseif ( ! in_array( $locale, get_available_languages(), true ) ) { $locale = ''; } $user->locale = $locale; } if ( $update ) { $user->rich_editing = isset( $_POST['rich_editing'] ) && 'false' === $_POST['rich_editing'] ? 'false' : 'true'; $user->syntax_highlighting = isset( $_POST['syntax_highlighting'] ) && 'false' === $_POST['syntax_highlighting'] ? 'false' : 'true'; $user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh'; $user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false'; } $user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' === $_POST['comment_shortcuts'] ? 'true' : ''; $user->use_ssl = 0; if ( ! empty( $_POST['use_ssl'] ) ) { $user->use_ssl = 1; } $errors = new WP_Error(); /* checking that username has been typed */ if ( '' === $user->user_login ) { $errors->add( 'user_login', __( '<strong>Error:</strong> Please enter a username.' ) ); } /* checking that nickname has been typed */ if ( $update && empty( $user->nickname ) ) { $errors->add( 'nickname', __( '<strong>Error:</strong> Please enter a nickname.' ) ); } /** * Fires before the password and confirm password fields are checked for congruity. * * @since 1.5.1 * * @param string $user_login The username. * @param string $pass1 The password (passed by reference). * @param string $pass2 The confirmed password (passed by reference). */ do_action_ref_array( 'check_passwords', array( $user->user_login, &$pass1, &$pass2 ) ); // Check for blank password when adding a user. if ( ! $update && empty( $pass1 ) ) { $errors->add( 'pass', __( '<strong>Error:</strong> Please enter a password.' ), array( 'form-field' => 'pass1' ) ); } // Check for "\" in password. if ( false !== strpos( wp_unslash( $pass1 ), '\\' ) ) { $errors->add( 'pass', __( '<strong>Error:</strong> Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) ); } // Checking the password has been typed twice the same. if ( ( $update || ! empty( $pass1 ) ) && $pass1 != $pass2 ) { $errors->add( 'pass', __( '<strong>Error:</strong> Passwords do not match. Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) ); } if ( ! empty( $pass1 ) ) { $user->user_pass = $pass1; } if ( ! $update && isset( $_POST['user_login'] ) && ! validate_username( $_POST['user_login'] ) ) { $errors->add( 'user_login', __( '<strong>Error:</strong> This username is invalid because it uses illegal characters. Please enter a valid username.' ) ); } if ( ! $update && username_exists( $user->user_login ) ) { $errors->add( 'user_login', __( '<strong>Error:</strong> This username is already registered. Please choose another one.' ) ); } /** This filter is documented in wp-includes/user.php */ $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); if ( in_array( strtolower( $user->user_login ), array_map( 'strtolower', $illegal_logins ), true ) ) { $errors->add( 'invalid_username', __( '<strong>Error:</strong> Sorry, that username is not allowed.' ) ); } /* checking email address */ if ( empty( $user->user_email ) ) { $errors->add( 'empty_email', __( '<strong>Error:</strong> Please enter an email address.' ), array( 'form-field' => 'email' ) ); } elseif ( ! is_email( $user->user_email ) ) { $errors->add( 'invalid_email', __( '<strong>Error:</strong> The email address is not correct.' ), array( 'form-field' => 'email' ) ); } else { $owner_id = email_exists( $user->user_email ); if ( $owner_id && ( ! $update || ( $owner_id != $user->ID ) ) ) { $errors->add( 'email_exists', __( '<strong>Error:</strong> This email is already registered. Please choose another one.' ), array( 'form-field' => 'email' ) ); } } /** * Fires before user profile update errors are returned. * * @since 2.8.0 * * @param WP_Error $errors WP_Error object (passed by reference). * @param bool $update Whether this is a user update. * @param stdClass $user User object (passed by reference). */ do_action_ref_array( 'user_profile_update_errors', array( &$errors, $update, &$user ) ); if ( $errors->has_errors() ) { return $errors; } if ( $update ) { $user_id = wp_update_user( $user ); } else { $user_id = wp_insert_user( $user ); $notify = isset( $_POST['send_user_notification'] ) ? 'both' : 'admin'; /** * Fires after a new user has been created. * * @since 4.4.0 * * @param int|WP_Error $user_id ID of the newly created user or WP_Error on failure. * @param string $notify Type of notification that should happen. See * wp_send_new_user_notifications() for more information. */ do_action( 'edit_user_created_user', $user_id, $notify ); } return $user_id; } ``` [do\_action\_ref\_array( 'check\_passwords', string $user\_login, string $pass1, string $pass2 )](../hooks/check_passwords) Fires before the password and confirm password fields are checked for congruity. [do\_action( 'edit\_user\_created\_user', int|WP\_Error $user\_id, string $notify )](../hooks/edit_user_created_user) Fires after a new user has been created. [apply\_filters( 'illegal\_user\_logins', array $usernames )](../hooks/illegal_user_logins) Filters the list of disallowed usernames. [do\_action\_ref\_array( 'user\_profile\_update\_errors', WP\_Error $errors, bool $update, stdClass $user )](../hooks/user_profile_update_errors) Fires before user profile update errors are returned. | Uses | Description | | --- | --- | | [wp\_roles()](wp_roles) wp-includes/capabilities.php | Retrieves the global [WP\_Roles](../classes/wp_roles) instance and instantiates it if necessary. | | [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. | | [wp\_insert\_user()](wp_insert_user) wp-includes/user.php | Inserts a user into the database. | | [email\_exists()](email_exists) wp-includes/user.php | Determines whether the given email exists. | | [username\_exists()](username_exists) wp-includes/user.php | Determines whether the given username exists. | | [validate\_username()](validate_username) wp-includes/user.php | Checks whether a username is valid. | | [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. | | [do\_action\_ref\_array()](do_action_ref_array) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook, specifying arguments in an array. | | [get\_editable\_roles()](get_editable_roles) wp-admin/includes/user.php | Fetch a filtered list of user roles that the current user is allowed to edit. | | [wp\_allowed\_protocols()](wp_allowed_protocols) wp-includes/functions.php | Retrieves a list of protocols to allow in HTML attributes. | | [sanitize\_user()](sanitize_user) wp-includes/formatting.php | Sanitizes a username, stripping out unsafe characters. | | [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. | | [sanitize\_text\_field()](sanitize_text_field) wp-includes/formatting.php | Sanitizes a string from user input or from the database. | | [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\_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. | | [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. | | [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. | | [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. | | [\_\_()](__) wp-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\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Used By | Description | | --- | --- | | [add\_user()](add_user) wp-admin/includes/user.php | Creates a new user from the “Users” form using $\_POST information. | | [wp\_ajax\_add\_user()](wp_ajax_add_user) wp-admin/includes/ajax-actions.php | Ajax handler for adding a user. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
programming_docs
wordpress wp_get_password_hint(): string wp\_get\_password\_hint(): string ================================= Gets the text suggesting how to create strong passwords. string The password hint text. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function wp_get_password_hint() { $hint = __( 'Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ &amp; ).' ); /** * Filters the text describing the site's password complexity policy. * * @since 4.1.0 * * @param string $hint The password hint text. */ return apply_filters( 'password_hint', $hint ); } ``` [apply\_filters( 'password\_hint', string $hint )](../hooks/password_hint) Filters the text describing the site’s password complexity policy. | Uses | Description | | --- | --- | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Version | Description | | --- | --- | | [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Introduced. | wordpress wp_authenticate_spam_check( WP_User|WP_Error|null $user ): WP_User|WP_Error wp\_authenticate\_spam\_check( WP\_User|WP\_Error|null $user ): WP\_User|WP\_Error ================================================================================== 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. `$user` [WP\_User](../classes/wp_user)|[WP\_Error](../classes/wp_error)|null Required [WP\_User](../classes/wp_user) or [WP\_Error](../classes/wp_error) object from a previous callback. Default null. [WP\_User](../classes/wp_user)|[WP\_Error](../classes/wp_error) [WP\_User](../classes/wp_user) on success, [WP\_Error](../classes/wp_error) if the user is considered a spammer. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function wp_authenticate_spam_check( $user ) { if ( $user instanceof WP_User && is_multisite() ) { /** * Filters whether the user has been marked as a spammer. * * @since 3.7.0 * * @param bool $spammed Whether the user is considered a spammer. * @param WP_User $user User to check against. */ $spammed = apply_filters( 'check_is_user_spammed', is_user_spammy( $user ), $user ); if ( $spammed ) { return new WP_Error( 'spammer_account', __( '<strong>Error:</strong> Your account has been marked as a spammer.' ) ); } } return $user; } ``` [apply\_filters( 'check\_is\_user\_spammed', bool $spammed, WP\_User $user )](../hooks/check_is_user_spammed) Filters whether the user has been marked as a spammer. | Uses | Description | | --- | --- | | [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. | | [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.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. | wordpress wp_get_user_contact_methods( WP_User|null $user = null ): string[] wp\_get\_user\_contact\_methods( WP\_User|null $user = null ): string[] ======================================================================= Sets up the user contact methods. Default contact methods were removed in 3.6. A filter dictates contact methods. `$user` [WP\_User](../classes/wp_user)|null Optional [WP\_User](../classes/wp_user) object. Default: `null` string[] Array of contact method labels keyed by contact method. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function wp_get_user_contact_methods( $user = null ) { $methods = array(); if ( get_site_option( 'initial_db_version' ) < 23588 ) { $methods = array( 'aim' => __( 'AIM' ), 'yim' => __( 'Yahoo IM' ), 'jabber' => __( 'Jabber / Google Talk' ), ); } /** * Filters the user contact methods. * * @since 2.9.0 * * @param string[] $methods Array of contact method labels keyed by contact method. * @param WP_User|null $user WP_User object or null if none was provided. */ return apply_filters( 'user_contactmethods', $methods, $user ); } ``` [apply\_filters( 'user\_contactmethods', string[] $methods, WP\_User|null $user )](../hooks/user_contactmethods) Filters the user contact methods. | Uses | Description | | --- | --- | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_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 | | --- | --- | | [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST | | [\_get\_additional\_user\_keys()](_get_additional_user_keys) wp-includes/user.php | Returns a list of meta keys to be (maybe) populated in [wp\_update\_user()](wp_update_user) . | | [\_wp\_get\_user\_contactmethods()](_wp_get_user_contactmethods) wp-includes/user.php | The old private function for setting up user contact methods. | | [wp\_insert\_user()](wp_insert_user) wp-includes/user.php | Inserts a user into the database. | | Version | Description | | --- | --- | | [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. | wordpress check_import_new_users( string $permission ): bool check\_import\_new\_users( string $permission ): bool ===================================================== Checks if the current user has permissions to import new users. `$permission` string Required A permission to be checked. Currently not used. bool True if the user has proper permissions, false if they do not. File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/) ``` function check_import_new_users( $permission ) { if ( ! current_user_can( 'manage_network_users' ) ) { return false; } return true; } ``` | Uses | Description | | --- | --- | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress image_media_send_to_editor( string $html, int $attachment_id, array $attachment ): string image\_media\_send\_to\_editor( string $html, int $attachment\_id, array $attachment ): string ============================================================================================== Retrieves the media element HTML to send to the editor. `$html` string Required `$attachment_id` int Required `$attachment` array Required string File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/) ``` function image_media_send_to_editor( $html, $attachment_id, $attachment ) { $post = get_post( $attachment_id ); if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) { $url = $attachment['url']; $align = ! empty( $attachment['align'] ) ? $attachment['align'] : 'none'; $size = ! empty( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium'; $alt = ! empty( $attachment['image_alt'] ) ? $attachment['image_alt'] : ''; $rel = ( strpos( $url, 'attachment_id' ) || get_attachment_link( $attachment_id ) === $url ); return get_image_send_to_editor( $attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size, $alt ); } return $html; } ``` | Uses | Description | | --- | --- | | [get\_image\_send\_to\_editor()](get_image_send_to_editor) wp-admin/includes/media.php | Retrieves the image HTML to send to the editor. | | [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. | | [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 get_comment_text( int|WP_Comment $comment_ID, array $args = array() ): string get\_comment\_text( int|WP\_Comment $comment\_ID, array $args = array() ): string ================================================================================= Retrieves the text of the current comment. * [Walker\_Comment::comment()](../classes/walker_comment/comment) `$comment_ID` int|[WP\_Comment](../classes/wp_comment) Required [WP\_Comment](../classes/wp_comment) or ID of the comment for which to get the text. Default current comment. `$args` array Optional An array of arguments. Default: `array()` string The comment content. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function get_comment_text( $comment_ID = 0, $args = array() ) { $comment = get_comment( $comment_ID ); $comment_content = $comment->comment_content; if ( is_comment_feed() && $comment->comment_parent ) { $parent = get_comment( $comment->comment_parent ); if ( $parent ) { $parent_link = esc_url( get_comment_link( $parent ) ); $name = get_comment_author( $parent ); $comment_content = sprintf( /* translators: %s: Comment link. */ ent2ncr( __( 'In reply to %s.' ) ), '<a href="' . $parent_link . '">' . $name . '</a>' ) . "\n\n" . $comment_content; } } /** * Filters the text of a comment. * * @since 1.5.0 * * @see Walker_Comment::comment() * * @param string $comment_content Text of the comment. * @param WP_Comment $comment The comment object. * @param array $args An array of arguments. */ return apply_filters( 'get_comment_text', $comment_content, $comment, $args ); } ``` [apply\_filters( 'get\_comment\_text', string $comment\_content, WP\_Comment $comment, array $args )](../hooks/get_comment_text) Filters the text of a comment. | Uses | Description | | --- | --- | | [ent2ncr()](ent2ncr) wp-includes/formatting.php | Converts named entities into numbered entities. | | [is\_comment\_feed()](is_comment_feed) wp-includes/query.php | Is the query for a comments feed? | | [get\_comment\_link()](get_comment_link) wp-includes/comment-template.php | Retrieves the link to a given comment. | | [get\_comment\_author()](get_comment_author) wp-includes/comment-template.php | Retrieves the author of the current comment. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. | | Used By | Description | | --- | --- | | [wp\_comments\_personal\_data\_exporter()](wp_comments_personal_data_exporter) wp-includes/comment.php | Finds and exports personal data associated with an email address from the comments table. | | [comment\_text\_rss()](comment_text_rss) wp-includes/feed.php | Displays the current comment content for use in the feeds. | | [comment\_text()](comment_text) wp-includes/comment-template.php | Displays the text of the current comment. | | Version | Description | | --- | --- | | [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Added 'In reply to %s.' prefix to child comments in comments feed. | | [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_ajax_health_check_loopback_requests() wp\_ajax\_health\_check\_loopback\_requests() ============================================= This function has been deprecated. Use [WP\_REST\_Site\_Health\_Controller::test\_loopback\_requests()](../classes/wp_rest_site_health_controller/test_loopback_requests) instead. Ajax handler for site health checks on loopback requests. * [WP\_REST\_Site\_Health\_Controller::test\_loopback\_requests()](../classes/wp_rest_site_health_controller/test_loopback_requests) 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_loopback_requests() { _doing_it_wrong( 'wp_ajax_health_check_loopback_requests', 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_loopback_requests', 'WP_REST_Site_Health_Controller::test_loopback_requests' ), '5.6.0' ); check_ajax_referer( 'health-check-site-status' ); if ( ! current_user_can( 'view_site_health_checks' ) ) { wp_send_json_error(); } if ( ! class_exists( 'WP_Site_Health' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; } $site_health = WP_Site_Health::get_instance(); wp_send_json_success( $site_health->get_test_loopback_requests() ); } ``` | Uses | Description | | --- | --- | | [WP\_Site\_Health::get\_instance()](../classes/wp_site_health/get_instance) wp-admin/includes/class-wp-site-health.php | Returns an instance of the [WP\_Site\_Health](../classes/wp_site_health) class, or create one if none exist yet. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. | | [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. | | [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. | | [wp\_send\_json\_success()](wp_send_json_success) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating success. | | Version | Description | | --- | --- | | [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Use [WP\_REST\_Site\_Health\_Controller::test\_loopback\_requests()](../classes/wp_rest_site_health_controller/test_loopback_requests) | | [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. | wordpress get_category_by_slug( string $slug ): object|false get\_category\_by\_slug( string $slug ): object|false ===================================================== Retrieves a category object by category slug. `$slug` string Required The category slug. object|false Category data object on success, false if not found. Same is achieved by: `get_term_by('slug', $slug, 'category');` File: `wp-includes/category.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category.php/) ``` function get_category_by_slug( $slug ) { $category = get_term_by( 'slug', $slug, 'category' ); if ( $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\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress get_media_embedded_in_content( string $content, string[] $types = null ): string[] get\_media\_embedded\_in\_content( string $content, string[] $types = null ): string[] ====================================================================================== Checks the HTML content for a audio, video, object, embed, or iframe tags. `$content` string Required A string of HTML which might contain media elements. `$types` string[] Optional An array of media types: `'audio'`, `'video'`, `'object'`, `'embed'`, or `'iframe'`. Default: `null` string[] Array of found HTML media elements. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/) ``` function get_media_embedded_in_content( $content, $types = null ) { $html = array(); /** * Filters the embedded media types that are allowed to be returned from the content blob. * * @since 4.2.0 * * @param string[] $allowed_media_types An array of allowed media types. Default media types are * 'audio', 'video', 'object', 'embed', and 'iframe'. */ $allowed_media_types = apply_filters( 'media_embedded_in_content_allowed_types', array( 'audio', 'video', 'object', 'embed', 'iframe' ) ); if ( ! empty( $types ) ) { if ( ! is_array( $types ) ) { $types = array( $types ); } $allowed_media_types = array_intersect( $allowed_media_types, $types ); } $tags = implode( '|', $allowed_media_types ); if ( preg_match_all( '#<(?P<tag>' . $tags . ')[^<]*?(?:>[\s\S]*?<\/(?P=tag)>|\s*\/>)#', $content, $matches ) ) { foreach ( $matches[0] as $match ) { $html[] = $match; } } return $html; } ``` [apply\_filters( 'media\_embedded\_in\_content\_allowed\_types', string[] $allowed\_media\_types )](../hooks/media_embedded_in_content_allowed_types) Filters the embedded media types that are allowed to be returned from the content blob. | Uses | Description | | --- | --- | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress wp_oembed_add_discovery_links() wp\_oembed\_add\_discovery\_links() =================================== Adds oEmbed discovery links in the head element of the website. File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/) ``` function wp_oembed_add_discovery_links() { $output = ''; if ( is_singular() ) { $output .= '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n"; if ( class_exists( 'SimpleXMLElement' ) ) { $output .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink(), 'xml' ) ) . '" />' . "\n"; } } /** * Filters the oEmbed discovery links HTML. * * @since 4.4.0 * * @param string $output HTML of the discovery links. */ echo apply_filters( 'oembed_discovery_links', $output ); } ``` [apply\_filters( 'oembed\_discovery\_links', string $output )](../hooks/oembed_discovery_links) Filters the oEmbed discovery links HTML. | Uses | Description | | --- | --- | | [get\_oembed\_endpoint\_url()](get_oembed_endpoint_url) wp-includes/embed.php | Retrieves the oEmbed endpoint URL for a given permalink. | | [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). | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [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. |
programming_docs
wordpress single_tag_title( string $prefix = '', bool $display = true ): string|void single\_tag\_title( string $prefix = '', bool $display = true ): string|void ============================================================================ Displays or retrieves page title for tag post archive. Useful for tag template files for displaying the tag page title. 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_tag_title( $prefix = '', $display = true ) { return single_term_title( $prefix, $display ); } ``` | Uses | Description | | --- | --- | | [single\_term\_title()](single_term_title) wp-includes/general-template.php | Displays or retrieves page title for taxonomy term archive. | | Used By | Description | | --- | --- | | [get\_the\_archive\_title()](get_the_archive_title) wp-includes/general-template.php | Retrieves the archive title based on the queried object. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress get_post_time( string $format = 'U', bool $gmt = false, int|WP_Post $post = null, bool $translate = false ): string|int|false get\_post\_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 written. `$format` string Optional Format to use for retrieving the time the post was written. 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. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function get_post_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, 'date', $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 written. * * @since 2.6.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 written. * Accepts 'G', 'U', or PHP date format. * @param bool $gmt Whether to retrieve the GMT time. */ return apply_filters( 'get_post_time', $time, $format, $gmt ); } ``` [apply\_filters( 'get\_post\_time', string|int $time, string $format, bool $gmt )](../hooks/get_post_time) Filters the localized time a post was written. | 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 | | --- | --- | | [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. | | [get\_the\_time()](get_the_time) wp-includes/general-template.php | Retrieves the time at which the post was written. | | [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\_the\_date()](get_the_date) wp-includes/general-template.php | Retrieves the date on which the post was written. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress wp_maybe_enqueue_oembed_host_js( string $html ): string wp\_maybe\_enqueue\_oembed\_host\_js( string $html ): string ============================================================ Enqueue the wp-embed script if the provided oEmbed HTML contains a post embed. In order to only enqueue the wp-embed script on pages that actually contain post embeds, this function checks if the provided HTML contains post embed markup and if so enqueues the script so that it will get printed in the footer. `$html` string Required Embed markup. string Embed markup (without modifications). File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/) ``` function wp_maybe_enqueue_oembed_host_js( $html ) { if ( has_action( 'wp_head', 'wp_oembed_add_host_js' ) && preg_match( '/<blockquote\s[^>]*?wp-embedded-content/', $html ) ) { wp_enqueue_script( 'wp-embed' ); } return $html; } ``` | Uses | Description | | --- | --- | | [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. | | [has\_action()](has_action) wp-includes/plugin.php | Checks if any action has been registered for a hook. | | Version | Description | | --- | --- | | [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. | wordpress wp_kses_hair( string $attr, string[] $allowed_protocols ): array[] wp\_kses\_hair( string $attr, string[] $allowed\_protocols ): array[] ===================================================================== Builds an attribute list from string containing attributes. This function does a lot of work. It parses an attribute list into an array with attribute data, and tries to do the right thing even if it gets weird input. It will add quotes around attribute values that don’t have any quotes or apostrophes around them, to make it easier to produce HTML code that will conform to W3C’s HTML specification. It will also remove bad URL protocols from attribute values. It also reduces duplicate attributes by using the attribute defined first (`foo='bar' foo='baz'` will result in `foo='bar'`). `$attr` string Required Attribute list from HTML element to closing HTML element tag. `$allowed_protocols` string[] Required Array of allowed URL protocols. array[] Array of attribute information after parsing. File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/) ``` function wp_kses_hair( $attr, $allowed_protocols ) { $attrarr = array(); $mode = 0; $attrname = ''; $uris = wp_kses_uri_attributes(); // Loop through the whole attribute list. while ( strlen( $attr ) != 0 ) { $working = 0; // Was the last operation successful? switch ( $mode ) { case 0: if ( preg_match( '/^([_a-zA-Z][-_a-zA-Z0-9:.]*)/', $attr, $match ) ) { $attrname = $match[1]; $working = 1; $mode = 1; $attr = preg_replace( '/^[_a-zA-Z][-_a-zA-Z0-9:.]*/', '', $attr ); } break; case 1: if ( preg_match( '/^\s*=\s*/', $attr ) ) { // Equals sign. $working = 1; $mode = 2; $attr = preg_replace( '/^\s*=\s*/', '', $attr ); break; } if ( preg_match( '/^\s+/', $attr ) ) { // Valueless. $working = 1; $mode = 0; if ( false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y', ); } $attr = preg_replace( '/^\s+/', '', $attr ); } break; case 2: if ( preg_match( '%^"([^"]*)"(\s+|/?$)%', $attr, $match ) ) { // "value" $thisval = $match[1]; if ( in_array( strtolower( $attrname ), $uris, true ) ) { $thisval = wp_kses_bad_protocol( $thisval, $allowed_protocols ); } if ( false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n', ); } $working = 1; $mode = 0; $attr = preg_replace( '/^"[^"]*"(\s+|$)/', '', $attr ); break; } if ( preg_match( "%^'([^']*)'(\s+|/?$)%", $attr, $match ) ) { // 'value' $thisval = $match[1]; if ( in_array( strtolower( $attrname ), $uris, true ) ) { $thisval = wp_kses_bad_protocol( $thisval, $allowed_protocols ); } if ( false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n', ); } $working = 1; $mode = 0; $attr = preg_replace( "/^'[^']*'(\s+|$)/", '', $attr ); break; } if ( preg_match( "%^([^\s\"']+)(\s+|/?$)%", $attr, $match ) ) { // value $thisval = $match[1]; if ( in_array( strtolower( $attrname ), $uris, true ) ) { $thisval = wp_kses_bad_protocol( $thisval, $allowed_protocols ); } if ( false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n', ); } // We add quotes to conform to W3C's HTML spec. $working = 1; $mode = 0; $attr = preg_replace( "%^[^\s\"']+(\s+|$)%", '', $attr ); } break; } // End switch. if ( 0 == $working ) { // Not well-formed, remove and try again. $attr = wp_kses_html_error( $attr ); $mode = 0; } } // End while. if ( 1 == $mode && false === array_key_exists( $attrname, $attrarr ) ) { // Special case, for when the attribute list ends with a valueless // attribute like "selected". $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y', ); } return $attrarr; } ``` | Uses | Description | | --- | --- | | [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\_kses\_bad\_protocol()](wp_kses_bad_protocol) wp-includes/kses.php | Sanitizes a string and removed disallowed URL protocols. | | [wp\_kses\_html\_error()](wp_kses_html_error) wp-includes/kses.php | Handles parsing errors in `wp_kses_hair()`. | | Used By | Description | | --- | --- | | [wp\_rel\_callback()](wp_rel_callback) wp-includes/formatting.php | Callback to add a rel attribute to HTML A element. | | [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\_targeted\_link\_rel\_callback()](wp_targeted_link_rel_callback) wp-includes/formatting.php | Callback to add `rel="noopener"` string to HTML A element. | | [wp\_kses\_attr()](wp_kses_attr) wp-includes/kses.php | Removes all attributes, if none are allowed for this element. | | Version | Description | | --- | --- | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. | wordpress wp_privacy_process_personal_data_erasure_page( array $response, int $eraser_index, string $email_address, int $page, int $request_id ): array wp\_privacy\_process\_personal\_data\_erasure\_page( array $response, int $eraser\_index, string $email\_address, int $page, int $request\_id ): array ====================================================================================================================================================== Mark erasure requests as completed after processing is finished. This intercepts the Ajax responses to personal data eraser page requests, and monitors the status of a request. Once all of the processing has finished, the request is marked as completed. * [‘wp\_privacy\_personal\_data\_erasure\_page’](../hooks/wp_privacy_personal_data_erasure_page) `$response` array Required The response from the personal data eraser for the given page. `$eraser_index` int Required The index of the personal data eraser. Begins at 1. `$email_address` string Required The email address of the user whose personal data this is. `$page` int Required The page of personal data for this eraser. Begins at 1. `$request_id` int Required The request ID for this personal data erasure. array The filtered response. File: `wp-admin/includes/privacy-tools.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/privacy-tools.php/) ``` function wp_privacy_process_personal_data_erasure_page( $response, $eraser_index, $email_address, $page, $request_id ) { /* * If the eraser response is malformed, don't attempt to consume it; let it * pass through, so that the default Ajax processing will generate a warning * to the user. */ if ( ! is_array( $response ) ) { return $response; } if ( ! array_key_exists( 'done', $response ) ) { return $response; } if ( ! array_key_exists( 'items_removed', $response ) ) { return $response; } if ( ! array_key_exists( 'items_retained', $response ) ) { return $response; } if ( ! array_key_exists( 'messages', $response ) ) { return $response; } // Get the request. $request = wp_get_user_request( $request_id ); if ( ! $request || 'remove_personal_data' !== $request->action_name ) { wp_send_json_error( __( 'Invalid request ID when processing personal data to erase.' ) ); } /** This filter is documented in wp-admin/includes/ajax-actions.php */ $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); $is_last_eraser = count( $erasers ) === $eraser_index; $eraser_done = $response['done']; if ( ! $is_last_eraser || ! $eraser_done ) { return $response; } _wp_privacy_completed_request( $request_id ); /** * Fires immediately after a personal data erasure request has been marked completed. * * @since 4.9.6 * * @param int $request_id The privacy request post ID associated with this request. */ do_action( 'wp_privacy_personal_data_erased', $request_id ); return $response; } ``` [do\_action( 'wp\_privacy\_personal\_data\_erased', int $request\_id )](../hooks/wp_privacy_personal_data_erased) Fires immediately after a personal data erasure request has been marked completed. [apply\_filters( 'wp\_privacy\_personal\_data\_erasers', array $args )](../hooks/wp_privacy_personal_data_erasers) Filters the array of personal data eraser callbacks. | Uses | Description | | --- | --- | | [wp\_get\_user\_request()](wp_get_user_request) wp-includes/user.php | Returns the user request object for the specified request ID. | | [\_wp\_privacy\_completed\_request()](_wp_privacy_completed_request) wp-admin/includes/privacy-tools.php | Marks a request as completed by the admin and logs the current timestamp. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | Version | Description | | --- | --- | | [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. | wordpress rest_ensure_request( array|string|WP_REST_Request $request ): WP_REST_Request rest\_ensure\_request( array|string|WP\_REST\_Request $request ): WP\_REST\_Request =================================================================================== Ensures request arguments are a request object (for consistency). `$request` array|string|[WP\_REST\_Request](../classes/wp_rest_request) Required Request to check. [WP\_REST\_Request](../classes/wp_rest_request) REST request instance. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_ensure_request( $request ) { if ( $request instanceof WP_REST_Request ) { return $request; } if ( is_string( $request ) ) { return new WP_REST_Request( 'GET', $request ); } return new WP_REST_Request( 'GET', '', $request ); } ``` | Uses | Description | | --- | --- | | [WP\_REST\_Request::\_\_construct()](../classes/wp_rest_request/__construct) wp-includes/rest-api/class-wp-rest-request.php | Constructor. | | Used By | Description | | --- | --- | | [rest\_do\_request()](rest_do_request) wp-includes/rest-api.php | Do a REST request. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Accept string argument for the request path. | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. | wordpress create_initial_post_types() create\_initial\_post\_types() ============================== Creates the initial post types when ‘init’ action is fired. See [‘init’](../hooks/init). File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function create_initial_post_types() { WP_Post_Type::reset_default_labels(); register_post_type( 'post', array( 'labels' => array( 'name_admin_bar' => _x( 'Post', 'add new from admin bar' ), ), 'public' => true, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */ 'capability_type' => 'post', 'map_meta_cap' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-admin-post', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'delete_with_user' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ), 'show_in_rest' => true, 'rest_base' => 'posts', 'rest_controller_class' => 'WP_REST_Posts_Controller', ) ); register_post_type( 'page', array( 'labels' => array( 'name_admin_bar' => _x( 'Page', 'add new from admin bar' ), ), 'public' => true, 'publicly_queryable' => false, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */ 'capability_type' => 'page', 'map_meta_cap' => true, 'menu_position' => 20, 'menu_icon' => 'dashicons-admin-page', 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'delete_with_user' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions' ), 'show_in_rest' => true, 'rest_base' => 'pages', 'rest_controller_class' => 'WP_REST_Posts_Controller', ) ); register_post_type( 'attachment', array( 'labels' => array( 'name' => _x( 'Media', 'post type general name' ), 'name_admin_bar' => _x( 'Media', 'add new from admin bar' ), 'add_new' => _x( 'Add New', 'file' ), 'edit_item' => __( 'Edit Media' ), 'view_item' => __( 'View Attachment Page' ), 'attributes' => __( 'Attachment Attributes' ), ), 'public' => true, 'show_ui' => true, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */ 'capability_type' => 'post', 'capabilities' => array( 'create_posts' => 'upload_files', ), 'map_meta_cap' => true, 'menu_icon' => 'dashicons-admin-media', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'show_in_nav_menus' => false, 'delete_with_user' => true, 'supports' => array( 'title', 'author', 'comments' ), 'show_in_rest' => true, 'rest_base' => 'media', 'rest_controller_class' => 'WP_REST_Attachments_Controller', ) ); add_post_type_support( 'attachment:audio', 'thumbnail' ); add_post_type_support( 'attachment:video', 'thumbnail' ); register_post_type( 'revision', array( 'labels' => array( 'name' => __( 'Revisions' ), 'singular_name' => __( 'Revision' ), ), 'public' => false, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ '_edit_link' => 'revision.php?revision=%d', /* internal use only. don't use this when registering your own post type. */ 'capability_type' => 'post', 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'can_export' => false, 'delete_with_user' => true, 'supports' => array( 'author' ), ) ); register_post_type( 'nav_menu_item', array( 'labels' => array( 'name' => __( 'Navigation Menu Items' ), 'singular_name' => __( 'Navigation Menu Item' ), ), 'public' => false, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 'hierarchical' => false, 'rewrite' => false, 'delete_with_user' => false, 'query_var' => false, 'map_meta_cap' => true, 'capability_type' => array( 'edit_theme_options', 'edit_theme_options' ), 'capabilities' => array( // Meta Capabilities. 'edit_post' => 'edit_post', 'read_post' => 'read_post', 'delete_post' => 'delete_post', // Primitive Capabilities. 'edit_posts' => 'edit_theme_options', 'edit_others_posts' => 'edit_theme_options', 'delete_posts' => 'edit_theme_options', 'publish_posts' => 'edit_theme_options', 'read_private_posts' => 'edit_theme_options', 'read' => 'read', 'delete_private_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'edit_private_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', ), 'show_in_rest' => true, 'rest_base' => 'menu-items', 'rest_controller_class' => 'WP_REST_Menu_Items_Controller', ) ); register_post_type( 'custom_css', array( 'labels' => array( 'name' => __( 'Custom CSS' ), 'singular_name' => __( 'Custom CSS' ), ), 'public' => false, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'delete_with_user' => false, 'can_export' => true, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 'supports' => array( 'title', 'revisions' ), 'capabilities' => array( 'delete_posts' => 'edit_theme_options', 'delete_post' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'delete_private_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'edit_post' => 'edit_css', 'edit_posts' => 'edit_css', 'edit_others_posts' => 'edit_css', 'edit_published_posts' => 'edit_css', 'read_post' => 'read', 'read_private_posts' => 'read', 'publish_posts' => 'edit_theme_options', ), ) ); register_post_type( 'customize_changeset', array( 'labels' => array( 'name' => _x( 'Changesets', 'post type general name' ), 'singular_name' => _x( 'Changeset', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Customize Changeset' ), 'add_new_item' => __( 'Add New Changeset' ), 'new_item' => __( 'New Changeset' ), 'edit_item' => __( 'Edit Changeset' ), 'view_item' => __( 'View Changeset' ), 'all_items' => __( 'All Changesets' ), 'search_items' => __( 'Search Changesets' ), 'not_found' => __( 'No changesets found.' ), 'not_found_in_trash' => __( 'No changesets found in Trash.' ), ), 'public' => false, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'can_export' => false, 'delete_with_user' => false, 'supports' => array( 'title', 'author' ), 'capability_type' => 'customize_changeset', 'capabilities' => array( 'create_posts' => 'customize', 'delete_others_posts' => 'customize', 'delete_post' => 'customize', 'delete_posts' => 'customize', 'delete_private_posts' => 'customize', 'delete_published_posts' => 'customize', 'edit_others_posts' => 'customize', 'edit_post' => 'customize', 'edit_posts' => 'customize', 'edit_private_posts' => 'customize', 'edit_published_posts' => 'do_not_allow', 'publish_posts' => 'customize', 'read' => 'read', 'read_post' => 'customize', 'read_private_posts' => 'customize', ), ) ); register_post_type( 'oembed_cache', array( 'labels' => array( 'name' => __( 'oEmbed Responses' ), 'singular_name' => __( 'oEmbed Response' ), ), 'public' => false, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'delete_with_user' => false, 'can_export' => false, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 'supports' => array(), ) ); register_post_type( 'user_request', array( 'labels' => array( 'name' => __( 'User Requests' ), 'singular_name' => __( 'User Request' ), ), 'public' => false, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'can_export' => false, 'delete_with_user' => false, 'supports' => array(), ) ); register_post_type( 'wp_block', array( 'labels' => array( 'name' => _x( 'Reusable blocks', 'post type general name' ), 'singular_name' => _x( 'Reusable block', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Reusable block' ), 'add_new_item' => __( 'Add new Reusable block' ), 'new_item' => __( 'New Reusable block' ), 'edit_item' => __( 'Edit Reusable block' ), 'view_item' => __( 'View Reusable block' ), 'all_items' => __( 'All Reusable blocks' ), 'search_items' => __( 'Search Reusable blocks' ), 'not_found' => __( 'No reusable blocks found.' ), 'not_found_in_trash' => __( 'No reusable blocks found in Trash.' ), 'filter_items_list' => __( 'Filter reusable blocks list' ), 'items_list_navigation' => __( 'Reusable blocks list navigation' ), 'items_list' => __( 'Reusable blocks list' ), 'item_published' => __( 'Reusable block published.' ), 'item_published_privately' => __( 'Reusable block published privately.' ), 'item_reverted_to_draft' => __( 'Reusable block reverted to draft.' ), 'item_scheduled' => __( 'Reusable block scheduled.' ), 'item_updated' => __( 'Reusable block updated.' ), ), 'public' => false, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 'show_ui' => true, 'show_in_menu' => false, 'rewrite' => false, 'show_in_rest' => true, 'rest_base' => 'blocks', 'rest_controller_class' => 'WP_REST_Blocks_Controller', 'capability_type' => 'block', 'capabilities' => array( // You need to be able to edit posts, in order to read blocks in their raw form. 'read' => 'edit_posts', // You need to be able to publish posts, in order to create blocks. 'create_posts' => 'publish_posts', 'edit_posts' => 'edit_posts', 'edit_published_posts' => 'edit_published_posts', 'delete_published_posts' => 'delete_published_posts', 'edit_others_posts' => 'edit_others_posts', 'delete_others_posts' => 'delete_others_posts', ), 'map_meta_cap' => true, 'supports' => array( 'title', 'editor', 'revisions', ), ) ); register_post_type( 'wp_template', array( 'labels' => array( 'name' => _x( 'Templates', 'post type general name' ), 'singular_name' => _x( 'Template', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Template' ), 'add_new_item' => __( 'Add New Template' ), 'new_item' => __( 'New Template' ), 'edit_item' => __( 'Edit Template' ), 'view_item' => __( 'View Template' ), 'all_items' => __( 'Templates' ), 'search_items' => __( 'Search Templates' ), 'parent_item_colon' => __( 'Parent Template:' ), 'not_found' => __( 'No templates found.' ), 'not_found_in_trash' => __( 'No templates found in Trash.' ), 'archives' => __( 'Template archives' ), 'insert_into_item' => __( 'Insert into template' ), 'uploaded_to_this_item' => __( 'Uploaded to this template' ), 'filter_items_list' => __( 'Filter templates list' ), 'items_list_navigation' => __( 'Templates list navigation' ), 'items_list' => __( 'Templates list' ), ), 'description' => __( 'Templates to include in your theme.' ), 'public' => false, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 'has_archive' => false, 'show_ui' => false, 'show_in_menu' => false, 'show_in_rest' => true, 'rewrite' => false, 'rest_base' => 'templates', 'rest_controller_class' => 'WP_REST_Templates_Controller', 'capability_type' => array( 'template', 'templates' ), 'capabilities' => array( 'create_posts' => 'edit_theme_options', 'delete_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'delete_private_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'edit_posts' => 'edit_theme_options', 'edit_others_posts' => 'edit_theme_options', 'edit_private_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', 'publish_posts' => 'edit_theme_options', 'read' => 'edit_theme_options', 'read_private_posts' => 'edit_theme_options', ), 'map_meta_cap' => true, 'supports' => array( 'title', 'slug', 'excerpt', 'editor', 'revisions', 'author', ), ) ); register_post_type( 'wp_template_part', array( 'labels' => array( 'name' => _x( 'Template Parts', 'post type general name' ), 'singular_name' => _x( 'Template Part', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Template Part' ), 'add_new_item' => __( 'Add New Template Part' ), 'new_item' => __( 'New Template Part' ), 'edit_item' => __( 'Edit Template Part' ), 'view_item' => __( 'View Template Part' ), 'all_items' => __( 'Template Parts' ), 'search_items' => __( 'Search Template Parts' ), 'parent_item_colon' => __( 'Parent Template Part:' ), 'not_found' => __( 'No template parts found.' ), 'not_found_in_trash' => __( 'No template parts found in Trash.' ), 'archives' => __( 'Template part archives' ), 'insert_into_item' => __( 'Insert into template part' ), 'uploaded_to_this_item' => __( 'Uploaded to this template part' ), 'filter_items_list' => __( 'Filter template parts list' ), 'items_list_navigation' => __( 'Template parts list navigation' ), 'items_list' => __( 'Template parts list' ), ), 'description' => __( 'Template parts to include in your templates.' ), 'public' => false, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 'has_archive' => false, 'show_ui' => false, 'show_in_menu' => false, 'show_in_rest' => true, 'rewrite' => false, 'rest_base' => 'template-parts', 'rest_controller_class' => 'WP_REST_Templates_Controller', 'map_meta_cap' => true, 'capabilities' => array( 'create_posts' => 'edit_theme_options', 'delete_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'delete_private_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'edit_posts' => 'edit_theme_options', 'edit_others_posts' => 'edit_theme_options', 'edit_private_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', 'publish_posts' => 'edit_theme_options', 'read' => 'edit_theme_options', 'read_private_posts' => 'edit_theme_options', ), 'supports' => array( 'title', 'slug', 'excerpt', 'editor', 'revisions', 'author', ), ) ); register_post_type( 'wp_global_styles', array( 'label' => _x( 'Global Styles', 'post type general name' ), 'description' => __( 'Global styles to include in themes.' ), 'public' => false, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 'show_ui' => false, 'show_in_rest' => false, 'rewrite' => false, 'capabilities' => array( 'read' => 'edit_theme_options', 'create_posts' => 'edit_theme_options', 'edit_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'edit_others_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', ), 'map_meta_cap' => true, 'supports' => array( 'title', 'editor', 'revisions', ), ) ); register_post_type( 'wp_navigation', array( 'labels' => array( 'name' => _x( 'Navigation Menus', 'post type general name' ), 'singular_name' => _x( 'Navigation Menu', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Navigation Menu' ), 'add_new_item' => __( 'Add New Navigation Menu' ), 'new_item' => __( 'New Navigation Menu' ), 'edit_item' => __( 'Edit Navigation Menu' ), 'view_item' => __( 'View Navigation Menu' ), 'all_items' => __( 'Navigation Menus' ), 'search_items' => __( 'Search Navigation Menus' ), 'parent_item_colon' => __( 'Parent Navigation Menu:' ), 'not_found' => __( 'No Navigation Menu found.' ), 'not_found_in_trash' => __( 'No Navigation Menu found in Trash.' ), 'archives' => __( 'Navigation Menu archives' ), 'insert_into_item' => __( 'Insert into Navigation Menu' ), 'uploaded_to_this_item' => __( 'Uploaded to this Navigation Menu' ), 'filter_items_list' => __( 'Filter Navigation Menu list' ), 'items_list_navigation' => __( 'Navigation Menus list navigation' ), 'items_list' => __( 'Navigation Menus list' ), ), 'description' => __( 'Navigation menus that can be inserted into your site.' ), 'public' => false, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 'has_archive' => false, 'show_ui' => true, 'show_in_menu' => false, 'show_in_admin_bar' => false, 'show_in_rest' => true, 'rewrite' => false, 'map_meta_cap' => true, 'capabilities' => array( 'edit_others_posts' => 'edit_theme_options', 'delete_posts' => 'edit_theme_options', 'publish_posts' => 'edit_theme_options', 'create_posts' => 'edit_theme_options', 'read_private_posts' => 'edit_theme_options', 'delete_private_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'edit_private_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', 'edit_posts' => 'edit_theme_options', ), 'rest_base' => 'navigation', 'rest_controller_class' => 'WP_REST_Posts_Controller', 'supports' => array( 'title', 'editor', 'revisions', ), ) ); register_post_status( 'publish', array( 'label' => _x( 'Published', 'post status' ), 'public' => true, '_builtin' => true, /* internal use only. */ /* translators: %s: Number of published posts. */ 'label_count' => _n_noop( 'Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>' ), ) ); register_post_status( 'future', array( 'label' => _x( 'Scheduled', 'post status' ), 'protected' => true, '_builtin' => true, /* internal use only. */ /* translators: %s: Number of scheduled posts. */ 'label_count' => _n_noop( 'Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>' ), ) ); register_post_status( 'draft', array( 'label' => _x( 'Draft', 'post status' ), 'protected' => true, '_builtin' => true, /* internal use only. */ /* translators: %s: Number of draft posts. */ 'label_count' => _n_noop( 'Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>' ), 'date_floating' => true, ) ); register_post_status( 'pending', array( 'label' => _x( 'Pending', 'post status' ), 'protected' => true, '_builtin' => true, /* internal use only. */ /* translators: %s: Number of pending posts. */ 'label_count' => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>' ), 'date_floating' => true, ) ); register_post_status( 'private', array( 'label' => _x( 'Private', 'post status' ), 'private' => true, '_builtin' => true, /* internal use only. */ /* translators: %s: Number of private posts. */ 'label_count' => _n_noop( 'Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>' ), ) ); register_post_status( 'trash', array( 'label' => _x( 'Trash', 'post status' ), 'internal' => true, '_builtin' => true, /* internal use only. */ /* translators: %s: Number of trashed posts. */ 'label_count' => _n_noop( 'Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>' ), 'show_in_admin_status_list' => true, ) ); register_post_status( 'auto-draft', array( 'label' => 'auto-draft', 'internal' => true, '_builtin' => true, /* internal use only. */ 'date_floating' => true, ) ); register_post_status( 'inherit', array( 'label' => 'inherit', 'internal' => true, '_builtin' => true, /* internal use only. */ 'exclude_from_search' => false, ) ); register_post_status( 'request-pending', array( 'label' => _x( 'Pending', 'request status' ), 'internal' => true, '_builtin' => true, /* internal use only. */ /* translators: %s: Number of pending requests. */ 'label_count' => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>' ), 'exclude_from_search' => false, ) ); register_post_status( 'request-confirmed', array( 'label' => _x( 'Confirmed', 'request status' ), 'internal' => true, '_builtin' => true, /* internal use only. */ /* translators: %s: Number of confirmed requests. */ 'label_count' => _n_noop( 'Confirmed <span class="count">(%s)</span>', 'Confirmed <span class="count">(%s)</span>' ), 'exclude_from_search' => false, ) ); register_post_status( 'request-failed', array( 'label' => _x( 'Failed', 'request status' ), 'internal' => true, '_builtin' => true, /* internal use only. */ /* translators: %s: Number of failed requests. */ 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>' ), 'exclude_from_search' => false, ) ); register_post_status( 'request-completed', array( 'label' => _x( 'Completed', 'request status' ), 'internal' => true, '_builtin' => true, /* internal use only. */ /* translators: %s: Number of completed requests. */ 'label_count' => _n_noop( 'Completed <span class="count">(%s)</span>', 'Completed <span class="count">(%s)</span>' ), 'exclude_from_search' => false, ) ); } ``` | Uses | Description | | --- | --- | | [WP\_Post\_Type::reset\_default\_labels()](../classes/wp_post_type/reset_default_labels) wp-includes/class-wp-post-type.php | Resets the cache for the default labels. | | [\_n\_noop()](_n_noop) wp-includes/l10n.php | Registers plural strings in POT file, but does not translate them. | | [add\_post\_type\_support()](add_post_type_support) wp-includes/post.php | Registers support of certain features for a post type. | | [register\_post\_type()](register_post_type) wp-includes/post.php | Registers a post type. | | [register\_post\_status()](register_post_status) wp-includes/post.php | Registers a post status. Do not use before init. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | Version | Description | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
programming_docs
wordpress _prime_network_caches( array $network_ids ) \_prime\_network\_caches( array $network\_ids ) =============================================== Adds any networks from the given IDs to the cache that do not already exist in cache. * [update\_network\_cache()](update_network_cache) `$network_ids` array Required Array of network IDs. File: `wp-includes/ms-network.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-network.php/) ``` function _prime_network_caches( $network_ids ) { global $wpdb; $non_cached_ids = _get_non_cached_ids( $network_ids, 'networks' ); if ( ! empty( $non_cached_ids ) ) { $fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared update_network_cache( $fresh_networks ); } } ``` | Uses | Description | | --- | --- | | [update\_network\_cache()](update_network_cache) wp-includes/ms-network.php | Updates the network cache of given networks. | | [\_get\_non\_cached\_ids()](_get_non_cached_ids) wp-includes/functions.php | Retrieves IDs that are not already present in the cache. | | [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). | | Used By | Description | | --- | --- | | [WP\_Network\_Query::get\_networks()](../classes/wp_network_query/get_networks) wp-includes/class-wp-network-query.php | Gets a list of networks matching the query vars. | | Version | Description | | --- | --- | | [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | This function is no longer marked as "private". | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. | wordpress prev_post_rel_link( string $title = '%title', bool $in_same_term = false, int[]|string $excluded_terms = '', string $taxonomy = 'category' ) prev\_post\_rel\_link( string $title = '%title', bool $in\_same\_term = false, int[]|string $excluded\_terms = '', string $taxonomy = 'category' ) ================================================================================================================================================== Displays the relational link for the previous post adjacent to the current post. * [get\_adjacent\_post\_rel\_link()](get_adjacent_post_rel_link) `$title` string Optional Link title format. Default `'%title'`. Default: `'%title'` `$in_same_term` bool Optional Whether link should be in a same taxonomy term. Default: `false` `$excluded_terms` int[]|string Optional Array or comma-separated list of excluded term IDs. Default true. Default: `''` `$taxonomy` string Optional Taxonomy, if $in\_same\_term is true. Default `'category'`. Default: `'category'` File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function prev_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy ); } ``` | Uses | Description | | --- | --- | | [get\_adjacent\_post\_rel\_link()](get_adjacent_post_rel_link) wp-includes/link-template.php | Retrieves the adjacent post relational link. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress get_search_query( bool $escaped = true ): string get\_search\_query( bool $escaped = true ): string ================================================== Retrieves the contents of the search WordPress query variable. The search query string is passed through [esc\_attr()](esc_attr) to ensure that it is safe for placing in an HTML attribute. `$escaped` bool Optional Whether the result is escaped. Only use when you are later escaping it. Do not use unescaped. Default: `true` string File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function get_search_query( $escaped = true ) { /** * Filters the contents of the search query variable. * * @since 2.3.0 * * @param mixed $search Contents of the search query variable. */ $query = apply_filters( 'get_search_query', get_query_var( 's' ) ); if ( $escaped ) { $query = esc_attr( $query ); } return $query; } ``` [apply\_filters( 'get\_search\_query', mixed $search )](../hooks/get_search_query) Filters the contents of the search query variable. | Uses | Description | | --- | --- | | [get\_query\_var()](get_query_var) wp-includes/query.php | Retrieves the value of a query variable in the [WP\_Query](../classes/wp_query) class. | | [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\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. | | [the\_search\_query()](the_search_query) wp-includes/general-template.php | Displays the contents of the search query variable. | | [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. | | [get\_search\_form()](get_search_form) wp-includes/general-template.php | Displays search form. | | [get\_search\_link()](get_search_link) wp-includes/link-template.php | Retrieves the permalink for a search. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress wp_dropdown_roles( string $selected = '' ) wp\_dropdown\_roles( string $selected = '' ) ============================================ Prints out option HTML elements for role selectors. `$selected` string Optional Slug for the role that should be already selected. Default: `''` File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/) ``` function wp_dropdown_roles( $selected = '' ) { $r = ''; $editable_roles = array_reverse( get_editable_roles() ); foreach ( $editable_roles as $role => $details ) { $name = translate_user_role( $details['name'] ); // Preselect specified role. if ( $selected === $role ) { $r .= "\n\t<option selected='selected' value='" . esc_attr( $role ) . "'>$name</option>"; } else { $r .= "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>"; } } echo $r; } ``` | Uses | Description | | --- | --- | | [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. | | [translate\_user\_role()](translate_user_role) wp-includes/l10n.php | Translates role name. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | Used By | Description | | --- | --- | | [WP\_Users\_List\_Table::extra\_tablenav()](../classes/wp_users_list_table/extra_tablenav) wp-admin/includes/class-wp-users-list-table.php | Output the controls to allow user roles to be changed in bulk. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress wp_should_load_block_editor_scripts_and_styles(): bool wp\_should\_load\_block\_editor\_scripts\_and\_styles(): bool ============================================================= Checks if the editor scripts and styles for all registered block types should be enqueued on the current screen. bool Whether scripts and styles should be enqueued. File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/) ``` function wp_should_load_block_editor_scripts_and_styles() { global $current_screen; $is_block_editor_screen = ( $current_screen instanceof WP_Screen ) && $current_screen->is_block_editor(); /** * Filters the flag that decides whether or not block editor scripts and styles * are going to be enqueued on the current screen. * * @since 5.6.0 * * @param bool $is_block_editor_screen Current value of the flag. */ return apply_filters( 'should_load_block_editor_scripts_and_styles', $is_block_editor_screen ); } ``` [apply\_filters( 'should\_load\_block\_editor\_scripts\_and\_styles', bool $is\_block\_editor\_screen )](../hooks/should_load_block_editor_scripts_and_styles) Filters the flag that decides whether or not block editor scripts and styles are going to be enqueued on the current screen. | 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\_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). | | Version | Description | | --- | --- | | [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. | wordpress taxonomy_exists( string $taxonomy ): bool taxonomy\_exists( string $taxonomy ): bool ========================================== Determines whether the taxonomy name exists. Formerly [is\_taxonomy()](is_taxonomy) , introduced in 2.3.0. For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook. `$taxonomy` string Required Name of taxonomy object. bool Whether the taxonomy exists. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/) ``` function taxonomy_exists( $taxonomy ) { global $wp_taxonomies; return is_string( $taxonomy ) && isset( $wp_taxonomies[ $taxonomy ] ); } ``` | Used By | Description | | --- | --- | | [unregister\_taxonomy()](unregister_taxonomy) wp-includes/taxonomy.php | Unregisters a taxonomy. | | [WP\_Term::get\_instance()](../classes/wp_term/get_instance) wp-includes/class-wp-term.php | Retrieve [WP\_Term](../classes/wp_term) instance. | | [WP\_Customize\_Nav\_Menu\_Item\_Setting::populate\_value()](../classes/wp_customize_nav_menu_item_setting/populate_value) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Ensure that the value is fully populated with the necessary properties. | | [WP\_Screen::get()](../classes/wp_screen/get) wp-admin/includes/class-wp-screen.php | Fetches a screen object. | | [WP\_Terms\_List\_Table::\_\_construct()](../classes/wp_terms_list_table/__construct) wp-admin/includes/class-wp-terms-list-table.php | Constructor. | | [\_wp\_ajax\_menu\_quick\_search()](_wp_ajax_menu_quick_search) wp-admin/includes/nav-menu.php | Prints the appropriate response to a menu quick search. | | [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. | | [is\_taxonomy()](is_taxonomy) wp-includes/deprecated.php | Checks that the taxonomy name exists. | | [WP\_Widget\_Tag\_Cloud::\_get\_current\_taxonomy()](../classes/wp_widget_tag_cloud/_get_current_taxonomy) wp-includes/widgets/class-wp-widget-tag-cloud.php | Retrieves the taxonomy for the current Tag cloud widget instance. | | [WP\_Tax\_Query::clean\_query()](../classes/wp_tax_query/clean_query) wp-includes/class-wp-tax-query.php | Validates a single query. | | [wp\_update\_term()](wp_update_term) wp-includes/taxonomy.php | Updates term based on arguments provided. | | [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. | | [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. | | [wp\_remove\_object\_terms()](wp_remove_object_terms) wp-includes/taxonomy.php | Removes term(s) associated with a given object. | | [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. | | [wp\_count\_terms()](wp_count_terms) wp-includes/taxonomy.php | Counts how many terms are in taxonomy. | | [get\_term\_children()](get_term_children) wp-includes/taxonomy.php | Merges all term children into a single array of their IDs. | | [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. | | [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. | | [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. | | [get\_objects\_in\_term()](get_objects_in_term) wp-includes/taxonomy.php | Retrieves object IDs of valid taxonomy and term. | | [is\_taxonomy\_hierarchical()](is_taxonomy_hierarchical) wp-includes/taxonomy.php | Determines whether the taxonomy object is hierarchical. | | [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. | | [get\_adjacent\_post()](get_adjacent_post) wp-includes/link-template.php | Retrieves the adjacent post. | | [get\_boundary\_post()](get_boundary_post) wp-includes/link-template.php | Retrieves the boundary post. | | [wp\_get\_nav\_menu\_items()](wp_get_nav_menu_items) wp-includes/nav-menu.php | Retrieves all menu items of a navigation menu. | | [wp\_xmlrpc\_server::wp\_newTerm()](../classes/wp_xmlrpc_server/wp_newterm) wp-includes/class-wp-xmlrpc-server.php | Create a new term. | | [wp\_xmlrpc\_server::wp\_editTerm()](../classes/wp_xmlrpc_server/wp_editterm) wp-includes/class-wp-xmlrpc-server.php | Edit a term. | | [wp\_xmlrpc\_server::wp\_deleteTerm()](../classes/wp_xmlrpc_server/wp_deleteterm) wp-includes/class-wp-xmlrpc-server.php | Delete a term. | | [wp\_xmlrpc\_server::wp\_getTerm()](../classes/wp_xmlrpc_server/wp_getterm) wp-includes/class-wp-xmlrpc-server.php | Retrieve a term. | | [wp\_xmlrpc\_server::wp\_getTerms()](../classes/wp_xmlrpc_server/wp_getterms) wp-includes/class-wp-xmlrpc-server.php | Retrieve all terms for a taxonomy. | | [wp\_xmlrpc\_server::wp\_getTaxonomy()](../classes/wp_xmlrpc_server/wp_gettaxonomy) wp-includes/class-wp-xmlrpc-server.php | Retrieve a taxonomy. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress wp_nav_menu( array $args = array() ): void|string|false wp\_nav\_menu( array $args = array() ): void|string|false ========================================================= Displays a navigation menu. `$args` array Optional 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'`. Default: `array()` void|string|false Void if `'echo'` argument is true, menu output if `'echo'` is false. False if there are no items or no menu was found. ``` wp_nav_menu( $args ); ``` Given a theme\_location parameter, the function displays the menu assigned to that location. If no such location exists or no menu is assigned to it, the parameter fallback\_cb will determine what is displayed. If not given a theme\_location parameter, the function displays * the menu matching the ID, slug, or name given by the menu parameter; * otherwise, the first non-empty menu; * otherwise (or if the menu given by menu is empty), output of the function given by the fallback\_cb parameter ([wp\_page\_menu()](wp_page_menu) , by default); * otherwise nothing. The following classes are applied to menu items, i.e. to the HTML <li> tags, generated by `wp_nav_menu()`: * `.menu-item` This class is added to every menu item. * `.menu-item-has-children` This class is added to menu item which has sub-items . * `.menu-item-object-{object}` This class is added to every menu item, where {object} is either a post type or a taxonomy. * `.menu-item-object-category` This class is added to menu items that correspond to a category. * `.menu-item-object-tag` This class is added to menu items that correspond to a tag. * `.menu-item-object-page` This class is added to menu items that correspond to static pages. * `.menu-item-object-{custom}` This class is added to menu items that correspond to a custom post type or a custom taxonomy. * `.menu-item-type-{type}` This class is added to every menu item, where {type} is either “post\_type” or “taxonomy”. * `.menu-item-type-post_type` This class is added to menu items that correspond to post types: i.e. static pages or custom post types. * `.menu-item-type-taxonomy` This class is added to menu items that correspond to taxonomies: i.e. categories, tags, or custom taxonomies. * `.current-menu-item` This class is added to menu items that correspond to the currently rendered page. * `.current-menu-parent` This class is added to menu items that correspond to the hierarchical parent of the currently rendered page. * `.current-{object}-parent` This class is added to menu items that correspond to the hierachical parent of the currently rendered object, where {object} corresponds to the the value used for .menu-item-object-{object}. * `.current-{type}-parent` This class is added to menu items that correspond to the hierachical parent of the currently rendered type, where {type} corresponds to the the value used for .menu-item-type-{type}. * `.current-menu-ancestor` This class is added to menu items that correspond to a hierarchical ancestor of the currently rendered page. * `.current-{object}-ancestor` This class is added to menu items that correspond to a hierachical ancestor of the currently rendered object, where {object} corresponds to the the value used for .menu-item-object-{object}. * `.current-{type}-ancestor` This class is added to menu items that correspond to a hierachical ancestor of the currently rendered type, where {type} corresponds to the the value used for .menu-item-type-{type}. * `.menu-item-home` This class is added to menu items that correspond to the site front page. The following classes are added to maintain backward compatibility with the [[Function Reference/wp\_page\_menu|[wp\_page\_menu()](wp_page_menu) ]] function output: * `.page_item` This class is added to menu items that correspond to a static page. * `.page_item_has_children` This class is added to menu items that have sub pages to it. * `.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/nav-menu-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu-template.php/) ``` function wp_nav_menu( $args = array() ) { static $menu_id_slugs = array(); $defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'container_aria_label' => '', 'menu_class' => 'menu', 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 'item_spacing' => 'preserve', 'depth' => 0, 'walker' => '', 'theme_location' => '', ); $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']; } /** * Filters the arguments used to display a navigation menu. * * @since 3.0.0 * * @see wp_nav_menu() * * @param array $args Array of wp_nav_menu() arguments. */ $args = apply_filters( 'wp_nav_menu_args', $args ); $args = (object) $args; /** * Filters whether to short-circuit the wp_nav_menu() output. * * Returning a non-null value from the filter will short-circuit wp_nav_menu(), * echoing that value if $args->echo is true, returning that value otherwise. * * @since 3.9.0 * * @see wp_nav_menu() * * @param string|null $output Nav menu output to short-circuit with. Default null. * @param stdClass $args An object containing wp_nav_menu() arguments. */ $nav_menu = apply_filters( 'pre_wp_nav_menu', null, $args ); if ( null !== $nav_menu ) { if ( $args->echo ) { echo $nav_menu; return; } return $nav_menu; } // Get the nav menu based on the requested menu. $menu = wp_get_nav_menu_object( $args->menu ); // Get the nav menu based on the theme_location. $locations = get_nav_menu_locations(); if ( ! $menu && $args->theme_location && $locations && isset( $locations[ $args->theme_location ] ) ) { $menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] ); } // Get the first menu that has items if we still can't find a menu. if ( ! $menu && ! $args->theme_location ) { $menus = wp_get_nav_menus(); foreach ( $menus as $menu_maybe ) { $menu_items = wp_get_nav_menu_items( $menu_maybe->term_id, array( 'update_post_term_cache' => false ) ); if ( $menu_items ) { $menu = $menu_maybe; break; } } } if ( empty( $args->menu ) ) { $args->menu = $menu; } // If the menu exists, get its items. if ( $menu && ! is_wp_error( $menu ) && ! isset( $menu_items ) ) { $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) ); } /* * If no menu was found: * - Fall back (if one was specified), or bail. * * If no menu items were found: * - Fall back, but only if no theme location was specified. * - Otherwise, bail. */ if ( ( ! $menu || is_wp_error( $menu ) || ( isset( $menu_items ) && empty( $menu_items ) && ! $args->theme_location ) ) && isset( $args->fallback_cb ) && $args->fallback_cb && is_callable( $args->fallback_cb ) ) { return call_user_func( $args->fallback_cb, (array) $args ); } if ( ! $menu || is_wp_error( $menu ) ) { return false; } $nav_menu = ''; $items = ''; $show_container = false; if ( $args->container ) { /** * Filters the list of HTML tags that are valid for use as menu containers. * * @since 3.0.0 * * @param string[] $tags The acceptable HTML tags for use as menu containers. * Default is array containing 'div' and 'nav'. */ $allowed_tags = apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) ); if ( is_string( $args->container ) && in_array( $args->container, $allowed_tags, true ) ) { $show_container = true; $class = $args->container_class ? ' class="' . esc_attr( $args->container_class ) . '"' : ' class="menu-' . $menu->slug . '-container"'; $id = $args->container_id ? ' id="' . esc_attr( $args->container_id ) . '"' : ''; $aria_label = ( 'nav' === $args->container && $args->container_aria_label ) ? ' aria-label="' . esc_attr( $args->container_aria_label ) . '"' : ''; $nav_menu .= '<' . $args->container . $id . $class . $aria_label . '>'; } } // Set up the $menu_item variables. _wp_menu_item_classes_by_context( $menu_items ); $sorted_menu_items = array(); $menu_items_tree = array(); $menu_items_with_children = array(); foreach ( (array) $menu_items as $menu_item ) { $sorted_menu_items[ $menu_item->menu_order ] = $menu_item; $menu_items_tree[ $menu_item->ID ] = $menu_item->menu_item_parent; if ( $menu_item->menu_item_parent ) { $menu_items_with_children[ $menu_item->menu_item_parent ] = 1; } // Calculate the depth of each menu item with children foreach ( $menu_items_with_children as $menu_item_key => &$menu_item_depth ) { $menu_item_parent = $menu_items_tree[ $menu_item_key ]; while ( $menu_item_parent ) { $menu_item_depth = $menu_item_depth + 1; $menu_item_parent = $menu_items_tree[ $menu_item_parent ]; } } } // Add the menu-item-has-children class where applicable. if ( $menu_items_with_children ) { foreach ( $sorted_menu_items as &$menu_item ) { if ( isset( $menu_items_with_children[ $menu_item->ID ] ) && ( $args->depth <= 0 || $menu_items_with_children[ $menu_item->ID ] < $args->depth ) ) { $menu_item->classes[] = 'menu-item-has-children'; } } } unset( $menu_items_tree, $menu_items_with_children, $menu_items, $menu_item ); /** * Filters the sorted list of menu item objects before generating the menu's HTML. * * @since 3.1.0 * * @param array $sorted_menu_items The menu items, sorted by each menu item's menu order. * @param stdClass $args An object containing wp_nav_menu() arguments. */ $sorted_menu_items = apply_filters( 'wp_nav_menu_objects', $sorted_menu_items, $args ); $items .= walk_nav_menu_tree( $sorted_menu_items, $args->depth, $args ); unset( $sorted_menu_items ); // Attributes. if ( ! empty( $args->menu_id ) ) { $wrap_id = $args->menu_id; } else { $wrap_id = 'menu-' . $menu->slug; while ( in_array( $wrap_id, $menu_id_slugs, true ) ) { if ( preg_match( '#-(\d+)$#', $wrap_id, $matches ) ) { $wrap_id = preg_replace( '#-(\d+)$#', '-' . ++$matches[1], $wrap_id ); } else { $wrap_id = $wrap_id . '-1'; } } } $menu_id_slugs[] = $wrap_id; $wrap_class = $args->menu_class ? $args->menu_class : ''; /** * Filters the HTML list content for navigation menus. * * @since 3.0.0 * * @see wp_nav_menu() * * @param string $items The HTML list content for the menu items. * @param stdClass $args An object containing wp_nav_menu() arguments. */ $items = apply_filters( 'wp_nav_menu_items', $items, $args ); /** * Filters the HTML list content for a specific navigation menu. * * @since 3.0.0 * * @see wp_nav_menu() * * @param string $items The HTML list content for the menu items. * @param stdClass $args An object containing wp_nav_menu() arguments. */ $items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args ); // Don't print any markup if there are no items at this point. if ( empty( $items ) ) { return false; } $nav_menu .= sprintf( $args->items_wrap, esc_attr( $wrap_id ), esc_attr( $wrap_class ), $items ); unset( $items ); if ( $show_container ) { $nav_menu .= '</' . $args->container . '>'; } /** * Filters the HTML content for navigation menus. * * @since 3.0.0 * * @see wp_nav_menu() * * @param string $nav_menu The HTML content for the navigation menu. * @param stdClass $args An object containing wp_nav_menu() arguments. */ $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args ); if ( $args->echo ) { echo $nav_menu; } else { return $nav_menu; } } ``` [apply\_filters( 'pre\_wp\_nav\_menu', string|null $output, stdClass $args )](../hooks/pre_wp_nav_menu) Filters whether to short-circuit the [wp\_nav\_menu()](wp_nav_menu) output. [apply\_filters( 'wp\_nav\_menu', string $nav\_menu, stdClass $args )](../hooks/wp_nav_menu) Filters the HTML content for navigation menus. [apply\_filters( 'wp\_nav\_menu\_args', array $args )](../hooks/wp_nav_menu_args) Filters the arguments used to display a navigation menu. [apply\_filters( 'wp\_nav\_menu\_container\_allowedtags', string[] $tags )](../hooks/wp_nav_menu_container_allowedtags) Filters the list of HTML tags that are valid for use as menu containers. [apply\_filters( 'wp\_nav\_menu\_items', string $items, stdClass $args )](../hooks/wp_nav_menu_items) Filters the HTML list content for navigation menus. [apply\_filters( 'wp\_nav\_menu\_objects', array $sorted\_menu\_items, stdClass $args )](../hooks/wp_nav_menu_objects) Filters the sorted list of menu item objects before generating the menu’s HTML. [apply\_filters( "wp\_nav\_menu\_{$menu->slug}\_items", string $items, stdClass $args )](../hooks/wp_nav_menu_menu-slug_items) Filters the HTML list content for a specific navigation menu. | Uses | Description | | --- | --- | | [\_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. | | [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\_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. | | [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. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [WP\_Customize\_Nav\_Menus::render\_nav\_menu\_partial()](../classes/wp_customize_nav_menus/render_nav_menu_partial) wp-includes/class-wp-customize-nav-menus.php | Renders a specific menu via [wp\_nav\_menu()](wp_nav_menu) using the supplied arguments. | | [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. | | Version | Description | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Added the `container_aria_label` argument. | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Added the `item_spacing` argument. | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
programming_docs
wordpress wp_media_insert_url_form( string $default_view = 'image' ): string wp\_media\_insert\_url\_form( string $default\_view = 'image' ): string ======================================================================= Creates the form for external url. `$default_view` string Optional Default: `'image'` string HTML content of the form. File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/) ``` function wp_media_insert_url_form( $default_view = 'image' ) { /** This filter is documented in wp-admin/includes/media.php */ if ( ! apply_filters( 'disable_captions', '' ) ) { $caption = ' <tr class="image-only"> <th scope="row" class="label"> <label for="caption"><span class="alignleft">' . __( 'Image Caption' ) . '</span></label> </th> <td class="field"><textarea id="caption" name="caption"></textarea></td> </tr>'; } else { $caption = ''; } $default_align = get_option( 'image_default_align' ); if ( empty( $default_align ) ) { $default_align = 'none'; } if ( 'image' === $default_view ) { $view = 'image-only'; $table_class = ''; } else { $view = 'not-image'; $table_class = $view; } return ' <p class="media-types"><label><input type="radio" name="media_type" value="image" id="image-only"' . checked( 'image-only', $view, false ) . ' /> ' . __( 'Image' ) . '</label> &nbsp; &nbsp; <label><input type="radio" name="media_type" value="generic" id="not-image"' . checked( 'not-image', $view, false ) . ' /> ' . __( 'Audio, Video, or Other File' ) . '</label></p> <p class="media-types media-types-required-info">' . wp_required_field_message() . '</p> <table class="describe ' . $table_class . '"><tbody> <tr> <th scope="row" class="label" style="width:130px;"> <label for="src"><span class="alignleft">' . __( 'URL' ) . '</span> ' . wp_required_field_indicator() . '</label> <span class="alignright" id="status_img"></span> </th> <td class="field"><input id="src" name="src" value="" type="text" required onblur="addExtImage.getImageData()" /></td> </tr> <tr> <th scope="row" class="label"> <label for="title"><span class="alignleft">' . __( 'Title' ) . '</span> ' . wp_required_field_indicator() . '</label> </th> <td class="field"><input id="title" name="title" value="" type="text" required /></td> </tr> <tr class="not-image"><td></td><td><p class="help">' . __( 'Link text, e.g. &#8220;Ransom Demands (PDF)&#8221;' ) . '</p></td></tr> <tr class="image-only"> <th scope="row" class="label"> <label for="alt"><span class="alignleft">' . __( 'Alternative Text' ) . '</span> ' . wp_required_field_indicator() . '</label> </th> <td class="field"><input id="alt" name="alt" value="" type="text" required /> <p class="help">' . __( 'Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;' ) . '</p></td> </tr> ' . $caption . ' <tr class="align image-only"> <th scope="row" class="label"><p><label for="align">' . __( 'Alignment' ) . '</label></p></th> <td class="field"> <input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'none' === $default_align ? ' checked="checked"' : '' ) . ' /> <label for="align-none" class="align image-align-none-label">' . __( 'None' ) . '</label> <input name="align" id="align-left" value="left" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'left' === $default_align ? ' checked="checked"' : '' ) . ' /> <label for="align-left" class="align image-align-left-label">' . __( 'Left' ) . '</label> <input name="align" id="align-center" value="center" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'center' === $default_align ? ' checked="checked"' : '' ) . ' /> <label for="align-center" class="align image-align-center-label">' . __( 'Center' ) . '</label> <input name="align" id="align-right" value="right" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ( 'right' === $default_align ? ' checked="checked"' : '' ) . ' /> <label for="align-right" class="align image-align-right-label">' . __( 'Right' ) . '</label> </td> </tr> <tr class="image-only"> <th scope="row" class="label"> <label for="url"><span class="alignleft">' . __( 'Link Image To:' ) . '</span></label> </th> <td class="field"><input id="url" name="url" value="" type="text" /><br /> <button type="button" class="button" value="" onclick="document.forms[0].url.value=null">' . __( 'None' ) . '</button> <button type="button" class="button" value="" onclick="document.forms[0].url.value=document.forms[0].src.value">' . __( 'Link to image' ) . '</button> <p class="help">' . __( 'Enter a link URL or click above for presets.' ) . '</p></td> </tr> <tr class="image-only"> <td></td> <td> <input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__( 'Insert into Post' ) . '" /> </td> </tr> <tr class="not-image"> <td></td> <td> ' . get_submit_button( __( 'Insert into Post' ), '', 'insertonlybutton', false ) . ' </td> </tr> </tbody></table>'; } ``` [apply\_filters( 'disable\_captions', bool $bool )](../hooks/disable_captions) Filters whether to disable captions. | Uses | Description | | --- | --- | | [wp\_required\_field\_message()](wp_required_field_message) wp-includes/general-template.php | Creates a message to explain required form fields. | | [wp\_required\_field\_indicator()](wp_required_field_indicator) wp-includes/general-template.php | Assigns a visual indicator for required form fields. | | [get\_submit\_button()](get_submit_button) wp-admin/includes/template.php | Returns a submit button, with provided text and appropriate class. | | [esc\_attr\_\_()](esc_attr__) wp-includes/l10n.php | Retrieves the translation of $text and escapes it for safe use in an attribute. | | [checked()](checked) wp-includes/general-template.php | Outputs the HTML checked attribute. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [type\_url\_form\_image()](type_url_form_image) wp-admin/includes/deprecated.php | Handles retrieving the insert-from-URL form for an image. | | [type\_url\_form\_audio()](type_url_form_audio) wp-admin/includes/deprecated.php | Handles retrieving the insert-from-URL form for an audio file. | | [type\_url\_form\_video()](type_url_form_video) wp-admin/includes/deprecated.php | Handles retrieving the insert-from-URL form for a video file. | | [type\_url\_form\_file()](type_url_form_file) wp-admin/includes/deprecated.php | Handles retrieving the insert-from-URL form for a generic file. | | [media\_upload\_type\_url\_form()](media_upload_type_url_form) wp-admin/includes/media.php | Outputs the legacy media upload form for external media. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress wp_user_settings() wp\_user\_settings() ==================== Saves and restores user interface settings stored in a cookie. Checks if the current user-settings cookie is updated and stores it. When no cookie exists (different browser used), adds the last saved cookie restoring the settings. File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/) ``` function wp_user_settings() { if ( ! is_admin() || wp_doing_ajax() ) { return; } $user_id = get_current_user_id(); if ( ! $user_id ) { return; } if ( ! is_user_member_of_blog() ) { return; } $settings = (string) get_user_option( 'user-settings', $user_id ); if ( isset( $_COOKIE[ 'wp-settings-' . $user_id ] ) ) { $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE[ 'wp-settings-' . $user_id ] ); // No change or both empty. if ( $cookie == $settings ) { return; } $last_saved = (int) get_user_option( 'user-settings-time', $user_id ); $current = isset( $_COOKIE[ 'wp-settings-time-' . $user_id ] ) ? preg_replace( '/[^0-9]/', '', $_COOKIE[ 'wp-settings-time-' . $user_id ] ) : 0; // The cookie is newer than the saved value. Update the user_option and leave the cookie as-is. if ( $current > $last_saved ) { update_user_option( $user_id, 'user-settings', $cookie, false ); update_user_option( $user_id, 'user-settings-time', time() - 5, false ); return; } } // The cookie is not set in the current browser or the saved value is newer. $secure = ( 'https' === parse_url( admin_url(), PHP_URL_SCHEME ) ); setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, '', $secure ); setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, '', $secure ); $_COOKIE[ 'wp-settings-' . $user_id ] = $settings; } ``` | Uses | Description | | --- | --- | | [wp\_doing\_ajax()](wp_doing_ajax) wp-includes/load.php | Determines whether the current request is a WordPress Ajax request. | | [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\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. | | [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. | | [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. | | [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress is_comments_popup(): false is\_comments\_popup(): false ============================ This function has been deprecated. Determines whether the current URL is within the comments popup window. 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. false Always returns false. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function is_comments_popup() { _deprecated_function( __FUNCTION__, '4.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 | | --- | --- | | [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | This function has been deprecated. | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress get_post_type_archive_feed_link( string $post_type, string $feed = '' ): string|false get\_post\_type\_archive\_feed\_link( string $post\_type, string $feed = '' ): string|false =========================================================================================== Retrieves the permalink for a post type archive feed. `$post_type` string Required Post type. `$feed` string Optional Feed type. Possible values include `'rss2'`, `'atom'`. Default is the value of [get\_default\_feed()](get_default_feed) . Default: `''` string|false The post type feed permalink. False if the post type does not exist or does not have an archive. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function get_post_type_archive_feed_link( $post_type, $feed = '' ) { $default_feed = get_default_feed(); if ( empty( $feed ) ) { $feed = $default_feed; } $link = get_post_type_archive_link( $post_type ); if ( ! $link ) { return false; } $post_type_obj = get_post_type_object( $post_type ); if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) && $post_type_obj->rewrite['feeds'] ) { $link = trailingslashit( $link ); $link .= 'feed/'; if ( $feed != $default_feed ) { $link .= "$feed/"; } } else { $link = add_query_arg( 'feed', $feed, $link ); } /** * Filters the post type archive feed link. * * @since 3.1.0 * * @param string $link The post type archive feed link. * @param string $feed Feed type. Possible values include 'rss2', 'atom'. */ return apply_filters( 'post_type_archive_feed_link', $link, $feed ); } ``` [apply\_filters( 'post\_type\_archive\_feed\_link', string $link, string $feed )](../hooks/post_type_archive_feed_link) Filters the post type archive feed link. | Uses | Description | | --- | --- | | [get\_post\_type\_archive\_link()](get_post_type_archive_link) wp-includes/link-template.php | Retrieves the permalink for a post type archive. | | [get\_default\_feed()](get_default_feed) wp-includes/feed.php | Retrieves the default feed. | | [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. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. | | Used By | Description | | --- | --- | | [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress _admin_search_query() \_admin\_search\_query() ======================== Displays the search query. A simple wrapper to display the "s" parameter in a `GET` URI. This function should only be used when [the\_search\_query()](the_search_query) cannot. File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/) ``` function _admin_search_query() { echo isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : ''; } ``` | Uses | Description | | --- | --- | | [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 | | --- | --- | | [WP\_Plugins\_List\_Table::search\_box()](../classes/wp_plugins_list_table/search_box) wp-admin/includes/class-wp-plugins-list-table.php | Displays the search box. | | [WP\_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\_List\_Table::search\_box()](../classes/wp_list_table/search_box) wp-admin/includes/class-wp-list-table.php | Displays the search box. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ): string wp\_embed\_handler\_googlevideo( $matches, $attr, $url, $rawattr ): string ========================================================================== This function has been deprecated. The Google Video embed handler callback. Deprecated function that previously assisted in turning Google Video URLs into embeds but that service has since been shut down. string An empty string. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) { _deprecated_function( __FUNCTION__, '4.6.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.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | This function has been deprecated. | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress get_the_category_rss( string $type = null ): string get\_the\_category\_rss( string $type = null ): string ====================================================== Retrieves all of the post categories, formatted for use in feeds. All of the categories for the current post in the feed loop, will be retrieved and have feed markup added, so that they can easily be added to the RSS2, Atom, or RSS1 and RSS0.91 RDF feeds. `$type` string Optional default is the type returned by [get\_default\_feed()](get_default_feed) . Default: `null` string All of the post categories for displaying in the feed. File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/) ``` function get_the_category_rss( $type = null ) { if ( empty( $type ) ) { $type = get_default_feed(); } $categories = get_the_category(); $tags = get_the_tags(); $the_list = ''; $cat_names = array(); $filter = 'rss'; if ( 'atom' === $type ) { $filter = 'raw'; } if ( ! empty( $categories ) ) { foreach ( (array) $categories as $category ) { $cat_names[] = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', $filter ); } } if ( ! empty( $tags ) ) { foreach ( (array) $tags as $tag ) { $cat_names[] = sanitize_term_field( 'name', $tag->name, $tag->term_id, 'post_tag', $filter ); } } $cat_names = array_unique( $cat_names ); foreach ( $cat_names as $cat_name ) { if ( 'rdf' === $type ) { $the_list .= "\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n"; } elseif ( 'atom' === $type ) { $the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) ); } else { $the_list .= "\t\t<category><![CDATA[" . html_entity_decode( $cat_name, ENT_COMPAT, get_option( 'blog_charset' ) ) . "]]></category>\n"; } } /** * Filters all of the post categories for display in a feed. * * @since 1.2.0 * * @param string $the_list All of the RSS post categories. * @param string $type Type of feed. Possible values include 'rss2', 'atom'. * Default 'rss2'. */ return apply_filters( 'the_category_rss', $the_list, $type ); } ``` [apply\_filters( 'the\_category\_rss', string $the\_list, string $type )](../hooks/the_category_rss) Filters all of the post categories for display in a feed. | Uses | Description | | --- | --- | | [get\_the\_tags()](get_the_tags) wp-includes/category-template.php | Retrieves the tags for a post. | | [get\_the\_category()](get_the_category) wp-includes/category-template.php | Retrieves post categories. | | [sanitize\_term\_field()](sanitize_term_field) wp-includes/taxonomy.php | Sanitizes the field value in the term based on the context. | | [get\_default\_feed()](get_default_feed) wp-includes/feed.php | Retrieves the default feed. | | [get\_bloginfo\_rss()](get_bloginfo_rss) wp-includes/feed.php | Retrieves RSS container for the bloginfo function. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [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 | | --- | --- | | [the\_category\_rss()](the_category_rss) wp-includes/feed.php | Displays the post categories in the feed. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
programming_docs
wordpress get_registered_meta_keys( string $object_type, string $object_subtype = '' ): array[] get\_registered\_meta\_keys( string $object\_type, string $object\_subtype = '' ): array[] ========================================================================================== Retrieves a list of registered metadata args for an object type, keyed by their meta keys. `$object_type` string Required Type of object metadata is for. Accepts `'post'`, `'comment'`, `'term'`, `'user'`, or any other object type with an associated meta table. `$object_subtype` string Optional The subtype of the object type. Default: `''` array[] List of registered metadata args, keyed by their meta keys. File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/) ``` function get_registered_meta_keys( $object_type, $object_subtype = '' ) { global $wp_meta_keys; if ( ! is_array( $wp_meta_keys ) || ! isset( $wp_meta_keys[ $object_type ] ) || ! isset( $wp_meta_keys[ $object_type ][ $object_subtype ] ) ) { return array(); } return $wp_meta_keys[ $object_type ][ $object_subtype ]; } ``` | Used By | Description | | --- | --- | | [WP\_REST\_Meta\_Fields::get\_registered\_fields()](../classes/wp_rest_meta_fields/get_registered_fields) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Retrieves all the registered meta fields. | | [registered\_meta\_key\_exists()](registered_meta_key_exists) wp-includes/meta.php | Checks if a meta key is registered. | | [get\_registered\_metadata()](get_registered_metadata) wp-includes/meta.php | Retrieves registered metadata for a specified object. | | Version | Description | | --- | --- | | [4.9.8](https://developer.wordpress.org/reference/since/4.9.8/) | The `$object_subtype` parameter was added. | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. | wordpress the_permalink( int|WP_Post $post ) the\_permalink( int|WP\_Post $post ) ==================================== Displays the permalink for the current post. `$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Default is the global `$post`. This tag must be within [The Loop](https://codex.wordpress.org/The_Loop "The Loop"), and is generally used to display the permalink for each post, when the posts are being displayed. Since this template tag is limited to displaying the permalink for the post that is being processed, you cannot use it to display the permalink to an arbitrary post on your weblog. Refer to [get\_permalink()](get_permalink) if you want to get the permalink for a post, given its unique post id. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function the_permalink( $post = 0 ) { /** * Filters the display of the permalink for the current post. * * @since 1.5.0 * @since 4.4.0 Added the `$post` parameter. * * @param string $permalink The permalink for the current post. * @param int|WP_Post $post Post ID, WP_Post object, or 0. Default 0. */ echo esc_url( apply_filters( 'the_permalink', get_permalink( $post ), $post ) ); } ``` [apply\_filters( 'the\_permalink', string $permalink, int|WP\_Post $post )](../hooks/the_permalink) Filters the display of the permalink for the current post. | Uses | Description | | --- | --- | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [print\_embed\_sharing\_dialog()](print_embed_sharing_dialog) wp-includes/embed.php | Prints the necessary markup for the embed sharing dialog. | | [permalink\_link()](permalink_link) wp-includes/deprecated.php | Print the permalink of the current post in the loop. | | [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. | | [trackback\_rdf()](trackback_rdf) wp-includes/comment-template.php | Generates and displays the RDF for the trackback information of current post. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the `$post` parameter. | | [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. | wordpress wpmu_create_blog( string $domain, string $path, string $title, int $user_id, array $options = array(), int $network_id = 1 ): int|WP_Error wpmu\_create\_blog( string $domain, string $path, string $title, int $user\_id, array $options = array(), int $network\_id = 1 ): int|WP\_Error =============================================================================================================================================== Creates a site. This function runs when a user self-registers a new site as well as when a Super Admin creates a new site. Hook to [‘wpmu\_new\_blog’](../hooks/wpmu_new_blog) for events that should affect all new sites. On subdirectory installations, $domain is the same as the main site’s domain, and the path is the subdirectory name (eg ‘example.com’ and ‘/blog1/’). On subdomain installations, $domain is the new subdomain + root domain (eg ‘blog1.example.com’), and $path is ‘/’. `$domain` string Required The new site's domain. `$path` string Required The new site's path. `$title` string Required The new site's title. `$user_id` int Required The user ID of the new site's admin. `$options` array Optional Array of key=>value pairs used to set initial site options. If valid status keys are included (`'public'`, `'archived'`, `'mature'`, `'spam'`, `'deleted'`, or `'lang_id'`) the given site status(es) will be updated. Otherwise, keys and values will be used to set options for the new site. Default: `array()` `$network_id` int Optional Network ID. Only relevant on multi-network installations. Default: `1` int|[WP\_Error](../classes/wp_error) Returns [WP\_Error](../classes/wp_error) object on failure, the new site 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_blog( $domain, $path, $title, $user_id, $options = array(), $network_id = 1 ) { $defaults = array( 'public' => 0, ); $options = wp_parse_args( $options, $defaults ); $title = strip_tags( $title ); $user_id = (int) $user_id; // Check if the domain has been used already. We should return an error message. if ( domain_exists( $domain, $path, $network_id ) ) { return new WP_Error( 'blog_taken', __( 'Sorry, that site already exists!' ) ); } if ( ! wp_installing() ) { wp_installing( true ); } $allowed_data_fields = array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ); $site_data = array_merge( array( 'domain' => $domain, 'path' => $path, 'network_id' => $network_id, ), array_intersect_key( $options, array_flip( $allowed_data_fields ) ) ); // Data to pass to wp_initialize_site(). $site_initialization_data = array( 'title' => $title, 'user_id' => $user_id, 'options' => array_diff_key( $options, array_flip( $allowed_data_fields ) ), ); $blog_id = wp_insert_site( array_merge( $site_data, $site_initialization_data ) ); if ( is_wp_error( $blog_id ) ) { return $blog_id; } wp_cache_set( 'last_changed', microtime(), 'sites' ); return $blog_id; } ``` | Uses | Description | | --- | --- | | [wp\_insert\_site()](wp_insert_site) wp-includes/ms-site.php | Inserts a new site into the database. | | [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. | | [domain\_exists()](domain_exists) wp-includes/ms-functions.php | Checks whether a site name is already taken. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Used By | Description | | --- | --- | | [validate\_another\_blog\_signup()](validate_another_blog_signup) wp-signup.php | Validates a new site sign-up for an existing user. | | [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. | wordpress wp_update_comment_count_now( int $post_id ): bool wp\_update\_comment\_count\_now( int $post\_id ): bool ====================================================== Updates the comment count for the post. `$post_id` int Required Post ID bool True on success, false if the post 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_now( $post_id ) { global $wpdb; $post_id = (int) $post_id; if ( ! $post_id ) { return false; } wp_cache_delete( 'comments-0', 'counts' ); wp_cache_delete( "comments-{$post_id}", 'counts' ); $post = get_post( $post_id ); if ( ! $post ) { return false; } $old = (int) $post->comment_count; /** * Filters a post's comment count before it is updated in the database. * * @since 4.5.0 * * @param int|null $new The new comment count. Default null. * @param int $old The old comment count. * @param int $post_id Post ID. */ $new = apply_filters( 'pre_wp_update_comment_count_now', null, $old, $post_id ); if ( is_null( $new ) ) { $new = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id ) ); } else { $new = (int) $new; } $wpdb->update( $wpdb->posts, array( 'comment_count' => $new ), array( 'ID' => $post_id ) ); clean_post_cache( $post ); /** * Fires immediately after a post's comment count is updated in the database. * * @since 2.3.0 * * @param int $post_id Post ID. * @param int $new The new comment count. * @param int $old The old comment count. */ do_action( 'wp_update_comment_count', $post_id, $new, $old ); /** This action is documented in wp-includes/post.php */ do_action( "edit_post_{$post->post_type}", $post_id, $post ); /** This action is documented in wp-includes/post.php */ do_action( 'edit_post', $post_id, $post ); return true; } ``` [do\_action( 'edit\_post', int $post\_ID, WP\_Post $post )](../hooks/edit_post) Fires once an existing post has been updated. [do\_action( "edit\_post\_{$post->post\_type}", int $post\_ID, WP\_Post $post )](../hooks/edit_post_post-post_type) Fires once an existing post has been updated. [apply\_filters( 'pre\_wp\_update\_comment\_count\_now', int|null $new, int $old, int $post\_id )](../hooks/pre_wp_update_comment_count_now) Filters a post’s comment count before it is updated in the database. [do\_action( 'wp\_update\_comment\_count', int $post\_id, int $new, int $old )](../hooks/wp_update_comment_count) Fires immediately after a post’s comment count is updated in the database. | Uses | Description | | --- | --- | | [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. | | [clean\_post\_cache()](clean_post_cache) wp-includes/post.php | Will clean the post in the cache. | | [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [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. | | [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. | | [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. | | Used By | Description | | --- | --- | | [wp\_update\_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_site_screen_help_sidebar_content(): string get\_site\_screen\_help\_sidebar\_content(): string =================================================== Returns the content for the help sidebar on the Edit Site screens. string Help sidebar content. 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_sidebar_content() { return '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . '<p>' . __( '<a href="https://wordpress.org/support/article/network-admin-sites-screen/">Documentation on Site Management</a>' ) . '</p>' . '<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>' ) . '</p>'; } ``` | Uses | Description | | --- | --- | | [\_\_()](__) 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 wpmu_update_blogs_date() wpmu\_update\_blogs\_date() =========================== Update the last\_updated field for the current site. File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/) ``` function wpmu_update_blogs_date() { $site_id = get_current_blog_id(); update_blog_details( $site_id, array( 'last_updated' => current_time( 'mysql', true ) ) ); /** * Fires after the blog details are updated. * * @since MU (3.0.0) * * @param int $blog_id Site ID. */ do_action( 'wpmu_blog_updated', $site_id ); } ``` [do\_action( 'wpmu\_blog\_updated', int $blog\_id )](../hooks/wpmu_blog_updated) Fires after the blog details are updated. | Uses | Description | | --- | --- | | [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. | | [update\_blog\_details()](update_blog_details) wp-includes/ms-blogs.php | Update the details for a blog. Updates the blogs table for a given blog ID. | | [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 | | --- | --- | | [\_update\_blog\_date\_on\_post\_publish()](_update_blog_date_on_post_publish) wp-includes/ms-blogs.php | Handler for updating the site’s last updated date when a post is published or an already published post is changed. | | [\_update\_blog\_date\_on\_post\_delete()](_update_blog_date_on_post_delete) wp-includes/ms-blogs.php | Handler for updating the current site’s last updated date when a published post is deleted. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress get_year_link( int|false $year ): string get\_year\_link( int|false $year ): string ========================================== Retrieves the permalink for the year archives. `$year` int|false Required Integer of year. False for current year. string The permalink for the specified year archive. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function get_year_link( $year ) { global $wp_rewrite; if ( ! $year ) { $year = current_time( 'Y' ); } $yearlink = $wp_rewrite->get_year_permastruct(); if ( ! empty( $yearlink ) ) { $yearlink = str_replace( '%year%', $year, $yearlink ); $yearlink = home_url( user_trailingslashit( $yearlink, 'year' ) ); } else { $yearlink = home_url( '?m=' . $year ); } /** * Filters the year archive permalink. * * @since 1.5.0 * * @param string $yearlink Permalink for the year archive. * @param int $year Year for the archive. */ return apply_filters( 'year_link', $yearlink, $year ); } ``` [apply\_filters( 'year\_link', string $yearlink, int $year )](../hooks/year_link) Filters the year archive permalink. | Uses | Description | | --- | --- | | [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\_year\_permastruct()](../classes/wp_rewrite/get_year_permastruct) wp-includes/class-wp-rewrite.php | Retrieves the year permalink structure without month and day. | | [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. | | [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 screen_icon() screen\_icon() ============== This function has been deprecated. Displays a screen icon. File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/) ``` function screen_icon() { _deprecated_function( __FUNCTION__, '3.8.0' ); echo get_screen_icon(); } ``` | Uses | Description | | --- | --- | | [get\_screen\_icon()](get_screen_icon) wp-admin/includes/deprecated.php | Retrieves the screen icon (no longer used in 3.8+). | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [3.8.0](https://developer.wordpress.org/reference/since/3.8.0/) | This function has been deprecated. | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress get_commentdata( int $comment_ID, int $no_cache, bool $include_unapproved = false ): array get\_commentdata( int $comment\_ID, int $no\_cache, bool $include\_unapproved = false ): array ============================================================================================== This function has been deprecated. Use [get\_comment()](get_comment) instead. Retrieve an array of comment data about comment $comment\_ID. * [get\_comment()](get_comment) `$comment_ID` int Required The ID of the comment `$no_cache` int Required Whether to use the cache (cast to bool) `$include_unapproved` bool Optional Whether to include unapproved comments Default: `false` array The comment data File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { _deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' ); return get_comment($comment_ID, ARRAY_A); } ``` | Uses | Description | | --- | --- | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Use [get\_comment()](get_comment) | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
programming_docs
wordpress wp_get_nav_menu_name( string $location ): string wp\_get\_nav\_menu\_name( string $location ): string ==================================================== Returns the name of a navigation menu. `$location` string Required Menu location identifier. string Menu name. File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/) ``` function wp_get_nav_menu_name( $location ) { $menu_name = ''; $locations = get_nav_menu_locations(); if ( isset( $locations[ $location ] ) ) { $menu = wp_get_nav_menu_object( $locations[ $location ] ); if ( $menu && $menu->name ) { $menu_name = $menu->name; } } /** * Filters the navigation menu name being returned. * * @since 4.9.0 * * @param string $menu_name Menu name. * @param string $location Menu location identifier. */ return apply_filters( 'wp_get_nav_menu_name', $menu_name, $location ); } ``` [apply\_filters( 'wp\_get\_nav\_menu\_name', string $menu\_name, string $location )](../hooks/wp_get_nav_menu_name) Filters the navigation menu name being returned. | Uses | Description | | --- | --- | | [wp\_get\_nav\_menu\_object()](wp_get_nav_menu_object) wp-includes/nav-menu.php | Returns a navigation menu object. | | [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. | | [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 wp_get_theme_file_editable_extensions( WP_Theme $theme ): string[] wp\_get\_theme\_file\_editable\_extensions( WP\_Theme $theme ): string[] ======================================================================== Gets the list of file extensions that are editable for a given theme. `$theme` [WP\_Theme](../classes/wp_theme) Required Theme object. 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_theme_file_editable_extensions( $theme ) { $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 theme file editor. * * @since 4.4.0 * * @param string[] $default_types An array of editable theme file extensions. * @param WP_Theme $theme The active theme object. */ $file_types = apply_filters( 'wp_theme_editor_filetypes', $default_types, $theme ); // Ensure that default types are still there. return array_unique( array_merge( $file_types, $default_types ) ); } ``` [apply\_filters( 'wp\_theme\_editor\_filetypes', string[] $default\_types, WP\_Theme $theme )](../hooks/wp_theme_editor_filetypes) Filters the list of file types allowed for editing in the theme 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_unschedule_hook( string $hook, bool $wp_error = false ): int|false|WP_Error wp\_unschedule\_hook( string $hook, bool $wp\_error = false ): int|false|WP\_Error ================================================================================== Unschedules all events attached to the hook. Can be useful for plugins when deactivating to clean up the cron queue. Warning: This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. For information about casting to booleans see the [PHP documentation](https://www.php.net/manual/en/language.types.boolean.php). Use the `===` operator for testing the return value of this function. `$hook` string Required Action hook, the execution of which will be unscheduled. `$wp_error` bool Optional Whether to return a [WP\_Error](../classes/wp_error) on failure. Default: `false` int|false|[WP\_Error](../classes/wp_error) On success an integer indicating number of events unscheduled (0 indicates no events were registered on the hook), false or [WP\_Error](../classes/wp_error) if unscheduling fails. File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/) ``` function wp_unschedule_hook( $hook, $wp_error = false ) { /** * Filter to preflight or hijack clearing all events attached to the hook. * * Returning a non-null value will short-circuit the normal unscheduling * process, causing the function to return the filtered value instead. * * For plugins replacing wp-cron, return the number of events successfully * unscheduled (zero if no events were registered with the hook) or false * if unscheduling one or more events fails. * * @since 5.1.0 * @since 5.7.0 The `$wp_error` parameter was added, and a `WP_Error` object can now be returned. * * @param null|int|false|WP_Error $pre Value to return instead. Default null to continue unscheduling the hook. * @param string $hook Action hook, the execution of which will be unscheduled. * @param bool $wp_error Whether to return a WP_Error on failure. */ $pre = apply_filters( 'pre_unschedule_hook', null, $hook, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_unschedule_hook_false', __( 'A plugin prevented the hook from being cleared.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } $crons = _get_cron_array(); if ( empty( $crons ) ) { return 0; } $results = array(); foreach ( $crons as $timestamp => $args ) { if ( ! empty( $crons[ $timestamp ][ $hook ] ) ) { $results[] = count( $crons[ $timestamp ][ $hook ] ); } unset( $crons[ $timestamp ][ $hook ] ); if ( empty( $crons[ $timestamp ] ) ) { unset( $crons[ $timestamp ] ); } } /* * If the results are empty (zero events to unschedule), no attempt * to update the cron array is required. */ if ( empty( $results ) ) { return 0; } $set = _set_cron_array( $crons, $wp_error ); if ( true === $set ) { return array_sum( $results ); } return $set; } ``` [apply\_filters( 'pre\_unschedule\_hook', null|int|false|WP\_Error $pre, string $hook, bool $wp\_error )](../hooks/pre_unschedule_hook) Filter to preflight or hijack clearing all events attached to the hook. | Uses | Description | | --- | --- | | [\_get\_cron\_array()](_get_cron_array) wp-includes/cron.php | Retrieve cron info array option. | | [\_set\_cron\_array()](_set_cron_array) wp-includes/cron.php | Updates the cron option with the new cron array. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | 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 added to indicate success or failure. | | [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. | wordpress get_bookmark( int|stdClass $bookmark, string $output = OBJECT, string $filter = 'raw' ): array|object|null get\_bookmark( int|stdClass $bookmark, string $output = OBJECT, string $filter = 'raw' ): array|object|null =========================================================================================================== Retrieves bookmark data. `$bookmark` int|stdClass Required `$output` string Optional The required return type. One of OBJECT, ARRAY\_A, or ARRAY\_N, which correspond to an stdClass object, an associative array, or a numeric array, respectively. Default: `OBJECT` `$filter` string Optional How to sanitize bookmark fields. Default `'raw'`. Default: `'raw'` array|object|null Type returned depends on $output value. File: `wp-includes/bookmark.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/bookmark.php/) ``` function get_bookmark( $bookmark, $output = OBJECT, $filter = 'raw' ) { global $wpdb; if ( empty( $bookmark ) ) { if ( isset( $GLOBALS['link'] ) ) { $_bookmark = & $GLOBALS['link']; } else { $_bookmark = null; } } elseif ( is_object( $bookmark ) ) { wp_cache_add( $bookmark->link_id, $bookmark, 'bookmark' ); $_bookmark = $bookmark; } else { if ( isset( $GLOBALS['link'] ) && ( $GLOBALS['link']->link_id == $bookmark ) ) { $_bookmark = & $GLOBALS['link']; } else { $_bookmark = wp_cache_get( $bookmark, 'bookmark' ); if ( ! $_bookmark ) { $_bookmark = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark ) ); if ( $_bookmark ) { $_bookmark->link_category = array_unique( wp_get_object_terms( $_bookmark->link_id, 'link_category', array( 'fields' => 'ids' ) ) ); wp_cache_add( $_bookmark->link_id, $_bookmark, 'bookmark' ); } } } } if ( ! $_bookmark ) { return $_bookmark; } $_bookmark = sanitize_bookmark( $_bookmark, $filter ); if ( OBJECT === $output ) { return $_bookmark; } elseif ( ARRAY_A === $output ) { return get_object_vars( $_bookmark ); } elseif ( ARRAY_N === $output ) { return array_values( get_object_vars( $_bookmark ) ); } else { return $_bookmark; } } ``` | 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\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. | | [sanitize\_bookmark()](sanitize_bookmark) wp-includes/bookmark.php | Sanitizes all bookmark fields. | | [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. | | [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. | | Used By | Description | | --- | --- | | [wp\_ajax\_delete\_link()](wp_ajax_delete_link) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a link. | | [get\_link\_to\_edit()](get_link_to_edit) wp-admin/includes/bookmark.php | Retrieves link data based on its ID. | | [wp\_update\_link()](wp_update_link) wp-admin/includes/bookmark.php | Updates a link in the database. | | [get\_link()](get_link) wp-includes/deprecated.php | Retrieves bookmark data based on ID. | | [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\_bookmark\_field()](get_bookmark_field) wp-includes/bookmark.php | Retrieves single bookmark data item or field. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress update_option( string $option, mixed $value, string|bool $autoload = null ): bool update\_option( string $option, mixed $value, string|bool $autoload = null ): bool ================================================================================== Updates the value of an option that was already added. You do not need to serialize values. If the value needs to be serialized, then it will be serialized before it is inserted into the database. Remember, resources cannot be serialized or added as an option. If the option does not exist, it will be created. This function is designed to work with or without a logged-in user. In terms of security, plugin developers should check the current user’s capabilities before updating any options. `$option` string Required Name of the option to update. Expected to not be SQL-escaped. `$value` mixed Required Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped. `$autoload` string|bool Optional Whether to load the option when WordPress starts up. For existing options, `$autoload` can only be updated using `update_option()` if `$value` is also changed. Accepts ``'yes'`|true` to enable or ``'no'`|false` to disable. For non-existent options, the default value is `'yes'`. Default: `null` bool True if the value was updated, false otherwise. File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/) ``` function update_option( $option, $value, $autoload = null ) { global $wpdb; if ( is_scalar( $option ) ) { $option = trim( $option ); } if ( empty( $option ) ) { return false; } /* * Until a proper _deprecated_option() function can be introduced, * redirect requests to deprecated keys to the new, correct ones. */ $deprecated_keys = array( 'blacklist_keys' => 'disallowed_keys', 'comment_whitelist' => 'comment_previously_approved', ); if ( isset( $deprecated_keys[ $option ] ) && ! wp_installing() ) { _deprecated_argument( __FUNCTION__, '5.5.0', sprintf( /* translators: 1: Deprecated option key, 2: New option key. */ __( 'The "%1$s" option key has been renamed to "%2$s".' ), $option, $deprecated_keys[ $option ] ) ); return update_option( $deprecated_keys[ $option ], $value, $autoload ); } wp_protect_special_option( $option ); if ( is_object( $value ) ) { $value = clone $value; } $value = sanitize_option( $option, $value ); $old_value = get_option( $option ); /** * Filters a specific option before its value is (maybe) serialized and updated. * * The dynamic portion of the hook name, `$option`, refers to the option name. * * @since 2.6.0 * @since 4.4.0 The `$option` parameter was added. * * @param mixed $value The new, unserialized option value. * @param mixed $old_value The old option value. * @param string $option Option name. */ $value = apply_filters( "pre_update_option_{$option}", $value, $old_value, $option ); /** * Filters an option before its value is (maybe) serialized and updated. * * @since 3.9.0 * * @param mixed $value The new, unserialized option value. * @param string $option Name of the option. * @param mixed $old_value The old option value. */ $value = apply_filters( 'pre_update_option', $value, $option, $old_value ); /* * If the new and old values are the same, no need to update. * * Unserialized values will be adequate in most cases. If the unserialized * data differs, the (maybe) serialized data is checked to avoid * unnecessary database calls for otherwise identical object instances. * * See https://core.trac.wordpress.org/ticket/38903 */ if ( $value === $old_value || maybe_serialize( $value ) === maybe_serialize( $old_value ) ) { return false; } /** This filter is documented in wp-includes/option.php */ if ( apply_filters( "default_option_{$option}", false, $option, false ) === $old_value ) { // Default setting for new options is 'yes'. if ( null === $autoload ) { $autoload = 'yes'; } return add_option( $option, $value, '', $autoload ); } $serialized_value = maybe_serialize( $value ); /** * Fires immediately before an option value is updated. * * @since 2.9.0 * * @param string $option Name of the option to update. * @param mixed $old_value The old option value. * @param mixed $value The new option value. */ do_action( 'update_option', $option, $old_value, $value ); $update_args = array( 'option_value' => $serialized_value, ); if ( null !== $autoload ) { $update_args['autoload'] = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes'; } $result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => $option ) ); if ( ! $result ) { return false; } $notoptions = wp_cache_get( 'notoptions', 'options' ); if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { unset( $notoptions[ $option ] ); wp_cache_set( 'notoptions', $notoptions, 'options' ); } if ( ! wp_installing() ) { $alloptions = wp_load_alloptions( true ); if ( isset( $alloptions[ $option ] ) ) { $alloptions[ $option ] = $serialized_value; wp_cache_set( 'alloptions', $alloptions, 'options' ); } else { wp_cache_set( $option, $serialized_value, 'options' ); } } /** * Fires after the value of a specific option has been successfully updated. * * The dynamic portion of the hook name, `$option`, refers to the option name. * * @since 2.0.1 * @since 4.4.0 The `$option` parameter was added. * * @param mixed $old_value The old option value. * @param mixed $value The new option value. * @param string $option Option name. */ do_action( "update_option_{$option}", $old_value, $value, $option ); /** * Fires after the value of an option has been successfully updated. * * @since 2.9.0 * * @param string $option Name of the updated option. * @param mixed $old_value The old option value. * @param mixed $value The new option value. */ do_action( 'updated_option', $option, $old_value, $value ); return true; } ``` [apply\_filters( "default\_option\_{$option}", mixed $default, string $option, bool $passed\_default )](../hooks/default_option_option) Filters the default value for an option. [apply\_filters( 'pre\_update\_option', mixed $value, string $option, mixed $old\_value )](../hooks/pre_update_option) Filters an option before its value is (maybe) serialized and updated. [apply\_filters( "pre\_update\_option\_{$option}", mixed $value, mixed $old\_value, string $option )](../hooks/pre_update_option_option) Filters a specific option before its value is (maybe) serialized and updated. [do\_action( 'updated\_option', string $option, mixed $old\_value, mixed $value )](../hooks/updated_option) Fires after the value of an option has been successfully updated. [do\_action( 'update\_option', string $option, mixed $old\_value, mixed $value )](../hooks/update_option) Fires immediately before an option value is updated. [do\_action( "update\_option\_{$option}", mixed $old\_value, mixed $value, string $option )](../hooks/update_option_option) Fires after the value of a specific option has been successfully updated. | 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. | | [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. | | [maybe\_serialize()](maybe_serialize) wp-includes/functions.php | Serializes data, if needed. | | [add\_option()](add_option) wp-includes/option.php | Adds a new option. | | [wp\_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::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. | | [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. | | [\_\_()](__) 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. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [WP\_REST\_Menus\_Controller::handle\_auto\_add()](../classes/wp_rest_menus_controller/handle_auto_add) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Updates the menu’s auto add from a REST request. | | [deactivated\_plugins\_notice()](deactivated_plugins_notice) wp-admin/includes/plugin.php | Renders an admin notice when a plugin was deactivated during an update. | | [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\_update\_urls\_to\_https()](wp_update_urls_to_https) wp-includes/https-migration.php | Update the ‘home’ and ‘siteurl’ option to use the HTTPS variant of their URL. | | [wp\_update\_https\_migration\_required()](wp_update_https_migration_required) wp-includes/https-migration.php | Updates the ‘https\_migration\_required’ option if needed when the given URL has been updated from HTTP to HTTPS. | | [\_wp\_batch\_update\_comment\_type()](_wp_batch_update_comment_type) wp-includes/comment.php | Updates the comment type for a batch of comments. | | [WP\_Automatic\_Updater::send\_plugin\_theme\_email()](../classes/wp_automatic_updater/send_plugin_theme_email) wp-admin/includes/class-wp-automatic-updater.php | Sends an email upon the completion or failure of a plugin or theme background update. | | [WP\_Recovery\_Mode\_Key\_Service::update\_keys()](../classes/wp_recovery_mode_key_service/update_keys) wp-includes/class-wp-recovery-mode-key-service.php | Updates the recovery key records. | | [WP\_Recovery\_Mode\_Email\_Service::maybe\_send\_recovery\_mode\_email()](../classes/wp_recovery_mode_email_service/maybe_send_recovery_mode_email) wp-includes/class-wp-recovery-mode-email-service.php | Sends the recovery mode email if the rate limit has not been sent. | | [WP\_Paused\_Extensions\_Storage::set()](../classes/wp_paused_extensions_storage/set) wp-includes/class-wp-paused-extensions-storage.php | Records an extension error. | | [WP\_Paused\_Extensions\_Storage::delete()](../classes/wp_paused_extensions_storage/delete) wp-includes/class-wp-paused-extensions-storage.php | Forgets a previously recorded extension error. | | [WP\_Paused\_Extensions\_Storage::delete\_all()](../classes/wp_paused_extensions_storage/delete_all) wp-includes/class-wp-paused-extensions-storage.php | Remove all paused extensions. | | [WP\_Privacy\_Policy\_Content::text\_change\_check()](../classes/wp_privacy_policy_content/text_change_check) wp-admin/includes/class-wp-privacy-policy-content.php | Quick check if any privacy info has changed. | | [WP\_Customize\_Manager::update\_stashed\_theme\_mod\_settings()](../classes/wp_customize_manager/update_stashed_theme_mod_settings) wp-includes/class-wp-customize-manager.php | Updates stashed theme mod settings. | | [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. | | [WP\_REST\_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. | | [\_delete\_option\_fresh\_site()](_delete_option_fresh_site) wp-includes/functions.php | Deletes the fresh site option. | | [WP\_Upgrader::create\_lock()](../classes/wp_upgrader/create_lock) wp-admin/includes/class-wp-upgrader.php | Creates a lock using WordPress options. | | [WP\_Customize\_Setting::set\_root\_value()](../classes/wp_customize_setting/set_root_value) wp-includes/class-wp-customize-setting.php | Set the root value for a setting, especially for multidimensional ones. | | [update\_network\_option()](update_network_option) wp-includes/option.php | Updates the value of a network option that was already added. | | [wp\_ajax\_delete\_inactive\_widgets()](wp_ajax_delete_inactive_widgets) wp-admin/includes/ajax-actions.php | Ajax handler for removing inactive widgets. | | [WP\_Customize\_Nav\_Menu\_Setting::update()](../classes/wp_customize_nav_menu_setting/update) wp-includes/customize/class-wp-customize-nav-menu-setting.php | Create/update the nav\_menu term for this setting. | | [\_wp\_batch\_split\_terms()](_wp_batch_split_terms) wp-includes/taxonomy.php | Splits a batch of shared taxonomy terms. | | [Plugin\_Upgrader::bulk\_upgrade()](../classes/plugin_upgrader/bulk_upgrade) wp-admin/includes/class-plugin-upgrader.php | Bulk upgrade several plugins at once. | | [Theme\_Upgrader::upgrade()](../classes/theme_upgrader/upgrade) wp-admin/includes/class-theme-upgrader.php | Upgrade a theme. | | [Theme\_Upgrader::bulk\_upgrade()](../classes/theme_upgrader/bulk_upgrade) wp-admin/includes/class-theme-upgrader.php | Upgrade several themes at once. | | [Plugin\_Upgrader::upgrade()](../classes/plugin_upgrader/upgrade) wp-admin/includes/class-plugin-upgrader.php | Upgrade a plugin. | | [WP\_Plugins\_List\_Table::prepare\_items()](../classes/wp_plugins_list_table/prepare_items) wp-admin/includes/class-wp-plugins-list-table.php | | | [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. | | [update\_recently\_edited()](update_recently_edited) wp-admin/includes/misc.php | Updates the “recently-edited” file for the plugin or theme file editor. | | [populate\_options()](populate_options) wp-admin/includes/schema.php | Create WordPress options and set the default values. | | [wp\_dashboard\_rss\_control()](wp_dashboard_rss_control) wp-admin/includes/dashboard.php | The RSS dashboard widget control. | | [make\_site\_theme()](make_site_theme) wp-admin/includes/upgrade.php | Creates a site theme. | | [maybe\_disable\_automattic\_widgets()](maybe_disable_automattic_widgets) wp-admin/includes/upgrade.php | Disables the Automattic widgets plugin, which was merged into core. | | [maybe\_disable\_link\_manager()](maybe_disable_link_manager) wp-admin/includes/upgrade.php | Disables the Link Manager on upgrade if, at the time of upgrade, no links exist in the DB. | | [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. | | [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. | | [uninstall\_plugin()](uninstall_plugin) wp-admin/includes/plugin.php | Uninstalls a single plugin. | | [activate\_plugin()](activate_plugin) wp-admin/includes/plugin.php | Attempts activation of plugin in a “sandbox” and redirects on success. | | [deactivate\_plugins()](deactivate_plugins) wp-admin/includes/plugin.php | Deactivates a single plugin or multiple plugins. | | [validate\_active\_plugins()](validate_active_plugins) wp-admin/includes/plugin.php | Validates active plugins. | | [wp\_nav\_menu\_update\_menu\_items()](wp_nav_menu_update_menu_items) wp-admin/includes/nav-menu.php | Saves nav menu items | | [request\_filesystem\_credentials()](request_filesystem_credentials) wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. | | [WP\_Roles::add\_cap()](../classes/wp_roles/add_cap) wp-includes/class-wp-roles.php | Adds a capability to role. | | [WP\_Roles::remove\_cap()](../classes/wp_roles/remove_cap) wp-includes/class-wp-roles.php | Removes a capability from role. | | [WP\_Roles::add\_role()](../classes/wp_roles/add_role) wp-includes/class-wp-roles.php | Adds a role name with capabilities to the list. | | [WP\_Roles::remove\_role()](../classes/wp_roles/remove_role) wp-includes/class-wp-roles.php | Removes a role by name. | | [\_set\_cron\_array()](_set_cron_array) wp-includes/cron.php | Updates the cron option with the new cron array. | | [\_upgrade\_cron\_array()](_upgrade_cron_array) wp-includes/cron.php | Upgrade a cron info array. | | [check\_theme\_switched()](check_theme_switched) wp-includes/theme.php | Checks if a theme has been changed and runs ‘after\_switch\_theme’ hook on the next WP load. | | [set\_theme\_mod()](set_theme_mod) wp-includes/theme.php | Updates theme modification value for the active theme. | | [remove\_theme\_mod()](remove_theme_mod) wp-includes/theme.php | Removes theme modification name from active theme list. | | [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\_term\_hierarchy()](_get_term_hierarchy) wp-includes/taxonomy.php | Retrieves children of taxonomy as term IDs. | | [register\_taxonomy()](register_taxonomy) wp-includes/taxonomy.php | Creates or modifies a taxonomy object. | | [register\_uninstall\_hook()](register_uninstall_hook) wp-includes/plugin.php | Sets the uninstallation hook for a plugin. | | [set\_transient()](set_transient) wp-includes/option.php | Sets/updates the value of a transient. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [\_reset\_front\_page\_settings\_for\_post()](_reset_front_page_settings_for_post) wp-includes/post.php | Resets the page\_on\_front, show\_on\_front, and page\_for\_post settings when a linked page is deleted or trashed. | | [stick\_post()](stick_post) wp-includes/post.php | Makes a post sticky. | | [unstick\_post()](unstick_post) wp-includes/post.php | Un-sticks a post. | | [WP\_Rewrite::set\_permalink\_structure()](../classes/wp_rewrite/set_permalink_structure) wp-includes/class-wp-rewrite.php | Sets the main permalink structure for the site. | | [WP\_Rewrite::set\_category\_base()](../classes/wp_rewrite/set_category_base) wp-includes/class-wp-rewrite.php | Sets the category base for the category permalink. | | [WP\_Rewrite::set\_tag\_base()](../classes/wp_rewrite/set_tag_base) wp-includes/class-wp-rewrite.php | Sets the tag base for the tag permalink. | | [WP\_Rewrite::wp\_rewrite\_rules()](../classes/wp_rewrite/wp_rewrite_rules) wp-includes/class-wp-rewrite.php | Retrieves the rewrite rules. | | [WP\_Rewrite::flush\_rules()](../classes/wp_rewrite/flush_rules) wp-includes/class-wp-rewrite.php | Removes rewrite rules and then recreate rewrite rules. | | [\_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. | | [update\_posts\_count()](update_posts_count) wp-includes/ms-functions.php | Updates a blog’s post count. | | [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. | | [update\_blog\_option()](update_blog_option) wp-includes/ms-blogs.php | Update an option for a particular blog. | | [wp\_xmlrpc\_server::wp\_setOptions()](../classes/wp_xmlrpc_server/wp_setoptions) wp-includes/class-wp-xmlrpc-server.php | Update blog options. | | [WP\_Widget::save\_settings()](../classes/wp_widget/save_settings) wp-includes/class-wp-widget.php | Saves the settings for all instances of the widget class. | | [wp\_set\_sidebars\_widgets()](wp_set_sidebars_widgets) wp-includes/widgets.php | Set the sidebar widget option to update sidebars. | | [wp\_convert\_widget\_settings()](wp_convert_widget_settings) wp-includes/widgets.php | Converts the widget settings from single to multi-widget format. | | Version | Description | | --- | --- | | [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | The `$autoload` parameter was added. | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
programming_docs
wordpress comment_author_email( int|WP_Comment $comment_ID ) comment\_author\_email( int|WP\_Comment $comment\_ID ) ====================================================== Displays the email of the author of the current global $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. `$comment_ID` int|[WP\_Comment](../classes/wp_comment) Optional [WP\_Comment](../classes/wp_comment) or the ID of the comment for which to print the author's email. Default current comment. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function comment_author_email( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $author_email = get_comment_author_email( $comment ); /** * Filters the comment author's email for display. * * @since 1.2.0 * @since 4.1.0 The `$comment_ID` parameter was added. * * @param string $author_email The comment author's email address. * @param string $comment_ID The comment ID as a numeric string. */ echo apply_filters( 'author_email', $author_email, $comment->comment_ID ); } ``` [apply\_filters( 'author\_email', string $author\_email, string $comment\_ID )](../hooks/author_email) Filters the comment author’s email for display. | Uses | Description | | --- | --- | | [get\_comment\_author\_email()](get_comment_author_email) wp-includes/comment-template.php | Retrieves the email of the author of the current comment. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the ability for `$comment_ID` to also accept a [WP\_Comment](../classes/wp_comment) object. | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress wp_lostpassword_url( string $redirect = '' ): string wp\_lostpassword\_url( string $redirect = '' ): string ====================================================== Returns the URL that allows the user to reset the lost password. `$redirect` string Optional Path to redirect to on login. Default: `''` string Lost password URL. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function wp_lostpassword_url( $redirect = '' ) { $args = array( 'action' => 'lostpassword', ); if ( ! empty( $redirect ) ) { $args['redirect_to'] = urlencode( $redirect ); } if ( is_multisite() ) { $blog_details = get_blog_details(); $wp_login_path = $blog_details->path . 'wp-login.php'; } else { $wp_login_path = 'wp-login.php'; } $lostpassword_url = add_query_arg( $args, network_site_url( $wp_login_path, 'login' ) ); /** * Filters the Lost Password URL. * * @since 2.8.0 * * @param string $lostpassword_url The lost password page URL. * @param string $redirect The path to redirect to on login. */ return apply_filters( 'lostpassword_url', $lostpassword_url, $redirect ); } ``` [apply\_filters( 'lostpassword\_url', string $lostpassword\_url, string $redirect )](../hooks/lostpassword_url) Filters the Lost Password URL. | Uses | Description | | --- | --- | | [network\_site\_url()](network_site_url) wp-includes/link-template.php | Retrieves the site URL for the current network. | | [get\_blog\_details()](get_blog_details) wp-includes/ms-blogs.php | Retrieve the details for a blog from the blogs table and blog options. | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. | | [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\_email\_password()](wp_authenticate_email_password) wp-includes/user.php | Authenticates a user using the email and password. | | [wp\_authenticate\_username\_password()](wp_authenticate_username_password) wp-includes/user.php | Authenticates a user, confirming the username and password are valid. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress remove_theme_mod( string $name ) remove\_theme\_mod( string $name ) ================================== Removes theme modification name from active theme list. If removing the name also removes all elements, then the entire option will be removed. `$name` string Required Theme modification name. File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/) ``` function remove_theme_mod( $name ) { $mods = get_theme_mods(); if ( ! isset( $mods[ $name ] ) ) { return; } unset( $mods[ $name ] ); if ( empty( $mods ) ) { remove_theme_mods(); return; } $theme = get_option( 'stylesheet' ); update_option( "theme_mods_$theme", $mods ); } ``` | Uses | Description | | --- | --- | | [remove\_theme\_mods()](remove_theme_mods) wp-includes/theme.php | Removes theme modifications option for the active theme. | | [get\_theme\_mods()](get_theme_mods) wp-includes/theme.php | Retrieves all theme modifications. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [Custom\_Image\_Header::set\_header\_image()](../classes/custom_image_header/set_header_image) wp-admin/includes/class-custom-image-header.php | Choose a header image, selected from existing uploaded and default headers, or provide an array of uploaded header data (either new, or from media library). | | [Custom\_Background::take\_action()](../classes/custom_background/take_action) wp-admin/includes/class-custom-background.php | Executes custom background modification. | | [\_delete\_attachment\_theme\_mod()](_delete_attachment_theme_mod) wp-includes/theme.php | Checks an attachment being deleted to see if it’s a header or background image. | | [switch\_theme()](switch_theme) wp-includes/theme.php | Switches the theme. | | [WP\_Customize\_Background\_Image\_Setting::update()](../classes/wp_customize_background_image_setting/update) wp-includes/customize/class-wp-customize-background-image-setting.php | | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress add_post_meta( int $post_id, string $meta_key, mixed $meta_value, bool $unique = false ): int|false add\_post\_meta( int $post\_id, string $meta\_key, mixed $meta\_value, bool $unique = false ): int|false ======================================================================================================== Adds a meta field to the given post. Post meta data is called "Custom Fields" on the Administration Screen. `$post_id` int Required Post 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. Note that if the given key already exists among custom fields of the specified post, another custom field with the same key is added unless the $unique argument is set to true, in which case, no changes are made. If you want to update the value of an existing key, use the [update\_post\_meta()](update_post_meta) function instead Because meta values are passed through the [stripslashes()](http://php.net/stripslashes) function, you need to be careful about content escaped with \ characters. You can read more about the behavior, and a workaround example, in the [update\_post\_meta()](update_post_meta) documentation. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) { // Make sure meta is added to the post, not a revision. $the_post = wp_is_post_revision( $post_id ); if ( $the_post ) { $post_id = $the_post; } return add_metadata( 'post', $post_id, $meta_key, $meta_value, $unique ); } ``` | Uses | Description | | --- | --- | | [wp\_is\_post\_revision()](wp_is_post_revision) wp-includes/revision.php | Determines if the specified post is a revision. | | [add\_metadata()](add_metadata) wp-includes/meta.php | Adds metadata for the specified object. | | Used By | Description | | --- | --- | | [wp\_check\_for\_changed\_dates()](wp_check_for_changed_dates) wp-includes/post.php | Checks for changed dates for published post objects and save the old date. | | [WP\_Privacy\_Policy\_Content::get\_suggested\_policy\_text()](../classes/wp_privacy_policy_content/get_suggested_policy_text) wp-admin/includes/class-wp-privacy-policy-content.php | Check for updated, added or removed privacy policy information from plugins. | | [WP\_Privacy\_Policy\_Content::\_policy\_page\_updated()](../classes/wp_privacy_policy_content/_policy_page_updated) wp-admin/includes/class-wp-privacy-policy-content.php | Update the cached policy info when the policy page is updated. | | [WP\_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\_add\_trashed\_suffix\_to\_post\_name\_for\_post()](wp_add_trashed_suffix_to_post_name_for_post) wp-includes/post.php | Adds a trashed suffix for a given post. | | [wp\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. | | [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. | | [wp\_write\_post()](wp_write_post) wp-admin/includes/post.php | Creates a new post from the “Write Post” form using `$_POST` information. | | [add\_meta()](add_meta) wp-admin/includes/post.php | Adds post meta data defined in the `$_POST` superglobal for a post with given ID. | | [do\_enclose()](do_enclose) wp-includes/functions.php | Checks content for video and audio links to add as enclosures. | | [\_publish\_post\_hook()](_publish_post_hook) wp-includes/post.php | Hook to schedule pings and enclosures when a post is published. | | [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\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. | | [wp\_trash\_post()](wp_trash_post) wp-includes/post.php | Moves a post or page to the Trash | | [wp\_trash\_post\_comments()](wp_trash_post_comments) wp-includes/post.php | Moves comments for a post to the Trash. | | [wp\_xmlrpc\_server::add\_enclosure\_if\_new()](../classes/wp_xmlrpc_server/add_enclosure_if_new) wp-includes/class-wp-xmlrpc-server.php | Adds an enclosure to a post if it’s new. | | [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. | | Version | Description | | --- | --- | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress like_escape( string $text ): string like\_escape( string $text ): string ==================================== This function has been deprecated. Use [wpdb::esc\_like()](../classes/wpdb/esc_like) instead. Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described. * [wpdb::esc\_like()](../classes/wpdb/esc_like) `$text` string Required The text to be escaped. string text, safe for inclusion in LIKE query. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function like_escape($text) { _deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' ); return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text ); } ``` | Uses | Description | | --- | --- | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Used By | Description | | --- | --- | | [WP\_User\_Search::prepare\_query()](../classes/wp_user_search/prepare_query) wp-admin/includes/deprecated.php | Prepares the user search query (legacy). | | Version | Description | | --- | --- | | [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Use [wpdb::esc\_like()](../classes/wpdb/esc_like) | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress maybe_disable_link_manager() maybe\_disable\_link\_manager() =============================== Disables the Link Manager on upgrade if, at the time of upgrade, no links exist in the DB. File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/) ``` function maybe_disable_link_manager() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version >= 22006 && get_option( 'link_manager_enabled' ) && ! $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) ) { update_option( 'link_manager_enabled', 0 ); } } ``` | Uses | Description | | --- | --- | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. | | Version | Description | | --- | --- | | [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. | wordpress the_weekday_date( string $before = '', string $after = '' ) the\_weekday\_date( string $before = '', string $after = '' ) ============================================================= Displays the weekday on which the post was written. Will only output the weekday if the current post’s weekday is different from the previous one output. `$before` string Optional Output before the date. Default: `''` `$after` string Optional Output after the date. Default: `''` File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function the_weekday_date( $before = '', $after = '' ) { global $wp_locale, $currentday, $previousweekday; $post = get_post(); if ( ! $post ) { return; } $the_weekday_date = ''; if ( $currentday !== $previousweekday ) { $the_weekday_date .= $before; $the_weekday_date .= $wp_locale->get_weekday( get_post_time( 'w', false, $post ) ); $the_weekday_date .= $after; $previousweekday = $currentday; } /** * Filters the localized date on which the post was written, for display. * * @since 0.71 * * @param string $the_weekday_date The weekday on which the post was written. * @param string $before The HTML to output before the date. * @param string $after The HTML to output after the date. */ echo apply_filters( 'the_weekday_date', $the_weekday_date, $before, $after ); } ``` [apply\_filters( 'the\_weekday\_date', string $the\_weekday\_date, string $before, string $after )](../hooks/the_weekday_date) Filters the localized date on which the post was written, for display. | Uses | Description | | --- | --- | | [get\_post\_time()](get_post_time) wp-includes/general-template.php | Retrieves the time at which the post was written. | | [WP\_Locale::get\_weekday()](../classes/wp_locale/get_weekday) wp-includes/class-wp-locale.php | Retrieves the full translated weekday word. | | [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 | | --- | --- | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress in_the_loop(): bool in\_the\_loop(): bool ===================== Determines whether the caller is 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. bool True if caller is within loop, false if loop hasn't started or ended. File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/) ``` function in_the_loop() { global $wp_query; if ( ! isset( $wp_query ) ) { return false; } return $wp_query->in_the_loop; } ``` | 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. | | [get\_the\_post\_thumbnail()](get_the_post_thumbnail) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress get_template_directory_uri(): string get\_template\_directory\_uri(): string ======================================= Retrieves template directory URI for the active theme. string URI to active theme's template directory. * Checks for SSL * Does not return a trailing slash following the directory address File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/) ``` function get_template_directory_uri() { $template = str_replace( '%2F', '/', rawurlencode( get_template() ) ); $theme_root_uri = get_theme_root_uri( $template ); $template_dir_uri = "$theme_root_uri/$template"; /** * Filters the active theme directory URI. * * @since 1.5.0 * * @param string $template_dir_uri The URI of the active theme directory. * @param string $template Directory name of the active theme. * @param string $theme_root_uri The themes root URI. */ return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri ); } ``` [apply\_filters( 'template\_directory\_uri', string $template\_dir\_uri, string $template, string $theme\_root\_uri )](../hooks/template_directory_uri) Filters the active theme directory URI. | Uses | Description | | --- | --- | | [get\_theme\_root\_uri()](get_theme_root_uri) wp-includes/theme.php | Retrieves URI for themes directory. | | [get\_template()](get_template) wp-includes/theme.php | Retrieves name of the active theme. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [get\_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\_uri()](get_theme_file_uri) wp-includes/link-template.php | Retrieves the URL of a file in the theme. | | [get\_editor\_stylesheets()](get_editor_stylesheets) wp-includes/theme.php | Retrieves any registered editor stylesheet URLs. | | [Custom\_Image\_Header::get\_default\_header\_images()](../classes/custom_image_header/get_default_header_images) wp-admin/includes/class-custom-image-header.php | Gets the details of default header images if defined. | | [Custom\_Image\_Header::step\_1()](../classes/custom_image_header/step_1) wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. | | [Custom\_Image\_Header::reset\_header\_image()](../classes/custom_image_header/reset_header_image) wp-admin/includes/class-custom-image-header.php | Reset a header image to the default image for the theme. | | [Custom\_Image\_Header::process\_default\_headers()](../classes/custom_image_header/process_default_headers) wp-admin/includes/class-custom-image-header.php | Process the default headers | | [WP\_Customize\_Manager::register\_controls()](../classes/wp_customize_manager/register_controls) wp-includes/class-wp-customize-manager.php | Registers some default controls. | | [\_get\_random\_header\_data()](_get_random_header_data) wp-includes/theme.php | Gets random header image data from registered images in theme. | | [get\_custom\_header()](get_custom_header) wp-includes/theme.php | Gets the header image data. | | [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. | | [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | Version | Description | | --- | --- | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
programming_docs
wordpress get_block_categories( WP_Post|WP_Block_Editor_Context $post_or_block_editor_context ): array[] get\_block\_categories( WP\_Post|WP\_Block\_Editor\_Context $post\_or\_block\_editor\_context ): array[] ======================================================================================================== Returns all the categories for block types that will be shown in the block editor. `$post_or_block_editor_context` [WP\_Post](../classes/wp_post)|[WP\_Block\_Editor\_Context](../classes/wp_block_editor_context) Required The current post object or the block editor context. array[] Array of categories for block types. File: `wp-includes/block-editor.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-editor.php/) ``` function get_block_categories( $post_or_block_editor_context ) { $block_categories = get_default_block_categories(); $block_editor_context = $post_or_block_editor_context instanceof WP_Post ? new WP_Block_Editor_Context( array( 'post' => $post_or_block_editor_context, ) ) : $post_or_block_editor_context; /** * Filters the default array of categories for block types. * * @since 5.8.0 * * @param array[] $block_categories Array of categories for block types. * @param WP_Block_Editor_Context $block_editor_context The current block editor context. */ $block_categories = apply_filters( 'block_categories_all', $block_categories, $block_editor_context ); if ( ! empty( $block_editor_context->post ) ) { $post = $block_editor_context->post; /** * Filters the default array of categories for block types. * * @since 5.0.0 * @deprecated 5.8.0 Use the {@see 'block_categories_all'} filter instead. * * @param array[] $block_categories Array of categories for block types. * @param WP_Post $post Post being loaded. */ $block_categories = apply_filters_deprecated( 'block_categories', array( $block_categories, $post ), '5.8.0', 'block_categories_all' ); } return $block_categories; } ``` [apply\_filters\_deprecated( 'block\_categories', array[] $block\_categories, WP\_Post $post )](../hooks/block_categories) Filters the default array of categories for block types. [apply\_filters( 'block\_categories\_all', array[] $block\_categories, WP\_Block\_Editor\_Context $block\_editor\_context )](../hooks/block_categories_all) Filters the default array of categories for block types. | Uses | Description | | --- | --- | | [WP\_Block\_Editor\_Context::\_\_construct()](../classes/wp_block_editor_context/__construct) wp-includes/class-wp-block-editor-context.php | Constructor. | | [get\_default\_block\_categories()](get_default_block_categories) wp-includes/block-editor.php | Returns the list of default categories for block types. | | [apply\_filters\_deprecated()](apply_filters_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated filter hook. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [get\_block\_editor\_settings()](get_block_editor_settings) wp-includes/block-editor.php | Returns the contextualized block editor settings for a selected editor context. | | [WP\_Customize\_Widgets::enqueue\_scripts()](../classes/wp_customize_widgets/enqueue_scripts) wp-includes/class-wp-customize-widgets.php | Enqueues scripts and styles for Customizer panel and export data to JavaScript. | | Version | Description | | --- | --- | | [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | It is possible to pass the block editor context as param. | | [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. | wordpress wp_setcookie( string $username, string $password = '', bool $already_md5 = false, string $home = '', string $siteurl = '', bool $remember = false ) wp\_setcookie( string $username, string $password = '', bool $already\_md5 = false, string $home = '', string $siteurl = '', bool $remember = false ) ===================================================================================================================================================== This function has been deprecated. Use [wp\_set\_auth\_cookie()](wp_set_auth_cookie) instead. Sets a cookie for a user who just logged in. This function is deprecated. * [wp\_set\_auth\_cookie()](wp_set_auth_cookie) `$username` string Required The user's username `$password` string Optional The user's password Default: `''` `$already_md5` bool Optional Whether the password has already been through MD5 Default: `false` `$home` string Optional Will be used instead of COOKIEPATH if set Default: `''` `$siteurl` string Optional Will be used instead of SITECOOKIEPATH if set Default: `''` `$remember` bool Optional Remember that the user is logged in Default: `false` File: `wp-includes/pluggable-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable-deprecated.php/) ``` function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) { _deprecated_function( __FUNCTION__, '2.5.0', 'wp_set_auth_cookie()' ); $user = get_user_by('login', $username); wp_set_auth_cookie($user->ID, $remember); } ``` | Uses | Description | | --- | --- | | [wp\_set\_auth\_cookie()](wp_set_auth_cookie) wp-includes/pluggable.php | Sets the authentication cookies based on user ID. | | [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 | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Use [wp\_set\_auth\_cookie()](wp_set_auth_cookie) | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress block_version( string $content ): int block\_version( string $content ): int ====================================== Returns the current version of the block format that the content string is using. If the string doesn’t contain blocks, it returns 0. `$content` string Required Content to test. int The block format version is 1 if the content contains one or more blocks, 0 otherwise. File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/) ``` function block_version( $content ) { return has_blocks( $content ) ? 1 : 0; } ``` | Uses | Description | | --- | --- | | [has\_blocks()](has_blocks) wp-includes/blocks.php | Determines whether a post or content string has blocks. | | Used By | Description | | --- | --- | | [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\_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. | | Version | Description | | --- | --- | | [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. | wordpress previous_comments_link( string $label = '' ) previous\_comments\_link( string $label = '' ) ============================================== Displays the link to the previous comments page. `$label` string Optional Label for comments link text. Default: `''` File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function previous_comments_link( $label = '' ) { echo get_previous_comments_link( $label ); } ``` | Uses | Description | | --- | --- | | [get\_previous\_comments\_link()](get_previous_comments_link) wp-includes/link-template.php | Retrieves the link to the previous comments page. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress wp_count_terms( array|string $args = array(), array|string $deprecated = '' ): string|WP_Error wp\_count\_terms( array|string $args = array(), array|string $deprecated = '' ): string|WP\_Error ================================================================================================= Counts how many terms are in taxonomy. Default $args is ‘hide\_empty’ which can be ‘hide\_empty=true’ or array(‘hide\_empty’ => true). `$args` array|string Optional Array or string of arguments. See [WP\_Term\_Query::\_\_construct()](../classes/wp_term_query/__construct) for information on accepted arguments. More Arguments from WP\_Term\_Query::\_\_construct( ... $query ) Array or query string of term query parameters. * `taxonomy`string|string[]Taxonomy name, or array of taxonomy names, to which results should be limited. * `object_ids`int|int[]Object ID, or array of object IDs. Results will be limited to terms associated with these objects. * `orderby`stringField(s) to order terms by. Accepts: + Term fields (`'name'`, `'slug'`, `'term_group'`, `'term_id'`, `'id'`, `'description'`, `'parent'`, `'term_order'`). Unless `$object_ids` is not empty, `'term_order'` is treated the same as `'term_id'`. + `'count'` to use the number of objects associated with the term. + `'include'` to match the `'order'` of the `$include` param. + `'slug__in'` to match the `'order'` of the `$slug` param. + `'meta_value'` + `'meta_value_num'`. + The value of `$meta_key`. + The array keys of `$meta_query`. + `'none'` to omit the ORDER BY clause. Default `'name'`. * `order`stringWhether to order terms in ascending or descending order. Accepts `'ASC'` (ascending) or `'DESC'` (descending). Default `'ASC'`. * `hide_empty`bool|intWhether to hide terms not assigned to any posts. Accepts `1|true` or `0|false`. Default `1|true`. * `include`int[]|stringArray or comma/space-separated string of term IDs to include. Default empty array. * `exclude`int[]|stringArray or comma/space-separated string of term IDs to exclude. If `$include` is non-empty, `$exclude` is ignored. Default empty array. * `exclude_tree`int[]|stringArray or comma/space-separated string of term IDs to exclude along with all of their descendant terms. If `$include` is non-empty, `$exclude_tree` is ignored. Default empty array. * `number`int|stringMaximum number of terms to return. Accepts ``''`|0` (all) or any positive number. Default ``''`|0` (all). Note that `$number` may not return accurate results when coupled with `$object_ids`. See #41796 for details. * `offset`intThe number by which to offset the terms query. * `fields`stringTerm fields to query for. Accepts: + `'all'` Returns an array of complete term objects (`WP_Term[]`). + `'all_with_object_id'` Returns an array of term objects with the `'object_id'` param (`WP_Term[]`). Works only when the `$object_ids` parameter is populated. + `'ids'` Returns an array of term IDs (`int[]`). + `'tt_ids'` Returns an array of term taxonomy IDs (`int[]`). + `'names'` Returns an array of term names (`string[]`). + `'slugs'` Returns an array of term slugs (`string[]`). + `'count'` Returns the number of matching terms (`int`). + `'id=>parent'` Returns an associative array of parent term IDs, keyed by term ID (`int[]`). + `'id=>name'` Returns an associative array of term names, keyed by term ID (`string[]`). + `'id=>slug'` Returns an associative array of term slugs, keyed by term ID (`string[]`). Default `'all'`. * `count`boolWhether to return a term count. If true, will take precedence over `$fields`. Default false. * `name`string|string[]Name or array of names to return term(s) for. * `slug`string|string[]Slug or array of slugs to return term(s) for. * `term_taxonomy_id`int|int[]Term taxonomy ID, or array of term taxonomy IDs, to match when querying terms. * `hierarchical`boolWhether to include terms that have non-empty descendants (even if `$hide_empty` is set to true). Default true. * `search`stringSearch criteria to match terms. Will be SQL-formatted with wildcards before and after. * `name__like`stringRetrieve terms with criteria by which a term is LIKE `$name__like`. * `description__like`stringRetrieve terms where the description is LIKE `$description__like`. * `pad_counts`boolWhether to pad the quantity of a term's children in the quantity of each term's "count" object variable. Default false. * `get`stringWhether to return terms regardless of ancestry or whether the terms are empty. Accepts `'all'` or `''` (disabled). Default `''`. * `child_of`intTerm ID to retrieve child terms of. If multiple taxonomies are passed, `$child_of` is ignored. Default 0. * `parent`intParent term ID to retrieve direct-child terms of. * `childless`boolTrue to limit results to terms that have no children. This parameter has no effect on non-hierarchical taxonomies. Default false. * `cache_domain`stringUnique cache key to be produced when this query is stored in an object cache. Default `'core'`. * `update_term_meta_cache`boolWhether to prime meta caches for matched terms. Default true. * `meta_key`string|string[]Meta key or keys to filter by. * `meta_value`string|string[]Meta value or values to filter by. * `meta_compare`stringMySQL operator used for comparing the meta value. See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value. * `meta_compare_key`stringMySQL operator used for comparing the meta key. See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value. * `meta_type`stringMySQL data type that the meta\_value column will be CAST to for comparisons. See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value. * `meta_type_key`stringMySQL data type that the meta\_key column will be CAST to for comparisons. See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value. * `meta_query`arrayAn associative array of [WP\_Meta\_Query](../classes/wp_meta_query) arguments. See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values. Default: `array()` `$deprecated` array|string Optional Argument array, when using the legacy function parameter format. If present, this parameter will be interpreted as `$args`, and the first function parameter will be parsed as a taxonomy or array of taxonomies. Default: `''` string|[WP\_Error](../classes/wp_error) Numeric string containing the number of terms in that taxonomy or [WP\_Error](../classes/wp_error) if the taxonomy does not exist. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/) ``` function wp_count_terms( $args = array(), $deprecated = '' ) { $use_legacy_args = false; // Check whether function is used with legacy signature: `$taxonomy` and `$args`. if ( $args && ( is_string( $args ) && taxonomy_exists( $args ) || is_array( $args ) && wp_is_numeric_array( $args ) ) ) { $use_legacy_args = true; } $defaults = array( 'hide_empty' => false ); if ( $use_legacy_args ) { $defaults['taxonomy'] = $args; $args = $deprecated; } $args = wp_parse_args( $args, $defaults ); // Backward compatibility. if ( isset( $args['ignore_empty'] ) ) { $args['hide_empty'] = $args['ignore_empty']; unset( $args['ignore_empty'] ); } $args['fields'] = 'count'; return get_terms( $args ); } ``` | Uses | Description | | --- | --- | | [wp\_is\_numeric\_array()](wp_is_numeric_array) wp-includes/functions.php | Determines if the variable is a numeric-indexed array. | | [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. | | [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | Used By | Description | | --- | --- | | [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\_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\_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\_Terms\_List\_Table::prepare\_items()](../classes/wp_terms_list_table/prepare_items) 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. | | Version | Description | | --- | --- | | [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Changed the function signature so that the `$args` array can be provided as the first parameter. | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress get_core_checksums( string $version, string $locale ): array|false get\_core\_checksums( string $version, string $locale ): array|false ==================================================================== Gets and caches the checksums for the given version of WordPress. `$version` string Required Version string to query. `$locale` string Required Locale to query. array|false An array of checksums on success, false on failure. File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/) ``` function get_core_checksums( $version, $locale ) { $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), '', '&' ); $url = $http_url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $options = array( 'timeout' => wp_doing_cron() ? 30 : 3, ); $response = wp_remote_get( $url, $options ); if ( $ssl && is_wp_error( $response ) ) { trigger_error( sprintf( /* translators: %s: Support forums URL. */ __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;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 ); $response = wp_remote_get( $http_url, $options ); } if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { return false; } $body = trim( wp_remote_retrieve_body( $response ) ); $body = json_decode( $body, true ); if ( ! is_array( $body ) || ! isset( $body['checksums'] ) || ! is_array( $body['checksums'] ) ) { return false; } return $body['checksums']; } ``` | Uses | Description | | --- | --- | | [wp\_doing\_cron()](wp_doing_cron) wp-includes/load.php | Determines whether the current request is a WordPress cron request. | | [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. | | [wp\_http\_supports()](wp_http_supports) wp-includes/http.php | Determines if there is an HTTP Transport that can process this request. | | [wp\_remote\_get()](wp_remote_get) wp-includes/http.php | Performs an HTTP request using the GET method and returns its response. | | [wp\_remote\_retrieve\_response\_code()](wp_remote_retrieve_response_code) wp-includes/http.php | Retrieve only the response code from the raw response. | | [wp\_remote\_retrieve\_body()](wp_remote_retrieve_body) wp-includes/http.php | Retrieve only the body from the raw response. | | [\_\_()](__) 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 | | --- | --- | | [WP\_Site\_Health\_Auto\_Updates::test\_all\_files\_writable()](../classes/wp_site_health_auto_updates/test_all_files_writable) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if core files are writable by the web user/group. | | [Core\_Upgrader::check\_files()](../classes/core_upgrader/check_files) wp-admin/includes/class-core-upgrader.php | Compare the disk file checksums against the expected checksums. | | [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. | | Version | Description | | --- | --- | | [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |
programming_docs
wordpress _publish_post_hook( int $post_id ) \_publish\_post\_hook( 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. Hook to schedule pings and enclosures when a post is published. Uses XMLRPC\_REQUEST and WP\_IMPORTING constants. `$post_id` int Required The ID of the post being published. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function _publish_post_hook( $post_id ) { if ( defined( 'XMLRPC_REQUEST' ) ) { /** * Fires when _publish_post_hook() is called during an XML-RPC request. * * @since 2.1.0 * * @param int $post_id Post ID. */ do_action( 'xmlrpc_publish_post', $post_id ); } if ( defined( 'WP_IMPORTING' ) ) { return; } if ( get_option( 'default_pingback_flag' ) ) { add_post_meta( $post_id, '_pingme', '1', true ); } add_post_meta( $post_id, '_encloseme', '1', true ); $to_ping = get_to_ping( $post_id ); if ( ! empty( $to_ping ) ) { add_post_meta( $post_id, '_trackbackme', '1' ); } if ( ! wp_next_scheduled( 'do_pings' ) ) { wp_schedule_single_event( time(), 'do_pings' ); } } ``` [do\_action( 'xmlrpc\_publish\_post', int $post\_id )](../hooks/xmlrpc_publish_post) Fires when [\_publish\_post\_hook()](_publish_post_hook) is called during an XML-RPC request. | Uses | Description | | --- | --- | | [wp\_next\_scheduled()](wp_next_scheduled) wp-includes/cron.php | Retrieve the next timestamp for an event. | | [wp\_schedule\_single\_event()](wp_schedule_single_event) wp-includes/cron.php | Schedules an event to run only once. | | [get\_to\_ping()](get_to_ping) wp-includes/post.php | Retrieves URLs that need to be pinged. | | [add\_post\_meta()](add_post_meta) wp-includes/post.php | Adds a meta field to the given post. | | [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. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress get_category_link( int|object $category ): string get\_category\_link( int|object $category ): string =================================================== Retrieves category link URL. * [get\_term\_link()](get_term_link) `$category` int|object Required Category ID or object. string Link on success, empty string if category does not exist. This function returns the correct url for a given Category ID. 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/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/) ``` function get_category_link( $category ) { if ( ! is_object( $category ) ) { $category = (int) $category; } $category = get_term_link( $category ); if ( is_wp_error( $category ) ) { return ''; } return $category; } ``` | Uses | Description | | --- | --- | | [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [get\_tag\_link()](get_tag_link) wp-includes/category-template.php | Retrieves the link to the tag. | | [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\_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. | | Version | Description | | --- | --- | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. | wordpress default_password_nag_handler( false $errors = false ) default\_password\_nag\_handler( false $errors = false ) ======================================================== `$errors` false Optional Deprecated. Default: `false` File: `wp-admin/includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/user.php/) ``` function default_password_nag_handler( $errors = false ) { global $user_ID; // Short-circuit it. if ( ! get_user_option( 'default_password_nag' ) ) { return; } // get_user_setting() = JS-saved UI setting. Else no-js-fallback code. if ( 'hide' === get_user_setting( 'default_password_nag' ) || isset( $_GET['default_password_nag'] ) && '0' == $_GET['default_password_nag'] ) { delete_user_setting( 'default_password_nag' ); update_user_meta( $user_ID, 'default_password_nag', false ); } } ``` | Uses | Description | | --- | --- | | [get\_user\_setting()](get_user_setting) wp-includes/option.php | Retrieves user interface setting value based on setting name. | | [delete\_user\_setting()](delete_user_setting) wp-includes/option.php | Deletes user interface settings. | | [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. | | [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress popuplinks( string $text ): string popuplinks( string $text ): string ================================== This function has been deprecated. Adds element attributes to open links in new tabs. `$text` string Required Content to replace links to open in a new tab. string Content that has filtered links. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function popuplinks( $text ) { _deprecated_function( __FUNCTION__, '4.5.0' ); $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text); return $text; } ``` | Uses | Description | | --- | --- | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | This function has been deprecated. | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress normalize_whitespace( string $str ): string normalize\_whitespace( string $str ): string ============================================ Normalizes EOL characters and strips duplicate whitespace. `$str` string Required The string to normalize. string The normalized string. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function normalize_whitespace( $str ) { $str = trim( $str ); $str = str_replace( "\r", "\n", $str ); $str = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str ); return $str; } ``` | 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\_text\_diff()](wp_text_diff) wp-includes/pluggable.php | Displays a human readable HTML representation of the difference between two strings. | | [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.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress wp_post_revision_title_expanded( int|object $revision, bool $link = true ): string|false wp\_post\_revision\_title\_expanded( 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 gravatar, user, 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_expanded( $revision, $link = true ) { $revision = get_post( $revision ); if ( ! $revision ) { return $revision; } if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ), true ) ) { return false; } $author = get_the_author_meta( 'display_name', $revision->post_author ); /* translators: Revision date format, see https://www.php.net/manual/datetime.format.php */ $datef = _x( 'F j, Y @ H:i:s', 'revision date format' ); $gravatar = get_avatar( $revision->post_author, 24 ); $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>"; } $revision_date_author = sprintf( /* translators: Post revision title. 1: Author avatar, 2: Author name, 3: Time ago, 4: Date. */ __( '%1$s %2$s, %3$s ago (%4$s)' ), $gravatar, $author, human_time_diff( strtotime( $revision->post_modified_gmt ) ), $date ); /* translators: %s: Revision date with author avatar. */ $autosavef = __( '%s [Autosave]' ); /* translators: %s: Revision date with author avatar. */ $currentf = __( '%s [Current Revision]' ); if ( ! wp_is_post_revision( $revision ) ) { $revision_date_author = sprintf( $currentf, $revision_date_author ); } elseif ( wp_is_post_autosave( $revision ) ) { $revision_date_author = sprintf( $autosavef, $revision_date_author ); } /** * Filters the formatted author and date for a revision. * * @since 4.4.0 * * @param string $revision_date_author The formatted string. * @param WP_Post $revision The revision object. * @param bool $link Whether to link to the revisions page, as passed into * wp_post_revision_title_expanded(). */ return apply_filters( 'wp_post_revision_title_expanded', $revision_date_author, $revision, $link ); } ``` [apply\_filters( 'wp\_post\_revision\_title\_expanded', string $revision\_date\_author, WP\_Post $revision, bool $link )](../hooks/wp_post_revision_title_expanded) Filters the formatted author and date for a revision. | Uses | Description | | --- | --- | | [human\_time\_diff()](human_time_diff) wp-includes/formatting.php | Determines the difference between two timestamps. | | [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or 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. | | [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. | | [get\_the\_author\_meta()](get_the_author_meta) wp-includes/author-template.php | Retrieves the requested data of the author of the current post. | | [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. | | [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\_list\_post\_revisions()](wp_list_post_revisions) wp-includes/post-template.php | Displays a list of a post’s revisions. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress strip_shortcodes( string $content ): string strip\_shortcodes( string $content ): string ============================================ Removes all shortcode tags from the given content. `$content` string Required Content to remove shortcode tags. string Content without shortcode tags. File: `wp-includes/shortcodes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/shortcodes.php/) ``` function strip_shortcodes( $content ) { global $shortcode_tags; if ( false === strpos( $content, '[' ) ) { return $content; } if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) { return $content; } // Find all registered tag names in $content. preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches ); $tags_to_remove = array_keys( $shortcode_tags ); /** * Filters the list of shortcode tags to remove from the content. * * @since 4.7.0 * * @param array $tags_to_remove Array of shortcode tags to remove. * @param string $content Content shortcodes are being removed from. */ $tags_to_remove = apply_filters( 'strip_shortcodes_tagnames', $tags_to_remove, $content ); $tagnames = array_intersect( $tags_to_remove, $matches[1] ); if ( empty( $tagnames ) ) { return $content; } $content = do_shortcodes_in_html_tags( $content, true, $tagnames ); $pattern = get_shortcode_regex( $tagnames ); $content = preg_replace_callback( "/$pattern/", 'strip_shortcode_tag', $content ); // Always restore square braces so we don't break things like <!--[if IE ]>. $content = unescape_invalid_shortcodes( $content ); return $content; } ``` [apply\_filters( 'strip\_shortcodes\_tagnames', array $tags\_to\_remove, string $content )](../hooks/strip_shortcodes_tagnames) Filters the list of shortcode tags to remove from the content. | Uses | Description | | --- | --- | | [do\_shortcodes\_in\_html\_tags()](do_shortcodes_in_html_tags) wp-includes/shortcodes.php | Searches only inside HTML elements for shortcodes and process them. | | [unescape\_invalid\_shortcodes()](unescape_invalid_shortcodes) wp-includes/shortcodes.php | Removes placeholders added by [do\_shortcodes\_in\_html\_tags()](do_shortcodes_in_html_tags) . | | [get\_shortcode\_regex()](get_shortcode_regex) wp-includes/shortcodes.php | Retrieves the shortcode regular expression for searching. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [wp\_trim\_excerpt()](wp_trim_excerpt) wp-includes/formatting.php | Generates an excerpt from the content, if needed. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress wp_admin_bar_customize_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_customize\_menu( WP\_Admin\_Bar $wp\_admin\_bar ) ================================================================= Adds the “Customize” link to the Toolbar. `$wp_admin_bar` [WP\_Admin\_Bar](../classes/wp_admin_bar) Required The [WP\_Admin\_Bar](../classes/wp_admin_bar) instance. File: `wp-includes/admin-bar.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/admin-bar.php/) ``` function wp_admin_bar_customize_menu( $wp_admin_bar ) { global $wp_customize; // Don't show if a block theme is activated and no plugins use the customizer. if ( wp_is_block_theme() && ! has_action( 'customize_register' ) ) { return; } // Don't show for users who can't access the customizer or when in the admin. if ( ! current_user_can( 'customize' ) || is_admin() ) { return; } // Don't show if the user cannot edit a given customize_changeset post currently being previewed. if ( is_customize_preview() && $wp_customize->changeset_post_id() && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $wp_customize->changeset_post_id() ) ) { return; } $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; if ( is_customize_preview() && $wp_customize->changeset_uuid() ) { $current_url = remove_query_arg( 'customize_changeset_uuid', $current_url ); } $customize_url = add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ); if ( is_customize_preview() ) { $customize_url = add_query_arg( array( 'changeset_uuid' => $wp_customize->changeset_uuid() ), $customize_url ); } $wp_admin_bar->add_node( array( 'id' => 'customize', 'title' => __( 'Customize' ), 'href' => $customize_url, 'meta' => array( 'class' => 'hide-if-no-customize', ), ) ); add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' ); } ``` | 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. | | [is\_customize\_preview()](is_customize_preview) wp-includes/theme.php | Whether the site is being previewed in the Customizer. | | [wp\_customize\_url()](wp_customize_url) wp-includes/theme.php | Returns a URL to load the Customizer. | | [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. | | [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. | | [WP\_Admin\_Bar::add\_node()](../classes/wp_admin_bar/add_node) wp-includes/class-wp-admin-bar.php | Adds a node to the menu. | | [has\_action()](has_action) wp-includes/plugin.php | Checks if any action has been registered for a 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. | | [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. | | [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. | | [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. | | [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. | | Version | Description | | --- | --- | | [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. | wordpress wp_credits_section_title( array $group_data = array() ) wp\_credits\_section\_title( array $group\_data = array() ) =========================================================== Displays the title for a given group of contributors. `$group_data` array Optional The current contributor group. Default: `array()` File: `wp-admin/includes/credits.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/credits.php/) ``` function wp_credits_section_title( $group_data = array() ) { if ( ! count( $group_data ) ) { return; } if ( $group_data['name'] ) { if ( 'Translators' === $group_data['name'] ) { // Considered a special slug in the API response. (Also, will never be returned for en_US.) $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' ); } elseif ( isset( $group_data['placeholders'] ) ) { // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText $title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] ); } else { // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText $title = translate( $group_data['name'] ); } echo '<h2 class="wp-people-group-title">' . esc_html( $title ) . "</h2>\n"; } } ``` | Uses | Description | | --- | --- | | [translate()](translate) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
programming_docs
wordpress wp_privacy_process_personal_data_export_page( array $response, int $exporter_index, string $email_address, int $page, int $request_id, bool $send_as_email, string $exporter_key ): array wp\_privacy\_process\_personal\_data\_export\_page( array $response, int $exporter\_index, string $email\_address, int $page, int $request\_id, bool $send\_as\_email, string $exporter\_key ): array ===================================================================================================================================================================================================== Intercept personal data exporter page Ajax responses in order to assemble the personal data export file. * [‘wp\_privacy\_personal\_data\_export\_page’](../hooks/wp_privacy_personal_data_export_page) `$response` array Required The response from the personal data exporter for the given page. `$exporter_index` int Required The index of the personal data exporter. Begins at 1. `$email_address` string Required The email address of the user whose personal data this is. `$page` int Required The page of personal data for this exporter. Begins at 1. `$request_id` int Required The request ID for this personal data export. `$send_as_email` bool Required Whether the final results of the export should be emailed to the user. `$exporter_key` string Required The slug (key) of the exporter. array The filtered response. File: `wp-admin/includes/privacy-tools.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/privacy-tools.php/) ``` function wp_privacy_process_personal_data_export_page( $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key ) { /* Do some simple checks on the shape of the response from the exporter. * If the exporter response is malformed, don't attempt to consume it - let it * pass through to generate a warning to the user by default Ajax processing. */ if ( ! is_array( $response ) ) { return $response; } if ( ! array_key_exists( 'done', $response ) ) { return $response; } if ( ! array_key_exists( 'data', $response ) ) { return $response; } if ( ! is_array( $response['data'] ) ) { return $response; } // Get the request. $request = wp_get_user_request( $request_id ); if ( ! $request || 'export_personal_data' !== $request->action_name ) { wp_send_json_error( __( 'Invalid request ID when merging personal data to export.' ) ); } $export_data = array(); // First exporter, first page? Reset the report data accumulation array. if ( 1 === $exporter_index && 1 === $page ) { update_post_meta( $request_id, '_export_data_raw', $export_data ); } else { $accumulated_data = get_post_meta( $request_id, '_export_data_raw', true ); if ( $accumulated_data ) { $export_data = $accumulated_data; } } // Now, merge the data from the exporter response into the data we have accumulated already. $export_data = array_merge( $export_data, $response['data'] ); update_post_meta( $request_id, '_export_data_raw', $export_data ); // If we are not yet on the last page of the last exporter, return now. /** This filter is documented in wp-admin/includes/ajax-actions.php */ $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); $is_last_exporter = count( $exporters ) === $exporter_index; $exporter_done = $response['done']; if ( ! $is_last_exporter || ! $exporter_done ) { return $response; } // Last exporter, last page - let's prepare the export file. // First we need to re-organize the raw data hierarchically in groups and items. $groups = array(); foreach ( (array) $export_data as $export_datum ) { $group_id = $export_datum['group_id']; $group_label = $export_datum['group_label']; $group_description = ''; if ( ! empty( $export_datum['group_description'] ) ) { $group_description = $export_datum['group_description']; } if ( ! array_key_exists( $group_id, $groups ) ) { $groups[ $group_id ] = array( 'group_label' => $group_label, 'group_description' => $group_description, 'items' => array(), ); } $item_id = $export_datum['item_id']; if ( ! array_key_exists( $item_id, $groups[ $group_id ]['items'] ) ) { $groups[ $group_id ]['items'][ $item_id ] = array(); } $old_item_data = $groups[ $group_id ]['items'][ $item_id ]; $merged_item_data = array_merge( $export_datum['data'], $old_item_data ); $groups[ $group_id ]['items'][ $item_id ] = $merged_item_data; } // Then save the grouped data into the request. delete_post_meta( $request_id, '_export_data_raw' ); update_post_meta( $request_id, '_export_data_grouped', $groups ); /** * Generate the export file from the collected, grouped personal data. * * @since 4.9.6 * * @param int $request_id The export request ID. */ do_action( 'wp_privacy_personal_data_export_file', $request_id ); // Clear the grouped data now that it is no longer needed. delete_post_meta( $request_id, '_export_data_grouped' ); // If the destination is email, send it now. if ( $send_as_email ) { $mail_success = wp_privacy_send_personal_data_export_email( $request_id ); if ( is_wp_error( $mail_success ) ) { wp_send_json_error( $mail_success->get_error_message() ); } // Update the request to completed state when the export email is sent. _wp_privacy_completed_request( $request_id ); } else { // Modify the response to include the URL of the export file so the browser can fetch it. $exports_url = wp_privacy_exports_url(); $export_file_name = get_post_meta( $request_id, '_export_file_name', true ); $export_file_url = $exports_url . $export_file_name; if ( ! empty( $export_file_url ) ) { $response['url'] = $export_file_url; } } return $response; } ``` [apply\_filters( 'wp\_privacy\_personal\_data\_exporters', array $args )](../hooks/wp_privacy_personal_data_exporters) Filters the array of exporter callbacks. [do\_action( 'wp\_privacy\_personal\_data\_export\_file', int $request\_id )](../hooks/wp_privacy_personal_data_export_file) Generate the export file from the collected, grouped personal 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. | | [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\_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\_completed\_request()](_wp_privacy_completed_request) wp-admin/includes/privacy-tools.php | Marks a request as completed by the admin and logs the current timestamp. | | [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. | | [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. | | [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. | | [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. | wordpress human_time_diff( int $from, int $to ): string human\_time\_diff( int $from, int $to ): string =============================================== Determines the difference between two timestamps. The difference is returned in a human readable format such as "1 hour", "5 mins", "2 days". `$from` int Required Unix timestamp from which the difference begins. `$to` int Optional Unix timestamp to end the time difference. Default becomes time() if not set. string Human readable time difference. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function human_time_diff( $from, $to = 0 ) { if ( empty( $to ) ) { $to = time(); } $diff = (int) abs( $to - $from ); if ( $diff < MINUTE_IN_SECONDS ) { $secs = $diff; if ( $secs <= 1 ) { $secs = 1; } /* translators: Time difference between two dates, in seconds. %s: Number of seconds. */ $since = sprintf( _n( '%s second', '%s seconds', $secs ), $secs ); } elseif ( $diff < HOUR_IN_SECONDS && $diff >= MINUTE_IN_SECONDS ) { $mins = round( $diff / MINUTE_IN_SECONDS ); if ( $mins <= 1 ) { $mins = 1; } /* translators: Time difference between two dates, in minutes (min=minute). %s: Number of minutes. */ $since = sprintf( _n( '%s min', '%s mins', $mins ), $mins ); } elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) { $hours = round( $diff / HOUR_IN_SECONDS ); if ( $hours <= 1 ) { $hours = 1; } /* translators: Time difference between two dates, in hours. %s: Number of hours. */ $since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours ); } elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) { $days = round( $diff / DAY_IN_SECONDS ); if ( $days <= 1 ) { $days = 1; } /* translators: Time difference between two dates, in days. %s: Number of days. */ $since = sprintf( _n( '%s day', '%s days', $days ), $days ); } elseif ( $diff < MONTH_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) { $weeks = round( $diff / WEEK_IN_SECONDS ); if ( $weeks <= 1 ) { $weeks = 1; } /* translators: Time difference between two dates, in weeks. %s: Number of weeks. */ $since = sprintf( _n( '%s week', '%s weeks', $weeks ), $weeks ); } elseif ( $diff < YEAR_IN_SECONDS && $diff >= MONTH_IN_SECONDS ) { $months = round( $diff / MONTH_IN_SECONDS ); if ( $months <= 1 ) { $months = 1; } /* translators: Time difference between two dates, in months. %s: Number of months. */ $since = sprintf( _n( '%s month', '%s months', $months ), $months ); } elseif ( $diff >= YEAR_IN_SECONDS ) { $years = round( $diff / YEAR_IN_SECONDS ); if ( $years <= 1 ) { $years = 1; } /* translators: Time difference between two dates, in years. %s: Number of years. */ $since = sprintf( _n( '%s year', '%s years', $years ), $years ); } /** * Filters the human readable difference between two timestamps. * * @since 4.0.0 * * @param string $since The difference in human readable text. * @param int $diff The difference in seconds. * @param int $from Unix timestamp from which the difference begins. * @param int $to Unix timestamp to end the time difference. */ return apply_filters( 'human_time_diff', $since, $diff, $from, $to ); } ``` [apply\_filters( 'human\_time\_diff', string $since, int $diff, int $from, int $to )](../hooks/human_time_diff) Filters the human readable difference between two timestamps. | Uses | Description | | --- | --- | | [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [WP\_REST\_Block\_Directory\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_block_directory_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php | Parse block metadata for a block, and prepare it for an API response. | | [wp\_get\_auto\_update\_message()](wp_get_auto_update_message) wp-admin/includes/update.php | Determines the appropriate auto-update message to be displayed. | | [WP\_Recovery\_Mode\_Email\_Service::maybe\_send\_recovery\_mode\_email()](../classes/wp_recovery_mode_email_service/maybe_send_recovery_mode_email) wp-includes/class-wp-recovery-mode-email-service.php | Sends the recovery mode email if the rate limit has not been sent. | | [WP\_Recovery\_Mode\_Email\_Service::send\_recovery\_mode\_email()](../classes/wp_recovery_mode_email_service/send_recovery_mode_email) wp-includes/class-wp-recovery-mode-email-service.php | Sends the Recovery Mode email to the site admin email address. | | [WP\_Privacy\_Requests\_Table::get\_timestamp\_as\_date()](../classes/wp_privacy_requests_table/get_timestamp_as_date) wp-admin/includes/class-wp-privacy-requests-table.php | Convert timestamp for display. | | [WP\_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. | | [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\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. | | [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). | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added support for showing a difference in seconds. | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress wp_sprintf( string $pattern, mixed $args ): string wp\_sprintf( string $pattern, mixed $args ): string =================================================== WordPress implementation of PHP sprintf() with filters. `$pattern` string Required The string which formatted args are inserted. `$args` mixed Required Arguments to be formatted into the $pattern string. string The formatted string. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function wp_sprintf( $pattern, ...$args ) { $len = strlen( $pattern ); $start = 0; $result = ''; $arg_index = 0; while ( $len > $start ) { // Last character: append and break. if ( strlen( $pattern ) - 1 == $start ) { $result .= substr( $pattern, -1 ); break; } // Literal %: append and continue. if ( '%%' === substr( $pattern, $start, 2 ) ) { $start += 2; $result .= '%'; continue; } // Get fragment before next %. $end = strpos( $pattern, '%', $start + 1 ); if ( false === $end ) { $end = $len; } $fragment = substr( $pattern, $start, $end - $start ); // Fragment has a specifier. if ( '%' === $pattern[ $start ] ) { // Find numbered arguments or take the next one in order. if ( preg_match( '/^%(\d+)\$/', $fragment, $matches ) ) { $index = $matches[1] - 1; // 0-based array vs 1-based sprintf() arguments. $arg = isset( $args[ $index ] ) ? $args[ $index ] : ''; $fragment = str_replace( "%{$matches[1]}$", '%', $fragment ); } else { $arg = isset( $args[ $arg_index ] ) ? $args[ $arg_index ] : ''; ++$arg_index; } /** * Filters a fragment from the pattern passed to wp_sprintf(). * * If the fragment is unchanged, then sprintf() will be run on the fragment. * * @since 2.5.0 * * @param string $fragment A fragment from the pattern. * @param string $arg The argument. */ $_fragment = apply_filters( 'wp_sprintf', $fragment, $arg ); if ( $_fragment != $fragment ) { $fragment = $_fragment; } else { $fragment = sprintf( $fragment, (string) $arg ); } } // Append to result and move to next fragment. $result .= $fragment; $start = $end; } return $result; } ``` [apply\_filters( 'wp\_sprintf', string $fragment, string $arg )](../hooks/wp_sprintf) Filters a fragment from the pattern passed to [wp\_sprintf()](wp_sprintf) . | 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\_validate\_enum()](rest_validate_enum) wp-includes/rest-api.php | Validates that the given value is a member of the JSON Schema “enum”. | | [rest\_get\_combining\_operation\_error()](rest_get_combining_operation_error) wp-includes/rest-api.php | Gets the error of combining operation. | | [rest\_find\_one\_matching\_schema()](rest_find_one_matching_schema) wp-includes/rest-api.php | Finds the matching schema among the “oneOf” schemas. | | [rest\_handle\_multi\_type\_schema()](rest_handle_multi_type_schema) wp-includes/rest-api.php | Handles getting the best type for a multi-type schema. | | [wp\_credits\_section\_list()](wp_credits_section_list) wp-admin/includes/credits.php | Displays a list of contributors for a given group. | | [rest\_sanitize\_value\_from\_schema()](rest_sanitize_value_from_schema) wp-includes/rest-api.php | Sanitize a value based on a schema. | | [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. | | [get\_the\_taxonomies()](get_the_taxonomies) wp-includes/taxonomy.php | Retrieves all taxonomies associated with a post. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Formalized the existing and already documented `...$args` parameter by adding it to the function signature. | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress add_plugins_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', int $position = null ): string|false add\_plugins\_page( string $page\_title, string $menu\_title, string $capability, string $menu\_slug, callable $callback = '', int $position = null ): string|false =================================================================================================================================================================== Adds a submenu page to the Plugins main menu. This function takes a capability which will be used to determine whether or not a page is included in the menu. The function which is hooked in to handle the output of the page must check that the user has the required capability as well. `$page_title` string Required The text to be displayed in the title tags of the page when the menu is selected. `$menu_title` string Required The text to be used for the menu. `$capability` string Required The capability required for this menu to be displayed to the user. `$menu_slug` string Required The slug name to refer to this menu by (should be unique for this menu). `$callback` callable Optional The function to be called to output the content for this page. Default: `''` `$position` int Optional The position in the menu order this item should appear. Default: `null` string|false The resulting page's hook\_suffix, or false if the user does not have the capability required. This function is a simple wrapper for a call to [add\_submenu\_page()](add_submenu_page) , passing the received arguments and specifying 'plugins.php' as the $parent\_slug argument. This means the new page will be added as a sub-menu to the *Plugins* menu. File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/) ``` function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } ``` | Uses | Description | | --- | --- | | [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added the `$position` parameter. | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
programming_docs
wordpress image_edit_apply_changes( WP_Image_Editor $image, array $changes ): WP_Image_Editor image\_edit\_apply\_changes( WP\_Image\_Editor $image, array $changes ): WP\_Image\_Editor ========================================================================================== Performs group of changes on Editor specified. `$image` [WP\_Image\_Editor](../classes/wp_image_editor) Required [WP\_Image\_Editor](../classes/wp_image_editor) instance. `$changes` array Required Array of change operations. [WP\_Image\_Editor](../classes/wp_image_editor) [WP\_Image\_Editor](../classes/wp_image_editor) instance with changes applied. File: `wp-admin/includes/image-edit.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image-edit.php/) ``` function image_edit_apply_changes( $image, $changes ) { if ( is_gd_image( $image ) ) { /* 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' ) ); } if ( ! is_array( $changes ) ) { return $image; } // Expand change operations. foreach ( $changes as $key => $obj ) { if ( isset( $obj->r ) ) { $obj->type = 'rotate'; $obj->angle = $obj->r; unset( $obj->r ); } elseif ( isset( $obj->f ) ) { $obj->type = 'flip'; $obj->axis = $obj->f; unset( $obj->f ); } elseif ( isset( $obj->c ) ) { $obj->type = 'crop'; $obj->sel = $obj->c; unset( $obj->c ); } $changes[ $key ] = $obj; } // Combine operations. if ( count( $changes ) > 1 ) { $filtered = array( $changes[0] ); for ( $i = 0, $j = 1, $c = count( $changes ); $j < $c; $j++ ) { $combined = false; if ( $filtered[ $i ]->type == $changes[ $j ]->type ) { switch ( $filtered[ $i ]->type ) { case 'rotate': $filtered[ $i ]->angle += $changes[ $j ]->angle; $combined = true; break; case 'flip': $filtered[ $i ]->axis ^= $changes[ $j ]->axis; $combined = true; break; } } if ( ! $combined ) { $filtered[ ++$i ] = $changes[ $j ]; } } $changes = $filtered; unset( $filtered ); } // Image resource before applying the changes. if ( $image instanceof WP_Image_Editor ) { /** * Filters the WP_Image_Editor instance before applying changes to the image. * * @since 3.5.0 * * @param WP_Image_Editor $image WP_Image_Editor instance. * @param array $changes Array of change operations. */ $image = apply_filters( 'wp_image_editor_before_change', $image, $changes ); } elseif ( is_gd_image( $image ) ) { /** * Filters the GD image resource before applying changes to the image. * * @since 2.9.0 * @deprecated 3.5.0 Use {@see 'wp_image_editor_before_change'} instead. * * @param resource|GdImage $image GD image resource or GdImage instance. * @param array $changes Array of change operations. */ $image = apply_filters_deprecated( 'image_edit_before_change', array( $image, $changes ), '3.5.0', 'wp_image_editor_before_change' ); } foreach ( $changes as $operation ) { switch ( $operation->type ) { case 'rotate': if ( 0 != $operation->angle ) { if ( $image instanceof WP_Image_Editor ) { $image->rotate( $operation->angle ); } else { $image = _rotate_image_resource( $image, $operation->angle ); } } break; case 'flip': if ( 0 != $operation->axis ) { if ( $image instanceof WP_Image_Editor ) { $image->flip( ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 ); } else { $image = _flip_image_resource( $image, ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 ); } } break; case 'crop': $sel = $operation->sel; if ( $image instanceof WP_Image_Editor ) { $size = $image->get_size(); $w = $size['width']; $h = $size['height']; $scale = 1 / _image_get_preview_ratio( $w, $h ); // Discard preview scaling. $image->crop( $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale ); } else { $scale = 1 / _image_get_preview_ratio( imagesx( $image ), imagesy( $image ) ); // Discard preview scaling. $image = _crop_image_resource( $image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale ); } break; } } return $image; } ``` [apply\_filters\_deprecated( 'image\_edit\_before\_change', resource|GdImage $image, array $changes )](../hooks/image_edit_before_change) Filters the GD image resource before applying changes to the image. [apply\_filters( 'wp\_image\_editor\_before\_change', WP\_Image\_Editor $image, array $changes )](../hooks/wp_image_editor_before_change) Filters the [WP\_Image\_Editor](../classes/wp_image_editor) instance before applying changes to the image. | Uses | Description | | --- | --- | | [is\_gd\_image()](is_gd_image) wp-includes/media.php | Determines whether the value is an acceptable type for GD image functions. | | [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. | | 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']`. | | [wp\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. | | Version | Description | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress apache_mod_loaded( string $mod, bool $default = false ): bool apache\_mod\_loaded( string $mod, bool $default = false ): bool =============================================================== Determines whether the specified module exist in the Apache config. `$mod` string Required The module, e.g. mod\_rewrite. `$default` bool Optional The default return value if the module is not found. Default: `false` bool Whether the specified module is loaded. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function apache_mod_loaded( $mod, $default = false ) { global $is_apache; if ( ! $is_apache ) { return false; } $loaded_mods = array(); if ( function_exists( 'apache_get_modules' ) ) { $loaded_mods = apache_get_modules(); if ( in_array( $mod, $loaded_mods, true ) ) { return true; } } if ( empty( $loaded_mods ) && function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) { ob_start(); phpinfo( INFO_MODULES ); $phpinfo = ob_get_clean(); if ( false !== strpos( $phpinfo, $mod ) ) { return true; } } return $default; } ``` | Used By | Description | | --- | --- | | [network\_step1()](network_step1) wp-admin/includes/network.php | Prints step 1 for Network installation process. | | [got\_mod\_rewrite()](got_mod_rewrite) wp-admin/includes/misc.php | Returns whether the server is running Apache with the mod\_rewrite module loaded. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress rest_parse_embed_param( string|array $embed ): true|string[] rest\_parse\_embed\_param( string|array $embed ): true|string[] =============================================================== Parses the “\_embed” parameter into the list of resources to embed. `$embed` string|array Required Raw "\_embed" parameter value. true|string[] Either true to embed all embeds, or a list of relations to embed. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_parse_embed_param( $embed ) { if ( ! $embed || 'true' === $embed || '1' === $embed ) { return true; } $rels = wp_parse_list( $embed ); if ( ! $rels ) { return true; } return $rels; } ``` | 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 | | --- | --- | | [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\_Server::serve\_request()](../classes/wp_rest_server/serve_request) wp-includes/rest-api/class-wp-rest-server.php | Handles serving a REST API request. | | Version | Description | | --- | --- | | [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Introduced. | wordpress has_custom_logo( int $blog_id ): bool has\_custom\_logo( int $blog\_id ): bool ======================================== Determines whether the site has a custom logo. `$blog_id` int Optional ID of the blog in question. Default is the ID of the current blog. bool Whether the site has a custom logo or not. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function has_custom_logo( $blog_id = 0 ) { $switched_blog = false; if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) { switch_to_blog( $blog_id ); $switched_blog = true; } $custom_logo_id = get_theme_mod( 'custom_logo' ); if ( $switched_blog ) { restore_current_blog(); } return (bool) $custom_logo_id; } ``` | Uses | Description | | --- | --- | | [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. | | [switch\_to\_blog()](switch_to_blog) wp-includes/ms-blogs.php | Switch the current blog. | | [restore\_current\_blog()](restore_current_blog) wp-includes/ms-blogs.php | Restore the current blog, after calling [switch\_to\_blog()](switch_to_blog) . | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. | | Used By | Description | | --- | --- | | [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. | | Version | Description | | --- | --- | | [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. | wordpress get_tag( int|WP_Term|object $tag, string $output = OBJECT, string $filter = 'raw' ): WP_Term|array|WP_Error|null get\_tag( int|WP\_Term|object $tag, string $output = OBJECT, string $filter = 'raw' ): WP\_Term|array|WP\_Error|null ==================================================================================================================== Retrieves a post tag by tag ID or tag object. If you pass the $tag parameter an object, which is assumed to be the tag row object retrieved from the database, it will cache the tag data. If you pass $tag an integer of the tag ID, then that tag will be retrieved from the database, if it isn’t already cached, and passed back. If you look at [get\_term()](get_term) , both types will be passed through several filters and finally sanitized based on the $filter parameter value. `$tag` int|[WP\_Term](../classes/wp_term)|object Required A tag ID or 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 tag fields. Default `'raw'`. Default: `'raw'` [WP\_Term](../classes/wp_term)|array|[WP\_Error](../classes/wp_error)|null Tag data in type defined by $output parameter. [WP\_Error](../classes/wp_error) if $tag 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_tag( $tag, $output = OBJECT, $filter = 'raw' ) { return get_term( $tag, 'post_tag', $output, $filter ); } ``` | Uses | Description | | --- | --- | | [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress wp_is_application_passwords_supported(): bool wp\_is\_application\_passwords\_supported(): bool ================================================= Checks if Application Passwords is supported. Application Passwords is supported only by sites using SSL or local environments but may be made available using the [‘wp\_is\_application\_passwords\_available’](../hooks/wp_is_application_passwords_available) filter. bool File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function wp_is_application_passwords_supported() { return is_ssl() || 'local' === wp_get_environment_type(); } ``` | Uses | Description | | --- | --- | | [wp\_get\_environment\_type()](wp_get_environment_type) wp-includes/load.php | Retrieves the current environment type. | | [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. | | Used By | Description | | --- | --- | | [wp\_is\_application\_passwords\_available()](wp_is_application_passwords_available) wp-includes/user.php | Checks if Application Passwords is globally available. | | Version | Description | | --- | --- | | [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. | wordpress did_action( string $hook_name ): int did\_action( string $hook\_name ): int ====================================== Retrieves the number of times an action has been fired during the current request. `$hook_name` string Required The name of the action hook. int The number of times the action hook has been fired. File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/) ``` function did_action( $hook_name ) { global $wp_actions; if ( ! isset( $wp_actions[ $hook_name ] ) ) { return 0; } return $wp_actions[ $hook_name ]; } ``` | Used By | Description | | --- | --- | | [wp\_enqueue\_block\_style()](wp_enqueue_block_style) wp-includes/script-loader.php | Enqueues a stylesheet for a specific block. | | [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()](wp_default_packages) wp-includes/script-loader.php | Registers all the WordPress packages scripts. | | [WP\_Privacy\_Policy\_Content::text\_change\_check()](../classes/wp_privacy_policy_content/text_change_check) wp-admin/includes/class-wp-privacy-policy-content.php | Quick check if any privacy info has changed. | | [wp\_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\_switch\_roles\_and\_user()](wp_switch_roles_and_user) wp-includes/ms-blogs.php | Switches the initialized roles and current user capabilities to another site. | | [\_WP\_Editors::enqueue\_default\_editor()](../classes/_wp_editors/enqueue_default_editor) wp-includes/class-wp-editor.php | Enqueue all editor scripts. | | [WP\_Customize\_Manager::\_publish\_changeset\_values()](../classes/wp_customize_manager/_publish_changeset_values) wp-includes/class-wp-customize-manager.php | Publishes the values of a changeset. | | [WP\_Customize\_Manager::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\_publish\_changeset()](_wp_customize_publish_changeset) wp-includes/theme.php | Publishes a snapshot’s changes. | | [WP\_Site::\_\_get()](../classes/wp_site/__get) wp-includes/class-wp-site.php | Getter. | | [WP\_Site::\_\_isset()](../classes/wp_site/__isset) wp-includes/class-wp-site.php | Isset-er. | | [register\_rest\_route()](register_rest_route) wp-includes/rest-api.php | Registers a REST API route. | | [wp\_cron()](wp_cron) wp-includes/cron.php | Register [\_wp\_cron()](_wp_cron) to run on the {@see ‘wp\_loaded’} action. | | [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. | | [\_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. | | [wp\_admin\_css()](wp_admin_css) wp-includes/general-template.php | Enqueues or directly prints a stylesheet link to the specified CSS file. | | [wp\_load\_translations\_early()](wp_load_translations_early) wp-includes/load.php | Attempt an early load of translations. | | [wp\_allowed\_protocols()](wp_allowed_protocols) wp-includes/functions.php | Retrieves a list of protocols to allow in HTML attributes. | | [\_default\_wp\_die\_handler()](_default_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. | | [create\_initial\_taxonomies()](create_initial_taxonomies) wp-includes/taxonomy.php | Creates the initial taxonomies. | | [WP\_Admin\_Bar::\_render()](../classes/wp_admin_bar/_render) wp-includes/class-wp-admin-bar.php | | | [get\_the\_content()](get_the_content) wp-includes/post-template.php | Retrieves the post content. | | [wp\_enqueue\_media()](wp_enqueue_media) wp-includes/media.php | Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. | | [wp\_oembed\_add\_provider()](wp_oembed_add_provider) wp-includes/embed.php | Adds a URL format and oEmbed provider URL pair. | | [wp\_oembed\_remove\_provider()](wp_oembed_remove_provider) wp-includes/embed.php | Removes an oEmbed provider. | | [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::wp\_rewrite\_rules()](../classes/wp_rewrite/wp_rewrite_rules) wp-includes/class-wp-rewrite.php | Retrieves the rewrite rules. | | [WP\_Rewrite::flush\_rules()](../classes/wp_rewrite/flush_rules) wp-includes/class-wp-rewrite.php | Removes rewrite rules and then recreate rewrite rules. | | [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::select()](../classes/wpdb/select) wp-includes/class-wpdb.php | Selects a database using the current or provided database connection. | | [wp\_register\_sidebar\_widget()](wp_register_sidebar_widget) wp-includes/widgets.php | Register an instance of a widget. | | [wp\_register\_widget\_control()](wp_register_widget_control) wp-includes/widgets.php | Registers widget control callback for customizing options. | | [\_register\_widget\_form\_callback()](_register_widget_form_callback) wp-includes/widgets.php | Registers the form callback for a widget. | | [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. | | [print\_head\_scripts()](print_head_scripts) wp-includes/script-loader.php | Prints the script queue in the HTML head on admin pages. | | [wp\_print\_head\_scripts()](wp_print_head_scripts) wp-includes/script-loader.php | Prints the script queue in the HTML head on the front end. | | [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. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
programming_docs
wordpress _wp_ajax_add_hierarchical_term() \_wp\_ajax\_add\_hierarchical\_term() ===================================== 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. Ajax handler for adding a hierarchical term. File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/) ``` function _wp_ajax_add_hierarchical_term() { $action = $_POST['action']; $taxonomy = get_taxonomy( substr( $action, 4 ) ); check_ajax_referer( $action, '_ajax_nonce-add-' . $taxonomy->name ); if ( ! current_user_can( $taxonomy->cap->edit_terms ) ) { wp_die( -1 ); } $names = explode( ',', $_POST[ 'new' . $taxonomy->name ] ); $parent = isset( $_POST[ 'new' . $taxonomy->name . '_parent' ] ) ? (int) $_POST[ 'new' . $taxonomy->name . '_parent' ] : 0; if ( 0 > $parent ) { $parent = 0; } if ( 'category' === $taxonomy->name ) { $post_category = isset( $_POST['post_category'] ) ? (array) $_POST['post_category'] : array(); } else { $post_category = ( isset( $_POST['tax_input'] ) && isset( $_POST['tax_input'][ $taxonomy->name ] ) ) ? (array) $_POST['tax_input'][ $taxonomy->name ] : array(); } $checked_categories = array_map( 'absint', (array) $post_category ); $popular_ids = wp_popular_terms_checklist( $taxonomy->name, 0, 10, false ); foreach ( $names as $cat_name ) { $cat_name = trim( $cat_name ); $category_nicename = sanitize_title( $cat_name ); if ( '' === $category_nicename ) { continue; } $cat_id = wp_insert_term( $cat_name, $taxonomy->name, array( 'parent' => $parent ) ); if ( ! $cat_id || is_wp_error( $cat_id ) ) { continue; } else { $cat_id = $cat_id['term_id']; } $checked_categories[] = $cat_id; if ( $parent ) { // Do these all at once in a second. continue; } ob_start(); wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'descendants_and_self' => $cat_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids, ) ); $data = ob_get_clean(); $add = array( 'what' => $taxonomy->name, 'id' => $cat_id, 'data' => str_replace( array( "\n", "\t" ), '', $data ), 'position' => -1, ); } if ( $parent ) { // Foncy - replace the parent and all its children. $parent = get_term( $parent, $taxonomy->name ); $term_id = $parent->term_id; while ( $parent->parent ) { // Get the top parent. $parent = get_term( $parent->parent, $taxonomy->name ); if ( is_wp_error( $parent ) ) { break; } $term_id = $parent->term_id; } ob_start(); wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'descendants_and_self' => $term_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids, ) ); $data = ob_get_clean(); $add = array( 'what' => $taxonomy->name, 'id' => $term_id, 'data' => str_replace( array( "\n", "\t" ), '', $data ), 'position' => -1, ); } ob_start(); wp_dropdown_categories( array( 'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new' . $taxonomy->name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '&mdash; ' . $taxonomy->labels->parent_item . ' &mdash;', ) ); $sup = ob_get_clean(); $add['supplemental'] = array( 'newcat_parent' => $sup ); $x = new WP_Ajax_Response( $add ); $x->send(); } ``` | Uses | Description | | --- | --- | | [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\_terms\_checklist()](wp_terms_checklist) wp-admin/includes/template.php | Outputs an unordered list of checkbox input elements labelled with term names. | | [wp\_dropdown\_categories()](wp_dropdown_categories) wp-includes/category-template.php | Displays or retrieves the HTML dropdown list of categories. | | [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. | | [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. | | [WP\_Ajax\_Response::\_\_construct()](../classes/wp_ajax_response/__construct) wp-includes/class-wp-ajax-response.php | Constructor – Passes args to [WP\_Ajax\_Response::add()](../classes/wp_ajax_response/add). | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. | | [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. | | [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. | | [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 screen_layout( $screen ) screen\_layout( $screen ) ========================= This function has been deprecated. Use [WP\_Screen::render\_screen\_layout()](../classes/wp_screen/render_screen_layout) instead. Returns the screen layout options. * [WP\_Screen::render\_screen\_layout()](../classes/wp_screen/render_screen_layout) File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/) ``` function screen_layout( $screen ) { _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_screen_layout()' ); $current_screen = get_current_screen(); if ( ! $current_screen ) return ''; ob_start(); $current_screen->render_screen_layout(); return ob_get_clean(); } ``` | Uses | Description | | --- | --- | | [get\_current\_screen()](get_current_screen) wp-admin/includes/screen.php | Get the current screen object | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | [WP\_Screen::render\_screen\_layout()](../classes/wp_screen/render_screen_layout) | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress get_currentuserinfo(): bool|WP_User get\_currentuserinfo(): bool|WP\_User ===================================== This function has been deprecated. Use [wp\_get\_current\_user()](wp_get_current_user) instead. Populate global variables with information about the currently logged in user. * [wp\_get\_current\_user()](wp_get_current_user) bool|[WP\_User](../classes/wp_user) False on XMLRPC Request and invalid auth cookie, [WP\_User](../classes/wp_user) instance otherwise. File: `wp-includes/pluggable-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable-deprecated.php/) ``` function get_currentuserinfo() { _deprecated_function( __FUNCTION__, '4.5.0', 'wp_get_current_user()' ); return _wp_get_current_user(); } ``` | Uses | Description | | --- | --- | | [\_wp\_get\_current\_user()](_wp_get_current_user) wp-includes/user.php | Retrieves the current user object. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Use [wp\_get\_current\_user()](wp_get_current_user) | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress wp_ajax_save_wporg_username() wp\_ajax\_save\_wporg\_username() ================================= Ajax handler for saving the user’s WordPress.org username. 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_wporg_username() { if ( ! current_user_can( 'install_themes' ) && ! current_user_can( 'install_plugins' ) ) { wp_send_json_error(); } check_ajax_referer( 'save_wporg_username_' . get_current_user_id() ); $username = isset( $_REQUEST['username'] ) ? wp_unslash( $_REQUEST['username'] ) : false; if ( ! $username ) { wp_send_json_error(); } wp_send_json_success( update_user_meta( get_current_user_id(), 'wporg_favorites', $username ) ); } ``` | Uses | Description | | --- | --- | | [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user 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. | | [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. | | [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. | | [wp\_send\_json\_success()](wp_send_json_success) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating success. | | [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. | wordpress update_network_cache( array $networks ) update\_network\_cache( array $networks ) ========================================= Updates the network cache of given networks. Will add the networks in $networks to the cache. If network ID already exists in the network cache then it will not be updated. The network is added to the cache using the network group with the key using the ID of the networks. `$networks` array Required Array of network row objects. File: `wp-includes/ms-network.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-network.php/) ``` function update_network_cache( $networks ) { $data = array(); foreach ( (array) $networks as $network ) { $data[ $network->id ] = $network; } wp_cache_add_multiple( $data, 'networks' ); } ``` | Uses | Description | | --- | --- | | [wp\_cache\_add\_multiple()](wp_cache_add_multiple) wp-includes/cache.php | Adds multiple values to the cache in one call. | | Used By | Description | | --- | --- | | [\_prime\_network\_caches()](_prime_network_caches) wp-includes/ms-network.php | Adds any networks from the given IDs to the cache that do not already exist in cache. | | Version | Description | | --- | --- | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. | wordpress remove_query_arg( string|string[] $key, false|string $query = false ): string remove\_query\_arg( string|string[] $key, false|string $query = false ): string =============================================================================== Removes an item or items from a query string. `$key` string|string[] Required Query key or keys to remove. `$query` false|string Optional When false uses the current URL. Default: `false` string New URL query string. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function remove_query_arg( $key, $query = false ) { if ( is_array( $key ) ) { // Removing multiple keys. foreach ( $key as $k ) { $query = add_query_arg( $k, false, $query ); } return $query; } return add_query_arg( $key, false, $query ); } ``` | Uses | Description | | --- | --- | | [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. | | 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\_bar\_customize\_menu()](wp_admin_bar_customize_menu) wp-includes/admin-bar.php | Adds the “Customize” link to the Toolbar. | | [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\_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. | | [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::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. | | [set\_screen\_options()](set_screen_options) wp-admin/includes/misc.php | Saves option for number of rows when listing posts, pages, comments, etc. | | [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. | | [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. | | [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\_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\_nonce\_ays()](wp_nonce_ays) wp-includes/functions.php | Displays “Are You Sure” message to confirm the action being taken. | | [wp\_referer\_field()](wp_referer_field) wp-includes/functions.php | Retrieves or displays referer hidden field for forms. | | [get\_pagenum\_link()](get_pagenum_link) wp-includes/link-template.php | Retrieves the link for a page number. | | [wp\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. | | [\_remove\_qs\_args\_if\_not\_in\_url()](_remove_qs_args_if_not_in_url) wp-includes/canonical.php | Removes arguments from a query string if they are not present in a URL DO NOT use this in plugin code. | | [redirect\_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. | | [get\_cancel\_comment\_reply\_link()](get_cancel_comment_reply_link) wp-includes/comment-template.php | Retrieves HTML content for cancel comment reply link. | | Version | Description | | --- | --- | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress wp_ajax_press_this_save_post() wp\_ajax\_press\_this\_save\_post() =================================== This function has been deprecated. Ajax handler for saving a post from Press This. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function wp_ajax_press_this_save_post() { _deprecated_function( __FUNCTION__, '4.9.0' ); if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php'; $wp_press_this = new WP_Press_This_Plugin(); $wp_press_this->save_post(); } else { wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); } } ``` | Uses | Description | | --- | --- | | [is\_plugin\_active()](is_plugin_active) wp-admin/includes/plugin.php | Determines whether a plugin is active. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. | | Version | Description | | --- | --- | | [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | This function has been deprecated. | | [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. | wordpress wp_get_image_editor( string $path, array $args = array() ): WP_Image_Editor|WP_Error wp\_get\_image\_editor( string $path, array $args = array() ): WP\_Image\_Editor|WP\_Error ========================================================================================== Returns a [WP\_Image\_Editor](../classes/wp_image_editor) instance and loads file into it. `$path` string Required Path to the file to load. `$args` array Optional Additional arguments for retrieving the image editor. Default: `array()` [WP\_Image\_Editor](../classes/wp_image_editor)|[WP\_Error](../classes/wp_error) The [WP\_Image\_Editor](../classes/wp_image_editor) object on success, a [WP\_Error](../classes/wp_error) object otherwise. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/) ``` function wp_get_image_editor( $path, $args = array() ) { $args['path'] = $path; // If the mime type is not set in args, try to extract and set it from the file. if ( ! isset( $args['mime_type'] ) ) { $file_info = wp_check_filetype( $args['path'] ); // If $file_info['type'] is false, then we let the editor attempt to // figure out the file type, rather than forcing a failure based on extension. if ( isset( $file_info ) && $file_info['type'] ) { $args['mime_type'] = $file_info['type']; } } // Check and set the output mime type mapped to the input type. if ( isset( $args['mime_type'] ) ) { /** This filter is documented in wp-includes/class-wp-image-editor.php */ $output_format = apply_filters( 'image_editor_output_format', array(), $path, $args['mime_type'] ); if ( isset( $output_format[ $args['mime_type'] ] ) ) { $args['output_mime_type'] = $output_format[ $args['mime_type'] ]; } } $implementation = _wp_image_editor_choose( $args ); if ( $implementation ) { $editor = new $implementation( $path ); $loaded = $editor->load(); if ( is_wp_error( $loaded ) ) { return $loaded; } return $editor; } return new WP_Error( 'image_no_editor', __( 'No editor could be selected.' ) ); } ``` [apply\_filters( 'image\_editor\_output\_format', string[] $output\_format, string $filename, string $mime\_type )](../hooks/image_editor_output_format) Filters the image editor output format mapping. | Uses | Description | | --- | --- | | [wp\_check\_filetype()](wp_check_filetype) wp-includes/functions.php | Retrieves the file type from the file name. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Used By | Description | | --- | --- | | [WP\_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\_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. | | [stream\_preview\_image()](stream_preview_image) wp-admin/includes/image-edit.php | Streams image in post to browser, along with enqueued changes in `$_REQUEST['history']`. | | [wp\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. | | [wp\_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. | | [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. | | [image\_make\_intermediate\_size()](image_make_intermediate_size) wp-includes/media.php | Resizes an image to make a thumbnail or intermediate size. | | Version | Description | | --- | --- | | [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
programming_docs
wordpress stick_post( int $post_id ) stick\_post( int $post\_id ) ============================ Makes a post sticky. Sticky posts should be displayed at the top of the front page. `$post_id` int Required Post ID. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function stick_post( $post_id ) { $post_id = (int) $post_id; $stickies = get_option( 'sticky_posts' ); $updated = false; if ( ! is_array( $stickies ) ) { $stickies = array(); } else { $stickies = array_unique( array_map( 'intval', $stickies ) ); } if ( ! in_array( $post_id, $stickies, true ) ) { $stickies[] = $post_id; $updated = update_option( 'sticky_posts', array_values( $stickies ) ); } if ( $updated ) { /** * Fires once a post has been added to the sticky list. * * @since 4.6.0 * * @param int $post_id ID of the post that was stuck. */ do_action( 'post_stuck', $post_id ); } } ``` [do\_action( 'post\_stuck', int $post\_id )](../hooks/post_stuck) Fires once a post has been added to the sticky list. | Uses | Description | | --- | --- | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [WP\_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\_xmlrpc\_server::\_toggle\_sticky()](../classes/wp_xmlrpc_server/_toggle_sticky) wp-includes/class-wp-xmlrpc-server.php | Encapsulate the logic for sticking a post and determining if the user has permission to do so | | [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. | | [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress _get_last_post_time( string $timezone, string $field, string $post_type = 'any' ): string|false \_get\_last\_post\_time( string $timezone, string $field, string $post\_type = 'any' ): string|false ==================================================================================================== This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Gets the timestamp of the last time any post was modified or published. `$timezone` string Required The timezone for the timestamp. See [get\_lastpostdate()](get_lastpostdate) . for information on accepted values. More Arguments from get\_lastpostdate( ... $timezone ) The timezone for the timestamp. Accepts `'server'`, `'blog'`, or `'gmt'`. `'server'` uses the server's internal timezone. `'blog'` uses the `post_date` field, which proxies to the timezone set for the site. `'gmt'` uses the `post_date_gmt` field. Default `'server'`. `$field` string Required Post field to check. Accepts `'date'` or `'modified'`. `$post_type` string Optional The post type to check. Default `'any'`. Default: `'any'` string|false The timestamp in 'Y-m-d H:i:s' format, or false on failure. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function _get_last_post_time( $timezone, $field, $post_type = 'any' ) { global $wpdb; if ( ! in_array( $field, array( 'date', 'modified' ), true ) ) { return false; } $timezone = strtolower( $timezone ); $key = "lastpost{$field}:$timezone"; if ( 'any' !== $post_type ) { $key .= ':' . sanitize_key( $post_type ); } $date = wp_cache_get( $key, 'timeinfo' ); if ( false !== $date ) { return $date; } if ( 'any' === $post_type ) { $post_types = get_post_types( array( 'public' => true ) ); array_walk( $post_types, array( $wpdb, 'escape_by_ref' ) ); $post_types = "'" . implode( "', '", $post_types ) . "'"; } else { $post_types = "'" . sanitize_key( $post_type ) . "'"; } switch ( $timezone ) { case 'gmt': $date = $wpdb->get_var( "SELECT post_{$field}_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1" ); break; case 'blog': $date = $wpdb->get_var( "SELECT post_{$field} FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1" ); break; case 'server': $add_seconds_server = gmdate( 'Z' ); $date = $wpdb->get_var( "SELECT DATE_ADD(post_{$field}_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1" ); break; } if ( $date ) { wp_cache_set( $key, $date, 'timeinfo' ); return $date; } return false; } ``` | Uses | Description | | --- | --- | | [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. | | [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. | | [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. | | [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. | | [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. | | Used By | Description | | --- | --- | | [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. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `$post_type` argument was added. | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress wp_tinymce_inline_scripts() wp\_tinymce\_inline\_scripts() ============================== Adds inline scripts required for the TinyMCE in the block editor. These TinyMCE init settings are used to extend and override the default settings from `_WP_Editors::default_settings()` for the Classic block. File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/) ``` function wp_tinymce_inline_scripts() { global $wp_scripts; /** This filter is documented in wp-includes/class-wp-editor.php */ $editor_settings = apply_filters( 'wp_editor_settings', array( 'tinymce' => true ), 'classic-block' ); $tinymce_plugins = array( 'charmap', 'colorpicker', 'hr', 'lists', 'media', 'paste', 'tabfocus', 'textcolor', 'fullscreen', 'wordpress', 'wpautoresize', 'wpeditimage', 'wpemoji', 'wpgallery', 'wplink', 'wpdialogs', 'wptextpattern', 'wpview', ); /** This filter is documented in wp-includes/class-wp-editor.php */ $tinymce_plugins = apply_filters( 'tiny_mce_plugins', $tinymce_plugins, 'classic-block' ); $tinymce_plugins = array_unique( $tinymce_plugins ); $disable_captions = false; // Runs after `tiny_mce_plugins` but before `mce_buttons`. /** This filter is documented in wp-admin/includes/media.php */ if ( apply_filters( 'disable_captions', '' ) ) { $disable_captions = true; } $toolbar1 = array( 'formatselect', 'bold', 'italic', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker', 'wp_add_media', 'wp_adv', ); /** This filter is documented in wp-includes/class-wp-editor.php */ $toolbar1 = apply_filters( 'mce_buttons', $toolbar1, 'classic-block' ); $toolbar2 = array( 'strikethrough', 'hr', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help', ); /** This filter is documented in wp-includes/class-wp-editor.php */ $toolbar2 = apply_filters( 'mce_buttons_2', $toolbar2, 'classic-block' ); /** This filter is documented in wp-includes/class-wp-editor.php */ $toolbar3 = apply_filters( 'mce_buttons_3', array(), 'classic-block' ); /** This filter is documented in wp-includes/class-wp-editor.php */ $toolbar4 = apply_filters( 'mce_buttons_4', array(), 'classic-block' ); /** This filter is documented in wp-includes/class-wp-editor.php */ $external_plugins = apply_filters( 'mce_external_plugins', array(), 'classic-block' ); $tinymce_settings = array( 'plugins' => implode( ',', $tinymce_plugins ), 'toolbar1' => implode( ',', $toolbar1 ), 'toolbar2' => implode( ',', $toolbar2 ), 'toolbar3' => implode( ',', $toolbar3 ), 'toolbar4' => implode( ',', $toolbar4 ), 'external_plugins' => wp_json_encode( $external_plugins ), 'classic_block_editor' => true, ); if ( $disable_captions ) { $tinymce_settings['wpeditimage_disable_captions'] = true; } if ( ! empty( $editor_settings['tinymce'] ) && is_array( $editor_settings['tinymce'] ) ) { array_merge( $tinymce_settings, $editor_settings['tinymce'] ); } /** This filter is documented in wp-includes/class-wp-editor.php */ $tinymce_settings = apply_filters( 'tiny_mce_before_init', $tinymce_settings, 'classic-block' ); // Do "by hand" translation from PHP array to js object. // Prevents breakage in some custom settings. $init_obj = ''; foreach ( $tinymce_settings as $key => $value ) { if ( is_bool( $value ) ) { $val = $value ? 'true' : 'false'; $init_obj .= $key . ':' . $val . ','; continue; } elseif ( ! empty( $value ) && is_string( $value ) && ( ( '{' === $value[0] && '}' === $value[ strlen( $value ) - 1 ] ) || ( '[' === $value[0] && ']' === $value[ strlen( $value ) - 1 ] ) || preg_match( '/^\(?function ?\(/', $value ) ) ) { $init_obj .= $key . ':' . $value . ','; continue; } $init_obj .= $key . ':"' . $value . '",'; } $init_obj = '{' . trim( $init_obj, ' ,' ) . '}'; $script = 'window.wpEditorL10n = { tinymce: { baseURL: ' . wp_json_encode( includes_url( 'js/tinymce' ) ) . ', suffix: ' . ( SCRIPT_DEBUG ? '""' : '".min"' ) . ', settings: ' . $init_obj . ', } }'; $wp_scripts->add_inline_script( 'wp-block-library', $script, 'before' ); } ``` [apply\_filters( 'disable\_captions', bool $bool )](../hooks/disable_captions) Filters whether to disable captions. [apply\_filters( 'mce\_buttons', array $mce\_buttons, string $editor\_id )](../hooks/mce_buttons) Filters the first-row list of TinyMCE buttons (Visual tab). [apply\_filters( 'mce\_buttons\_2', array $mce\_buttons\_2, string $editor\_id )](../hooks/mce_buttons_2) Filters the second-row list of TinyMCE buttons (Visual tab). [apply\_filters( 'mce\_buttons\_3', array $mce\_buttons\_3, string $editor\_id )](../hooks/mce_buttons_3) Filters the third-row list of TinyMCE buttons (Visual tab). [apply\_filters( 'mce\_buttons\_4', array $mce\_buttons\_4, string $editor\_id )](../hooks/mce_buttons_4) Filters the fourth-row list of TinyMCE buttons (Visual tab). [apply\_filters( 'mce\_external\_plugins', array $external\_plugins, string $editor\_id )](../hooks/mce_external_plugins) Filters the list of TinyMCE external plugins. [apply\_filters( 'tiny\_mce\_before\_init', array $mceInit, string $editor\_id )](../hooks/tiny_mce_before_init) Filters the TinyMCE config before init. [apply\_filters( 'tiny\_mce\_plugins', array $plugins, string $editor\_id )](../hooks/tiny_mce_plugins) Filters the list of default TinyMCE plugins. [apply\_filters( 'wp\_editor\_settings', array $settings, string $editor\_id )](../hooks/wp_editor_settings) Filters the [wp\_editor()](wp_editor) settings. | Uses | Description | | --- | --- | | [WP\_Scripts::add\_inline\_script()](../classes/wp_scripts/add_inline_script) wp-includes/class-wp-scripts.php | Adds extra code to a registered script. | | [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. | | [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Version | Description | | --- | --- | | [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. | wordpress remove_role( string $role ) remove\_role( string $role ) ============================ Removes a role, if it exists. `$role` string Required Role name. File: `wp-includes/capabilities.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/capabilities.php/) ``` function remove_role( $role ) { wp_roles()->remove_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::remove\_role()](../classes/wp_roles/remove_role) wp-includes/class-wp-roles.php | Removes a role by name. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress deactivated_plugins_notice() deactivated\_plugins\_notice() ============================== This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Renders an admin notice when a plugin was deactivated during an update. Displays an admin notice in case a plugin has been deactivated during an upgrade due to incompatibility with the current version of WordPress. File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/) ``` function deactivated_plugins_notice() { if ( 'plugins.php' === $GLOBALS['pagenow'] ) { return; } if ( ! current_user_can( 'activate_plugins' ) ) { return; } $blog_deactivated_plugins = get_option( 'wp_force_deactivated_plugins' ); $site_deactivated_plugins = array(); if ( false === $blog_deactivated_plugins ) { // Option not in database, add an empty array to avoid extra DB queries on subsequent loads. update_option( 'wp_force_deactivated_plugins', array() ); } if ( is_multisite() ) { $site_deactivated_plugins = get_site_option( 'wp_force_deactivated_plugins' ); if ( false === $site_deactivated_plugins ) { // Option not in database, add an empty array to avoid extra DB queries on subsequent loads. update_site_option( 'wp_force_deactivated_plugins', array() ); } } if ( empty( $blog_deactivated_plugins ) && empty( $site_deactivated_plugins ) ) { // No deactivated plugins. return; } $deactivated_plugins = array_merge( $blog_deactivated_plugins, $site_deactivated_plugins ); foreach ( $deactivated_plugins as $plugin ) { if ( ! empty( $plugin['version_compatible'] ) && ! empty( $plugin['version_deactivated'] ) ) { $explanation = sprintf( /* translators: 1: Name of deactivated plugin, 2: Plugin version deactivated, 3: Current WP version, 4: Compatible plugin version. */ __( '%1$s %2$s was deactivated due to incompatibility with WordPress %3$s, please upgrade to %1$s %4$s or later.' ), $plugin['plugin_name'], $plugin['version_deactivated'], $GLOBALS['wp_version'], $plugin['version_compatible'] ); } else { $explanation = sprintf( /* translators: 1: Name of deactivated plugin, 2: Plugin version deactivated, 3: Current WP version. */ __( '%1$s %2$s was deactivated due to incompatibility with WordPress %3$s.' ), $plugin['plugin_name'], ! empty( $plugin['version_deactivated'] ) ? $plugin['version_deactivated'] : '', $GLOBALS['wp_version'], $plugin['version_compatible'] ); } printf( '<div class="notice notice-warning"><p><strong>%s</strong><br>%s</p><p><a href="%s">%s</a></p></div>', sprintf( /* translators: %s: Name of deactivated plugin. */ __( '%s plugin deactivated during WordPress upgrade.' ), $plugin['plugin_name'] ), $explanation, esc_url( admin_url( 'plugins.php?plugin_status=inactive' ) ), __( 'Go to the Plugins screen' ) ); } // Empty the options. update_option( 'wp_force_deactivated_plugins', array() ); if ( is_multisite() ) { update_site_option( 'wp_force_deactivated_plugins', array() ); } } ``` | Uses | Description | | --- | --- | | [update\_site\_option()](update_site_option) wp-includes/option.php | Updates the value of an option that was already added for the current network. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [is\_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. | | [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Version | Description | | --- | --- | | [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. | wordpress wp_auth_check( array $response ): array wp\_auth\_check( array $response ): array ========================================= Checks whether a user is still logged in, for the heartbeat. Send a result that shows a log-in box if the user is no longer logged in, or if their cookie is within the grace period. `$response` array Required The Heartbeat response. array The Heartbeat response with `'wp-auth-check'` value set. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp_auth_check( $response ) { $response['wp-auth-check'] = is_user_logged_in() && empty( $GLOBALS['login_grace_period'] ); return $response; } ``` | Uses | Description | | --- | --- | | [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress upload_is_file_too_big( array $upload ): string|array upload\_is\_file\_too\_big( array $upload ): string|array ========================================================= Checks whether an upload is too big. `$upload` array Required string|array If the upload is under the size limit, $upload is returned. Otherwise returns an error message. File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/) ``` function upload_is_file_too_big( $upload ) { if ( ! is_array( $upload ) || defined( 'WP_IMPORTING' ) || get_site_option( 'upload_space_check_disabled' ) ) { return $upload; } if ( strlen( $upload['bits'] ) > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) { /* translators: %s: Maximum allowed file size in kilobytes. */ return sprintf( __( 'This file is too big. Files must be less than %s KB in size.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ) ); } return $upload; } ``` | Uses | Description | | --- | --- | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [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 | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
programming_docs
wordpress wp_richedit_pre( string $text ): string wp\_richedit\_pre( string $text ): string ========================================= This function has been deprecated. Use [format\_for\_editor()](format_for_editor) instead. Formats text for the rich text editor. The [‘richedit\_pre’](../hooks/richedit_pre) filter is applied here. If `$text` is empty the filter will be applied to an empty string. * [format\_for\_editor()](format_for_editor) `$text` string Required The text to be formatted. string The formatted text after filter is applied. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function wp_richedit_pre($text) { _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); if ( empty( $text ) ) { /** * Filters text returned for the rich text editor. * * This filter is first evaluated, and the value returned, if an empty string * is passed to wp_richedit_pre(). If an empty string is passed, it results * in a break tag and line feed. * * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre() * return after being formatted. * * @since 2.0.0 * @deprecated 4.3.0 * * @param string $output Text for the rich text editor. */ return apply_filters( 'richedit_pre', '' ); } $output = convert_chars($text); $output = wpautop($output); $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); /** This filter is documented in wp-includes/deprecated.php */ return apply_filters( 'richedit_pre', $output ); } ``` [apply\_filters( 'richedit\_pre', string $output )](../hooks/richedit_pre) Filters text returned for the rich text editor. | Uses | Description | | --- | --- | | [convert\_chars()](convert_chars) wp-includes/formatting.php | Converts lone & characters into `&#038;` (a.k.a. `&amp;`) | | [wpautop()](wpautop) wp-includes/formatting.php | Replaces double line breaks with paragraph elements. | | [\_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\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Version | Description | | --- | --- | | [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Use [format\_for\_editor()](format_for_editor) | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress wp_schedule_delete_old_privacy_export_files() wp\_schedule\_delete\_old\_privacy\_export\_files() =================================================== Schedules a `WP_Cron` job to delete expired export files. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp_schedule_delete_old_privacy_export_files() { if ( wp_installing() ) { return; } if ( ! wp_next_scheduled( 'wp_privacy_delete_old_export_files' ) ) { wp_schedule_event( time(), 'hourly', 'wp_privacy_delete_old_export_files' ); } } ``` | 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 | | --- | --- | | [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. | wordpress wxr_term_meta( WP_Term $term ) wxr\_term\_meta( WP\_Term $term ) ================================= Outputs term meta XML tags for a given term object. `$term` [WP\_Term](../classes/wp_term) Required Term object. File: `wp-admin/includes/export.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/export.php/) ``` function wxr_term_meta( $term ) { global $wpdb; $termmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->termmeta WHERE term_id = %d", $term->term_id ) ); foreach ( $termmeta as $meta ) { /** * Filters whether to selectively skip term meta used for WXR exports. * * Returning a truthy value from the filter will skip the current meta * object from being exported. * * @since 4.6.0 * * @param bool $skip Whether to skip the current piece of term meta. Default false. * @param string $meta_key Current meta key. * @param object $meta Current meta object. */ if ( ! apply_filters( 'wxr_export_skip_termmeta', false, $meta->meta_key, $meta ) ) { printf( "\t\t<wp:termmeta>\n\t\t\t<wp:meta_key>%s</wp:meta_key>\n\t\t\t<wp:meta_value>%s</wp:meta_value>\n\t\t</wp:termmeta>\n", wxr_cdata( $meta->meta_key ), wxr_cdata( $meta->meta_value ) ); } } } ``` [apply\_filters( 'wxr\_export\_skip\_termmeta', bool $skip, string $meta\_key, object $meta )](../hooks/wxr_export_skip_termmeta) Filters whether to selectively skip term meta used for WXR exports. | Uses | Description | | --- | --- | | [wxr\_cdata()](wxr_cdata) wp-admin/includes/export.php | Wraps given string in XML CDATA tag. | | [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 | | --- | --- | | [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. | | Version | Description | | --- | --- | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. | wordpress do_activate_header() do\_activate\_header() ====================== Adds an action hook specific to this page. Fires on [‘wp\_head’](../hooks/wp_head). File: `wp-activate.php`. [View all references](https://developer.wordpress.org/reference/files/wp-activate.php/) ``` function do_activate_header() { /** * Fires before the Site Activation page is loaded. * * Fires on the {@see 'wp_head'} action. * * @since 3.0.0 */ do_action( 'activate_wp_head' ); } ``` [do\_action( 'activate\_wp\_head' )](../hooks/activate_wp_head) Fires before the Site Activation page is loaded. | Uses | Description | | --- | --- | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress wp_update_plugin( $plugin, $feedback = '' ) wp\_update\_plugin( $plugin, $feedback = '' ) ============================================= This function has been deprecated. Use [Plugin\_Upgrader](../classes/plugin_upgrader)() instead. This was once used to kick-off the Plugin Updater. Deprecated in favor of instantating a [Plugin\_Upgrader](../classes/plugin_upgrader) instance directly, and calling the ‘upgrade’ method. Unused since 2.8.0. * [Plugin\_Upgrader](../classes/plugin_upgrader) File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/) ``` function wp_update_plugin($plugin, $feedback = '') { _deprecated_function( __FUNCTION__, '3.7.0', 'new Plugin_Upgrader();' ); if ( !empty($feedback) ) add_filter('update_feedback', $feedback); require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $upgrader = new Plugin_Upgrader(); return $upgrader->upgrade($plugin); } ``` | 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 [Plugin\_Upgrader](../classes/plugin_upgrader) | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress map_meta_cap( string $cap, int $user_id, mixed $args ): string[] map\_meta\_cap( string $cap, int $user\_id, mixed $args ): string[] =================================================================== Maps a capability to the primitive capabilities required of the given user to satisfy the capability being checked. This function also accepts an ID of an object to map against if the capability is a meta capability. Meta capabilities such as `edit_post` and `edit_user` are capabilities used by this function to map to primitive capabilities that a user or role requires, such as `edit_posts` and `edit_others_posts`. Example usage: ``` map_meta_cap( 'edit_posts', $user->ID ); map_meta_cap( 'edit_post', $user->ID, $post->ID ); map_meta_cap( 'edit_post_meta', $user->ID, $post->ID, $meta_key ); ``` This function does not check whether the user has the required capabilities, it just returns what the required capabilities are. `$cap` string Required Capability being checked. `$user_id` int Required User ID. `$args` mixed Optional further parameters, typically starting with an object ID. string[] Primitive capabilities required of the user. File: `wp-includes/capabilities.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/capabilities.php/) ``` function map_meta_cap( $cap, $user_id, ...$args ) { $caps = array(); switch ( $cap ) { case 'remove_user': // In multisite the user must be a super admin to remove themselves. if ( isset( $args[0] ) && $user_id == $args[0] && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'remove_users'; } break; case 'promote_user': case 'add_users': $caps[] = 'promote_users'; break; case 'edit_user': case 'edit_users': // Allow user to edit themselves. if ( 'edit_user' === $cap && isset( $args[0] ) && $user_id == $args[0] ) { break; } // In multisite the user must have manage_network_users caps. If editing a super admin, the user must be a super admin. if ( is_multisite() && ( ( ! is_super_admin( $user_id ) && 'edit_user' === $cap && is_super_admin( $args[0] ) ) || ! user_can( $user_id, 'manage_network_users' ) ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'edit_users'; // edit_user maps to edit_users. } break; case 'delete_post': case 'delete_page': if ( ! isset( $args[0] ) ) { if ( 'delete_post' === $cap ) { /* translators: %s: Capability name. */ $message = __( 'When checking for the %s capability, you must always check it against a specific post.' ); } else { /* translators: %s: Capability name. */ $message = __( 'When checking for the %s capability, you must always check it against a specific page.' ); } _doing_it_wrong( __FUNCTION__, sprintf( $message, '<code>' . $cap . '</code>' ), '6.1.0' ); $caps[] = 'do_not_allow'; break; } $post = get_post( $args[0] ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } if ( 'revision' === $post->post_type ) { $caps[] = 'do_not_allow'; break; } if ( ( get_option( 'page_for_posts' ) == $post->ID ) || ( get_option( 'page_on_front' ) == $post->ID ) ) { $caps[] = 'manage_options'; break; } $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type ) { /* translators: 1: Post type, 2: Capability name. */ $message = __( 'The post type %1$s is not registered, so it may not be reliable to check the capability %2$s against a post of that type.' ); _doing_it_wrong( __FUNCTION__, sprintf( $message, '<code>' . $post->post_type . '</code>', '<code>' . $cap . '</code>' ), '4.4.0' ); $caps[] = 'edit_others_posts'; break; } if ( ! $post_type->map_meta_cap ) { $caps[] = $post_type->cap->$cap; // Prior to 3.1 we would re-call map_meta_cap here. if ( 'delete_post' === $cap ) { $cap = $post_type->cap->$cap; } break; } // If the post author is set and the user is the author... if ( $post->post_author && $user_id == $post->post_author ) { // If the post is published or scheduled... if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->delete_published_posts; } elseif ( 'trash' === $post->post_status ) { $status = get_post_meta( $post->ID, '_wp_trash_meta_status', true ); if ( in_array( $status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->delete_published_posts; } else { $caps[] = $post_type->cap->delete_posts; } } else { // If the post is draft... $caps[] = $post_type->cap->delete_posts; } } else { // The user is trying to edit someone else's post. $caps[] = $post_type->cap->delete_others_posts; // The post is published or scheduled, extra cap required. if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->delete_published_posts; } elseif ( 'private' === $post->post_status ) { $caps[] = $post_type->cap->delete_private_posts; } } /* * Setting the privacy policy page requires `manage_privacy_options`, * so deleting it should require that too. */ if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) { $caps = array_merge( $caps, map_meta_cap( 'manage_privacy_options', $user_id ) ); } break; // edit_post breaks down to edit_posts, edit_published_posts, or // edit_others_posts. case 'edit_post': case 'edit_page': if ( ! isset( $args[0] ) ) { if ( 'edit_post' === $cap ) { /* translators: %s: Capability name. */ $message = __( 'When checking for the %s capability, you must always check it against a specific post.' ); } else { /* translators: %s: Capability name. */ $message = __( 'When checking for the %s capability, you must always check it against a specific page.' ); } _doing_it_wrong( __FUNCTION__, sprintf( $message, '<code>' . $cap . '</code>' ), '6.1.0' ); $caps[] = 'do_not_allow'; break; } $post = get_post( $args[0] ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } if ( 'revision' === $post->post_type ) { $post = get_post( $post->post_parent ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } } $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type ) { /* translators: 1: Post type, 2: Capability name. */ $message = __( 'The post type %1$s is not registered, so it may not be reliable to check the capability %2$s against a post of that type.' ); _doing_it_wrong( __FUNCTION__, sprintf( $message, '<code>' . $post->post_type . '</code>', '<code>' . $cap . '</code>' ), '4.4.0' ); $caps[] = 'edit_others_posts'; break; } if ( ! $post_type->map_meta_cap ) { $caps[] = $post_type->cap->$cap; // Prior to 3.1 we would re-call map_meta_cap here. if ( 'edit_post' === $cap ) { $cap = $post_type->cap->$cap; } break; } // If the post author is set and the user is the author... if ( $post->post_author && $user_id == $post->post_author ) { // If the post is published or scheduled... if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->edit_published_posts; } elseif ( 'trash' === $post->post_status ) { $status = get_post_meta( $post->ID, '_wp_trash_meta_status', true ); if ( in_array( $status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->edit_published_posts; } else { $caps[] = $post_type->cap->edit_posts; } } else { // If the post is draft... $caps[] = $post_type->cap->edit_posts; } } else { // The user is trying to edit someone else's post. $caps[] = $post_type->cap->edit_others_posts; // The post is published or scheduled, extra cap required. if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->edit_published_posts; } elseif ( 'private' === $post->post_status ) { $caps[] = $post_type->cap->edit_private_posts; } } /* * Setting the privacy policy page requires `manage_privacy_options`, * so editing it should require that too. */ if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) { $caps = array_merge( $caps, map_meta_cap( 'manage_privacy_options', $user_id ) ); } break; case 'read_post': case 'read_page': if ( ! isset( $args[0] ) ) { if ( 'read_post' === $cap ) { /* translators: %s: Capability name. */ $message = __( 'When checking for the %s capability, you must always check it against a specific post.' ); } else { /* translators: %s: Capability name. */ $message = __( 'When checking for the %s capability, you must always check it against a specific page.' ); } _doing_it_wrong( __FUNCTION__, sprintf( $message, '<code>' . $cap . '</code>' ), '6.1.0' ); $caps[] = 'do_not_allow'; break; } $post = get_post( $args[0] ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } if ( 'revision' === $post->post_type ) { $post = get_post( $post->post_parent ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } } $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type ) { /* translators: 1: Post type, 2: Capability name. */ $message = __( 'The post type %1$s is not registered, so it may not be reliable to check the capability %2$s against a post of that type.' ); _doing_it_wrong( __FUNCTION__, sprintf( $message, '<code>' . $post->post_type . '</code>', '<code>' . $cap . '</code>' ), '4.4.0' ); $caps[] = 'edit_others_posts'; break; } if ( ! $post_type->map_meta_cap ) { $caps[] = $post_type->cap->$cap; // Prior to 3.1 we would re-call map_meta_cap here. if ( 'read_post' === $cap ) { $cap = $post_type->cap->$cap; } break; } $status_obj = get_post_status_object( get_post_status( $post ) ); if ( ! $status_obj ) { /* translators: 1: Post status, 2: Capability name. */ $message = __( 'The post status %1$s is not registered, so it may not be reliable to check the capability %2$s against a post with that status.' ); _doing_it_wrong( __FUNCTION__, sprintf( $message, '<code>' . get_post_status( $post ) . '</code>', '<code>' . $cap . '</code>' ), '5.4.0' ); $caps[] = 'edit_others_posts'; break; } if ( $status_obj->public ) { $caps[] = $post_type->cap->read; break; } if ( $post->post_author && $user_id == $post->post_author ) { $caps[] = $post_type->cap->read; } elseif ( $status_obj->private ) { $caps[] = $post_type->cap->read_private_posts; } else { $caps = map_meta_cap( 'edit_post', $user_id, $post->ID ); } break; case 'publish_post': if ( ! isset( $args[0] ) ) { /* translators: %s: Capability name. */ $message = __( 'When checking for the %s capability, you must always check it against a specific post.' ); _doing_it_wrong( __FUNCTION__, sprintf( $message, '<code>' . $cap . '</code>' ), '6.1.0' ); $caps[] = 'do_not_allow'; break; } $post = get_post( $args[0] ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type ) { /* translators: 1: Post type, 2: Capability name. */ $message = __( 'The post type %1$s is not registered, so it may not be reliable to check the capability %2$s against a post of that type.' ); _doing_it_wrong( __FUNCTION__, sprintf( $message, '<code>' . $post->post_type . '</code>', '<code>' . $cap . '</code>' ), '4.4.0' ); $caps[] = 'edit_others_posts'; break; } $caps[] = $post_type->cap->publish_posts; break; case 'edit_post_meta': case 'delete_post_meta': case 'add_post_meta': case 'edit_comment_meta': case 'delete_comment_meta': case 'add_comment_meta': case 'edit_term_meta': case 'delete_term_meta': case 'add_term_meta': case 'edit_user_meta': case 'delete_user_meta': case 'add_user_meta': $object_type = explode( '_', $cap )[1]; if ( ! isset( $args[0] ) ) { if ( 'post' === $object_type ) { /* translators: %s: Capability name. */ $message = __( 'When checking for the %s capability, you must always check it against a specific post.' ); } elseif ( 'comment' === $object_type ) { /* translators: %s: Capability name. */ $message = __( 'When checking for the %s capability, you must always check it against a specific comment.' ); } elseif ( 'term' === $object_type ) { /* translators: %s: Capability name. */ $message = __( 'When checking for the %s capability, you must always check it against a specific term.' ); } else { /* translators: %s: Capability name. */ $message = __( 'When checking for the %s capability, you must always check it against a specific user.' ); } _doing_it_wrong( __FUNCTION__, sprintf( $message, '<code>' . $cap . '</code>' ), '6.1.0' ); $caps[] = 'do_not_allow'; break; } $object_id = (int) $args[0]; $object_subtype = get_object_subtype( $object_type, $object_id ); if ( empty( $object_subtype ) ) { $caps[] = 'do_not_allow'; break; } $caps = map_meta_cap( "edit_{$object_type}", $user_id, $object_id ); $meta_key = isset( $args[1] ) ? $args[1] : false; if ( $meta_key ) { $allowed = ! is_protected_meta( $meta_key, $object_type ); if ( ! empty( $object_subtype ) && has_filter( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}" ) ) { /** * Filters whether the user is allowed to edit a specific meta key of a specific object 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 bool $allowed Whether the user can add the object meta. Default false. * @param string $meta_key The meta key. * @param int $object_id Object ID. * @param int $user_id User ID. * @param string $cap Capability name. * @param string[] $caps Array of the user's capabilities. */ $allowed = apply_filters( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $allowed, $meta_key, $object_id, $user_id, $cap, $caps ); } else { /** * Filters whether the user is allowed to edit a specific meta key of a specific object type. * * Return true to have the mapped meta caps from `edit_{$object_type}` apply. * * The dynamic portion of the hook name, `$object_type` refers to the object type being filtered. * The dynamic portion of the hook name, `$meta_key`, refers to the meta key passed to map_meta_cap(). * * @since 3.3.0 As `auth_post_meta_{$meta_key}`. * @since 4.6.0 * * @param bool $allowed Whether the user can add the object meta. Default false. * @param string $meta_key The meta key. * @param int $object_id Object ID. * @param int $user_id User ID. * @param string $cap Capability name. * @param string[] $caps Array of the user's capabilities. */ $allowed = apply_filters( "auth_{$object_type}_meta_{$meta_key}", $allowed, $meta_key, $object_id, $user_id, $cap, $caps ); } if ( ! empty( $object_subtype ) ) { /** * Filters whether the user is allowed to edit meta for specific object types/subtypes. * * Return true to have the mapped meta caps from `edit_{$object_type}` apply. * * The dynamic portion of the hook name, `$object_type` refers to the object type being filtered. * The dynamic portion of the hook name, `$object_subtype` refers to the object subtype being filtered. * The dynamic portion of the hook name, `$meta_key`, refers to the meta key passed to map_meta_cap(). * * @since 4.6.0 As `auth_post_{$post_type}_meta_{$meta_key}`. * @since 4.7.0 Renamed from `auth_post_{$post_type}_meta_{$meta_key}` to * `auth_{$object_type}_{$object_subtype}_meta_{$meta_key}`. * @deprecated 4.9.8 Use {@see 'auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}'} instead. * * @param bool $allowed Whether the user can add the object meta. Default false. * @param string $meta_key The meta key. * @param int $object_id Object ID. * @param int $user_id User ID. * @param string $cap Capability name. * @param string[] $caps Array of the user's capabilities. */ $allowed = apply_filters_deprecated( "auth_{$object_type}_{$object_subtype}_meta_{$meta_key}", array( $allowed, $meta_key, $object_id, $user_id, $cap, $caps ), '4.9.8', "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}" ); } if ( ! $allowed ) { $caps[] = $cap; } } break; case 'edit_comment': if ( ! isset( $args[0] ) ) { /* translators: %s: Capability name. */ $message = __( 'When checking for the %s capability, you must always check it against a specific comment.' ); _doing_it_wrong( __FUNCTION__, sprintf( $message, '<code>' . $cap . '</code>' ), '6.1.0' ); $caps[] = 'do_not_allow'; break; } $comment = get_comment( $args[0] ); if ( ! $comment ) { $caps[] = 'do_not_allow'; break; } $post = get_post( $comment->comment_post_ID ); /* * If the post doesn't exist, we have an orphaned comment. * Fall back to the edit_posts capability, instead. */ if ( $post ) { $caps = map_meta_cap( 'edit_post', $user_id, $post->ID ); } else { $caps = map_meta_cap( 'edit_posts', $user_id ); } break; case 'unfiltered_upload': if ( defined( 'ALLOW_UNFILTERED_UPLOADS' ) && ALLOW_UNFILTERED_UPLOADS && ( ! is_multisite() || is_super_admin( $user_id ) ) ) { $caps[] = $cap; } else { $caps[] = 'do_not_allow'; } break; case 'edit_css': case 'unfiltered_html': // Disallow unfiltered_html for all users, even admins and super admins. if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) { $caps[] = 'do_not_allow'; } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'unfiltered_html'; } break; case 'edit_files': case 'edit_plugins': case 'edit_themes': // Disallow the file editors. if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) { $caps[] = 'do_not_allow'; } elseif ( ! wp_is_file_mod_allowed( 'capability_edit_themes' ) ) { $caps[] = 'do_not_allow'; } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = $cap; } break; case 'update_plugins': case 'delete_plugins': case 'install_plugins': case 'upload_plugins': case 'update_themes': case 'delete_themes': case 'install_themes': case 'upload_themes': case 'update_core': // Disallow anything that creates, deletes, or updates core, plugin, or theme files. // Files in uploads are excepted. if ( ! wp_is_file_mod_allowed( 'capability_update_core' ) ) { $caps[] = 'do_not_allow'; } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } elseif ( 'upload_themes' === $cap ) { $caps[] = 'install_themes'; } elseif ( 'upload_plugins' === $cap ) { $caps[] = 'install_plugins'; } else { $caps[] = $cap; } break; case 'install_languages': case 'update_languages': if ( ! wp_is_file_mod_allowed( 'can_install_language_pack' ) ) { $caps[] = 'do_not_allow'; } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'install_languages'; } break; case 'activate_plugins': case 'deactivate_plugins': case 'activate_plugin': case 'deactivate_plugin': $caps[] = 'activate_plugins'; if ( is_multisite() ) { // update_, install_, and delete_ are handled above with is_super_admin(). $menu_perms = get_site_option( 'menu_items', array() ); if ( empty( $menu_perms['plugins'] ) ) { $caps[] = 'manage_network_plugins'; } } break; case 'resume_plugin': $caps[] = 'resume_plugins'; break; case 'resume_theme': $caps[] = 'resume_themes'; break; case 'delete_user': case 'delete_users': // If multisite only super admins can delete users. if ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'delete_users'; // delete_user maps to delete_users. } break; case 'create_users': if ( ! is_multisite() ) { $caps[] = $cap; } elseif ( is_super_admin( $user_id ) || get_site_option( 'add_new_users' ) ) { $caps[] = $cap; } else { $caps[] = 'do_not_allow'; } break; case 'manage_links': if ( get_option( 'link_manager_enabled' ) ) { $caps[] = $cap; } else { $caps[] = 'do_not_allow'; } break; case 'customize': $caps[] = 'edit_theme_options'; break; case 'delete_site': if ( is_multisite() ) { $caps[] = 'manage_options'; } else { $caps[] = 'do_not_allow'; } break; case 'edit_term': case 'delete_term': case 'assign_term': if ( ! isset( $args[0] ) ) { /* translators: %s: Capability name. */ $message = __( 'When checking for the %s capability, you must always check it against a specific term.' ); _doing_it_wrong( __FUNCTION__, sprintf( $message, '<code>' . $cap . '</code>' ), '6.1.0' ); $caps[] = 'do_not_allow'; break; } $term_id = (int) $args[0]; $term = get_term( $term_id ); if ( ! $term || is_wp_error( $term ) ) { $caps[] = 'do_not_allow'; break; } $tax = get_taxonomy( $term->taxonomy ); if ( ! $tax ) { $caps[] = 'do_not_allow'; break; } if ( 'delete_term' === $cap && ( get_option( 'default_' . $term->taxonomy ) == $term->term_id || get_option( 'default_term_' . $term->taxonomy ) == $term->term_id ) ) { $caps[] = 'do_not_allow'; break; } $taxo_cap = $cap . 's'; $caps = map_meta_cap( $tax->cap->$taxo_cap, $user_id, $term_id ); break; case 'manage_post_tags': case 'edit_categories': case 'edit_post_tags': case 'delete_categories': case 'delete_post_tags': $caps[] = 'manage_categories'; break; case 'assign_categories': case 'assign_post_tags': $caps[] = 'edit_posts'; break; case 'create_sites': case 'delete_sites': case 'manage_network': case 'manage_sites': case 'manage_network_users': case 'manage_network_plugins': case 'manage_network_themes': case 'manage_network_options': case 'upgrade_network': $caps[] = $cap; break; case 'setup_network': if ( is_multisite() ) { $caps[] = 'manage_network_options'; } else { $caps[] = 'manage_options'; } break; case 'update_php': if ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'update_core'; } break; case 'update_https': if ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'manage_options'; $caps[] = 'update_core'; } break; case 'export_others_personal_data': case 'erase_others_personal_data': case 'manage_privacy_options': $caps[] = is_multisite() ? 'manage_network' : 'manage_options'; break; case 'create_app_password': case 'list_app_passwords': case 'read_app_password': case 'edit_app_password': case 'delete_app_passwords': case 'delete_app_password': $caps = map_meta_cap( 'edit_user', $user_id, $args[0] ); break; default: // Handle meta capabilities for custom post types. global $post_type_meta_caps; if ( isset( $post_type_meta_caps[ $cap ] ) ) { return map_meta_cap( $post_type_meta_caps[ $cap ], $user_id, ...$args ); } // Block capabilities map to their post equivalent. $block_caps = array( 'edit_blocks', 'edit_others_blocks', 'publish_blocks', 'read_private_blocks', 'delete_blocks', 'delete_private_blocks', 'delete_published_blocks', 'delete_others_blocks', 'edit_private_blocks', 'edit_published_blocks', ); if ( in_array( $cap, $block_caps, true ) ) { $cap = str_replace( '_blocks', '_posts', $cap ); } // If no meta caps match, return the original cap. $caps[] = $cap; } /** * Filters the primitive capabilities required of the given user to satisfy the * capability being checked. * * @since 2.8.0 * * @param string[] $caps Primitive capabilities required of the user. * @param string $cap Capability being checked. * @param int $user_id The user ID. * @param array $args Adds context to the capability check, typically * starting with an object ID. */ return apply_filters( 'map_meta_cap', $caps, $cap, $user_id, $args ); } ``` [apply\_filters( "auth\_{$object\_type}\_meta\_{$meta\_key}", bool $allowed, string $meta\_key, int $object\_id, int $user\_id, string $cap, string[] $caps )](../hooks/auth_object_type_meta_meta_key) Filters whether the user is allowed to edit a specific meta key of a specific object type. [apply\_filters( "auth\_{$object\_type}\_meta\_{$meta\_key}\_for\_{$object\_subtype}", bool $allowed, string $meta\_key, int $object\_id, int $user\_id, string $cap, string[] $caps )](../hooks/auth_object_type_meta_meta_key_for_object_subtype) Filters whether the user is allowed to edit a specific meta key of a specific object type and subtype. [apply\_filters\_deprecated( "auth\_{$object\_type}\_{$object\_subtype}\_meta\_{$meta\_key}", bool $allowed, string $meta\_key, int $object\_id, int $user\_id, string $cap, string[] $caps )](../hooks/auth_object_type_object_subtype_meta_meta_key) Filters whether the user is allowed to edit meta for specific object types/subtypes. [apply\_filters( 'map\_meta\_cap', string[] $caps, string $cap, int $user\_id, array $args )](../hooks/map_meta_cap) Filters the primitive capabilities required of the given user to satisfy the capability being checked. | Uses | Description | | --- | --- | | [get\_object\_subtype()](get_object_subtype) wp-includes/meta.php | Returns the object subtype for a given object ID of a specific type. | | [wp\_is\_file\_mod\_allowed()](wp_is_file_mod_allowed) wp-includes/load.php | Determines whether file modifications are allowed. | | [is\_protected\_meta()](is_protected_meta) wp-includes/meta.php | Determines whether a meta key is considered protected. | | [get\_post\_status()](get_post_status) wp-includes/post.php | Retrieves the post status based on the post ID. | | [get\_post\_status\_object()](get_post_status_object) wp-includes/post.php | Retrieves a post status object by name. | | [has\_filter()](has_filter) wp-includes/plugin.php | Checks if any filter has been registered for a hook. | | [apply\_filters\_deprecated()](apply_filters_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated filter hook. | | [is\_super\_admin()](is_super_admin) wp-includes/capabilities.php | Determines whether user is a site 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. | | [user\_can()](user_can) wp-includes/capabilities.php | Returns whether a particular user has the specified capability. | | [\_\_()](__) 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. | | [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. | | [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. | | [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. | | [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. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. | | [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. | | [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [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\_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. | | Version | Description | | --- | --- | | [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Added the `create_app_password`, `list_app_passwords`, `read_app_password`, `edit_app_password`, `delete_app_passwords`, `delete_app_password`, and `update_https` capabilities. | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Formalized the existing and already documented `...$args` parameter by adding it to the function signature. | | [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Added the `resume_plugin` and `resume_theme` capabilities. | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Added the `update_php` capability. | | [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Added the `export_others_personal_data`, `erase_others_personal_data`, and `manage_privacy_options` capabilities. | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
programming_docs
wordpress wp_nonce_tick( string|int $action = -1 ): float wp\_nonce\_tick( string|int $action = -1 ): float ================================================= Returns the time-dependent variable for nonce creation. A nonce has a lifespan of two ticks. Nonces in their second tick may be updated, e.g. by autosave. `$action` string|int Optional The nonce action. Default: `-1` float Float value rounded up to the next highest integer. File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/) ``` function wp_nonce_tick( $action = -1 ) { /** * Filters the lifespan of nonces in seconds. * * @since 2.5.0 * @since 6.1.0 Added `$action` argument to allow for more targeted filters. * * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds, or one day. * @param string|int $action The nonce action, or -1 if none was provided. */ $nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS, $action ); return ceil( time() / ( $nonce_life / 2 ) ); } ``` [apply\_filters( 'nonce\_life', int $lifespan, string|int $action )](../hooks/nonce_life) Filters the lifespan of nonces in seconds. | 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\_verify\_nonce()](wp_verify_nonce) wp-includes/pluggable.php | Verifies that a correct security nonce was used with time limit. | | [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. | | Version | Description | | --- | --- | | [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Added `$action` argument. | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress refresh_blog_details( int $blog_id ) refresh\_blog\_details( int $blog\_id ) ======================================= Clear the blog details cache. `$blog_id` int Optional Blog ID. Defaults to current blog. File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/) ``` function refresh_blog_details( $blog_id = 0 ) { $blog_id = (int) $blog_id; if ( ! $blog_id ) { $blog_id = get_current_blog_id(); } clean_blog_cache( $blog_id ); } ``` | Uses | Description | | --- | --- | | [clean\_blog\_cache()](clean_blog_cache) wp-includes/ms-site.php | Clean the blog cache | | [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress wp_get_sitemap_providers(): WP_Sitemaps_Provider[] wp\_get\_sitemap\_providers(): WP\_Sitemaps\_Provider[] ======================================================= Gets an array of sitemap providers. [WP\_Sitemaps\_Provider](../classes/wp_sitemaps_provider)[] Array of sitemap providers. File: `wp-includes/sitemaps.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/sitemaps.php/) ``` function wp_get_sitemap_providers() { $sitemaps = wp_sitemaps_get_server(); return $sitemaps->registry->get_providers(); } ``` | Uses | Description | | --- | --- | | [wp\_sitemaps\_get\_server()](wp_sitemaps_get_server) wp-includes/sitemaps.php | Retrieves the current Sitemaps server instance. | | Version | Description | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. | wordpress update_term_cache( WP_Term[] $terms, string $taxonomy = '' ) update\_term\_cache( WP\_Term[] $terms, string $taxonomy = '' ) =============================================================== Updates terms in cache. `$terms` [WP\_Term](../classes/wp_term)[] Required Array of term objects to change. `$taxonomy` string Optional Not used. Default: `''` File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/) ``` function update_term_cache( $terms, $taxonomy = '' ) { $data = array(); foreach ( (array) $terms as $term ) { // Create a copy in case the array was passed by reference. $_term = clone $term; // Object ID should not be cached. unset( $_term->object_id ); $data[ $term->term_id ] = $_term; } wp_cache_add_multiple( $data, 'terms' ); } ``` | Uses | Description | | --- | --- | | [wp\_cache\_add\_multiple()](wp_cache_add_multiple) wp-includes/cache.php | Adds multiple values to the cache in one call. | | Used By | Description | | --- | --- | | [\_prime\_term\_caches()](_prime_term_caches) wp-includes/taxonomy.php | Adds any terms from the given IDs to the cache that do not already exist in cache. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress has_custom_header(): bool has\_custom\_header(): bool =========================== Checks whether a custom header is set or not. bool True if a custom header is set. False if not. File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/) ``` function has_custom_header() { if ( has_header_image() || ( has_header_video() && is_header_video_active() ) ) { return true; } return false; } ``` | Uses | Description | | --- | --- | | [has\_header\_video()](has_header_video) wp-includes/theme.php | Checks whether a header video is set or not. | | [is\_header\_video\_active()](is_header_video_active) wp-includes/theme.php | Checks whether the custom header video is eligible to show on the current page. | | [has\_header\_image()](has_header_image) wp-includes/theme.php | Checks whether a header image is set or not. | | Used By | Description | | --- | --- | | [get\_custom\_header\_markup()](get_custom_header_markup) wp-includes/theme.php | Retrieves the markup for a custom header. | | Version | Description | | --- | --- | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. | wordpress tag_escape( string $tag_name ): string tag\_escape( string $tag\_name ): string ======================================== Escapes an HTML tag name. `$tag_name` string Required string File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function tag_escape( $tag_name ) { $safe_tag = strtolower( preg_replace( '/[^a-zA-Z0-9_:]/', '', $tag_name ) ); /** * Filters a string cleaned and escaped for output as an HTML tag. * * @since 2.8.0 * * @param string $safe_tag The tag name after it has been escaped. * @param string $tag_name The text before it was escaped. */ return apply_filters( 'tag_escape', $safe_tag, $tag_name ); } ``` [apply\_filters( 'tag\_escape', string $safe\_tag, string $tag\_name )](../hooks/tag_escape) Filters a string cleaned and escaped for output as an HTML tag. | 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\_tag\_regex()](get_tag_regex) wp-includes/functions.php | Returns RegEx body to liberally match an opening HTML tag. | | [gallery\_shortcode()](gallery_shortcode) wp-includes/media.php | Builds the Gallery shortcode output. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress self_link() self\_link() ============ Displays the link for the currently displayed feed in a XSS safe way. Generate a 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 self_link() { /** * Filters the current feed URL. * * @since 3.6.0 * * @see set_url_scheme() * @see wp_unslash() * * @param string $feed_link The link for the feed with set URL scheme. */ echo esc_url( apply_filters( 'self_link', get_self_link() ) ); } ``` [apply\_filters( 'self\_link', string $feed\_link )](../hooks/self_link) Filters the current feed URL. | Uses | Description | | --- | --- | | [get\_self\_link()](get_self_link) wp-includes/feed.php | Returns the link for the currently displayed feed. | | [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.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress wp_admin_css_color( string $key, string $name, string $url, array $colors = array(), array $icons = array() ) wp\_admin\_css\_color( string $key, string $name, string $url, array $colors = array(), array $icons = array() ) ================================================================================================================ Registers an admin color scheme css file. Allows a plugin to register a new admin color scheme. For example: ``` wp_admin_css_color( 'classic', __( 'Classic' ), admin_url( "css/colors-classic.css" ), array( '#07273E', '#14568A', '#D54E21', '#2683AE' ) ); ``` `$key` string Required The unique key for this theme. `$name` string Required The name of the theme. `$url` string Required The URL of the CSS file containing the color scheme. `$colors` array Optional An array of CSS color definition strings which are used to give the user a feel for the theme. Default: `array()` `$icons` array Optional CSS color definitions used to color any SVG icons. * `base`stringSVG icon base color. * `focus`stringSVG icon color on focus. * `current`stringSVG icon color of current admin menu link. Default: `array()` File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) { global $_wp_admin_css_colors; if ( ! isset( $_wp_admin_css_colors ) ) { $_wp_admin_css_colors = array(); } $_wp_admin_css_colors[ $key ] = (object) array( 'name' => $name, 'url' => $url, 'colors' => $colors, 'icon_colors' => $icons, ); } ``` | Used By | Description | | --- | --- | | [register\_admin\_color\_schemes()](register_admin_color_schemes) wp-includes/general-template.php | Registers the default admin color schemes. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress check_and_publish_future_post( int|WP_Post $post ) check\_and\_publish\_future\_post( int|WP\_Post $post ) ======================================================= Publishes future post and make sure post ID has future post status. Invoked by cron ‘publish\_future\_post’ event. This safeguard prevents cron from publishing drafts, etc. `$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function check_and_publish_future_post( $post ) { $post = get_post( $post ); if ( ! $post ) { return; } if ( 'future' !== $post->post_status ) { return; } $time = strtotime( $post->post_date_gmt . ' GMT' ); // Uh oh, someone jumped the gun! if ( $time > time() ) { wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) ); // Clear anything else in the system. wp_schedule_single_event( $time, 'publish_future_post', array( $post->ID ) ); return; } // wp_publish_post() returns no meaningful value. wp_publish_post( $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. | | [wp\_publish\_post()](wp_publish_post) wp-includes/post.php | Publishes a post by transitioning the post status. | | [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 wp_pre_kses_less_than_callback( string[] $matches ): string wp\_pre\_kses\_less\_than\_callback( string[] $matches ): string ================================================================ Callback function used by preg\_replace. `$matches` string[] Required Populated by matches to preg\_replace. string The text returned after esc\_html if needed. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function wp_pre_kses_less_than_callback( $matches ) { if ( false === strpos( $matches[0], '>' ) ) { return esc_html( $matches[0] ); } return $matches[0]; } ``` | Uses | Description | | --- | --- | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress update_site_cache( array $sites, bool $update_meta_cache = true ) update\_site\_cache( array $sites, bool $update\_meta\_cache = true ) ===================================================================== Updates sites in cache. `$sites` array Required Array of site objects. `$update_meta_cache` bool Optional Whether to update site meta cache. Default: `true` File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/) ``` function update_site_cache( $sites, $update_meta_cache = true ) { if ( ! $sites ) { return; } $site_ids = array(); $site_data = array(); $blog_details_data = array(); foreach ( $sites as $site ) { $site_ids[] = $site->blog_id; $site_data[ $site->blog_id ] = $site; $blog_details_data[ $site->blog_id . 'short' ] = $site; } wp_cache_add_multiple( $site_data, 'sites' ); wp_cache_add_multiple( $blog_details_data, 'blog-details' ); if ( $update_meta_cache ) { update_sitemeta_cache( $site_ids ); } } ``` | Uses | Description | | --- | --- | | [wp\_cache\_add\_multiple()](wp_cache_add_multiple) wp-includes/cache.php | Adds multiple values to the cache in one call. | | [update\_sitemeta\_cache()](update_sitemeta_cache) wp-includes/ms-site.php | Updates metadata cache for list of site IDs. | | Used By | Description | | --- | --- | | [\_prime\_site\_caches()](_prime_site_caches) wp-includes/ms-site.php | Adds any sites from the given IDs to the cache that do not already exist in cache. | | [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. | | Version | Description | | --- | --- | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced the `$update_meta_cache` parameter. | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. | wordpress wp_kses_hook( string $string, array[]|string $allowed_html, string[] $allowed_protocols ): string wp\_kses\_hook( string $string, array[]|string $allowed\_html, string[] $allowed\_protocols ): string ===================================================================================================== You add any KSES hooks here. There is currently only one KSES WordPress hook, [‘pre\_kses’](../hooks/pre_kses), and it is called here. All parameters are passed to the hooks and expected to receive a string. `$string` string Required Content to filter through KSES. `$allowed_html` array[]|string Required An array of allowed HTML elements and attributes, or a context name such as `'post'`. See [wp\_kses\_allowed\_html()](wp_kses_allowed_html) for the list of accepted context names. `$allowed_protocols` string[] Required Array of allowed URL protocols. string Filtered content through ['pre\_kses'](../hooks/pre_kses) hook. File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/) ``` function wp_kses_hook( $string, $allowed_html, $allowed_protocols ) { /** * Filters content to be run through KSES. * * @since 2.3.0 * * @param string $string Content to filter through KSES. * @param array[]|string $allowed_html An array of allowed HTML elements and attributes, * or a context name such as 'post'. See wp_kses_allowed_html() * for the list of accepted context names. * @param string[] $allowed_protocols Array of allowed URL protocols. */ return apply_filters( 'pre_kses', $string, $allowed_html, $allowed_protocols ); } ``` [apply\_filters( 'pre\_kses', string $string, array[]|string $allowed\_html, string[] $allowed\_protocols )](../hooks/pre_kses) Filters content to be run through KSES. | 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\_kses()](wp_kses) wp-includes/kses.php | Filters text content and strips out disallowed HTML. | | Version | Description | | --- | --- | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. | wordpress _register_widget_form_callback( int|string $id, string $name, callable $form_callback, array $options = array(), mixed $params ) \_register\_widget\_form\_callback( int|string $id, string $name, callable $form\_callback, array $options = array(), mixed $params ) ===================================================================================================================================== Registers the form callback for a widget. `$id` int|string Required Widget ID. `$name` string Required Name attribute for the widget. `$form_callback` callable Required Form callback. `$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_form_callback( $id, $name, $form_callback, $options = array(), ...$params ) { global $wp_registered_widget_controls; $id = strtolower( $id ); if ( empty( $form_callback ) ) { unset( $wp_registered_widget_controls[ $id ] ); return; } if ( isset( $wp_registered_widget_controls[ $id ] ) && ! did_action( 'widgets_init' ) ) { return; } $defaults = array( 'width' => 250, 'height' => 200, ); $options = wp_parse_args( $options, $defaults ); $options['width'] = (int) $options['width']; $options['height'] = (int) $options['height']; $widget = array( 'name' => $name, 'id' => $id, 'callback' => $form_callback, 'params' => $params, ); $widget = array_merge( $widget, $options ); $wp_registered_widget_controls[ $id ] = $widget; } ``` | Uses | Description | | --- | --- | | [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | 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. |
programming_docs
wordpress start_post_rel_link( string $title = '%title', bool $in_same_cat = false, string $excluded_categories = '' ) start\_post\_rel\_link( string $title = '%title', bool $in\_same\_cat = false, string $excluded\_categories = '' ) ================================================================================================================== This function has been deprecated. Display relational link for the first post. `$title` string Optional Link title format. Default: `'%title'` `$in_same_cat` bool Optional Whether link should be in a same category. Default: `false` `$excluded_categories` string Optional Excluded categories IDs. Default: `''` File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') { _deprecated_function( __FUNCTION__, '3.3.0' ); echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true); } ``` | Uses | Description | | --- | --- | | [get\_boundary\_post\_rel\_link()](get_boundary_post_rel_link) wp-includes/deprecated.php | Get boundary post relational link. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | This function has been deprecated. | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress the_title( string $before = '', string $after = '', bool $echo = true ): void|string the\_title( string $before = '', string $after = '', bool $echo = true ): void|string ===================================================================================== Displays or retrieves the current post title with optional markup. `$before` string Optional Markup to prepend to the title. Default: `''` `$after` string Optional Markup to append to the title. Default: `''` `$echo` bool Optional Whether to echo or return the title. Default true for echo. Default: `true` void|string Void if `$echo` argument is true, current post title if `$echo` is false. This function displays or returns the unescaped title of the current post. This tag may only be used within The Loop, to get the title of a post outside of the loop use [get\_the\_title](get_the_title "Function Reference/get the title"). If the post is protected or private, this will be noted by the words “Protected: ” or “Private: ” prepended to the title. **Security considerations** Like [the\_content()](the_content) , the output of [the\_title()](the_title) is unescaped. This is considered a feature and not a bug, see [the FAQ “Why are some users allowed to post unfiltered HTML?”](https://make.wordpress.org/core/handbook/testing/reporting-security-vulnerabilities/#why-are-some-users-allowed-to-post-unfiltered-html) . If the post title is <script>alert("test");</script>, then that JavaScript code will be run wherever [the\_title()](the_title) is used. For this reason, do not write code that allows untrusted users to create post titles. File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/) ``` function the_title( $before = '', $after = '', $echo = true ) { $title = get_the_title(); if ( strlen( $title ) == 0 ) { return; } $title = $before . $title . $after; if ( $echo ) { echo $title; } else { return $title; } } ``` | Uses | Description | | --- | --- | | [get\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. | | Version | Description | | --- | --- | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress add_options_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', int $position = null ): string|false add\_options\_page( string $page\_title, string $menu\_title, string $capability, string $menu\_slug, callable $callback = '', int $position = null ): string|false =================================================================================================================================================================== Adds a submenu page to the Settings main menu. This function takes a capability which will be used to determine whether or not a page is included in the menu. The function which is hooked in to handle the output of the page must check that the user has the required capability as well. `$page_title` string Required The text to be displayed in the title tags of the page when the menu is selected. `$menu_title` string Required The text to be used for the menu. `$capability` string Required The capability required for this menu to be displayed to the user. `$menu_slug` string Required The slug name to refer to this menu by (should be unique for this menu). `$callback` callable Optional The function to be called to output the content for this page. Default: `''` `$position` int Optional The position in the menu order this item should appear. Default: `null` string|false The resulting page's hook\_suffix, or false if the user does not have the capability required. * This function is a simple wrapper for a call to [add\_submenu\_page()](add_submenu_page) , passing the received arguments and specifying ‘`options-general.php`‘ as the `$parent_slug` argument. This means the new options page will be added as a sub menu to the Settings menu. * The `$capability` parameter is used to determine whether or not the page is included in the menu based on the [Roles and Capabilities](https://wordpress.org/support/article/roles-and-capabilities/)) of the current user. * The function handling the output of the options page should also verify the user’s capabilities. * If there are spaces in the `slug`, then these will be stripped out when the URL is generated. This will result in an error message telling you that you do not have sufficient permissions to view the page. File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/) ``` function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } ``` | Uses | Description | | --- | --- | | [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added the `$position` parameter. | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress get_stylesheet_directory_uri(): string get\_stylesheet\_directory\_uri(): string ========================================= Retrieves stylesheet directory URI for the active theme. string URI to active theme's stylesheet directory. * The returned URI does not contain a trailing slash. * This function returns a properly-formed URI; in other words, it will be a web-address (starting with http:// or https:// for SSL). As such, it is most appropriately used for links, referencing additional stylesheets, or probably most commonly, images. * In the event a child theme is being used, this function will return the child’s theme directory URI. Use [get\_template\_directory\_uri()](get_template_directory_uri) to avoid being overridden by a child theme. * If you want to include a local file in PHP, use [get\_stylesheet\_directory()](get_stylesheet_directory) instead. File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/) ``` function get_stylesheet_directory_uri() { $stylesheet = str_replace( '%2F', '/', rawurlencode( get_stylesheet() ) ); $theme_root_uri = get_theme_root_uri( $stylesheet ); $stylesheet_dir_uri = "$theme_root_uri/$stylesheet"; /** * Filters the stylesheet directory URI. * * @since 1.5.0 * * @param string $stylesheet_dir_uri Stylesheet directory URI. * @param string $stylesheet Name of the activated theme's directory. * @param string $theme_root_uri Themes root URI. */ return apply_filters( 'stylesheet_directory_uri', $stylesheet_dir_uri, $stylesheet, $theme_root_uri ); } ``` [apply\_filters( 'stylesheet\_directory\_uri', string $stylesheet\_dir\_uri, string $stylesheet, string $theme\_root\_uri )](../hooks/stylesheet_directory_uri) Filters the stylesheet directory URI. | Uses | Description | | --- | --- | | [get\_theme\_root\_uri()](get_theme_root_uri) wp-includes/theme.php | Retrieves URI for 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 | | --- | --- | | [get\_theme\_file\_uri()](get_theme_file_uri) wp-includes/link-template.php | Retrieves the URL of a file in the theme. | | [get\_editor\_stylesheets()](get_editor_stylesheets) wp-includes/theme.php | Retrieves any registered editor stylesheet URLs. | | [Custom\_Image\_Header::get\_default\_header\_images()](../classes/custom_image_header/get_default_header_images) wp-admin/includes/class-custom-image-header.php | Gets the details of default header images if defined. | | [Custom\_Image\_Header::step\_1()](../classes/custom_image_header/step_1) wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. | | [Custom\_Image\_Header::reset\_header\_image()](../classes/custom_image_header/reset_header_image) wp-admin/includes/class-custom-image-header.php | Reset a header image to the default image for the theme. | | [Custom\_Image\_Header::process\_default\_headers()](../classes/custom_image_header/process_default_headers) wp-admin/includes/class-custom-image-header.php | Process the default headers | | [WP\_Customize\_Manager::register\_controls()](../classes/wp_customize_manager/register_controls) wp-includes/class-wp-customize-manager.php | Registers some default controls. | | [\_get\_random\_header\_data()](_get_random_header_data) wp-includes/theme.php | Gets random header image data from registered images in theme. | | [get\_custom\_header()](get_custom_header) wp-includes/theme.php | Gets the header image data. | | [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. | | [get\_stylesheet\_uri()](get_stylesheet_uri) wp-includes/theme.php | Retrieves stylesheet URI for the active theme. | | [get\_locale\_stylesheet\_uri()](get_locale_stylesheet_uri) wp-includes/theme.php | Retrieves the localized stylesheet URI. | | [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | Version | Description | | --- | --- | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress wp_add_trashed_suffix_to_post_name_for_post( WP_Post $post ): string wp\_add\_trashed\_suffix\_to\_post\_name\_for\_post( WP\_Post $post ): 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. Adds a trashed suffix for a given post. Store its desired (i.e. current) slug so it can try to reclaim it if the post is untrashed. For internal use. `$post` [WP\_Post](../classes/wp_post) Required The post. string New slug for the post. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function wp_add_trashed_suffix_to_post_name_for_post( $post ) { global $wpdb; $post = get_post( $post ); if ( '__trashed' === substr( $post->post_name, -9 ) ) { return $post->post_name; } add_post_meta( $post->ID, '_wp_desired_post_slug', $post->post_name ); $post_name = _truncate_post_slug( $post->post_name, 191 ) . '__trashed'; $wpdb->update( $wpdb->posts, array( 'post_name' => $post_name ), array( 'ID' => $post->ID ) ); clean_post_cache( $post->ID ); return $post_name; } ``` | Uses | Description | | --- | --- | | [clean\_post\_cache()](clean_post_cache) wp-includes/post.php | Will clean the post in the cache. | | [\_truncate\_post\_slug()](_truncate_post_slug) wp-includes/post.php | Truncates a post slug. | | [add\_post\_meta()](add_post_meta) wp-includes/post.php | Adds a meta field to the given post. | | [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Used By | Description | | --- | --- | | [wp\_add\_trashed\_suffix\_to\_post\_name\_for\_trashed\_posts()](wp_add_trashed_suffix_to_post_name_for_trashed_posts) wp-includes/post.php | Adds a suffix if any trashed posts have a given slug. | | [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. | | Version | Description | | --- | --- | | [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. | wordpress register_initial_settings() register\_initial\_settings() ============================= Registers default settings available in WordPress. The settings registered here are primarily useful for the REST API, so this does not encompass all settings available in WordPress. File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/) ``` function register_initial_settings() { register_setting( 'general', 'blogname', array( 'show_in_rest' => array( 'name' => 'title', ), 'type' => 'string', 'description' => __( 'Site title.' ), ) ); register_setting( 'general', 'blogdescription', array( 'show_in_rest' => array( 'name' => 'description', ), 'type' => 'string', 'description' => __( 'Site tagline.' ), ) ); if ( ! is_multisite() ) { register_setting( 'general', 'siteurl', array( 'show_in_rest' => array( 'name' => 'url', 'schema' => array( 'format' => 'uri', ), ), 'type' => 'string', 'description' => __( 'Site URL.' ), ) ); } if ( ! is_multisite() ) { register_setting( 'general', 'admin_email', array( 'show_in_rest' => array( 'name' => 'email', 'schema' => array( 'format' => 'email', ), ), 'type' => 'string', 'description' => __( 'This address is used for admin purposes, like new user notification.' ), ) ); } register_setting( 'general', 'timezone_string', array( 'show_in_rest' => array( 'name' => 'timezone', ), 'type' => 'string', 'description' => __( 'A city in the same timezone as you.' ), ) ); register_setting( 'general', 'date_format', array( 'show_in_rest' => true, 'type' => 'string', 'description' => __( 'A date format for all date strings.' ), ) ); register_setting( 'general', 'time_format', array( 'show_in_rest' => true, 'type' => 'string', 'description' => __( 'A time format for all time strings.' ), ) ); register_setting( 'general', 'start_of_week', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'A day number of the week that the week should start on.' ), ) ); register_setting( 'general', 'WPLANG', array( 'show_in_rest' => array( 'name' => 'language', ), 'type' => 'string', 'description' => __( 'WordPress locale code.' ), 'default' => 'en_US', ) ); register_setting( 'writing', 'use_smilies', array( 'show_in_rest' => true, 'type' => 'boolean', 'description' => __( 'Convert emoticons like :-) and :-P to graphics on display.' ), 'default' => true, ) ); register_setting( 'writing', 'default_category', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'Default post category.' ), ) ); register_setting( 'writing', 'default_post_format', array( 'show_in_rest' => true, 'type' => 'string', 'description' => __( 'Default post format.' ), ) ); register_setting( 'reading', 'posts_per_page', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'Blog pages show at most.' ), 'default' => 10, ) ); register_setting( 'reading', 'show_on_front', array( 'show_in_rest' => true, 'type' => 'string', 'description' => __( 'What to show on the front page' ), ) ); register_setting( 'reading', 'page_on_front', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'The ID of the page that should be displayed on the front page' ), ) ); register_setting( 'reading', 'page_for_posts', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'The ID of the page that should display the latest posts' ), ) ); register_setting( 'discussion', 'default_ping_status', array( 'show_in_rest' => array( 'schema' => array( 'enum' => array( 'open', 'closed' ), ), ), 'type' => 'string', 'description' => __( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.' ), ) ); register_setting( 'discussion', 'default_comment_status', array( 'show_in_rest' => array( 'schema' => array( 'enum' => array( 'open', 'closed' ), ), ), 'type' => 'string', 'description' => __( 'Allow people to submit comments on new posts.' ), ) ); } ``` | Uses | Description | | --- | --- | | [register\_setting()](register_setting) wp-includes/option.php | Registers a setting and its data. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | Version | Description | | --- | --- | | [6.0.1](https://developer.wordpress.org/reference/since/6.0.1/) | The `show_on_front`, `page_on_front`, and `page_for_posts` options were added. | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. | wordpress privacy_ping_filter( mixed $sites ): mixed privacy\_ping\_filter( mixed $sites ): mixed ============================================ Checks whether blog is public before returning sites. `$sites` mixed Required Will return if blog is public, will not return if not public. mixed Empty string if blog is not public, returns $sites, if site is public. File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/) ``` function privacy_ping_filter( $sites ) { if ( '0' != get_option( 'blog_public' ) ) { return $sites; } else { return ''; } } ``` | Uses | Description | | --- | --- | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress delete_site_option( string $option ): bool delete\_site\_option( string $option ): bool ============================================ Removes a option by name for the current network. * [delete\_network\_option()](delete_network_option) `$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_site_option( $option ) { return delete_network_option( null, $option ); } ``` | Uses | Description | | --- | --- | | [delete\_network\_option()](delete_network_option) wp-includes/option.php | Removes a network option by name. | | Used By | Description | | --- | --- | | [upgrade\_network()](upgrade_network) wp-admin/includes/upgrade.php | Executes network-level upgrade routines. | | [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. | | [delete\_site\_transient()](delete_site_transient) wp-includes/option.php | Deletes a site transient. | | [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Modified into wrapper for [delete\_network\_option()](delete_network_option) | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
programming_docs
wordpress wp_remote_retrieve_response_code( array|WP_Error $response ): int|string wp\_remote\_retrieve\_response\_code( array|WP\_Error $response ): int|string ============================================================================= Retrieve only the response code from the raw response. Will return an empty string if incorrect parameter value is given. `$response` array|[WP\_Error](../classes/wp_error) Required HTTP response. int|string The response code as an integer. Empty string if incorrect parameter given. File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/) ``` function wp_remote_retrieve_response_code( $response ) { if ( is_wp_error( $response ) || ! isset( $response['response'] ) || ! is_array( $response['response'] ) ) { return ''; } return $response['response']['code']; } ``` | 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\_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\_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\_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\_Site\_Health::wp\_cron\_scheduled\_check()](../classes/wp_site_health/wp_cron_scheduled_check) wp-admin/includes/class-wp-site-health.php | Runs the scheduled event to check and update the latest site health status for the website. | | [WP\_Site\_Health::get\_test\_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::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\_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. | | [populate\_network()](populate_network) wp-admin/includes/schema.php | Populate network settings. | | [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. | | [download\_url()](download_url) wp-admin/includes/file.php | Downloads a URL to a local temporary file using the WordPress HTTP API. | | [wp\_credits()](wp_credits) wp-admin/includes/credits.php | Retrieve the contributor credits. | | [url\_is\_accessable\_via\_ssl()](url_is_accessable_via_ssl) wp-includes/deprecated.php | Determines if the URL can be accessed over SSL. | | [wp\_get\_http()](wp_get_http) wp-includes/deprecated.php | Perform a HTTP HEAD or GET request. | | [WP\_SimplePie\_File::\_\_construct()](../classes/wp_simplepie_file/__construct) wp-includes/class-wp-simplepie-file.php | Constructor. | | [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\_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\_HTTP\_IXR\_Client::query()](../classes/wp_http_ixr_client/query) wp-includes/class-wp-http-ixr-client.php | | | [\_fetch\_remote\_file()](_fetch_remote_file) wp-includes/rss.php | Retrieve URL headers and content using WP HTTP Request API. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress load_muplugin_textdomain( string $domain, string $mu_plugin_rel_path = '' ): bool load\_muplugin\_textdomain( string $domain, string $mu\_plugin\_rel\_path = '' ): bool ====================================================================================== Loads the translated strings for a plugin residing in the mu-plugins directory. `$domain` string Required Text domain. Unique identifier for retrieving translated strings. `$mu_plugin_rel_path` string Optional Relative to `WPMU_PLUGIN_DIR` directory in which the .mo file resides. Default: `''` 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_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) { /** @var WP_Textdomain_Registry $wp_textdomain_registry */ global $wp_textdomain_registry; /** This filter is documented in wp-includes/l10n.php */ $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; } $path = WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' ); $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. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Version | Description | | --- | --- | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | The function now tries to load the .mo file from the languages directory first. | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress update_nag(): void|false update\_nag(): void|false ========================= Returns core update notification message. void|false File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/) ``` function update_nag() { global $pagenow; if ( is_multisite() && ! current_user_can( 'update_core' ) ) { return false; } if ( 'update-core.php' === $pagenow ) { return; } $cur = get_preferred_from_update_core(); if ( ! isset( $cur->response ) || 'upgrade' !== $cur->response ) { return false; } $version_url = sprintf( /* translators: %s: WordPress version. */ esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), sanitize_title( $cur->current ) ); if ( current_user_can( 'update_core' ) ) { $msg = sprintf( /* translators: 1: URL to WordPress release notes, 2: New WordPress version, 3: URL to network admin, 4: Accessibility text. */ __( '<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.' ), $version_url, $cur->current, network_admin_url( 'update-core.php' ), esc_attr__( 'Please update WordPress now' ) ); } else { $msg = sprintf( /* translators: 1: URL to WordPress release notes, 2: New WordPress version. */ __( '<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.' ), $version_url, $cur->current ); } echo "<div class='update-nag notice notice-warning inline'>$msg</div>"; } ``` | 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. | | [esc\_attr\_\_()](esc_attr__) wp-includes/l10n.php | Retrieves the translation of $text and escapes it for safe use in an attribute. | | [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. | | [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. | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress _json_wp_die_handler( string $message, string $title = '', string|array $args = array() ) \_json\_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 JSON response with an error message. This is the handler for [wp\_die()](wp_die) when processing JSON 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 _json_wp_die_handler( $message, $title = '', $args = array() ) { list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); $data = array( 'code' => $parsed_args['code'], 'message' => $message, 'data' => array( 'status' => $parsed_args['response'], ), 'additional_errors' => $parsed_args['additional_errors'], ); if ( ! headers_sent() ) { header( "Content-Type: application/json; charset={$parsed_args['charset']}" ); if ( null !== $parsed_args['response'] ) { status_header( $parsed_args['response'] ); } nocache_headers(); } echo wp_json_encode( $data ); if ( $parsed_args['exit'] ) { die(); } } ``` | Uses | Description | | --- | --- | | [\_wp\_die\_process\_input()](_wp_die_process_input) wp-includes/functions.php | Processes arguments passed to [wp\_die()](wp_die) consistently for its handlers. | | [status\_header()](status_header) wp-includes/functions.php | Sets HTTP status header. | | [nocache\_headers()](nocache_headers) wp-includes/functions.php | Sets the headers to prevent caching for the different browsers. | | [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. | | Version | Description | | --- | --- | | [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. | wordpress _walk_bookmarks( array $bookmarks, string|array $args = '' ): string \_walk\_bookmarks( array $bookmarks, string|array $args = '' ): 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. The formatted output of a list of bookmarks. The $bookmarks array must contain bookmark objects and will be iterated over to retrieve the bookmark to be used in the output. The output is formatted as HTML with no way to change that format. However, what is between, before, and after can be changed. The link itself will be HTML. This function is used internally by [wp\_list\_bookmarks()](wp_list_bookmarks) and should not be used by themes. `$bookmarks` array Required List of bookmarks to traverse. `$args` string|array Optional Bookmarks arguments. * `show_updated`int|boolWhether to show the time the bookmark was last updated. Accepts `1|true` or `0|false`. Default `0|false`. * `show_description`int|boolWhether to show the bookmark description. Accepts `1|true`, Accepts `1|true` or `0|false`. Default `0|false`. * `show_images`int|boolWhether to show the link image if available. Accepts `1|true` or `0|false`. Default `1|true`. * `show_name`int|boolWhether to show link name if available. Accepts `1|true` or `0|false`. Default `0|false`. * `before`stringThe HTML or text to prepend to each bookmark. Default `<li>`. * `after`stringThe HTML or text to append to each bookmark. Default `</li>`. * `link_before`stringThe HTML or text to prepend to each bookmark inside the anchor tags. * `link_after`stringThe HTML or text to append to each bookmark inside the anchor tags. * `between`stringThe string for use in between the link, description, and image. Default "n". * `show_rating`int|boolWhether to show the link rating. Accepts `1|true` or `0|false`. Default `0|false`. Default: `''` string Formatted output in HTML File: `wp-includes/bookmark-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/bookmark-template.php/) ``` function _walk_bookmarks( $bookmarks, $args = '' ) { $defaults = array( 'show_updated' => 0, 'show_description' => 0, 'show_images' => 1, 'show_name' => 0, 'before' => '<li>', 'after' => '</li>', 'between' => "\n", 'show_rating' => 0, 'link_before' => '', 'link_after' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); $output = ''; // Blank string to start with. foreach ( (array) $bookmarks as $bookmark ) { if ( ! isset( $bookmark->recently_updated ) ) { $bookmark->recently_updated = false; } $output .= $parsed_args['before']; if ( $parsed_args['show_updated'] && $bookmark->recently_updated ) { $output .= '<em>'; } $the_link = '#'; if ( ! empty( $bookmark->link_url ) ) { $the_link = esc_url( $bookmark->link_url ); } $desc = esc_attr( sanitize_bookmark_field( 'link_description', $bookmark->link_description, $bookmark->link_id, 'display' ) ); $name = esc_attr( sanitize_bookmark_field( 'link_name', $bookmark->link_name, $bookmark->link_id, 'display' ) ); $title = $desc; if ( $parsed_args['show_updated'] ) { if ( '00' !== substr( $bookmark->link_updated_f, 0, 2 ) ) { $title .= ' ('; $title .= sprintf( /* translators: %s: Date and time of last update. */ __( 'Last updated: %s' ), gmdate( get_option( 'links_updated_date_format' ), $bookmark->link_updated_f + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ); $title .= ')'; } } $alt = ' alt="' . $name . ( $parsed_args['show_description'] ? ' ' . $title : '' ) . '"'; if ( '' !== $title ) { $title = ' title="' . $title . '"'; } $rel = $bookmark->link_rel; $target = $bookmark->link_target; if ( '' !== $target ) { if ( is_string( $rel ) && '' !== $rel ) { if ( ! str_contains( $rel, 'noopener' ) ) { $rel = trim( $rel ) . ' noopener'; } } else { $rel = 'noopener'; } $target = ' target="' . $target . '"'; } if ( '' !== $rel ) { $rel = ' rel="' . esc_attr( $rel ) . '"'; } $output .= '<a href="' . $the_link . '"' . $rel . $title . $target . '>'; $output .= $parsed_args['link_before']; if ( null != $bookmark->link_image && $parsed_args['show_images'] ) { if ( strpos( $bookmark->link_image, 'http' ) === 0 ) { $output .= "<img src=\"$bookmark->link_image\" $alt $title />"; } else { // If it's a relative path. $output .= '<img src="' . get_option( 'siteurl' ) . "$bookmark->link_image\" $alt $title />"; } if ( $parsed_args['show_name'] ) { $output .= " $name"; } } else { $output .= $name; } $output .= $parsed_args['link_after']; $output .= '</a>'; if ( $parsed_args['show_updated'] && $bookmark->recently_updated ) { $output .= '</em>'; } if ( $parsed_args['show_description'] && '' !== $desc ) { $output .= $parsed_args['between'] . $desc; } if ( $parsed_args['show_rating'] ) { $output .= $parsed_args['between'] . sanitize_bookmark_field( 'link_rating', $bookmark->link_rating, $bookmark->link_id, 'display' ); } $output .= $parsed_args['after'] . "\n"; } // End while. return $output; } ``` | Uses | Description | | --- | --- | | [sanitize\_bookmark\_field()](sanitize_bookmark_field) wp-includes/bookmark.php | Sanitizes a bookmark field. | | [\_\_()](__) 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. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [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. | wordpress wp_save_post_revision( int $post_id ): int|WP_Error|void wp\_save\_post\_revision( int $post\_id ): int|WP\_Error|void ============================================================= Creates a revision for the current version of a post. Typically used immediately after a post update, as every update is a revision, and the most recent revision always matches the current post. `$post_id` int Required The ID of the post to save as a revision. int|[WP\_Error](../classes/wp_error)|void Void 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_save_post_revision( $post_id ) { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } $post = get_post( $post_id ); if ( ! $post ) { return; } if ( ! post_type_supports( $post->post_type, 'revisions' ) ) { return; } if ( 'auto-draft' === $post->post_status ) { return; } if ( ! wp_revisions_enabled( $post ) ) { return; } /* * Compare the proposed update with the last stored revision verifying that * they are different, unless a plugin tells us to always save regardless. * If no previous revisions, save one. */ $revisions = wp_get_post_revisions( $post_id ); if ( $revisions ) { // Grab the latest revision, but not an autosave. foreach ( $revisions as $revision ) { if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) { $latest_revision = $revision; break; } } /** * Filters whether the post has changed since the latest revision. * * By default a revision is saved only if one of the revisioned fields has changed. * This filter can override that so a revision is saved even if nothing has changed. * * @since 3.6.0 * * @param bool $check_for_changes Whether to check for changes before saving a new revision. * Default true. * @param WP_Post $latest_revision The latest revision post object. * @param WP_Post $post The post object. */ if ( isset( $latest_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $latest_revision, $post ) ) { $post_has_changed = false; foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) { if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $latest_revision->$field ) ) { $post_has_changed = true; break; } } /** * Filters whether a post has changed. * * By default a revision is saved only if one of the revisioned fields has changed. * This filter allows for additional checks to determine if there were changes. * * @since 4.1.0 * * @param bool $post_has_changed Whether the post has changed. * @param WP_Post $latest_revision The latest revision post object. * @param WP_Post $post The post object. */ $post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $latest_revision, $post ); // Don't save revision if post unchanged. if ( ! $post_has_changed ) { return; } } } $return = _wp_put_post_revision( $post ); // If a limit for the number of revisions to keep has been set, // delete the oldest ones. $revisions_to_keep = wp_revisions_to_keep( $post ); if ( $revisions_to_keep < 0 ) { return $return; } $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) ); $delete = count( $revisions ) - $revisions_to_keep; if ( $delete < 1 ) { return $return; } $revisions = array_slice( $revisions, 0, $delete ); for ( $i = 0; isset( $revisions[ $i ] ); $i++ ) { if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) ) { continue; } wp_delete_post_revision( $revisions[ $i ]->ID ); } return $return; } ``` [apply\_filters( 'wp\_save\_post\_revision\_check\_for\_changes', bool $check\_for\_changes, WP\_Post $latest\_revision, WP\_Post $post )](../hooks/wp_save_post_revision_check_for_changes) Filters whether the post has changed since the latest revision. [apply\_filters( 'wp\_save\_post\_revision\_post\_has\_changed', bool $post\_has\_changed, WP\_Post $latest\_revision, WP\_Post $post )](../hooks/wp_save_post_revision_post_has_changed) Filters whether a post has changed. | Uses | Description | | --- | --- | | [normalize\_whitespace()](normalize_whitespace) wp-includes/formatting.php | Normalizes EOL characters and strips duplicate whitespace. | | [post\_type\_supports()](post_type_supports) wp-includes/post.php | Checks a post type’s support for a given feature. | | [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. | | [\_wp\_put\_post\_revision()](_wp_put_post_revision) wp-includes/revision.php | Inserts post data into the posts table as a post revision. | | [wp\_revisions\_to\_keep()](wp_revisions_to_keep) wp-includes/revision.php | Determines how many revisions to retain for a given post. | | [wp\_delete\_post\_revision()](wp_delete_post_revision) wp-includes/revision.php | Deletes a revision. | | [\_wp\_post\_revision\_fields()](_wp_post_revision_fields) wp-includes/revision.php | Determines which fields of posts are to be saved in revisions. | | [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\_update\_custom\_css\_post()](wp_update_custom_css_post) wp-includes/theme.php | Updates the `custom_css` post for a given theme. | | [\_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. | | Version | Description | | --- | --- | | [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
programming_docs
wordpress rest_find_one_matching_schema( mixed $value, array $args, string $param, bool $stop_after_first_match = false ): array|WP_Error rest\_find\_one\_matching\_schema( mixed $value, array $args, string $param, bool $stop\_after\_first\_match = false ): array|WP\_Error ======================================================================================================================================= Finds the matching schema among the “oneOf” schemas. `$value` mixed Required The value to validate. `$args` array Required The schema array to use. `$param` string Required The parameter name, used in error messages. `$stop_after_first_match` bool Optional Whether the process should stop after the first successful match. Default: `false` array|[WP\_Error](../classes/wp_error) The matching schema or [WP\_Error](../classes/wp_error) instance if the number of matching schemas is not equal to one. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_find_one_matching_schema( $value, $args, $param, $stop_after_first_match = false ) { $matching_schemas = array(); $errors = array(); foreach ( $args['oneOf'] as $index => $schema ) { if ( ! isset( $schema['type'] ) && isset( $args['type'] ) ) { $schema['type'] = $args['type']; } $is_valid = rest_validate_value_from_schema( $value, $schema, $param ); if ( ! is_wp_error( $is_valid ) ) { if ( $stop_after_first_match ) { return $schema; } $matching_schemas[] = array( 'schema_object' => $schema, 'index' => $index, ); } else { $errors[] = array( 'error_object' => $is_valid, 'schema' => $schema, 'index' => $index, ); } } if ( ! $matching_schemas ) { return rest_get_combining_operation_error( $value, $param, $errors ); } if ( count( $matching_schemas ) > 1 ) { $schema_positions = array(); $schema_titles = array(); foreach ( $matching_schemas as $schema ) { $schema_positions[] = $schema['index']; if ( isset( $schema['schema_object']['title'] ) ) { $schema_titles[] = $schema['schema_object']['title']; } } // If each schema has a title, include those titles in the error message. if ( count( $schema_titles ) === count( $matching_schemas ) ) { return new WP_Error( 'rest_one_of_multiple_matches', /* translators: 1: Parameter, 2: Schema titles. */ wp_sprintf( __( '%1$s matches %2$l, but should match only one.' ), $param, $schema_titles ), array( 'positions' => $schema_positions ) ); } return new WP_Error( 'rest_one_of_multiple_matches', /* translators: %s: Parameter. */ sprintf( __( '%s matches more than one of the expected formats.' ), $param ), array( 'positions' => $schema_positions ) ); } return $matching_schemas[0]['schema_object']; } ``` | Uses | Description | | --- | --- | | [rest\_get\_combining\_operation\_error()](rest_get_combining_operation_error) wp-includes/rest-api.php | Gets the error of combining operation. | | [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. | | [wp\_sprintf()](wp_sprintf) wp-includes/formatting.php | WordPress implementation of PHP sprintf() with filters. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Used By | Description | | --- | --- | | [rest\_filter\_response\_by\_context()](rest_filter_response_by_context) wp-includes/rest-api.php | Filters the response to remove any fields not available in the given context. | | [rest\_sanitize\_value\_from\_schema()](rest_sanitize_value_from_schema) wp-includes/rest-api.php | Sanitize a value based on a schema. | | [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. | | Version | Description | | --- | --- | | [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. | wordpress require_wp_db() require\_wp\_db() ================= Load the database class file and instantiate the `$wpdb` global. File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/) ``` function require_wp_db() { global $wpdb; require_once ABSPATH . WPINC . '/class-wpdb.php'; if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) { require_once WP_CONTENT_DIR . '/db.php'; } if ( isset( $wpdb ) ) { return; } $dbuser = defined( 'DB_USER' ) ? DB_USER : ''; $dbpassword = defined( 'DB_PASSWORD' ) ? DB_PASSWORD : ''; $dbname = defined( 'DB_NAME' ) ? DB_NAME : ''; $dbhost = defined( 'DB_HOST' ) ? DB_HOST : ''; $wpdb = new wpdb( $dbuser, $dbpassword, $dbname, $dbhost ); } ``` | Uses | Description | | --- | --- | | [wpdb::\_\_construct()](../classes/wpdb/__construct) wp-includes/class-wpdb.php | Connects to the database server and selects a database. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress wp_remote_retrieve_header( array|WP_Error $response, string $header ): array|string wp\_remote\_retrieve\_header( array|WP\_Error $response, string $header ): array|string ======================================================================================= Retrieve a single header by name from the raw response. `$response` array|[WP\_Error](../classes/wp_error) Required HTTP response. `$header` string Required Header name to retrieve value from. array|string The header(s) value(s). Array if multiple headers with the same name are retrieved. Empty string if incorrect parameter given, or if the header doesn't exist. File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/) ``` function wp_remote_retrieve_header( $response, $header ) { if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) { return ''; } if ( isset( $response['headers'][ $header ] ) ) { return $response['headers'][ $header ]; } return ''; } ``` | 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\_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\_install\_maybe\_enable\_pretty\_permalinks()](wp_install_maybe_enable_pretty_permalinks) wp-admin/includes/upgrade.php | Maybe enable pretty permalinks on installation. | | [download\_url()](download_url) wp-admin/includes/file.php | Downloads a URL to a local temporary file using the WordPress HTTP API. | | [discover\_pingback\_server\_uri()](discover_pingback_server_uri) wp-includes/comment.php | Finds a pingback server URI based on the given URL. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress has_shortcode( string $content, string $tag ): bool has\_shortcode( string $content, string $tag ): bool ==================================================== Determines whether the passed content contains the specified shortcode. `$content` string Required Content to search for shortcodes. `$tag` string Required Shortcode tag to check. bool Whether the passed content contains the given shortcode. File: `wp-includes/shortcodes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/shortcodes.php/) ``` function has_shortcode( $content, $tag ) { if ( false === strpos( $content, '[' ) ) { return false; } if ( shortcode_exists( $tag ) ) { preg_match_all( '/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER ); if ( empty( $matches ) ) { return false; } foreach ( $matches as $shortcode ) { if ( $tag === $shortcode[2] ) { return true; } elseif ( ! empty( $shortcode[5] ) && has_shortcode( $shortcode[5], $tag ) ) { return true; } } } return false; } ``` | Uses | Description | | --- | --- | | [shortcode\_exists()](shortcode_exists) wp-includes/shortcodes.php | Determines whether a registered shortcode exists named $tag. | | [get\_shortcode\_regex()](get_shortcode_regex) wp-includes/shortcodes.php | Retrieves the shortcode regular expression for searching. | | [has\_shortcode()](has_shortcode) wp-includes/shortcodes.php | Determines whether the passed content contains the specified shortcode. | | Used By | Description | | --- | --- | | [wp\_ajax\_parse\_embed()](wp_ajax_parse_embed) wp-admin/includes/ajax-actions.php | Apply [embed] Ajax handlers to a string. | | [has\_shortcode()](has_shortcode) wp-includes/shortcodes.php | Determines whether the passed content contains the specified shortcode. | | [get\_post\_galleries()](get_post_galleries) wp-includes/media.php | Retrieves galleries from the passed post’s content. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress wp_refresh_post_nonces( array $response, array $data, string $screen_id ): array wp\_refresh\_post\_nonces( array $response, array $data, string $screen\_id ): array ==================================================================================== Checks nonce expiration on the New/Edit Post screen and refresh if needed. `$response` array Required The Heartbeat response. `$data` array Required The $\_POST data sent. `$screen_id` string Required The screen ID. array The Heartbeat response. File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/) ``` function wp_refresh_post_nonces( $response, $data, $screen_id ) { if ( array_key_exists( 'wp-refresh-post-nonces', $data ) ) { $received = $data['wp-refresh-post-nonces']; $response['wp-refresh-post-nonces'] = array( 'check' => 1 ); $post_id = absint( $received['post_id'] ); if ( ! $post_id ) { return $response; } if ( ! current_user_can( 'edit_post', $post_id ) ) { return $response; } $response['wp-refresh-post-nonces'] = array( 'replace' => array( 'getpermalinknonce' => wp_create_nonce( 'getpermalink' ), 'samplepermalinknonce' => wp_create_nonce( 'samplepermalink' ), 'closedpostboxesnonce' => wp_create_nonce( 'closedpostboxes' ), '_ajax_linking_nonce' => wp_create_nonce( 'internal-linking' ), '_wpnonce' => wp_create_nonce( 'update-post_' . $post_id ), ), ); } return $response; } ``` | Uses | Description | | --- | --- | | [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. | | [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. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress is_random_header_image( string $type = 'any' ): bool is\_random\_header\_image( string $type = 'any' ): bool ======================================================= Checks if random header image is in use. Always true if user expressly chooses the option in Appearance > Header. Also true if theme has multiple header images registered, no specific header image is chosen, and theme turns on random headers with [add\_theme\_support()](add_theme_support) . `$type` string Optional The random pool to use. Possible values include `'any'`, `'default'`, `'uploaded'`. Default `'any'`. Default: `'any'` bool File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/) ``` function is_random_header_image( $type = 'any' ) { $header_image_mod = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) ); if ( 'any' === $type ) { if ( 'random-default-image' === $header_image_mod || 'random-uploaded-image' === $header_image_mod || ( '' !== get_random_header_image() && empty( $header_image_mod ) ) ) { return true; } } else { if ( "random-$type-image" === $header_image_mod ) { return true; } elseif ( 'default' === $type && empty( $header_image_mod ) && '' !== get_random_header_image() ) { return true; } } return false; } ``` | Uses | Description | | --- | --- | | [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. | | [get\_random\_header\_image()](get_random_header_image) wp-includes/theme.php | Gets random header image URL from registered images in theme. | | [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. | | 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::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\_header\_image()](get_header_image) wp-includes/theme.php | Retrieves header image for custom header. | | [get\_custom\_header()](get_custom_header) wp-includes/theme.php | Gets the header image data. | | Version | Description | | --- | --- | | [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. | wordpress maybe_redirect_404() maybe\_redirect\_404() ====================== Corrects 404 redirects when NOBLOGREDIRECT is defined. File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/) ``` function maybe_redirect_404() { if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) ) { /** * Filters the redirect URL for 404s on the main site. * * The filter is only evaluated if the NOBLOGREDIRECT constant is defined. * * @since 3.0.0 * * @param string $no_blog_redirect The redirect URL defined in NOBLOGREDIRECT. */ $destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT ); if ( $destination ) { if ( '%siteurl%' === $destination ) { $destination = network_home_url(); } wp_redirect( $destination ); exit; } } } ``` [apply\_filters( 'blog\_redirect\_404', string $no\_blog\_redirect )](../hooks/blog_redirect_404) Filters the redirect URL for 404s on the main site. | Uses | Description | | --- | --- | | [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. | | [is\_404()](is_404) wp-includes/query.php | Determines whether the query has resulted in a 404 (returns no results). | | [is\_main\_site()](is_main_site) wp-includes/functions.php | Determines whether a site is the main site of the current network. | | [network\_home\_url()](network_home_url) wp-includes/link-template.php | Retrieves the home URL for the current network. | | [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 setup_postdata( WP_Post|object|int $post ): bool setup\_postdata( WP\_Post|object|int $post ): bool ================================================== Set up global post data. `$post` [WP\_Post](../classes/wp_post)|object|int Required [WP\_Post](../classes/wp_post) instance or Post ID/object. bool True when finished. Sets up global post data. Helps to format custom query results for using Template tags. [setup\_postdata()](setup_postdata) fills the global variables `$id`, `$authordata`, `$currentday`, `$currentmonth`, `$page`, `$pages`, `$multipage`, `$more`, `$numpages`, which help many [Template Tags](https://developer.wordpress.org/themes/basics/template-tags/) work in the current post context. `setup_postdata()` does **not** assign the global `$post` variable so it’s important that you do this yourself. Failure to do so will cause problems with any hooks that use any of the above globals in conjunction with the `$post` global, as they will refer to separate entities. ``` <?php global $post; // modify the $post variable with the post data you want. Note that this variable must have this name! setup_postdata( $post ); ?> ``` File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/) ``` function setup_postdata( $post ) { global $wp_query; if ( ! empty( $wp_query ) && $wp_query instanceof WP_Query ) { return $wp_query->setup_postdata( $post ); } return false; } ``` | Uses | Description | | --- | --- | | [WP\_Query::setup\_postdata()](../classes/wp_query/setup_postdata) wp-includes/class-wp-query.php | Set up global post data. | | Used By | Description | | --- | --- | | [WP\_REST\_Block\_Renderer\_Controller::get\_item()](../classes/wp_rest_block_renderer_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php | Returns block output from block’s registered render\_callback. | | [WP\_REST\_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\_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 | | | [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. | | [WP\_Posts\_List\_Table::single\_row()](../classes/wp_posts_list_table/single_row) wp-admin/includes/class-wp-posts-list-table.php | | | [start\_wp()](start_wp) wp-includes/deprecated.php | Sets up the WordPress Loop. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the ability to pass a post ID to `$post`. | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress _wp_emoji_list( string $type = 'entities' ): array \_wp\_emoji\_list( string $type = 'entities' ): array ===================================================== This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Returns arrays of emoji data. These arrays are automatically built from the regex in twemoji.js – if they need to be updated, you should update the regex there, then run the `npm run grunt precommit:emoji` job. `$type` string Optional Which array type to return. Accepts `'partials'` or `'entities'`, default `'entities'`. Default: `'entities'` array An array to match all emoji that WordPress recognises. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function _wp_emoji_list( $type = 'entities' ) { // Do not remove the START/END comments - they're used to find where to insert the arrays. // START: emoji arrays $entities = array( '&#x1f468;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f468;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f468;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f468;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f468;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fe;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3ff;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fe;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3ff;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fe;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3ff;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3ff;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f9d1;&#x1f3fe;', '&#x1f468;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f468;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f468;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f468;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f468;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fe;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3ff;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fe;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3ff;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fe;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3ff;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3ff;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f9d1;&#x1f3fe;', '&#x1f468;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;', '&#x1f469;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;', '&#x1f469;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;', '&#x1f3f4;&#xe0067;&#xe0062;&#xe0065;&#xe006e;&#xe0067;&#xe007f;', '&#x1f3f4;&#xe0067;&#xe0062;&#xe0073;&#xe0063;&#xe0074;&#xe007f;', '&#x1f3f4;&#xe0067;&#xe0062;&#xe0077;&#xe006c;&#xe0073;&#xe007f;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3ff;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fb;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fc;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fd;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f468;&#x1f3fe;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f469;&#x1f3fe;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fe;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3ff;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fe;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3ff;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fe;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3ff;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fe;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3ff;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3fe;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;&#x1f3ff;', '&#x1f468;&#x200d;&#x1f468;&#x200d;&#x1f466;&#x200d;&#x1f466;', '&#x1f468;&#x200d;&#x1f468;&#x200d;&#x1f467;&#x200d;&#x1f466;', '&#x1f468;&#x200d;&#x1f468;&#x200d;&#x1f467;&#x200d;&#x1f467;', '&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f466;&#x200d;&#x1f466;', '&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;', '&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f467;', '&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f466;&#x200d;&#x1f466;', '&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;', '&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f467;', '&#x1f468;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;', '&#x1f469;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f468;', '&#x1f469;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f469;', '&#x1faf1;&#x1f3fb;&#x200d;&#x1faf2;&#x1f3fc;', '&#x1faf1;&#x1f3fb;&#x200d;&#x1faf2;&#x1f3fd;', '&#x1faf1;&#x1f3fb;&#x200d;&#x1faf2;&#x1f3fe;', '&#x1faf1;&#x1f3fb;&#x200d;&#x1faf2;&#x1f3ff;', '&#x1faf1;&#x1f3fc;&#x200d;&#x1faf2;&#x1f3fb;', '&#x1faf1;&#x1f3fc;&#x200d;&#x1faf2;&#x1f3fd;', '&#x1faf1;&#x1f3fc;&#x200d;&#x1faf2;&#x1f3fe;', '&#x1faf1;&#x1f3fc;&#x200d;&#x1faf2;&#x1f3ff;', '&#x1faf1;&#x1f3fd;&#x200d;&#x1faf2;&#x1f3fb;', '&#x1faf1;&#x1f3fd;&#x200d;&#x1faf2;&#x1f3fc;', '&#x1faf1;&#x1f3fd;&#x200d;&#x1faf2;&#x1f3fe;', '&#x1faf1;&#x1f3fd;&#x200d;&#x1faf2;&#x1f3ff;', '&#x1faf1;&#x1f3fe;&#x200d;&#x1faf2;&#x1f3fb;', '&#x1faf1;&#x1f3fe;&#x200d;&#x1faf2;&#x1f3fc;', '&#x1faf1;&#x1f3fe;&#x200d;&#x1faf2;&#x1f3fd;', '&#x1faf1;&#x1f3fe;&#x200d;&#x1faf2;&#x1f3ff;', '&#x1faf1;&#x1f3ff;&#x200d;&#x1faf2;&#x1f3fb;', '&#x1faf1;&#x1f3ff;&#x200d;&#x1faf2;&#x1f3fc;', '&#x1faf1;&#x1f3ff;&#x200d;&#x1faf2;&#x1f3fd;', '&#x1faf1;&#x1f3ff;&#x200d;&#x1faf2;&#x1f3fe;', '&#x1f468;&#x200d;&#x1f466;&#x200d;&#x1f466;', '&#x1f468;&#x200d;&#x1f467;&#x200d;&#x1f466;', '&#x1f468;&#x200d;&#x1f467;&#x200d;&#x1f467;', '&#x1f468;&#x200d;&#x1f468;&#x200d;&#x1f466;', '&#x1f468;&#x200d;&#x1f468;&#x200d;&#x1f467;', '&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f466;', '&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;', '&#x1f469;&#x200d;&#x1f466;&#x200d;&#x1f466;', '&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;', '&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f467;', '&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f466;', '&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;', '&#x1f9d1;&#x200d;&#x1f91d;&#x200d;&#x1f9d1;', '&#x1f3c3;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f3c3;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f3c3;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f3c3;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f3c3;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f3c3;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f3c3;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f3c3;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f3c3;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f3c3;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f3c4;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f3c4;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f3c4;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f3c4;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f3c4;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f3c4;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f3c4;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f3c4;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f3c4;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f3c4;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f3ca;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f3ca;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f3ca;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f3ca;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f3ca;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f3ca;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f3ca;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f3ca;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f3ca;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f3ca;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f3cb;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f3cb;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f3cb;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f3cb;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f3cb;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f3cb;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f3cb;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f3cb;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f3cb;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f3cb;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f3cc;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f3cc;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f3cc;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f3cc;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f3cc;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f3cc;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f3cc;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f3cc;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f3cc;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f3cc;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f468;&#x1f3fb;&#x200d;&#x2695;&#xfe0f;', '&#x1f468;&#x1f3fb;&#x200d;&#x2696;&#xfe0f;', '&#x1f468;&#x1f3fb;&#x200d;&#x2708;&#xfe0f;', '&#x1f468;&#x1f3fc;&#x200d;&#x2695;&#xfe0f;', '&#x1f468;&#x1f3fc;&#x200d;&#x2696;&#xfe0f;', '&#x1f468;&#x1f3fc;&#x200d;&#x2708;&#xfe0f;', '&#x1f468;&#x1f3fd;&#x200d;&#x2695;&#xfe0f;', '&#x1f468;&#x1f3fd;&#x200d;&#x2696;&#xfe0f;', '&#x1f468;&#x1f3fd;&#x200d;&#x2708;&#xfe0f;', '&#x1f468;&#x1f3fe;&#x200d;&#x2695;&#xfe0f;', '&#x1f468;&#x1f3fe;&#x200d;&#x2696;&#xfe0f;', '&#x1f468;&#x1f3fe;&#x200d;&#x2708;&#xfe0f;', '&#x1f468;&#x1f3ff;&#x200d;&#x2695;&#xfe0f;', '&#x1f468;&#x1f3ff;&#x200d;&#x2696;&#xfe0f;', '&#x1f468;&#x1f3ff;&#x200d;&#x2708;&#xfe0f;', '&#x1f469;&#x1f3fb;&#x200d;&#x2695;&#xfe0f;', '&#x1f469;&#x1f3fb;&#x200d;&#x2696;&#xfe0f;', '&#x1f469;&#x1f3fb;&#x200d;&#x2708;&#xfe0f;', '&#x1f469;&#x1f3fc;&#x200d;&#x2695;&#xfe0f;', '&#x1f469;&#x1f3fc;&#x200d;&#x2696;&#xfe0f;', '&#x1f469;&#x1f3fc;&#x200d;&#x2708;&#xfe0f;', '&#x1f469;&#x1f3fd;&#x200d;&#x2695;&#xfe0f;', '&#x1f469;&#x1f3fd;&#x200d;&#x2696;&#xfe0f;', '&#x1f469;&#x1f3fd;&#x200d;&#x2708;&#xfe0f;', '&#x1f469;&#x1f3fe;&#x200d;&#x2695;&#xfe0f;', '&#x1f469;&#x1f3fe;&#x200d;&#x2696;&#xfe0f;', '&#x1f469;&#x1f3fe;&#x200d;&#x2708;&#xfe0f;', '&#x1f469;&#x1f3ff;&#x200d;&#x2695;&#xfe0f;', '&#x1f469;&#x1f3ff;&#x200d;&#x2696;&#xfe0f;', '&#x1f469;&#x1f3ff;&#x200d;&#x2708;&#xfe0f;', '&#x1f46e;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f46e;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f46e;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f46e;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f46e;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f46e;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f46e;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f46e;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f46e;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f46e;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f470;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f470;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f470;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f470;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f470;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f470;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f470;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f470;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f470;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f470;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f471;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f471;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f471;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f471;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f471;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f471;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f471;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f471;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f471;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f471;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f473;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f473;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f473;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f473;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f473;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f473;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f473;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f473;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f473;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f473;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f477;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f477;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f477;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f477;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f477;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f477;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f477;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f477;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f477;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f477;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f481;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f481;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f481;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f481;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f481;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f481;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f481;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f481;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f481;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f481;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f482;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f482;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f482;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f482;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f482;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f482;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f482;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f482;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f482;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f482;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f486;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f486;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f486;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f486;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f486;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f486;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f486;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f486;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f486;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f486;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f487;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f487;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f487;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f487;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f487;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f487;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f487;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f487;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f487;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f487;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f574;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f574;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f574;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f574;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f574;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f574;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f574;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f574;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f574;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f574;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f575;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f575;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f575;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f575;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f575;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f575;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f575;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f575;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f575;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f575;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f645;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f645;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f645;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f645;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f645;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f645;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f645;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f645;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f645;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f645;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f646;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f646;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f646;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f646;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f646;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f646;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f646;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f646;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f646;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f646;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f647;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f647;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f647;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f647;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f647;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f647;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f647;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f647;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f647;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f647;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f64b;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f64b;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f64b;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f64b;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f64b;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f64b;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f64b;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f64b;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f64b;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f64b;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f64d;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f64d;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f64d;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f64d;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f64d;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f64d;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f64d;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f64d;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f64d;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f64d;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f64e;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f64e;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f64e;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f64e;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f64e;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f64e;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f64e;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f64e;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f64e;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f64e;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f6a3;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f6a3;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f6a3;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f6a3;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f6a3;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f6a3;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f6a3;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f6a3;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f6a3;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f6a3;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b4;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b4;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b4;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b4;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b4;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b4;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b4;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b4;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b4;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b4;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b5;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b5;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b5;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b5;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b5;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b5;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b5;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b5;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b5;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b5;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b6;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b6;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b6;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b6;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b6;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b6;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b6;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b6;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b6;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b6;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f926;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f926;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f926;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f926;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f926;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f926;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f926;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f926;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f926;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f926;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f935;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f935;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f935;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f935;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f935;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f935;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f935;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f935;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f935;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f935;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f937;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f937;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f937;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f937;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f937;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f937;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f937;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f937;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f937;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f937;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f938;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f938;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f938;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f938;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f938;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f938;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f938;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f938;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f938;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f938;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f939;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f939;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f939;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f939;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f939;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f939;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f939;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f939;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f939;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f939;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f93d;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f93d;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f93d;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f93d;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f93d;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f93d;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f93d;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f93d;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f93d;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f93d;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f93e;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f93e;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f93e;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f93e;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f93e;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f93e;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f93e;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f93e;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f93e;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f93e;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9b8;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9b8;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9b8;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9b8;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9b8;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9b8;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9b8;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9b8;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9b8;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9b8;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9b9;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9b9;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9b9;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9b9;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9b9;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9b9;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9b9;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9b9;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9b9;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9b9;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9cd;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9cd;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9cd;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9cd;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9cd;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9cd;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9cd;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9cd;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9cd;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9cd;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9ce;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9ce;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9ce;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9ce;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9ce;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9ce;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9ce;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9ce;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9ce;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9ce;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9cf;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9cf;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9cf;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9cf;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9cf;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9cf;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9cf;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9cf;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9cf;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9cf;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x2695;&#xfe0f;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x2696;&#xfe0f;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x2708;&#xfe0f;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x2695;&#xfe0f;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x2696;&#xfe0f;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x2708;&#xfe0f;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x2695;&#xfe0f;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x2696;&#xfe0f;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x2708;&#xfe0f;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x2695;&#xfe0f;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x2696;&#xfe0f;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x2708;&#xfe0f;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x2695;&#xfe0f;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x2696;&#xfe0f;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x2708;&#xfe0f;', '&#x1f9d4;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d4;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d4;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d4;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d4;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d4;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d4;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d4;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d4;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d4;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d6;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d6;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d6;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d6;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d6;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d6;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d6;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d6;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d6;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d6;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d7;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d7;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d7;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d7;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d7;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d7;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d7;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d7;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d7;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d7;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d8;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d8;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d8;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d8;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d8;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d8;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d8;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d8;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d8;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d8;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d9;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d9;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d9;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d9;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d9;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d9;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d9;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d9;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d9;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d9;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9da;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9da;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9da;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9da;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9da;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9da;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9da;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9da;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9da;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9da;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9db;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9db;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9db;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9db;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9db;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9db;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9db;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9db;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9db;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9db;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9dc;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9dc;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9dc;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9dc;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9dc;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9dc;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9dc;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9dc;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9dc;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9dc;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f9dd;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x1f9dd;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x1f9dd;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9dd;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9dd;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9dd;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9dd;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x1f9dd;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x1f9dd;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x1f9dd;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x1f3cb;&#xfe0f;&#x200d;&#x2640;&#xfe0f;', '&#x1f3cb;&#xfe0f;&#x200d;&#x2642;&#xfe0f;', '&#x1f3cc;&#xfe0f;&#x200d;&#x2640;&#xfe0f;', '&#x1f3cc;&#xfe0f;&#x200d;&#x2642;&#xfe0f;', '&#x1f3f3;&#xfe0f;&#x200d;&#x26a7;&#xfe0f;', '&#x1f574;&#xfe0f;&#x200d;&#x2640;&#xfe0f;', '&#x1f574;&#xfe0f;&#x200d;&#x2642;&#xfe0f;', '&#x1f575;&#xfe0f;&#x200d;&#x2640;&#xfe0f;', '&#x1f575;&#xfe0f;&#x200d;&#x2642;&#xfe0f;', '&#x26f9;&#x1f3fb;&#x200d;&#x2640;&#xfe0f;', '&#x26f9;&#x1f3fb;&#x200d;&#x2642;&#xfe0f;', '&#x26f9;&#x1f3fc;&#x200d;&#x2640;&#xfe0f;', '&#x26f9;&#x1f3fc;&#x200d;&#x2642;&#xfe0f;', '&#x26f9;&#x1f3fd;&#x200d;&#x2640;&#xfe0f;', '&#x26f9;&#x1f3fd;&#x200d;&#x2642;&#xfe0f;', '&#x26f9;&#x1f3fe;&#x200d;&#x2640;&#xfe0f;', '&#x26f9;&#x1f3fe;&#x200d;&#x2642;&#xfe0f;', '&#x26f9;&#x1f3ff;&#x200d;&#x2640;&#xfe0f;', '&#x26f9;&#x1f3ff;&#x200d;&#x2642;&#xfe0f;', '&#x26f9;&#xfe0f;&#x200d;&#x2640;&#xfe0f;', '&#x26f9;&#xfe0f;&#x200d;&#x2642;&#xfe0f;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f33e;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f373;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f37c;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f384;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f393;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f3a4;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f3a8;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f3eb;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f3ed;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f4bb;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f4bc;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f527;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f52c;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f680;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f692;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f9af;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f9b0;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f9b1;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f9b2;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f9b3;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f9bc;', '&#x1f468;&#x1f3fb;&#x200d;&#x1f9bd;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f33e;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f373;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f37c;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f384;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f393;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f3a4;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f3a8;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f3eb;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f3ed;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f4bb;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f4bc;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f527;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f52c;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f680;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f692;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f9af;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f9b0;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f9b1;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f9b2;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f9b3;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f9bc;', '&#x1f468;&#x1f3fc;&#x200d;&#x1f9bd;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f33e;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f373;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f37c;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f384;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f393;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f3a4;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f3a8;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f3eb;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f3ed;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f4bb;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f4bc;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f527;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f52c;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f680;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f692;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f9af;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f9b0;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f9b1;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f9b2;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f9b3;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f9bc;', '&#x1f468;&#x1f3fd;&#x200d;&#x1f9bd;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f33e;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f373;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f37c;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f384;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f393;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f3a4;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f3a8;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f3eb;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f3ed;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f4bb;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f4bc;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f527;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f52c;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f680;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f692;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f9af;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f9b0;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f9b1;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f9b2;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f9b3;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f9bc;', '&#x1f468;&#x1f3fe;&#x200d;&#x1f9bd;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f33e;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f373;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f37c;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f384;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f393;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f3a4;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f3a8;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f3eb;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f3ed;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f4bb;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f4bc;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f527;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f52c;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f680;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f692;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f9af;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f9b0;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f9b1;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f9b2;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f9b3;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f9bc;', '&#x1f468;&#x1f3ff;&#x200d;&#x1f9bd;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f33e;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f373;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f37c;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f384;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f393;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f3a4;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f3a8;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f3eb;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f3ed;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f4bb;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f4bc;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f527;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f52c;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f680;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f692;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f9af;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f9b0;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f9b1;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f9b2;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f9b3;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f9bc;', '&#x1f469;&#x1f3fb;&#x200d;&#x1f9bd;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f33e;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f373;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f37c;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f384;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f393;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f3a4;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f3a8;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f3eb;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f3ed;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f4bb;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f4bc;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f527;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f52c;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f680;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f692;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f9af;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f9b0;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f9b1;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f9b2;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f9b3;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f9bc;', '&#x1f469;&#x1f3fc;&#x200d;&#x1f9bd;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f33e;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f373;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f37c;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f384;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f393;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f3a4;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f3a8;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f3eb;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f3ed;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f4bb;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f4bc;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f527;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f52c;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f680;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f692;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f9af;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f9b0;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f9b1;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f9b2;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f9b3;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f9bc;', '&#x1f469;&#x1f3fd;&#x200d;&#x1f9bd;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f33e;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f373;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f37c;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f384;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f393;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f3a4;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f3a8;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f3eb;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f3ed;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f4bb;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f4bc;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f527;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f52c;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f680;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f692;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f9af;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f9b0;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f9b1;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f9b2;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f9b3;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f9bc;', '&#x1f469;&#x1f3fe;&#x200d;&#x1f9bd;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f33e;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f373;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f37c;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f384;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f393;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f3a4;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f3a8;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f3eb;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f3ed;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f4bb;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f4bc;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f527;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f52c;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f680;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f692;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f9af;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f9b0;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f9b1;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f9b2;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f9b3;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f9bc;', '&#x1f469;&#x1f3ff;&#x200d;&#x1f9bd;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f33e;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f373;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f37c;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f384;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f393;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f3a4;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f3a8;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f3eb;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f3ed;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f4bb;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f4bc;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f527;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f52c;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f680;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f692;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f9af;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f9b0;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f9b1;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f9b2;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f9b3;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f9bc;', '&#x1f9d1;&#x1f3fb;&#x200d;&#x1f9bd;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f33e;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f373;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f37c;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f384;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f393;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f3a4;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f3a8;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f3eb;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f3ed;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f4bb;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f4bc;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f527;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f52c;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f680;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f692;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f9af;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f9b0;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f9b1;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f9b2;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f9b3;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f9bc;', '&#x1f9d1;&#x1f3fc;&#x200d;&#x1f9bd;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f33e;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f373;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f37c;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f384;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f393;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f3a4;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f3a8;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f3eb;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f3ed;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f4bb;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f4bc;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f527;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f52c;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f680;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f692;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f9af;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f9b0;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f9b1;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f9b2;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f9b3;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f9bc;', '&#x1f9d1;&#x1f3fd;&#x200d;&#x1f9bd;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f33e;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f373;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f37c;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f384;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f393;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f3a4;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f3a8;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f3eb;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f3ed;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f4bb;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f4bc;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f527;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f52c;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f680;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f692;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f9af;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f9b0;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f9b1;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f9b2;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f9b3;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f9bc;', '&#x1f9d1;&#x1f3fe;&#x200d;&#x1f9bd;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f33e;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f373;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f37c;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f384;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f393;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f3a4;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f3a8;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f3eb;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f3ed;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f4bb;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f4bc;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f527;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f52c;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f680;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f692;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f9af;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f9b0;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f9b1;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f9b2;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f9b3;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f9bc;', '&#x1f9d1;&#x1f3ff;&#x200d;&#x1f9bd;', '&#x1f3f3;&#xfe0f;&#x200d;&#x1f308;', '&#x1f636;&#x200d;&#x1f32b;&#xfe0f;', '&#x1f3c3;&#x200d;&#x2640;&#xfe0f;', '&#x1f3c3;&#x200d;&#x2642;&#xfe0f;', '&#x1f3c4;&#x200d;&#x2640;&#xfe0f;', '&#x1f3c4;&#x200d;&#x2642;&#xfe0f;', '&#x1f3ca;&#x200d;&#x2640;&#xfe0f;', '&#x1f3ca;&#x200d;&#x2642;&#xfe0f;', '&#x1f3f4;&#x200d;&#x2620;&#xfe0f;', '&#x1f43b;&#x200d;&#x2744;&#xfe0f;', '&#x1f468;&#x200d;&#x2695;&#xfe0f;', '&#x1f468;&#x200d;&#x2696;&#xfe0f;', '&#x1f468;&#x200d;&#x2708;&#xfe0f;', '&#x1f469;&#x200d;&#x2695;&#xfe0f;', '&#x1f469;&#x200d;&#x2696;&#xfe0f;', '&#x1f469;&#x200d;&#x2708;&#xfe0f;', '&#x1f46e;&#x200d;&#x2640;&#xfe0f;', '&#x1f46e;&#x200d;&#x2642;&#xfe0f;', '&#x1f46f;&#x200d;&#x2640;&#xfe0f;', '&#x1f46f;&#x200d;&#x2642;&#xfe0f;', '&#x1f470;&#x200d;&#x2640;&#xfe0f;', '&#x1f470;&#x200d;&#x2642;&#xfe0f;', '&#x1f471;&#x200d;&#x2640;&#xfe0f;', '&#x1f471;&#x200d;&#x2642;&#xfe0f;', '&#x1f473;&#x200d;&#x2640;&#xfe0f;', '&#x1f473;&#x200d;&#x2642;&#xfe0f;', '&#x1f477;&#x200d;&#x2640;&#xfe0f;', '&#x1f477;&#x200d;&#x2642;&#xfe0f;', '&#x1f481;&#x200d;&#x2640;&#xfe0f;', '&#x1f481;&#x200d;&#x2642;&#xfe0f;', '&#x1f482;&#x200d;&#x2640;&#xfe0f;', '&#x1f482;&#x200d;&#x2642;&#xfe0f;', '&#x1f486;&#x200d;&#x2640;&#xfe0f;', '&#x1f486;&#x200d;&#x2642;&#xfe0f;', '&#x1f487;&#x200d;&#x2640;&#xfe0f;', '&#x1f487;&#x200d;&#x2642;&#xfe0f;', '&#x1f645;&#x200d;&#x2640;&#xfe0f;', '&#x1f645;&#x200d;&#x2642;&#xfe0f;', '&#x1f646;&#x200d;&#x2640;&#xfe0f;', '&#x1f646;&#x200d;&#x2642;&#xfe0f;', '&#x1f647;&#x200d;&#x2640;&#xfe0f;', '&#x1f647;&#x200d;&#x2642;&#xfe0f;', '&#x1f64b;&#x200d;&#x2640;&#xfe0f;', '&#x1f64b;&#x200d;&#x2642;&#xfe0f;', '&#x1f64d;&#x200d;&#x2640;&#xfe0f;', '&#x1f64d;&#x200d;&#x2642;&#xfe0f;', '&#x1f64e;&#x200d;&#x2640;&#xfe0f;', '&#x1f64e;&#x200d;&#x2642;&#xfe0f;', '&#x1f6a3;&#x200d;&#x2640;&#xfe0f;', '&#x1f6a3;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b4;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b4;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b5;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b5;&#x200d;&#x2642;&#xfe0f;', '&#x1f6b6;&#x200d;&#x2640;&#xfe0f;', '&#x1f6b6;&#x200d;&#x2642;&#xfe0f;', '&#x1f926;&#x200d;&#x2640;&#xfe0f;', '&#x1f926;&#x200d;&#x2642;&#xfe0f;', '&#x1f935;&#x200d;&#x2640;&#xfe0f;', '&#x1f935;&#x200d;&#x2642;&#xfe0f;', '&#x1f937;&#x200d;&#x2640;&#xfe0f;', '&#x1f937;&#x200d;&#x2642;&#xfe0f;', '&#x1f938;&#x200d;&#x2640;&#xfe0f;', '&#x1f938;&#x200d;&#x2642;&#xfe0f;', '&#x1f939;&#x200d;&#x2640;&#xfe0f;', '&#x1f939;&#x200d;&#x2642;&#xfe0f;', '&#x1f93c;&#x200d;&#x2640;&#xfe0f;', '&#x1f93c;&#x200d;&#x2642;&#xfe0f;', '&#x1f93d;&#x200d;&#x2640;&#xfe0f;', '&#x1f93d;&#x200d;&#x2642;&#xfe0f;', '&#x1f93e;&#x200d;&#x2640;&#xfe0f;', '&#x1f93e;&#x200d;&#x2642;&#xfe0f;', '&#x1f9b8;&#x200d;&#x2640;&#xfe0f;', '&#x1f9b8;&#x200d;&#x2642;&#xfe0f;', '&#x1f9b9;&#x200d;&#x2640;&#xfe0f;', '&#x1f9b9;&#x200d;&#x2642;&#xfe0f;', '&#x1f9cd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9cd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9ce;&#x200d;&#x2640;&#xfe0f;', '&#x1f9ce;&#x200d;&#x2642;&#xfe0f;', '&#x1f9cf;&#x200d;&#x2640;&#xfe0f;', '&#x1f9cf;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d1;&#x200d;&#x2695;&#xfe0f;', '&#x1f9d1;&#x200d;&#x2696;&#xfe0f;', '&#x1f9d1;&#x200d;&#x2708;&#xfe0f;', '&#x1f9d4;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d4;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d6;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d6;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d7;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d7;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d8;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d8;&#x200d;&#x2642;&#xfe0f;', '&#x1f9d9;&#x200d;&#x2640;&#xfe0f;', '&#x1f9d9;&#x200d;&#x2642;&#xfe0f;', '&#x1f9da;&#x200d;&#x2640;&#xfe0f;', '&#x1f9da;&#x200d;&#x2642;&#xfe0f;', '&#x1f9db;&#x200d;&#x2640;&#xfe0f;', '&#x1f9db;&#x200d;&#x2642;&#xfe0f;', '&#x1f9dc;&#x200d;&#x2640;&#xfe0f;', '&#x1f9dc;&#x200d;&#x2642;&#xfe0f;', '&#x1f9dd;&#x200d;&#x2640;&#xfe0f;', '&#x1f9dd;&#x200d;&#x2642;&#xfe0f;', '&#x1f9de;&#x200d;&#x2640;&#xfe0f;', '&#x1f9de;&#x200d;&#x2642;&#xfe0f;', '&#x1f9df;&#x200d;&#x2640;&#xfe0f;', '&#x1f9df;&#x200d;&#x2642;&#xfe0f;', '&#x2764;&#xfe0f;&#x200d;&#x1f525;', '&#x2764;&#xfe0f;&#x200d;&#x1fa79;', '&#x1f415;&#x200d;&#x1f9ba;', '&#x1f441;&#x200d;&#x1f5e8;', '&#x1f468;&#x200d;&#x1f33e;', '&#x1f468;&#x200d;&#x1f373;', '&#x1f468;&#x200d;&#x1f37c;', '&#x1f468;&#x200d;&#x1f384;', '&#x1f468;&#x200d;&#x1f393;', '&#x1f468;&#x200d;&#x1f3a4;', '&#x1f468;&#x200d;&#x1f3a8;', '&#x1f468;&#x200d;&#x1f3eb;', '&#x1f468;&#x200d;&#x1f3ed;', '&#x1f468;&#x200d;&#x1f466;', '&#x1f468;&#x200d;&#x1f467;', '&#x1f468;&#x200d;&#x1f4bb;', '&#x1f468;&#x200d;&#x1f4bc;', '&#x1f468;&#x200d;&#x1f527;', '&#x1f468;&#x200d;&#x1f52c;', '&#x1f468;&#x200d;&#x1f680;', '&#x1f468;&#x200d;&#x1f692;', '&#x1f468;&#x200d;&#x1f9af;', '&#x1f468;&#x200d;&#x1f9b0;', '&#x1f468;&#x200d;&#x1f9b1;', '&#x1f468;&#x200d;&#x1f9b2;', '&#x1f468;&#x200d;&#x1f9b3;', '&#x1f468;&#x200d;&#x1f9bc;', '&#x1f468;&#x200d;&#x1f9bd;', '&#x1f469;&#x200d;&#x1f33e;', '&#x1f469;&#x200d;&#x1f373;', '&#x1f469;&#x200d;&#x1f37c;', '&#x1f469;&#x200d;&#x1f384;', '&#x1f469;&#x200d;&#x1f393;', '&#x1f469;&#x200d;&#x1f3a4;', '&#x1f469;&#x200d;&#x1f3a8;', '&#x1f469;&#x200d;&#x1f3eb;', '&#x1f469;&#x200d;&#x1f3ed;', '&#x1f469;&#x200d;&#x1f466;', '&#x1f469;&#x200d;&#x1f467;', '&#x1f469;&#x200d;&#x1f4bb;', '&#x1f469;&#x200d;&#x1f4bc;', '&#x1f469;&#x200d;&#x1f527;', '&#x1f469;&#x200d;&#x1f52c;', '&#x1f469;&#x200d;&#x1f680;', '&#x1f469;&#x200d;&#x1f692;', '&#x1f469;&#x200d;&#x1f9af;', '&#x1f469;&#x200d;&#x1f9b0;', '&#x1f469;&#x200d;&#x1f9b1;', '&#x1f469;&#x200d;&#x1f9b2;', '&#x1f469;&#x200d;&#x1f9b3;', '&#x1f469;&#x200d;&#x1f9bc;', '&#x1f469;&#x200d;&#x1f9bd;', '&#x1f62e;&#x200d;&#x1f4a8;', '&#x1f635;&#x200d;&#x1f4ab;', '&#x1f9d1;&#x200d;&#x1f33e;', '&#x1f9d1;&#x200d;&#x1f373;', '&#x1f9d1;&#x200d;&#x1f37c;', '&#x1f9d1;&#x200d;&#x1f384;', '&#x1f9d1;&#x200d;&#x1f393;', '&#x1f9d1;&#x200d;&#x1f3a4;', '&#x1f9d1;&#x200d;&#x1f3a8;', '&#x1f9d1;&#x200d;&#x1f3eb;', '&#x1f9d1;&#x200d;&#x1f3ed;', '&#x1f9d1;&#x200d;&#x1f4bb;', '&#x1f9d1;&#x200d;&#x1f4bc;', '&#x1f9d1;&#x200d;&#x1f527;', '&#x1f9d1;&#x200d;&#x1f52c;', '&#x1f9d1;&#x200d;&#x1f680;', '&#x1f9d1;&#x200d;&#x1f692;', '&#x1f9d1;&#x200d;&#x1f9af;', '&#x1f9d1;&#x200d;&#x1f9b0;', '&#x1f9d1;&#x200d;&#x1f9b1;', '&#x1f9d1;&#x200d;&#x1f9b2;', '&#x1f9d1;&#x200d;&#x1f9b3;', '&#x1f9d1;&#x200d;&#x1f9bc;', '&#x1f9d1;&#x200d;&#x1f9bd;', '&#x1f408;&#x200d;&#x2b1b;', '&#x1f1e6;&#x1f1e8;', '&#x1f1e6;&#x1f1e9;', '&#x1f1e6;&#x1f1ea;', '&#x1f1e6;&#x1f1eb;', '&#x1f1e6;&#x1f1ec;', '&#x1f1e6;&#x1f1ee;', '&#x1f1e6;&#x1f1f1;', '&#x1f1e6;&#x1f1f2;', '&#x1f1e6;&#x1f1f4;', '&#x1f1e6;&#x1f1f6;', '&#x1f1e6;&#x1f1f7;', '&#x1f1e6;&#x1f1f8;', '&#x1f1e6;&#x1f1f9;', '&#x1f1e6;&#x1f1fa;', '&#x1f1e6;&#x1f1fc;', '&#x1f1e6;&#x1f1fd;', '&#x1f1e6;&#x1f1ff;', '&#x1f1e7;&#x1f1e6;', '&#x1f1e7;&#x1f1e7;', '&#x1f1e7;&#x1f1e9;', '&#x1f1e7;&#x1f1ea;', '&#x1f1e7;&#x1f1eb;', '&#x1f1e7;&#x1f1ec;', '&#x1f1e7;&#x1f1ed;', '&#x1f1e7;&#x1f1ee;', '&#x1f1e7;&#x1f1ef;', '&#x1f1e7;&#x1f1f1;', '&#x1f1e7;&#x1f1f2;', '&#x1f1e7;&#x1f1f3;', '&#x1f1e7;&#x1f1f4;', '&#x1f1e7;&#x1f1f6;', '&#x1f1e7;&#x1f1f7;', '&#x1f1e7;&#x1f1f8;', '&#x1f1e7;&#x1f1f9;', '&#x1f1e7;&#x1f1fb;', '&#x1f1e7;&#x1f1fc;', '&#x1f1e7;&#x1f1fe;', '&#x1f1e7;&#x1f1ff;', '&#x1f1e8;&#x1f1e6;', '&#x1f1e8;&#x1f1e8;', '&#x1f1e8;&#x1f1e9;', '&#x1f1e8;&#x1f1eb;', '&#x1f1e8;&#x1f1ec;', '&#x1f1e8;&#x1f1ed;', '&#x1f1e8;&#x1f1ee;', '&#x1f1e8;&#x1f1f0;', '&#x1f1e8;&#x1f1f1;', '&#x1f1e8;&#x1f1f2;', '&#x1f1e8;&#x1f1f3;', '&#x1f1e8;&#x1f1f4;', '&#x1f1e8;&#x1f1f5;', '&#x1f1e8;&#x1f1f7;', '&#x1f1e8;&#x1f1fa;', '&#x1f1e8;&#x1f1fb;', '&#x1f1e8;&#x1f1fc;', '&#x1f1e8;&#x1f1fd;', '&#x1f1e8;&#x1f1fe;', '&#x1f1e8;&#x1f1ff;', '&#x1f1e9;&#x1f1ea;', '&#x1f1e9;&#x1f1ec;', '&#x1f1e9;&#x1f1ef;', '&#x1f1e9;&#x1f1f0;', '&#x1f1e9;&#x1f1f2;', '&#x1f1e9;&#x1f1f4;', '&#x1f1e9;&#x1f1ff;', '&#x1f1ea;&#x1f1e6;', '&#x1f1ea;&#x1f1e8;', '&#x1f1ea;&#x1f1ea;', '&#x1f1ea;&#x1f1ec;', '&#x1f1ea;&#x1f1ed;', '&#x1f1ea;&#x1f1f7;', '&#x1f1ea;&#x1f1f8;', '&#x1f1ea;&#x1f1f9;', '&#x1f1ea;&#x1f1fa;', '&#x1f1eb;&#x1f1ee;', '&#x1f1eb;&#x1f1ef;', '&#x1f1eb;&#x1f1f0;', '&#x1f1eb;&#x1f1f2;', '&#x1f1eb;&#x1f1f4;', '&#x1f1eb;&#x1f1f7;', '&#x1f1ec;&#x1f1e6;', '&#x1f1ec;&#x1f1e7;', '&#x1f1ec;&#x1f1e9;', '&#x1f1ec;&#x1f1ea;', '&#x1f1ec;&#x1f1eb;', '&#x1f1ec;&#x1f1ec;', '&#x1f1ec;&#x1f1ed;', '&#x1f1ec;&#x1f1ee;', '&#x1f1ec;&#x1f1f1;', '&#x1f1ec;&#x1f1f2;', '&#x1f1ec;&#x1f1f3;', '&#x1f1ec;&#x1f1f5;', '&#x1f1ec;&#x1f1f6;', '&#x1f1ec;&#x1f1f7;', '&#x1f1ec;&#x1f1f8;', '&#x1f1ec;&#x1f1f9;', '&#x1f1ec;&#x1f1fa;', '&#x1f1ec;&#x1f1fc;', '&#x1f1ec;&#x1f1fe;', '&#x1f1ed;&#x1f1f0;', '&#x1f1ed;&#x1f1f2;', '&#x1f1ed;&#x1f1f3;', '&#x1f1ed;&#x1f1f7;', '&#x1f1ed;&#x1f1f9;', '&#x1f1ed;&#x1f1fa;', '&#x1f1ee;&#x1f1e8;', '&#x1f1ee;&#x1f1e9;', '&#x1f1ee;&#x1f1ea;', '&#x1f1ee;&#x1f1f1;', '&#x1f1ee;&#x1f1f2;', '&#x1f1ee;&#x1f1f3;', '&#x1f1ee;&#x1f1f4;', '&#x1f1ee;&#x1f1f6;', '&#x1f1ee;&#x1f1f7;', '&#x1f1ee;&#x1f1f8;', '&#x1f1ee;&#x1f1f9;', '&#x1f1ef;&#x1f1ea;', '&#x1f1ef;&#x1f1f2;', '&#x1f1ef;&#x1f1f4;', '&#x1f1ef;&#x1f1f5;', '&#x1f1f0;&#x1f1ea;', '&#x1f1f0;&#x1f1ec;', '&#x1f1f0;&#x1f1ed;', '&#x1f1f0;&#x1f1ee;', '&#x1f1f0;&#x1f1f2;', '&#x1f1f0;&#x1f1f3;', '&#x1f1f0;&#x1f1f5;', '&#x1f1f0;&#x1f1f7;', '&#x1f1f0;&#x1f1fc;', '&#x1f1f0;&#x1f1fe;', '&#x1f1f0;&#x1f1ff;', '&#x1f1f1;&#x1f1e6;', '&#x1f1f1;&#x1f1e7;', '&#x1f1f1;&#x1f1e8;', '&#x1f1f1;&#x1f1ee;', '&#x1f1f1;&#x1f1f0;', '&#x1f1f1;&#x1f1f7;', '&#x1f1f1;&#x1f1f8;', '&#x1f1f1;&#x1f1f9;', '&#x1f1f1;&#x1f1fa;', '&#x1f1f1;&#x1f1fb;', '&#x1f1f1;&#x1f1fe;', '&#x1f1f2;&#x1f1e6;', '&#x1f1f2;&#x1f1e8;', '&#x1f1f2;&#x1f1e9;', '&#x1f1f2;&#x1f1ea;', '&#x1f1f2;&#x1f1eb;', '&#x1f1f2;&#x1f1ec;', '&#x1f1f2;&#x1f1ed;', '&#x1f1f2;&#x1f1f0;', '&#x1f1f2;&#x1f1f1;', '&#x1f1f2;&#x1f1f2;', '&#x1f1f2;&#x1f1f3;', '&#x1f1f2;&#x1f1f4;', '&#x1f1f2;&#x1f1f5;', '&#x1f1f2;&#x1f1f6;', '&#x1f1f2;&#x1f1f7;', '&#x1f1f2;&#x1f1f8;', '&#x1f1f2;&#x1f1f9;', '&#x1f1f2;&#x1f1fa;', '&#x1f1f2;&#x1f1fb;', '&#x1f1f2;&#x1f1fc;', '&#x1f1f2;&#x1f1fd;', '&#x1f1f2;&#x1f1fe;', '&#x1f1f2;&#x1f1ff;', '&#x1f1f3;&#x1f1e6;', '&#x1f1f3;&#x1f1e8;', '&#x1f1f3;&#x1f1ea;', '&#x1f1f3;&#x1f1eb;', '&#x1f1f3;&#x1f1ec;', '&#x1f1f3;&#x1f1ee;', '&#x1f1f3;&#x1f1f1;', '&#x1f1f3;&#x1f1f4;', '&#x1f1f3;&#x1f1f5;', '&#x1f1f3;&#x1f1f7;', '&#x1f1f3;&#x1f1fa;', '&#x1f1f3;&#x1f1ff;', '&#x1f1f4;&#x1f1f2;', '&#x1f1f5;&#x1f1e6;', '&#x1f1f5;&#x1f1ea;', '&#x1f1f5;&#x1f1eb;', '&#x1f1f5;&#x1f1ec;', '&#x1f1f5;&#x1f1ed;', '&#x1f1f5;&#x1f1f0;', '&#x1f1f5;&#x1f1f1;', '&#x1f1f5;&#x1f1f2;', '&#x1f1f5;&#x1f1f3;', '&#x1f1f5;&#x1f1f7;', '&#x1f1f5;&#x1f1f8;', '&#x1f1f5;&#x1f1f9;', '&#x1f1f5;&#x1f1fc;', '&#x1f1f5;&#x1f1fe;', '&#x1f1f6;&#x1f1e6;', '&#x1f1f7;&#x1f1ea;', '&#x1f1f7;&#x1f1f4;', '&#x1f1f7;&#x1f1f8;', '&#x1f1f7;&#x1f1fa;', '&#x1f1f7;&#x1f1fc;', '&#x1f1f8;&#x1f1e6;', '&#x1f1f8;&#x1f1e7;', '&#x1f1f8;&#x1f1e8;', '&#x1f1f8;&#x1f1e9;', '&#x1f1f8;&#x1f1ea;', '&#x1f1f8;&#x1f1ec;', '&#x1f1f8;&#x1f1ed;', '&#x1f1f8;&#x1f1ee;', '&#x1f1f8;&#x1f1ef;', '&#x1f1f8;&#x1f1f0;', '&#x1f1f8;&#x1f1f1;', '&#x1f1f8;&#x1f1f2;', '&#x1f1f8;&#x1f1f3;', '&#x1f1f8;&#x1f1f4;', '&#x1f1f8;&#x1f1f7;', '&#x1f1f8;&#x1f1f8;', '&#x1f1f8;&#x1f1f9;', '&#x1f1f8;&#x1f1fb;', '&#x1f1f8;&#x1f1fd;', '&#x1f1f8;&#x1f1fe;', '&#x1f1f8;&#x1f1ff;', '&#x1f1f9;&#x1f1e6;', '&#x1f1f9;&#x1f1e8;', '&#x1f1f9;&#x1f1e9;', '&#x1f1f9;&#x1f1eb;', '&#x1f1f9;&#x1f1ec;', '&#x1f1f9;&#x1f1ed;', '&#x1f1f9;&#x1f1ef;', '&#x1f1f9;&#x1f1f0;', '&#x1f1f9;&#x1f1f1;', '&#x1f1f9;&#x1f1f2;', '&#x1f1f9;&#x1f1f3;', '&#x1f1f9;&#x1f1f4;', '&#x1f1f9;&#x1f1f7;', '&#x1f1f9;&#x1f1f9;', '&#x1f1f9;&#x1f1fb;', '&#x1f1f9;&#x1f1fc;', '&#x1f1f9;&#x1f1ff;', '&#x1f1fa;&#x1f1e6;', '&#x1f1fa;&#x1f1ec;', '&#x1f1fa;&#x1f1f2;', '&#x1f1fa;&#x1f1f3;', '&#x1f1fa;&#x1f1f8;', '&#x1f1fa;&#x1f1fe;', '&#x1f1fa;&#x1f1ff;', '&#x1f1fb;&#x1f1e6;', '&#x1f1fb;&#x1f1e8;', '&#x1f1fb;&#x1f1ea;', '&#x1f1fb;&#x1f1ec;', '&#x1f1fb;&#x1f1ee;', '&#x1f1fb;&#x1f1f3;', '&#x1f1fb;&#x1f1fa;', '&#x1f1fc;&#x1f1eb;', '&#x1f1fc;&#x1f1f8;', '&#x1f1fd;&#x1f1f0;', '&#x1f1fe;&#x1f1ea;', '&#x1f1fe;&#x1f1f9;', '&#x1f1ff;&#x1f1e6;', '&#x1f1ff;&#x1f1f2;', '&#x1f1ff;&#x1f1fc;', '&#x1f385;&#x1f3fb;', '&#x1f385;&#x1f3fc;', '&#x1f385;&#x1f3fd;', '&#x1f385;&#x1f3fe;', '&#x1f385;&#x1f3ff;', '&#x1f3c2;&#x1f3fb;', '&#x1f3c2;&#x1f3fc;', '&#x1f3c2;&#x1f3fd;', '&#x1f3c2;&#x1f3fe;', '&#x1f3c2;&#x1f3ff;', '&#x1f3c3;&#x1f3fb;', '&#x1f3c3;&#x1f3fc;', '&#x1f3c3;&#x1f3fd;', '&#x1f3c3;&#x1f3fe;', '&#x1f3c3;&#x1f3ff;', '&#x1f3c4;&#x1f3fb;', '&#x1f3c4;&#x1f3fc;', '&#x1f3c4;&#x1f3fd;', '&#x1f3c4;&#x1f3fe;', '&#x1f3c4;&#x1f3ff;', '&#x1f3c7;&#x1f3fb;', '&#x1f3c7;&#x1f3fc;', '&#x1f3c7;&#x1f3fd;', '&#x1f3c7;&#x1f3fe;', '&#x1f3c7;&#x1f3ff;', '&#x1f3ca;&#x1f3fb;', '&#x1f3ca;&#x1f3fc;', '&#x1f3ca;&#x1f3fd;', '&#x1f3ca;&#x1f3fe;', '&#x1f3ca;&#x1f3ff;', '&#x1f3cb;&#x1f3fb;', '&#x1f3cb;&#x1f3fc;', '&#x1f3cb;&#x1f3fd;', '&#x1f3cb;&#x1f3fe;', '&#x1f3cb;&#x1f3ff;', '&#x1f3cc;&#x1f3fb;', '&#x1f3cc;&#x1f3fc;', '&#x1f3cc;&#x1f3fd;', '&#x1f3cc;&#x1f3fe;', '&#x1f3cc;&#x1f3ff;', '&#x1f442;&#x1f3fb;', '&#x1f442;&#x1f3fc;', '&#x1f442;&#x1f3fd;', '&#x1f442;&#x1f3fe;', '&#x1f442;&#x1f3ff;', '&#x1f443;&#x1f3fb;', '&#x1f443;&#x1f3fc;', '&#x1f443;&#x1f3fd;', '&#x1f443;&#x1f3fe;', '&#x1f443;&#x1f3ff;', '&#x1f446;&#x1f3fb;', '&#x1f446;&#x1f3fc;', '&#x1f446;&#x1f3fd;', '&#x1f446;&#x1f3fe;', '&#x1f446;&#x1f3ff;', '&#x1f447;&#x1f3fb;', '&#x1f447;&#x1f3fc;', '&#x1f447;&#x1f3fd;', '&#x1f447;&#x1f3fe;', '&#x1f447;&#x1f3ff;', '&#x1f448;&#x1f3fb;', '&#x1f448;&#x1f3fc;', '&#x1f448;&#x1f3fd;', '&#x1f448;&#x1f3fe;', '&#x1f448;&#x1f3ff;', '&#x1f449;&#x1f3fb;', '&#x1f449;&#x1f3fc;', '&#x1f449;&#x1f3fd;', '&#x1f449;&#x1f3fe;', '&#x1f449;&#x1f3ff;', '&#x1f44a;&#x1f3fb;', '&#x1f44a;&#x1f3fc;', '&#x1f44a;&#x1f3fd;', '&#x1f44a;&#x1f3fe;', '&#x1f44a;&#x1f3ff;', '&#x1f44b;&#x1f3fb;', '&#x1f44b;&#x1f3fc;', '&#x1f44b;&#x1f3fd;', '&#x1f44b;&#x1f3fe;', '&#x1f44b;&#x1f3ff;', '&#x1f44c;&#x1f3fb;', '&#x1f44c;&#x1f3fc;', '&#x1f44c;&#x1f3fd;', '&#x1f44c;&#x1f3fe;', '&#x1f44c;&#x1f3ff;', '&#x1f44d;&#x1f3fb;', '&#x1f44d;&#x1f3fc;', '&#x1f44d;&#x1f3fd;', '&#x1f44d;&#x1f3fe;', '&#x1f44d;&#x1f3ff;', '&#x1f44e;&#x1f3fb;', '&#x1f44e;&#x1f3fc;', '&#x1f44e;&#x1f3fd;', '&#x1f44e;&#x1f3fe;', '&#x1f44e;&#x1f3ff;', '&#x1f44f;&#x1f3fb;', '&#x1f44f;&#x1f3fc;', '&#x1f44f;&#x1f3fd;', '&#x1f44f;&#x1f3fe;', '&#x1f44f;&#x1f3ff;', '&#x1f450;&#x1f3fb;', '&#x1f450;&#x1f3fc;', '&#x1f450;&#x1f3fd;', '&#x1f450;&#x1f3fe;', '&#x1f450;&#x1f3ff;', '&#x1f466;&#x1f3fb;', '&#x1f466;&#x1f3fc;', '&#x1f466;&#x1f3fd;', '&#x1f466;&#x1f3fe;', '&#x1f466;&#x1f3ff;', '&#x1f467;&#x1f3fb;', '&#x1f467;&#x1f3fc;', '&#x1f467;&#x1f3fd;', '&#x1f467;&#x1f3fe;', '&#x1f467;&#x1f3ff;', '&#x1f468;&#x1f3fb;', '&#x1f468;&#x1f3fc;', '&#x1f468;&#x1f3fd;', '&#x1f468;&#x1f3fe;', '&#x1f468;&#x1f3ff;', '&#x1f469;&#x1f3fb;', '&#x1f469;&#x1f3fc;', '&#x1f469;&#x1f3fd;', '&#x1f469;&#x1f3fe;', '&#x1f469;&#x1f3ff;', '&#x1f46b;&#x1f3fb;', '&#x1f46b;&#x1f3fc;', '&#x1f46b;&#x1f3fd;', '&#x1f46b;&#x1f3fe;', '&#x1f46b;&#x1f3ff;', '&#x1f46c;&#x1f3fb;', '&#x1f46c;&#x1f3fc;', '&#x1f46c;&#x1f3fd;', '&#x1f46c;&#x1f3fe;', '&#x1f46c;&#x1f3ff;', '&#x1f46d;&#x1f3fb;', '&#x1f46d;&#x1f3fc;', '&#x1f46d;&#x1f3fd;', '&#x1f46d;&#x1f3fe;', '&#x1f46d;&#x1f3ff;', '&#x1f46e;&#x1f3fb;', '&#x1f46e;&#x1f3fc;', '&#x1f46e;&#x1f3fd;', '&#x1f46e;&#x1f3fe;', '&#x1f46e;&#x1f3ff;', '&#x1f470;&#x1f3fb;', '&#x1f470;&#x1f3fc;', '&#x1f470;&#x1f3fd;', '&#x1f470;&#x1f3fe;', '&#x1f470;&#x1f3ff;', '&#x1f471;&#x1f3fb;', '&#x1f471;&#x1f3fc;', '&#x1f471;&#x1f3fd;', '&#x1f471;&#x1f3fe;', '&#x1f471;&#x1f3ff;', '&#x1f472;&#x1f3fb;', '&#x1f472;&#x1f3fc;', '&#x1f472;&#x1f3fd;', '&#x1f472;&#x1f3fe;', '&#x1f472;&#x1f3ff;', '&#x1f473;&#x1f3fb;', '&#x1f473;&#x1f3fc;', '&#x1f473;&#x1f3fd;', '&#x1f473;&#x1f3fe;', '&#x1f473;&#x1f3ff;', '&#x1f474;&#x1f3fb;', '&#x1f474;&#x1f3fc;', '&#x1f474;&#x1f3fd;', '&#x1f474;&#x1f3fe;', '&#x1f474;&#x1f3ff;', '&#x1f475;&#x1f3fb;', '&#x1f475;&#x1f3fc;', '&#x1f475;&#x1f3fd;', '&#x1f475;&#x1f3fe;', '&#x1f475;&#x1f3ff;', '&#x1f476;&#x1f3fb;', '&#x1f476;&#x1f3fc;', '&#x1f476;&#x1f3fd;', '&#x1f476;&#x1f3fe;', '&#x1f476;&#x1f3ff;', '&#x1f477;&#x1f3fb;', '&#x1f477;&#x1f3fc;', '&#x1f477;&#x1f3fd;', '&#x1f477;&#x1f3fe;', '&#x1f477;&#x1f3ff;', '&#x1f478;&#x1f3fb;', '&#x1f478;&#x1f3fc;', '&#x1f478;&#x1f3fd;', '&#x1f478;&#x1f3fe;', '&#x1f478;&#x1f3ff;', '&#x1f47c;&#x1f3fb;', '&#x1f47c;&#x1f3fc;', '&#x1f47c;&#x1f3fd;', '&#x1f47c;&#x1f3fe;', '&#x1f47c;&#x1f3ff;', '&#x1f481;&#x1f3fb;', '&#x1f481;&#x1f3fc;', '&#x1f481;&#x1f3fd;', '&#x1f481;&#x1f3fe;', '&#x1f481;&#x1f3ff;', '&#x1f482;&#x1f3fb;', '&#x1f482;&#x1f3fc;', '&#x1f482;&#x1f3fd;', '&#x1f482;&#x1f3fe;', '&#x1f482;&#x1f3ff;', '&#x1f483;&#x1f3fb;', '&#x1f483;&#x1f3fc;', '&#x1f483;&#x1f3fd;', '&#x1f483;&#x1f3fe;', '&#x1f483;&#x1f3ff;', '&#x1f485;&#x1f3fb;', '&#x1f485;&#x1f3fc;', '&#x1f485;&#x1f3fd;', '&#x1f485;&#x1f3fe;', '&#x1f485;&#x1f3ff;', '&#x1f486;&#x1f3fb;', '&#x1f486;&#x1f3fc;', '&#x1f486;&#x1f3fd;', '&#x1f486;&#x1f3fe;', '&#x1f486;&#x1f3ff;', '&#x1f487;&#x1f3fb;', '&#x1f487;&#x1f3fc;', '&#x1f487;&#x1f3fd;', '&#x1f487;&#x1f3fe;', '&#x1f487;&#x1f3ff;', '&#x1f48f;&#x1f3fb;', '&#x1f48f;&#x1f3fc;', '&#x1f48f;&#x1f3fd;', '&#x1f48f;&#x1f3fe;', '&#x1f48f;&#x1f3ff;', '&#x1f491;&#x1f3fb;', '&#x1f491;&#x1f3fc;', '&#x1f491;&#x1f3fd;', '&#x1f491;&#x1f3fe;', '&#x1f491;&#x1f3ff;', '&#x1f4aa;&#x1f3fb;', '&#x1f4aa;&#x1f3fc;', '&#x1f4aa;&#x1f3fd;', '&#x1f4aa;&#x1f3fe;', '&#x1f4aa;&#x1f3ff;', '&#x1f574;&#x1f3fb;', '&#x1f574;&#x1f3fc;', '&#x1f574;&#x1f3fd;', '&#x1f574;&#x1f3fe;', '&#x1f574;&#x1f3ff;', '&#x1f575;&#x1f3fb;', '&#x1f575;&#x1f3fc;', '&#x1f575;&#x1f3fd;', '&#x1f575;&#x1f3fe;', '&#x1f575;&#x1f3ff;', '&#x1f57a;&#x1f3fb;', '&#x1f57a;&#x1f3fc;', '&#x1f57a;&#x1f3fd;', '&#x1f57a;&#x1f3fe;', '&#x1f57a;&#x1f3ff;', '&#x1f590;&#x1f3fb;', '&#x1f590;&#x1f3fc;', '&#x1f590;&#x1f3fd;', '&#x1f590;&#x1f3fe;', '&#x1f590;&#x1f3ff;', '&#x1f595;&#x1f3fb;', '&#x1f595;&#x1f3fc;', '&#x1f595;&#x1f3fd;', '&#x1f595;&#x1f3fe;', '&#x1f595;&#x1f3ff;', '&#x1f596;&#x1f3fb;', '&#x1f596;&#x1f3fc;', '&#x1f596;&#x1f3fd;', '&#x1f596;&#x1f3fe;', '&#x1f596;&#x1f3ff;', '&#x1f645;&#x1f3fb;', '&#x1f645;&#x1f3fc;', '&#x1f645;&#x1f3fd;', '&#x1f645;&#x1f3fe;', '&#x1f645;&#x1f3ff;', '&#x1f646;&#x1f3fb;', '&#x1f646;&#x1f3fc;', '&#x1f646;&#x1f3fd;', '&#x1f646;&#x1f3fe;', '&#x1f646;&#x1f3ff;', '&#x1f647;&#x1f3fb;', '&#x1f647;&#x1f3fc;', '&#x1f647;&#x1f3fd;', '&#x1f647;&#x1f3fe;', '&#x1f647;&#x1f3ff;', '&#x1f64b;&#x1f3fb;', '&#x1f64b;&#x1f3fc;', '&#x1f64b;&#x1f3fd;', '&#x1f64b;&#x1f3fe;', '&#x1f64b;&#x1f3ff;', '&#x1f64c;&#x1f3fb;', '&#x1f64c;&#x1f3fc;', '&#x1f64c;&#x1f3fd;', '&#x1f64c;&#x1f3fe;', '&#x1f64c;&#x1f3ff;', '&#x1f64d;&#x1f3fb;', '&#x1f64d;&#x1f3fc;', '&#x1f64d;&#x1f3fd;', '&#x1f64d;&#x1f3fe;', '&#x1f64d;&#x1f3ff;', '&#x1f64e;&#x1f3fb;', '&#x1f64e;&#x1f3fc;', '&#x1f64e;&#x1f3fd;', '&#x1f64e;&#x1f3fe;', '&#x1f64e;&#x1f3ff;', '&#x1f64f;&#x1f3fb;', '&#x1f64f;&#x1f3fc;', '&#x1f64f;&#x1f3fd;', '&#x1f64f;&#x1f3fe;', '&#x1f64f;&#x1f3ff;', '&#x1f6a3;&#x1f3fb;', '&#x1f6a3;&#x1f3fc;', '&#x1f6a3;&#x1f3fd;', '&#x1f6a3;&#x1f3fe;', '&#x1f6a3;&#x1f3ff;', '&#x1f6b4;&#x1f3fb;', '&#x1f6b4;&#x1f3fc;', '&#x1f6b4;&#x1f3fd;', '&#x1f6b4;&#x1f3fe;', '&#x1f6b4;&#x1f3ff;', '&#x1f6b5;&#x1f3fb;', '&#x1f6b5;&#x1f3fc;', '&#x1f6b5;&#x1f3fd;', '&#x1f6b5;&#x1f3fe;', '&#x1f6b5;&#x1f3ff;', '&#x1f6b6;&#x1f3fb;', '&#x1f6b6;&#x1f3fc;', '&#x1f6b6;&#x1f3fd;', '&#x1f6b6;&#x1f3fe;', '&#x1f6b6;&#x1f3ff;', '&#x1f6c0;&#x1f3fb;', '&#x1f6c0;&#x1f3fc;', '&#x1f6c0;&#x1f3fd;', '&#x1f6c0;&#x1f3fe;', '&#x1f6c0;&#x1f3ff;', '&#x1f6cc;&#x1f3fb;', '&#x1f6cc;&#x1f3fc;', '&#x1f6cc;&#x1f3fd;', '&#x1f6cc;&#x1f3fe;', '&#x1f6cc;&#x1f3ff;', '&#x1f90c;&#x1f3fb;', '&#x1f90c;&#x1f3fc;', '&#x1f90c;&#x1f3fd;', '&#x1f90c;&#x1f3fe;', '&#x1f90c;&#x1f3ff;', '&#x1f90f;&#x1f3fb;', '&#x1f90f;&#x1f3fc;', '&#x1f90f;&#x1f3fd;', '&#x1f90f;&#x1f3fe;', '&#x1f90f;&#x1f3ff;', '&#x1f918;&#x1f3fb;', '&#x1f918;&#x1f3fc;', '&#x1f918;&#x1f3fd;', '&#x1f918;&#x1f3fe;', '&#x1f918;&#x1f3ff;', '&#x1f919;&#x1f3fb;', '&#x1f919;&#x1f3fc;', '&#x1f919;&#x1f3fd;', '&#x1f919;&#x1f3fe;', '&#x1f919;&#x1f3ff;', '&#x1f91a;&#x1f3fb;', '&#x1f91a;&#x1f3fc;', '&#x1f91a;&#x1f3fd;', '&#x1f91a;&#x1f3fe;', '&#x1f91a;&#x1f3ff;', '&#x1f91b;&#x1f3fb;', '&#x1f91b;&#x1f3fc;', '&#x1f91b;&#x1f3fd;', '&#x1f91b;&#x1f3fe;', '&#x1f91b;&#x1f3ff;', '&#x1f91c;&#x1f3fb;', '&#x1f91c;&#x1f3fc;', '&#x1f91c;&#x1f3fd;', '&#x1f91c;&#x1f3fe;', '&#x1f91c;&#x1f3ff;', '&#x1f91d;&#x1f3fb;', '&#x1f91d;&#x1f3fc;', '&#x1f91d;&#x1f3fd;', '&#x1f91d;&#x1f3fe;', '&#x1f91d;&#x1f3ff;', '&#x1f91e;&#x1f3fb;', '&#x1f91e;&#x1f3fc;', '&#x1f91e;&#x1f3fd;', '&#x1f91e;&#x1f3fe;', '&#x1f91e;&#x1f3ff;', '&#x1f91f;&#x1f3fb;', '&#x1f91f;&#x1f3fc;', '&#x1f91f;&#x1f3fd;', '&#x1f91f;&#x1f3fe;', '&#x1f91f;&#x1f3ff;', '&#x1f926;&#x1f3fb;', '&#x1f926;&#x1f3fc;', '&#x1f926;&#x1f3fd;', '&#x1f926;&#x1f3fe;', '&#x1f926;&#x1f3ff;', '&#x1f930;&#x1f3fb;', '&#x1f930;&#x1f3fc;', '&#x1f930;&#x1f3fd;', '&#x1f930;&#x1f3fe;', '&#x1f930;&#x1f3ff;', '&#x1f931;&#x1f3fb;', '&#x1f931;&#x1f3fc;', '&#x1f931;&#x1f3fd;', '&#x1f931;&#x1f3fe;', '&#x1f931;&#x1f3ff;', '&#x1f932;&#x1f3fb;', '&#x1f932;&#x1f3fc;', '&#x1f932;&#x1f3fd;', '&#x1f932;&#x1f3fe;', '&#x1f932;&#x1f3ff;', '&#x1f933;&#x1f3fb;', '&#x1f933;&#x1f3fc;', '&#x1f933;&#x1f3fd;', '&#x1f933;&#x1f3fe;', '&#x1f933;&#x1f3ff;', '&#x1f934;&#x1f3fb;', '&#x1f934;&#x1f3fc;', '&#x1f934;&#x1f3fd;', '&#x1f934;&#x1f3fe;', '&#x1f934;&#x1f3ff;', '&#x1f935;&#x1f3fb;', '&#x1f935;&#x1f3fc;', '&#x1f935;&#x1f3fd;', '&#x1f935;&#x1f3fe;', '&#x1f935;&#x1f3ff;', '&#x1f936;&#x1f3fb;', '&#x1f936;&#x1f3fc;', '&#x1f936;&#x1f3fd;', '&#x1f936;&#x1f3fe;', '&#x1f936;&#x1f3ff;', '&#x1f937;&#x1f3fb;', '&#x1f937;&#x1f3fc;', '&#x1f937;&#x1f3fd;', '&#x1f937;&#x1f3fe;', '&#x1f937;&#x1f3ff;', '&#x1f938;&#x1f3fb;', '&#x1f938;&#x1f3fc;', '&#x1f938;&#x1f3fd;', '&#x1f938;&#x1f3fe;', '&#x1f938;&#x1f3ff;', '&#x1f939;&#x1f3fb;', '&#x1f939;&#x1f3fc;', '&#x1f939;&#x1f3fd;', '&#x1f939;&#x1f3fe;', '&#x1f939;&#x1f3ff;', '&#x1f93d;&#x1f3fb;', '&#x1f93d;&#x1f3fc;', '&#x1f93d;&#x1f3fd;', '&#x1f93d;&#x1f3fe;', '&#x1f93d;&#x1f3ff;', '&#x1f93e;&#x1f3fb;', '&#x1f93e;&#x1f3fc;', '&#x1f93e;&#x1f3fd;', '&#x1f93e;&#x1f3fe;', '&#x1f93e;&#x1f3ff;', '&#x1f977;&#x1f3fb;', '&#x1f977;&#x1f3fc;', '&#x1f977;&#x1f3fd;', '&#x1f977;&#x1f3fe;', '&#x1f977;&#x1f3ff;', '&#x1f9b5;&#x1f3fb;', '&#x1f9b5;&#x1f3fc;', '&#x1f9b5;&#x1f3fd;', '&#x1f9b5;&#x1f3fe;', '&#x1f9b5;&#x1f3ff;', '&#x1f9b6;&#x1f3fb;', '&#x1f9b6;&#x1f3fc;', '&#x1f9b6;&#x1f3fd;', '&#x1f9b6;&#x1f3fe;', '&#x1f9b6;&#x1f3ff;', '&#x1f9b8;&#x1f3fb;', '&#x1f9b8;&#x1f3fc;', '&#x1f9b8;&#x1f3fd;', '&#x1f9b8;&#x1f3fe;', '&#x1f9b8;&#x1f3ff;', '&#x1f9b9;&#x1f3fb;', '&#x1f9b9;&#x1f3fc;', '&#x1f9b9;&#x1f3fd;', '&#x1f9b9;&#x1f3fe;', '&#x1f9b9;&#x1f3ff;', '&#x1f9bb;&#x1f3fb;', '&#x1f9bb;&#x1f3fc;', '&#x1f9bb;&#x1f3fd;', '&#x1f9bb;&#x1f3fe;', '&#x1f9bb;&#x1f3ff;', '&#x1f9cd;&#x1f3fb;', '&#x1f9cd;&#x1f3fc;', '&#x1f9cd;&#x1f3fd;', '&#x1f9cd;&#x1f3fe;', '&#x1f9cd;&#x1f3ff;', '&#x1f9ce;&#x1f3fb;', '&#x1f9ce;&#x1f3fc;', '&#x1f9ce;&#x1f3fd;', '&#x1f9ce;&#x1f3fe;', '&#x1f9ce;&#x1f3ff;', '&#x1f9cf;&#x1f3fb;', '&#x1f9cf;&#x1f3fc;', '&#x1f9cf;&#x1f3fd;', '&#x1f9cf;&#x1f3fe;', '&#x1f9cf;&#x1f3ff;', '&#x1f9d1;&#x1f3fb;', '&#x1f9d1;&#x1f3fc;', '&#x1f9d1;&#x1f3fd;', '&#x1f9d1;&#x1f3fe;', '&#x1f9d1;&#x1f3ff;', '&#x1f9d2;&#x1f3fb;', '&#x1f9d2;&#x1f3fc;', '&#x1f9d2;&#x1f3fd;', '&#x1f9d2;&#x1f3fe;', '&#x1f9d2;&#x1f3ff;', '&#x1f9d3;&#x1f3fb;', '&#x1f9d3;&#x1f3fc;', '&#x1f9d3;&#x1f3fd;', '&#x1f9d3;&#x1f3fe;', '&#x1f9d3;&#x1f3ff;', '&#x1f9d4;&#x1f3fb;', '&#x1f9d4;&#x1f3fc;', '&#x1f9d4;&#x1f3fd;', '&#x1f9d4;&#x1f3fe;', '&#x1f9d4;&#x1f3ff;', '&#x1f9d5;&#x1f3fb;', '&#x1f9d5;&#x1f3fc;', '&#x1f9d5;&#x1f3fd;', '&#x1f9d5;&#x1f3fe;', '&#x1f9d5;&#x1f3ff;', '&#x1f9d6;&#x1f3fb;', '&#x1f9d6;&#x1f3fc;', '&#x1f9d6;&#x1f3fd;', '&#x1f9d6;&#x1f3fe;', '&#x1f9d6;&#x1f3ff;', '&#x1f9d7;&#x1f3fb;', '&#x1f9d7;&#x1f3fc;', '&#x1f9d7;&#x1f3fd;', '&#x1f9d7;&#x1f3fe;', '&#x1f9d7;&#x1f3ff;', '&#x1f9d8;&#x1f3fb;', '&#x1f9d8;&#x1f3fc;', '&#x1f9d8;&#x1f3fd;', '&#x1f9d8;&#x1f3fe;', '&#x1f9d8;&#x1f3ff;', '&#x1f9d9;&#x1f3fb;', '&#x1f9d9;&#x1f3fc;', '&#x1f9d9;&#x1f3fd;', '&#x1f9d9;&#x1f3fe;', '&#x1f9d9;&#x1f3ff;', '&#x1f9da;&#x1f3fb;', '&#x1f9da;&#x1f3fc;', '&#x1f9da;&#x1f3fd;', '&#x1f9da;&#x1f3fe;', '&#x1f9da;&#x1f3ff;', '&#x1f9db;&#x1f3fb;', '&#x1f9db;&#x1f3fc;', '&#x1f9db;&#x1f3fd;', '&#x1f9db;&#x1f3fe;', '&#x1f9db;&#x1f3ff;', '&#x1f9dc;&#x1f3fb;', '&#x1f9dc;&#x1f3fc;', '&#x1f9dc;&#x1f3fd;', '&#x1f9dc;&#x1f3fe;', '&#x1f9dc;&#x1f3ff;', '&#x1f9dd;&#x1f3fb;', '&#x1f9dd;&#x1f3fc;', '&#x1f9dd;&#x1f3fd;', '&#x1f9dd;&#x1f3fe;', '&#x1f9dd;&#x1f3ff;', '&#x1fac3;&#x1f3fb;', '&#x1fac3;&#x1f3fc;', '&#x1fac3;&#x1f3fd;', '&#x1fac3;&#x1f3fe;', '&#x1fac3;&#x1f3ff;', '&#x1fac4;&#x1f3fb;', '&#x1fac4;&#x1f3fc;', '&#x1fac4;&#x1f3fd;', '&#x1fac4;&#x1f3fe;', '&#x1fac4;&#x1f3ff;', '&#x1fac5;&#x1f3fb;', '&#x1fac5;&#x1f3fc;', '&#x1fac5;&#x1f3fd;', '&#x1fac5;&#x1f3fe;', '&#x1fac5;&#x1f3ff;', '&#x1faf0;&#x1f3fb;', '&#x1faf0;&#x1f3fc;', '&#x1faf0;&#x1f3fd;', '&#x1faf0;&#x1f3fe;', '&#x1faf0;&#x1f3ff;', '&#x1faf1;&#x1f3fb;', '&#x1faf1;&#x1f3fc;', '&#x1faf1;&#x1f3fd;', '&#x1faf1;&#x1f3fe;', '&#x1faf1;&#x1f3ff;', '&#x1faf2;&#x1f3fb;', '&#x1faf2;&#x1f3fc;', '&#x1faf2;&#x1f3fd;', '&#x1faf2;&#x1f3fe;', '&#x1faf2;&#x1f3ff;', '&#x1faf3;&#x1f3fb;', '&#x1faf3;&#x1f3fc;', '&#x1faf3;&#x1f3fd;', '&#x1faf3;&#x1f3fe;', '&#x1faf3;&#x1f3ff;', '&#x1faf4;&#x1f3fb;', '&#x1faf4;&#x1f3fc;', '&#x1faf4;&#x1f3fd;', '&#x1faf4;&#x1f3fe;', '&#x1faf4;&#x1f3ff;', '&#x1faf5;&#x1f3fb;', '&#x1faf5;&#x1f3fc;', '&#x1faf5;&#x1f3fd;', '&#x1faf5;&#x1f3fe;', '&#x1faf5;&#x1f3ff;', '&#x1faf6;&#x1f3fb;', '&#x1faf6;&#x1f3fc;', '&#x1faf6;&#x1f3fd;', '&#x1faf6;&#x1f3fe;', '&#x1faf6;&#x1f3ff;', '&#x261d;&#x1f3fb;', '&#x261d;&#x1f3fc;', '&#x261d;&#x1f3fd;', '&#x261d;&#x1f3fe;', '&#x261d;&#x1f3ff;', '&#x26f7;&#x1f3fb;', '&#x26f7;&#x1f3fc;', '&#x26f7;&#x1f3fd;', '&#x26f7;&#x1f3fe;', '&#x26f7;&#x1f3ff;', '&#x26f9;&#x1f3fb;', '&#x26f9;&#x1f3fc;', '&#x26f9;&#x1f3fd;', '&#x26f9;&#x1f3fe;', '&#x26f9;&#x1f3ff;', '&#x270a;&#x1f3fb;', '&#x270a;&#x1f3fc;', '&#x270a;&#x1f3fd;', '&#x270a;&#x1f3fe;', '&#x270a;&#x1f3ff;', '&#x270b;&#x1f3fb;', '&#x270b;&#x1f3fc;', '&#x270b;&#x1f3fd;', '&#x270b;&#x1f3fe;', '&#x270b;&#x1f3ff;', '&#x270c;&#x1f3fb;', '&#x270c;&#x1f3fc;', '&#x270c;&#x1f3fd;', '&#x270c;&#x1f3fe;', '&#x270c;&#x1f3ff;', '&#x270d;&#x1f3fb;', '&#x270d;&#x1f3fc;', '&#x270d;&#x1f3fd;', '&#x270d;&#x1f3fe;', '&#x270d;&#x1f3ff;', '&#x23;&#x20e3;', '&#x2a;&#x20e3;', '&#x30;&#x20e3;', '&#x31;&#x20e3;', '&#x32;&#x20e3;', '&#x33;&#x20e3;', '&#x34;&#x20e3;', '&#x35;&#x20e3;', '&#x36;&#x20e3;', '&#x37;&#x20e3;', '&#x38;&#x20e3;', '&#x39;&#x20e3;', '&#x1f004;', '&#x1f0cf;', '&#x1f170;', '&#x1f171;', '&#x1f17e;', '&#x1f17f;', '&#x1f18e;', '&#x1f191;', '&#x1f192;', '&#x1f193;', '&#x1f194;', '&#x1f195;', '&#x1f196;', '&#x1f197;', '&#x1f198;', '&#x1f199;', '&#x1f19a;', '&#x1f1e6;', '&#x1f1e7;', '&#x1f1e8;', '&#x1f1e9;', '&#x1f1ea;', '&#x1f1eb;', '&#x1f1ec;', '&#x1f1ed;', '&#x1f1ee;', '&#x1f1ef;', '&#x1f1f0;', '&#x1f1f1;', '&#x1f1f2;', '&#x1f1f3;', '&#x1f1f4;', '&#x1f1f5;', '&#x1f1f6;', '&#x1f1f7;', '&#x1f1f8;', '&#x1f1f9;', '&#x1f1fa;', '&#x1f1fb;', '&#x1f1fc;', '&#x1f1fd;', '&#x1f1fe;', '&#x1f1ff;', '&#x1f201;', '&#x1f202;', '&#x1f21a;', '&#x1f22f;', '&#x1f232;', '&#x1f233;', '&#x1f234;', '&#x1f235;', '&#x1f236;', '&#x1f237;', '&#x1f238;', '&#x1f239;', '&#x1f23a;', '&#x1f250;', '&#x1f251;', '&#x1f300;', '&#x1f301;', '&#x1f302;', '&#x1f303;', '&#x1f304;', '&#x1f305;', '&#x1f306;', '&#x1f307;', '&#x1f308;', '&#x1f309;', '&#x1f30a;', '&#x1f30b;', '&#x1f30c;', '&#x1f30d;', '&#x1f30e;', '&#x1f30f;', '&#x1f310;', '&#x1f311;', '&#x1f312;', '&#x1f313;', '&#x1f314;', '&#x1f315;', '&#x1f316;', '&#x1f317;', '&#x1f318;', '&#x1f319;', '&#x1f31a;', '&#x1f31b;', '&#x1f31c;', '&#x1f31d;', '&#x1f31e;', '&#x1f31f;', '&#x1f320;', '&#x1f321;', '&#x1f324;', '&#x1f325;', '&#x1f326;', '&#x1f327;', '&#x1f328;', '&#x1f329;', '&#x1f32a;', '&#x1f32b;', '&#x1f32c;', '&#x1f32d;', '&#x1f32e;', '&#x1f32f;', '&#x1f330;', '&#x1f331;', '&#x1f332;', '&#x1f333;', '&#x1f334;', '&#x1f335;', '&#x1f336;', '&#x1f337;', '&#x1f338;', '&#x1f339;', '&#x1f33a;', '&#x1f33b;', '&#x1f33c;', '&#x1f33d;', '&#x1f33e;', '&#x1f33f;', '&#x1f340;', '&#x1f341;', '&#x1f342;', '&#x1f343;', '&#x1f344;', '&#x1f345;', '&#x1f346;', '&#x1f347;', '&#x1f348;', '&#x1f349;', '&#x1f34a;', '&#x1f34b;', '&#x1f34c;', '&#x1f34d;', '&#x1f34e;', '&#x1f34f;', '&#x1f350;', '&#x1f351;', '&#x1f352;', '&#x1f353;', '&#x1f354;', '&#x1f355;', '&#x1f356;', '&#x1f357;', '&#x1f358;', '&#x1f359;', '&#x1f35a;', '&#x1f35b;', '&#x1f35c;', '&#x1f35d;', '&#x1f35e;', '&#x1f35f;', '&#x1f360;', '&#x1f361;', '&#x1f362;', '&#x1f363;', '&#x1f364;', '&#x1f365;', '&#x1f366;', '&#x1f367;', '&#x1f368;', '&#x1f369;', '&#x1f36a;', '&#x1f36b;', '&#x1f36c;', '&#x1f36d;', '&#x1f36e;', '&#x1f36f;', '&#x1f370;', '&#x1f371;', '&#x1f372;', '&#x1f373;', '&#x1f374;', '&#x1f375;', '&#x1f376;', '&#x1f377;', '&#x1f378;', '&#x1f379;', '&#x1f37a;', '&#x1f37b;', '&#x1f37c;', '&#x1f37d;', '&#x1f37e;', '&#x1f37f;', '&#x1f380;', '&#x1f381;', '&#x1f382;', '&#x1f383;', '&#x1f384;', '&#x1f385;', '&#x1f386;', '&#x1f387;', '&#x1f388;', '&#x1f389;', '&#x1f38a;', '&#x1f38b;', '&#x1f38c;', '&#x1f38d;', '&#x1f38e;', '&#x1f38f;', '&#x1f390;', '&#x1f391;', '&#x1f392;', '&#x1f393;', '&#x1f396;', '&#x1f397;', '&#x1f399;', '&#x1f39a;', '&#x1f39b;', '&#x1f39e;', '&#x1f39f;', '&#x1f3a0;', '&#x1f3a1;', '&#x1f3a2;', '&#x1f3a3;', '&#x1f3a4;', '&#x1f3a5;', '&#x1f3a6;', '&#x1f3a7;', '&#x1f3a8;', '&#x1f3a9;', '&#x1f3aa;', '&#x1f3ab;', '&#x1f3ac;', '&#x1f3ad;', '&#x1f3ae;', '&#x1f3af;', '&#x1f3b0;', '&#x1f3b1;', '&#x1f3b2;', '&#x1f3b3;', '&#x1f3b4;', '&#x1f3b5;', '&#x1f3b6;', '&#x1f3b7;', '&#x1f3b8;', '&#x1f3b9;', '&#x1f3ba;', '&#x1f3bb;', '&#x1f3bc;', '&#x1f3bd;', '&#x1f3be;', '&#x1f3bf;', '&#x1f3c0;', '&#x1f3c1;', '&#x1f3c2;', '&#x1f3c3;', '&#x1f3c4;', '&#x1f3c5;', '&#x1f3c6;', '&#x1f3c7;', '&#x1f3c8;', '&#x1f3c9;', '&#x1f3ca;', '&#x1f3cb;', '&#x1f3cc;', '&#x1f3cd;', '&#x1f3ce;', '&#x1f3cf;', '&#x1f3d0;', '&#x1f3d1;', '&#x1f3d2;', '&#x1f3d3;', '&#x1f3d4;', '&#x1f3d5;', '&#x1f3d6;', '&#x1f3d7;', '&#x1f3d8;', '&#x1f3d9;', '&#x1f3da;', '&#x1f3db;', '&#x1f3dc;', '&#x1f3dd;', '&#x1f3de;', '&#x1f3df;', '&#x1f3e0;', '&#x1f3e1;', '&#x1f3e2;', '&#x1f3e3;', '&#x1f3e4;', '&#x1f3e5;', '&#x1f3e6;', '&#x1f3e7;', '&#x1f3e8;', '&#x1f3e9;', '&#x1f3ea;', '&#x1f3eb;', '&#x1f3ec;', '&#x1f3ed;', '&#x1f3ee;', '&#x1f3ef;', '&#x1f3f0;', '&#x1f3f3;', '&#x1f3f4;', '&#x1f3f5;', '&#x1f3f7;', '&#x1f3f8;', '&#x1f3f9;', '&#x1f3fa;', '&#x1f3fb;', '&#x1f3fc;', '&#x1f3fd;', '&#x1f3fe;', '&#x1f3ff;', '&#x1f400;', '&#x1f401;', '&#x1f402;', '&#x1f403;', '&#x1f404;', '&#x1f405;', '&#x1f406;', '&#x1f407;', '&#x1f408;', '&#x1f409;', '&#x1f40a;', '&#x1f40b;', '&#x1f40c;', '&#x1f40d;', '&#x1f40e;', '&#x1f40f;', '&#x1f410;', '&#x1f411;', '&#x1f412;', '&#x1f413;', '&#x1f414;', '&#x1f415;', '&#x1f416;', '&#x1f417;', '&#x1f418;', '&#x1f419;', '&#x1f41a;', '&#x1f41b;', '&#x1f41c;', '&#x1f41d;', '&#x1f41e;', '&#x1f41f;', '&#x1f420;', '&#x1f421;', '&#x1f422;', '&#x1f423;', '&#x1f424;', '&#x1f425;', '&#x1f426;', '&#x1f427;', '&#x1f428;', '&#x1f429;', '&#x1f42a;', '&#x1f42b;', '&#x1f42c;', '&#x1f42d;', '&#x1f42e;', '&#x1f42f;', '&#x1f430;', '&#x1f431;', '&#x1f432;', '&#x1f433;', '&#x1f434;', '&#x1f435;', '&#x1f436;', '&#x1f437;', '&#x1f438;', '&#x1f439;', '&#x1f43a;', '&#x1f43b;', '&#x1f43c;', '&#x1f43d;', '&#x1f43e;', '&#x1f43f;', '&#x1f440;', '&#x1f441;', '&#x1f442;', '&#x1f443;', '&#x1f444;', '&#x1f445;', '&#x1f446;', '&#x1f447;', '&#x1f448;', '&#x1f449;', '&#x1f44a;', '&#x1f44b;', '&#x1f44c;', '&#x1f44d;', '&#x1f44e;', '&#x1f44f;', '&#x1f450;', '&#x1f451;', '&#x1f452;', '&#x1f453;', '&#x1f454;', '&#x1f455;', '&#x1f456;', '&#x1f457;', '&#x1f458;', '&#x1f459;', '&#x1f45a;', '&#x1f45b;', '&#x1f45c;', '&#x1f45d;', '&#x1f45e;', '&#x1f45f;', '&#x1f460;', '&#x1f461;', '&#x1f462;', '&#x1f463;', '&#x1f464;', '&#x1f465;', '&#x1f466;', '&#x1f467;', '&#x1f468;', '&#x1f469;', '&#x1f46a;', '&#x1f46b;', '&#x1f46c;', '&#x1f46d;', '&#x1f46e;', '&#x1f46f;', '&#x1f470;', '&#x1f471;', '&#x1f472;', '&#x1f473;', '&#x1f474;', '&#x1f475;', '&#x1f476;', '&#x1f477;', '&#x1f478;', '&#x1f479;', '&#x1f47a;', '&#x1f47b;', '&#x1f47c;', '&#x1f47d;', '&#x1f47e;', '&#x1f47f;', '&#x1f480;', '&#x1f481;', '&#x1f482;', '&#x1f483;', '&#x1f484;', '&#x1f485;', '&#x1f486;', '&#x1f487;', '&#x1f488;', '&#x1f489;', '&#x1f48a;', '&#x1f48b;', '&#x1f48c;', '&#x1f48d;', '&#x1f48e;', '&#x1f48f;', '&#x1f490;', '&#x1f491;', '&#x1f492;', '&#x1f493;', '&#x1f494;', '&#x1f495;', '&#x1f496;', '&#x1f497;', '&#x1f498;', '&#x1f499;', '&#x1f49a;', '&#x1f49b;', '&#x1f49c;', '&#x1f49d;', '&#x1f49e;', '&#x1f49f;', '&#x1f4a0;', '&#x1f4a1;', '&#x1f4a2;', '&#x1f4a3;', '&#x1f4a4;', '&#x1f4a5;', '&#x1f4a6;', '&#x1f4a7;', '&#x1f4a8;', '&#x1f4a9;', '&#x1f4aa;', '&#x1f4ab;', '&#x1f4ac;', '&#x1f4ad;', '&#x1f4ae;', '&#x1f4af;', '&#x1f4b0;', '&#x1f4b1;', '&#x1f4b2;', '&#x1f4b3;', '&#x1f4b4;', '&#x1f4b5;', '&#x1f4b6;', '&#x1f4b7;', '&#x1f4b8;', '&#x1f4b9;', '&#x1f4ba;', '&#x1f4bb;', '&#x1f4bc;', '&#x1f4bd;', '&#x1f4be;', '&#x1f4bf;', '&#x1f4c0;', '&#x1f4c1;', '&#x1f4c2;', '&#x1f4c3;', '&#x1f4c4;', '&#x1f4c5;', '&#x1f4c6;', '&#x1f4c7;', '&#x1f4c8;', '&#x1f4c9;', '&#x1f4ca;', '&#x1f4cb;', '&#x1f4cc;', '&#x1f4cd;', '&#x1f4ce;', '&#x1f4cf;', '&#x1f4d0;', '&#x1f4d1;', '&#x1f4d2;', '&#x1f4d3;', '&#x1f4d4;', '&#x1f4d5;', '&#x1f4d6;', '&#x1f4d7;', '&#x1f4d8;', '&#x1f4d9;', '&#x1f4da;', '&#x1f4db;', '&#x1f4dc;', '&#x1f4dd;', '&#x1f4de;', '&#x1f4df;', '&#x1f4e0;', '&#x1f4e1;', '&#x1f4e2;', '&#x1f4e3;', '&#x1f4e4;', '&#x1f4e5;', '&#x1f4e6;', '&#x1f4e7;', '&#x1f4e8;', '&#x1f4e9;', '&#x1f4ea;', '&#x1f4eb;', '&#x1f4ec;', '&#x1f4ed;', '&#x1f4ee;', '&#x1f4ef;', '&#x1f4f0;', '&#x1f4f1;', '&#x1f4f2;', '&#x1f4f3;', '&#x1f4f4;', '&#x1f4f5;', '&#x1f4f6;', '&#x1f4f7;', '&#x1f4f8;', '&#x1f4f9;', '&#x1f4fa;', '&#x1f4fb;', '&#x1f4fc;', '&#x1f4fd;', '&#x1f4ff;', '&#x1f500;', '&#x1f501;', '&#x1f502;', '&#x1f503;', '&#x1f504;', '&#x1f505;', '&#x1f506;', '&#x1f507;', '&#x1f508;', '&#x1f509;', '&#x1f50a;', '&#x1f50b;', '&#x1f50c;', '&#x1f50d;', '&#x1f50e;', '&#x1f50f;', '&#x1f510;', '&#x1f511;', '&#x1f512;', '&#x1f513;', '&#x1f514;', '&#x1f515;', '&#x1f516;', '&#x1f517;', '&#x1f518;', '&#x1f519;', '&#x1f51a;', '&#x1f51b;', '&#x1f51c;', '&#x1f51d;', '&#x1f51e;', '&#x1f51f;', '&#x1f520;', '&#x1f521;', '&#x1f522;', '&#x1f523;', '&#x1f524;', '&#x1f525;', '&#x1f526;', '&#x1f527;', '&#x1f528;', '&#x1f529;', '&#x1f52a;', '&#x1f52b;', '&#x1f52c;', '&#x1f52d;', '&#x1f52e;', '&#x1f52f;', '&#x1f530;', '&#x1f531;', '&#x1f532;', '&#x1f533;', '&#x1f534;', '&#x1f535;', '&#x1f536;', '&#x1f537;', '&#x1f538;', '&#x1f539;', '&#x1f53a;', '&#x1f53b;', '&#x1f53c;', '&#x1f53d;', '&#x1f549;', '&#x1f54a;', '&#x1f54b;', '&#x1f54c;', '&#x1f54d;', '&#x1f54e;', '&#x1f550;', '&#x1f551;', '&#x1f552;', '&#x1f553;', '&#x1f554;', '&#x1f555;', '&#x1f556;', '&#x1f557;', '&#x1f558;', '&#x1f559;', '&#x1f55a;', '&#x1f55b;', '&#x1f55c;', '&#x1f55d;', '&#x1f55e;', '&#x1f55f;', '&#x1f560;', '&#x1f561;', '&#x1f562;', '&#x1f563;', '&#x1f564;', '&#x1f565;', '&#x1f566;', '&#x1f567;', '&#x1f56f;', '&#x1f570;', '&#x1f573;', '&#x1f574;', '&#x1f575;', '&#x1f576;', '&#x1f577;', '&#x1f578;', '&#x1f579;', '&#x1f57a;', '&#x1f587;', '&#x1f58a;', '&#x1f58b;', '&#x1f58c;', '&#x1f58d;', '&#x1f590;', '&#x1f595;', '&#x1f596;', '&#x1f5a4;', '&#x1f5a5;', '&#x1f5a8;', '&#x1f5b1;', '&#x1f5b2;', '&#x1f5bc;', '&#x1f5c2;', '&#x1f5c3;', '&#x1f5c4;', '&#x1f5d1;', '&#x1f5d2;', '&#x1f5d3;', '&#x1f5dc;', '&#x1f5dd;', '&#x1f5de;', '&#x1f5e1;', '&#x1f5e3;', '&#x1f5e8;', '&#x1f5ef;', '&#x1f5f3;', '&#x1f5fa;', '&#x1f5fb;', '&#x1f5fc;', '&#x1f5fd;', '&#x1f5fe;', '&#x1f5ff;', '&#x1f600;', '&#x1f601;', '&#x1f602;', '&#x1f603;', '&#x1f604;', '&#x1f605;', '&#x1f606;', '&#x1f607;', '&#x1f608;', '&#x1f609;', '&#x1f60a;', '&#x1f60b;', '&#x1f60c;', '&#x1f60d;', '&#x1f60e;', '&#x1f60f;', '&#x1f610;', '&#x1f611;', '&#x1f612;', '&#x1f613;', '&#x1f614;', '&#x1f615;', '&#x1f616;', '&#x1f617;', '&#x1f618;', '&#x1f619;', '&#x1f61a;', '&#x1f61b;', '&#x1f61c;', '&#x1f61d;', '&#x1f61e;', '&#x1f61f;', '&#x1f620;', '&#x1f621;', '&#x1f622;', '&#x1f623;', '&#x1f624;', '&#x1f625;', '&#x1f626;', '&#x1f627;', '&#x1f628;', '&#x1f629;', '&#x1f62a;', '&#x1f62b;', '&#x1f62c;', '&#x1f62d;', '&#x1f62e;', '&#x1f62f;', '&#x1f630;', '&#x1f631;', '&#x1f632;', '&#x1f633;', '&#x1f634;', '&#x1f635;', '&#x1f636;', '&#x1f637;', '&#x1f638;', '&#x1f639;', '&#x1f63a;', '&#x1f63b;', '&#x1f63c;', '&#x1f63d;', '&#x1f63e;', '&#x1f63f;', '&#x1f640;', '&#x1f641;', '&#x1f642;', '&#x1f643;', '&#x1f644;', '&#x1f645;', '&#x1f646;', '&#x1f647;', '&#x1f648;', '&#x1f649;', '&#x1f64a;', '&#x1f64b;', '&#x1f64c;', '&#x1f64d;', '&#x1f64e;', '&#x1f64f;', '&#x1f680;', '&#x1f681;', '&#x1f682;', '&#x1f683;', '&#x1f684;', '&#x1f685;', '&#x1f686;', '&#x1f687;', '&#x1f688;', '&#x1f689;', '&#x1f68a;', '&#x1f68b;', '&#x1f68c;', '&#x1f68d;', '&#x1f68e;', '&#x1f68f;', '&#x1f690;', '&#x1f691;', '&#x1f692;', '&#x1f693;', '&#x1f694;', '&#x1f695;', '&#x1f696;', '&#x1f697;', '&#x1f698;', '&#x1f699;', '&#x1f69a;', '&#x1f69b;', '&#x1f69c;', '&#x1f69d;', '&#x1f69e;', '&#x1f69f;', '&#x1f6a0;', '&#x1f6a1;', '&#x1f6a2;', '&#x1f6a3;', '&#x1f6a4;', '&#x1f6a5;', '&#x1f6a6;', '&#x1f6a7;', '&#x1f6a8;', '&#x1f6a9;', '&#x1f6aa;', '&#x1f6ab;', '&#x1f6ac;', '&#x1f6ad;', '&#x1f6ae;', '&#x1f6af;', '&#x1f6b0;', '&#x1f6b1;', '&#x1f6b2;', '&#x1f6b3;', '&#x1f6b4;', '&#x1f6b5;', '&#x1f6b6;', '&#x1f6b7;', '&#x1f6b8;', '&#x1f6b9;', '&#x1f6ba;', '&#x1f6bb;', '&#x1f6bc;', '&#x1f6bd;', '&#x1f6be;', '&#x1f6bf;', '&#x1f6c0;', '&#x1f6c1;', '&#x1f6c2;', '&#x1f6c3;', '&#x1f6c4;', '&#x1f6c5;', '&#x1f6cb;', '&#x1f6cc;', '&#x1f6cd;', '&#x1f6ce;', '&#x1f6cf;', '&#x1f6d0;', '&#x1f6d1;', '&#x1f6d2;', '&#x1f6d5;', '&#x1f6d6;', '&#x1f6d7;', '&#x1f6dd;', '&#x1f6de;', '&#x1f6df;', '&#x1f6e0;', '&#x1f6e1;', '&#x1f6e2;', '&#x1f6e3;', '&#x1f6e4;', '&#x1f6e5;', '&#x1f6e9;', '&#x1f6eb;', '&#x1f6ec;', '&#x1f6f0;', '&#x1f6f3;', '&#x1f6f4;', '&#x1f6f5;', '&#x1f6f6;', '&#x1f6f7;', '&#x1f6f8;', '&#x1f6f9;', '&#x1f6fa;', '&#x1f6fb;', '&#x1f6fc;', '&#x1f7e0;', '&#x1f7e1;', '&#x1f7e2;', '&#x1f7e3;', '&#x1f7e4;', '&#x1f7e5;', '&#x1f7e6;', '&#x1f7e7;', '&#x1f7e8;', '&#x1f7e9;', '&#x1f7ea;', '&#x1f7eb;', '&#x1f7f0;', '&#x1f90c;', '&#x1f90d;', '&#x1f90e;', '&#x1f90f;', '&#x1f910;', '&#x1f911;', '&#x1f912;', '&#x1f913;', '&#x1f914;', '&#x1f915;', '&#x1f916;', '&#x1f917;', '&#x1f918;', '&#x1f919;', '&#x1f91a;', '&#x1f91b;', '&#x1f91c;', '&#x1f91d;', '&#x1f91e;', '&#x1f91f;', '&#x1f920;', '&#x1f921;', '&#x1f922;', '&#x1f923;', '&#x1f924;', '&#x1f925;', '&#x1f926;', '&#x1f927;', '&#x1f928;', '&#x1f929;', '&#x1f92a;', '&#x1f92b;', '&#x1f92c;', '&#x1f92d;', '&#x1f92e;', '&#x1f92f;', '&#x1f930;', '&#x1f931;', '&#x1f932;', '&#x1f933;', '&#x1f934;', '&#x1f935;', '&#x1f936;', '&#x1f937;', '&#x1f938;', '&#x1f939;', '&#x1f93a;', '&#x1f93c;', '&#x1f93d;', '&#x1f93e;', '&#x1f93f;', '&#x1f940;', '&#x1f941;', '&#x1f942;', '&#x1f943;', '&#x1f944;', '&#x1f945;', '&#x1f947;', '&#x1f948;', '&#x1f949;', '&#x1f94a;', '&#x1f94b;', '&#x1f94c;', '&#x1f94d;', '&#x1f94e;', '&#x1f94f;', '&#x1f950;', '&#x1f951;', '&#x1f952;', '&#x1f953;', '&#x1f954;', '&#x1f955;', '&#x1f956;', '&#x1f957;', '&#x1f958;', '&#x1f959;', '&#x1f95a;', '&#x1f95b;', '&#x1f95c;', '&#x1f95d;', '&#x1f95e;', '&#x1f95f;', '&#x1f960;', '&#x1f961;', '&#x1f962;', '&#x1f963;', '&#x1f964;', '&#x1f965;', '&#x1f966;', '&#x1f967;', '&#x1f968;', '&#x1f969;', '&#x1f96a;', '&#x1f96b;', '&#x1f96c;', '&#x1f96d;', '&#x1f96e;', '&#x1f96f;', '&#x1f970;', '&#x1f971;', '&#x1f972;', '&#x1f973;', '&#x1f974;', '&#x1f975;', '&#x1f976;', '&#x1f977;', '&#x1f978;', '&#x1f979;', '&#x1f97a;', '&#x1f97b;', '&#x1f97c;', '&#x1f97d;', '&#x1f97e;', '&#x1f97f;', '&#x1f980;', '&#x1f981;', '&#x1f982;', '&#x1f983;', '&#x1f984;', '&#x1f985;', '&#x1f986;', '&#x1f987;', '&#x1f988;', '&#x1f989;', '&#x1f98a;', '&#x1f98b;', '&#x1f98c;', '&#x1f98d;', '&#x1f98e;', '&#x1f98f;', '&#x1f990;', '&#x1f991;', '&#x1f992;', '&#x1f993;', '&#x1f994;', '&#x1f995;', '&#x1f996;', '&#x1f997;', '&#x1f998;', '&#x1f999;', '&#x1f99a;', '&#x1f99b;', '&#x1f99c;', '&#x1f99d;', '&#x1f99e;', '&#x1f99f;', '&#x1f9a0;', '&#x1f9a1;', '&#x1f9a2;', '&#x1f9a3;', '&#x1f9a4;', '&#x1f9a5;', '&#x1f9a6;', '&#x1f9a7;', '&#x1f9a8;', '&#x1f9a9;', '&#x1f9aa;', '&#x1f9ab;', '&#x1f9ac;', '&#x1f9ad;', '&#x1f9ae;', '&#x1f9af;', '&#x1f9b0;', '&#x1f9b1;', '&#x1f9b2;', '&#x1f9b3;', '&#x1f9b4;', '&#x1f9b5;', '&#x1f9b6;', '&#x1f9b7;', '&#x1f9b8;', '&#x1f9b9;', '&#x1f9ba;', '&#x1f9bb;', '&#x1f9bc;', '&#x1f9bd;', '&#x1f9be;', '&#x1f9bf;', '&#x1f9c0;', '&#x1f9c1;', '&#x1f9c2;', '&#x1f9c3;', '&#x1f9c4;', '&#x1f9c5;', '&#x1f9c6;', '&#x1f9c7;', '&#x1f9c8;', '&#x1f9c9;', '&#x1f9ca;', '&#x1f9cb;', '&#x1f9cc;', '&#x1f9cd;', '&#x1f9ce;', '&#x1f9cf;', '&#x1f9d0;', '&#x1f9d1;', '&#x1f9d2;', '&#x1f9d3;', '&#x1f9d4;', '&#x1f9d5;', '&#x1f9d6;', '&#x1f9d7;', '&#x1f9d8;', '&#x1f9d9;', '&#x1f9da;', '&#x1f9db;', '&#x1f9dc;', '&#x1f9dd;', '&#x1f9de;', '&#x1f9df;', '&#x1f9e0;', '&#x1f9e1;', '&#x1f9e2;', '&#x1f9e3;', '&#x1f9e4;', '&#x1f9e5;', '&#x1f9e6;', '&#x1f9e7;', '&#x1f9e8;', '&#x1f9e9;', '&#x1f9ea;', '&#x1f9eb;', '&#x1f9ec;', '&#x1f9ed;', '&#x1f9ee;', '&#x1f9ef;', '&#x1f9f0;', '&#x1f9f1;', '&#x1f9f2;', '&#x1f9f3;', '&#x1f9f4;', '&#x1f9f5;', '&#x1f9f6;', '&#x1f9f7;', '&#x1f9f8;', '&#x1f9f9;', '&#x1f9fa;', '&#x1f9fb;', '&#x1f9fc;', '&#x1f9fd;', '&#x1f9fe;', '&#x1f9ff;', '&#x1fa70;', '&#x1fa71;', '&#x1fa72;', '&#x1fa73;', '&#x1fa74;', '&#x1fa78;', '&#x1fa79;', '&#x1fa7a;', '&#x1fa7b;', '&#x1fa7c;', '&#x1fa80;', '&#x1fa81;', '&#x1fa82;', '&#x1fa83;', '&#x1fa84;', '&#x1fa85;', '&#x1fa86;', '&#x1fa90;', '&#x1fa91;', '&#x1fa92;', '&#x1fa93;', '&#x1fa94;', '&#x1fa95;', '&#x1fa96;', '&#x1fa97;', '&#x1fa98;', '&#x1fa99;', '&#x1fa9a;', '&#x1fa9b;', '&#x1fa9c;', '&#x1fa9d;', '&#x1fa9e;', '&#x1fa9f;', '&#x1faa0;', '&#x1faa1;', '&#x1faa2;', '&#x1faa3;', '&#x1faa4;', '&#x1faa5;', '&#x1faa6;', '&#x1faa7;', '&#x1faa8;', '&#x1faa9;', '&#x1faaa;', '&#x1faab;', '&#x1faac;', '&#x1fab0;', '&#x1fab1;', '&#x1fab2;', '&#x1fab3;', '&#x1fab4;', '&#x1fab5;', '&#x1fab6;', '&#x1fab7;', '&#x1fab8;', '&#x1fab9;', '&#x1faba;', '&#x1fac0;', '&#x1fac1;', '&#x1fac2;', '&#x1fac3;', '&#x1fac4;', '&#x1fac5;', '&#x1fad0;', '&#x1fad1;', '&#x1fad2;', '&#x1fad3;', '&#x1fad4;', '&#x1fad5;', '&#x1fad6;', '&#x1fad7;', '&#x1fad8;', '&#x1fad9;', '&#x1fae0;', '&#x1fae1;', '&#x1fae2;', '&#x1fae3;', '&#x1fae4;', '&#x1fae5;', '&#x1fae6;', '&#x1fae7;', '&#x1faf0;', '&#x1faf1;', '&#x1faf2;', '&#x1faf3;', '&#x1faf4;', '&#x1faf5;', '&#x1faf6;', '&#x203c;', '&#x2049;', '&#x2122;', '&#x2139;', '&#x2194;', '&#x2195;', '&#x2196;', '&#x2197;', '&#x2198;', '&#x2199;', '&#x21a9;', '&#x21aa;', '&#x231a;', '&#x231b;', '&#x2328;', '&#x23cf;', '&#x23e9;', '&#x23ea;', '&#x23eb;', '&#x23ec;', '&#x23ed;', '&#x23ee;', '&#x23ef;', '&#x23f0;', '&#x23f1;', '&#x23f2;', '&#x23f3;', '&#x23f8;', '&#x23f9;', '&#x23fa;', '&#x24c2;', '&#x25aa;', '&#x25ab;', '&#x25b6;', '&#x25c0;', '&#x25fb;', '&#x25fc;', '&#x25fd;', '&#x25fe;', '&#x2600;', '&#x2601;', '&#x2602;', '&#x2603;', '&#x2604;', '&#x260e;', '&#x2611;', '&#x2614;', '&#x2615;', '&#x2618;', '&#x261d;', '&#x2620;', '&#x2622;', '&#x2623;', '&#x2626;', '&#x262a;', '&#x262e;', '&#x262f;', '&#x2638;', '&#x2639;', '&#x263a;', '&#x2640;', '&#x2642;', '&#x2648;', '&#x2649;', '&#x264a;', '&#x264b;', '&#x264c;', '&#x264d;', '&#x264e;', '&#x264f;', '&#x2650;', '&#x2651;', '&#x2652;', '&#x2653;', '&#x265f;', '&#x2660;', '&#x2663;', '&#x2665;', '&#x2666;', '&#x2668;', '&#x267b;', '&#x267e;', '&#x267f;', '&#x2692;', '&#x2693;', '&#x2694;', '&#x2695;', '&#x2696;', '&#x2697;', '&#x2699;', '&#x269b;', '&#x269c;', '&#x26a0;', '&#x26a1;', '&#x26a7;', '&#x26aa;', '&#x26ab;', '&#x26b0;', '&#x26b1;', '&#x26bd;', '&#x26be;', '&#x26c4;', '&#x26c5;', '&#x26c8;', '&#x26ce;', '&#x26cf;', '&#x26d1;', '&#x26d3;', '&#x26d4;', '&#x26e9;', '&#x26ea;', '&#x26f0;', '&#x26f1;', '&#x26f2;', '&#x26f3;', '&#x26f4;', '&#x26f5;', '&#x26f7;', '&#x26f8;', '&#x26f9;', '&#x26fa;', '&#x26fd;', '&#x2702;', '&#x2705;', '&#x2708;', '&#x2709;', '&#x270a;', '&#x270b;', '&#x270c;', '&#x270d;', '&#x270f;', '&#x2712;', '&#x2714;', '&#x2716;', '&#x271d;', '&#x2721;', '&#x2728;', '&#x2733;', '&#x2734;', '&#x2744;', '&#x2747;', '&#x274c;', '&#x274e;', '&#x2753;', '&#x2754;', '&#x2755;', '&#x2757;', '&#x2763;', '&#x2764;', '&#x2795;', '&#x2796;', '&#x2797;', '&#x27a1;', '&#x27b0;', '&#x27bf;', '&#x2934;', '&#x2935;', '&#x2b05;', '&#x2b06;', '&#x2b07;', '&#x2b1b;', '&#x2b1c;', '&#x2b50;', '&#x2b55;', '&#x3030;', '&#x303d;', '&#x3297;', '&#x3299;', '&#xe50a;' ); $partials = array( '&#x1f004;', '&#x1f0cf;', '&#x1f170;', '&#x1f171;', '&#x1f17e;', '&#x1f17f;', '&#x1f18e;', '&#x1f191;', '&#x1f192;', '&#x1f193;', '&#x1f194;', '&#x1f195;', '&#x1f196;', '&#x1f197;', '&#x1f198;', '&#x1f199;', '&#x1f19a;', '&#x1f1e6;', '&#x1f1e8;', '&#x1f1e9;', '&#x1f1ea;', '&#x1f1eb;', '&#x1f1ec;', '&#x1f1ee;', '&#x1f1f1;', '&#x1f1f2;', '&#x1f1f4;', '&#x1f1f6;', '&#x1f1f7;', '&#x1f1f8;', '&#x1f1f9;', '&#x1f1fa;', '&#x1f1fc;', '&#x1f1fd;', '&#x1f1ff;', '&#x1f1e7;', '&#x1f1ed;', '&#x1f1ef;', '&#x1f1f3;', '&#x1f1fb;', '&#x1f1fe;', '&#x1f1f0;', '&#x1f1f5;', '&#x1f201;', '&#x1f202;', '&#x1f21a;', '&#x1f22f;', '&#x1f232;', '&#x1f233;', '&#x1f234;', '&#x1f235;', '&#x1f236;', '&#x1f237;', '&#x1f238;', '&#x1f239;', '&#x1f23a;', '&#x1f250;', '&#x1f251;', '&#x1f300;', '&#x1f301;', '&#x1f302;', '&#x1f303;', '&#x1f304;', '&#x1f305;', '&#x1f306;', '&#x1f307;', '&#x1f308;', '&#x1f309;', '&#x1f30a;', '&#x1f30b;', '&#x1f30c;', '&#x1f30d;', '&#x1f30e;', '&#x1f30f;', '&#x1f310;', '&#x1f311;', '&#x1f312;', '&#x1f313;', '&#x1f314;', '&#x1f315;', '&#x1f316;', '&#x1f317;', '&#x1f318;', '&#x1f319;', '&#x1f31a;', '&#x1f31b;', '&#x1f31c;', '&#x1f31d;', '&#x1f31e;', '&#x1f31f;', '&#x1f320;', '&#x1f321;', '&#x1f324;', '&#x1f325;', '&#x1f326;', '&#x1f327;', '&#x1f328;', '&#x1f329;', '&#x1f32a;', '&#x1f32b;', '&#x1f32c;', '&#x1f32d;', '&#x1f32e;', '&#x1f32f;', '&#x1f330;', '&#x1f331;', '&#x1f332;', '&#x1f333;', '&#x1f334;', '&#x1f335;', '&#x1f336;', '&#x1f337;', '&#x1f338;', '&#x1f339;', '&#x1f33a;', '&#x1f33b;', '&#x1f33c;', '&#x1f33d;', '&#x1f33e;', '&#x1f33f;', '&#x1f340;', '&#x1f341;', '&#x1f342;', '&#x1f343;', '&#x1f344;', '&#x1f345;', '&#x1f346;', '&#x1f347;', '&#x1f348;', '&#x1f349;', '&#x1f34a;', '&#x1f34b;', '&#x1f34c;', '&#x1f34d;', '&#x1f34e;', '&#x1f34f;', '&#x1f350;', '&#x1f351;', '&#x1f352;', '&#x1f353;', '&#x1f354;', '&#x1f355;', '&#x1f356;', '&#x1f357;', '&#x1f358;', '&#x1f359;', '&#x1f35a;', '&#x1f35b;', '&#x1f35c;', '&#x1f35d;', '&#x1f35e;', '&#x1f35f;', '&#x1f360;', '&#x1f361;', '&#x1f362;', '&#x1f363;', '&#x1f364;', '&#x1f365;', '&#x1f366;', '&#x1f367;', '&#x1f368;', '&#x1f369;', '&#x1f36a;', '&#x1f36b;', '&#x1f36c;', '&#x1f36d;', '&#x1f36e;', '&#x1f36f;', '&#x1f370;', '&#x1f371;', '&#x1f372;', '&#x1f373;', '&#x1f374;', '&#x1f375;', '&#x1f376;', '&#x1f377;', '&#x1f378;', '&#x1f379;', '&#x1f37a;', '&#x1f37b;', '&#x1f37c;', '&#x1f37d;', '&#x1f37e;', '&#x1f37f;', '&#x1f380;', '&#x1f381;', '&#x1f382;', '&#x1f383;', '&#x1f384;', '&#x1f385;', '&#x1f3fb;', '&#x1f3fc;', '&#x1f3fd;', '&#x1f3fe;', '&#x1f3ff;', '&#x1f386;', '&#x1f387;', '&#x1f388;', '&#x1f389;', '&#x1f38a;', '&#x1f38b;', '&#x1f38c;', '&#x1f38d;', '&#x1f38e;', '&#x1f38f;', '&#x1f390;', '&#x1f391;', '&#x1f392;', '&#x1f393;', '&#x1f396;', '&#x1f397;', '&#x1f399;', '&#x1f39a;', '&#x1f39b;', '&#x1f39e;', '&#x1f39f;', '&#x1f3a0;', '&#x1f3a1;', '&#x1f3a2;', '&#x1f3a3;', '&#x1f3a4;', '&#x1f3a5;', '&#x1f3a6;', '&#x1f3a7;', '&#x1f3a8;', '&#x1f3a9;', '&#x1f3aa;', '&#x1f3ab;', '&#x1f3ac;', '&#x1f3ad;', '&#x1f3ae;', '&#x1f3af;', '&#x1f3b0;', '&#x1f3b1;', '&#x1f3b2;', '&#x1f3b3;', '&#x1f3b4;', '&#x1f3b5;', '&#x1f3b6;', '&#x1f3b7;', '&#x1f3b8;', '&#x1f3b9;', '&#x1f3ba;', '&#x1f3bb;', '&#x1f3bc;', '&#x1f3bd;', '&#x1f3be;', '&#x1f3bf;', '&#x1f3c0;', '&#x1f3c1;', '&#x1f3c2;', '&#x1f3c3;', '&#x200d;', '&#x2640;', '&#xfe0f;', '&#x2642;', '&#x1f3c4;', '&#x1f3c5;', '&#x1f3c6;', '&#x1f3c7;', '&#x1f3c8;', '&#x1f3c9;', '&#x1f3ca;', '&#x1f3cb;', '&#x1f3cc;', '&#x1f3cd;', '&#x1f3ce;', '&#x1f3cf;', '&#x1f3d0;', '&#x1f3d1;', '&#x1f3d2;', '&#x1f3d3;', '&#x1f3d4;', '&#x1f3d5;', '&#x1f3d6;', '&#x1f3d7;', '&#x1f3d8;', '&#x1f3d9;', '&#x1f3da;', '&#x1f3db;', '&#x1f3dc;', '&#x1f3dd;', '&#x1f3de;', '&#x1f3df;', '&#x1f3e0;', '&#x1f3e1;', '&#x1f3e2;', '&#x1f3e3;', '&#x1f3e4;', '&#x1f3e5;', '&#x1f3e6;', '&#x1f3e7;', '&#x1f3e8;', '&#x1f3e9;', '&#x1f3ea;', '&#x1f3eb;', '&#x1f3ec;', '&#x1f3ed;', '&#x1f3ee;', '&#x1f3ef;', '&#x1f3f0;', '&#x1f3f3;', '&#x26a7;', '&#x1f3f4;', '&#x2620;', '&#xe0067;', '&#xe0062;', '&#xe0065;', '&#xe006e;', '&#xe007f;', '&#xe0073;', '&#xe0063;', '&#xe0074;', '&#xe0077;', '&#xe006c;', '&#x1f3f5;', '&#x1f3f7;', '&#x1f3f8;', '&#x1f3f9;', '&#x1f3fa;', '&#x1f400;', '&#x1f401;', '&#x1f402;', '&#x1f403;', '&#x1f404;', '&#x1f405;', '&#x1f406;', '&#x1f407;', '&#x1f408;', '&#x2b1b;', '&#x1f409;', '&#x1f40a;', '&#x1f40b;', '&#x1f40c;', '&#x1f40d;', '&#x1f40e;', '&#x1f40f;', '&#x1f410;', '&#x1f411;', '&#x1f412;', '&#x1f413;', '&#x1f414;', '&#x1f415;', '&#x1f9ba;', '&#x1f416;', '&#x1f417;', '&#x1f418;', '&#x1f419;', '&#x1f41a;', '&#x1f41b;', '&#x1f41c;', '&#x1f41d;', '&#x1f41e;', '&#x1f41f;', '&#x1f420;', '&#x1f421;', '&#x1f422;', '&#x1f423;', '&#x1f424;', '&#x1f425;', '&#x1f426;', '&#x1f427;', '&#x1f428;', '&#x1f429;', '&#x1f42a;', '&#x1f42b;', '&#x1f42c;', '&#x1f42d;', '&#x1f42e;', '&#x1f42f;', '&#x1f430;', '&#x1f431;', '&#x1f432;', '&#x1f433;', '&#x1f434;', '&#x1f435;', '&#x1f436;', '&#x1f437;', '&#x1f438;', '&#x1f439;', '&#x1f43a;', '&#x1f43b;', '&#x2744;', '&#x1f43c;', '&#x1f43d;', '&#x1f43e;', '&#x1f43f;', '&#x1f440;', '&#x1f441;', '&#x1f5e8;', '&#x1f442;', '&#x1f443;', '&#x1f444;', '&#x1f445;', '&#x1f446;', '&#x1f447;', '&#x1f448;', '&#x1f449;', '&#x1f44a;', '&#x1f44b;', '&#x1f44c;', '&#x1f44d;', '&#x1f44e;', '&#x1f44f;', '&#x1f450;', '&#x1f451;', '&#x1f452;', '&#x1f453;', '&#x1f454;', '&#x1f455;', '&#x1f456;', '&#x1f457;', '&#x1f458;', '&#x1f459;', '&#x1f45a;', '&#x1f45b;', '&#x1f45c;', '&#x1f45d;', '&#x1f45e;', '&#x1f45f;', '&#x1f460;', '&#x1f461;', '&#x1f462;', '&#x1f463;', '&#x1f464;', '&#x1f465;', '&#x1f466;', '&#x1f467;', '&#x1f468;', '&#x1f4bb;', '&#x1f4bc;', '&#x1f527;', '&#x1f52c;', '&#x1f680;', '&#x1f692;', '&#x1f91d;', '&#x1f9af;', '&#x1f9b0;', '&#x1f9b1;', '&#x1f9b2;', '&#x1f9b3;', '&#x1f9bc;', '&#x1f9bd;', '&#x2695;', '&#x2696;', '&#x2708;', '&#x2764;', '&#x1f48b;', '&#x1f469;', '&#x1f46a;', '&#x1f46b;', '&#x1f46c;', '&#x1f46d;', '&#x1f46e;', '&#x1f46f;', '&#x1f470;', '&#x1f471;', '&#x1f472;', '&#x1f473;', '&#x1f474;', '&#x1f475;', '&#x1f476;', '&#x1f477;', '&#x1f478;', '&#x1f479;', '&#x1f47a;', '&#x1f47b;', '&#x1f47c;', '&#x1f47d;', '&#x1f47e;', '&#x1f47f;', '&#x1f480;', '&#x1f481;', '&#x1f482;', '&#x1f483;', '&#x1f484;', '&#x1f485;', '&#x1f486;', '&#x1f487;', '&#x1f488;', '&#x1f489;', '&#x1f48a;', '&#x1f48c;', '&#x1f48d;', '&#x1f48e;', '&#x1f48f;', '&#x1f490;', '&#x1f491;', '&#x1f492;', '&#x1f493;', '&#x1f494;', '&#x1f495;', '&#x1f496;', '&#x1f497;', '&#x1f498;', '&#x1f499;', '&#x1f49a;', '&#x1f49b;', '&#x1f49c;', '&#x1f49d;', '&#x1f49e;', '&#x1f49f;', '&#x1f4a0;', '&#x1f4a1;', '&#x1f4a2;', '&#x1f4a3;', '&#x1f4a4;', '&#x1f4a5;', '&#x1f4a6;', '&#x1f4a7;', '&#x1f4a8;', '&#x1f4a9;', '&#x1f4aa;', '&#x1f4ab;', '&#x1f4ac;', '&#x1f4ad;', '&#x1f4ae;', '&#x1f4af;', '&#x1f4b0;', '&#x1f4b1;', '&#x1f4b2;', '&#x1f4b3;', '&#x1f4b4;', '&#x1f4b5;', '&#x1f4b6;', '&#x1f4b7;', '&#x1f4b8;', '&#x1f4b9;', '&#x1f4ba;', '&#x1f4bd;', '&#x1f4be;', '&#x1f4bf;', '&#x1f4c0;', '&#x1f4c1;', '&#x1f4c2;', '&#x1f4c3;', '&#x1f4c4;', '&#x1f4c5;', '&#x1f4c6;', '&#x1f4c7;', '&#x1f4c8;', '&#x1f4c9;', '&#x1f4ca;', '&#x1f4cb;', '&#x1f4cc;', '&#x1f4cd;', '&#x1f4ce;', '&#x1f4cf;', '&#x1f4d0;', '&#x1f4d1;', '&#x1f4d2;', '&#x1f4d3;', '&#x1f4d4;', '&#x1f4d5;', '&#x1f4d6;', '&#x1f4d7;', '&#x1f4d8;', '&#x1f4d9;', '&#x1f4da;', '&#x1f4db;', '&#x1f4dc;', '&#x1f4dd;', '&#x1f4de;', '&#x1f4df;', '&#x1f4e0;', '&#x1f4e1;', '&#x1f4e2;', '&#x1f4e3;', '&#x1f4e4;', '&#x1f4e5;', '&#x1f4e6;', '&#x1f4e7;', '&#x1f4e8;', '&#x1f4e9;', '&#x1f4ea;', '&#x1f4eb;', '&#x1f4ec;', '&#x1f4ed;', '&#x1f4ee;', '&#x1f4ef;', '&#x1f4f0;', '&#x1f4f1;', '&#x1f4f2;', '&#x1f4f3;', '&#x1f4f4;', '&#x1f4f5;', '&#x1f4f6;', '&#x1f4f7;', '&#x1f4f8;', '&#x1f4f9;', '&#x1f4fa;', '&#x1f4fb;', '&#x1f4fc;', '&#x1f4fd;', '&#x1f4ff;', '&#x1f500;', '&#x1f501;', '&#x1f502;', '&#x1f503;', '&#x1f504;', '&#x1f505;', '&#x1f506;', '&#x1f507;', '&#x1f508;', '&#x1f509;', '&#x1f50a;', '&#x1f50b;', '&#x1f50c;', '&#x1f50d;', '&#x1f50e;', '&#x1f50f;', '&#x1f510;', '&#x1f511;', '&#x1f512;', '&#x1f513;', '&#x1f514;', '&#x1f515;', '&#x1f516;', '&#x1f517;', '&#x1f518;', '&#x1f519;', '&#x1f51a;', '&#x1f51b;', '&#x1f51c;', '&#x1f51d;', '&#x1f51e;', '&#x1f51f;', '&#x1f520;', '&#x1f521;', '&#x1f522;', '&#x1f523;', '&#x1f524;', '&#x1f525;', '&#x1f526;', '&#x1f528;', '&#x1f529;', '&#x1f52a;', '&#x1f52b;', '&#x1f52d;', '&#x1f52e;', '&#x1f52f;', '&#x1f530;', '&#x1f531;', '&#x1f532;', '&#x1f533;', '&#x1f534;', '&#x1f535;', '&#x1f536;', '&#x1f537;', '&#x1f538;', '&#x1f539;', '&#x1f53a;', '&#x1f53b;', '&#x1f53c;', '&#x1f53d;', '&#x1f549;', '&#x1f54a;', '&#x1f54b;', '&#x1f54c;', '&#x1f54d;', '&#x1f54e;', '&#x1f550;', '&#x1f551;', '&#x1f552;', '&#x1f553;', '&#x1f554;', '&#x1f555;', '&#x1f556;', '&#x1f557;', '&#x1f558;', '&#x1f559;', '&#x1f55a;', '&#x1f55b;', '&#x1f55c;', '&#x1f55d;', '&#x1f55e;', '&#x1f55f;', '&#x1f560;', '&#x1f561;', '&#x1f562;', '&#x1f563;', '&#x1f564;', '&#x1f565;', '&#x1f566;', '&#x1f567;', '&#x1f56f;', '&#x1f570;', '&#x1f573;', '&#x1f574;', '&#x1f575;', '&#x1f576;', '&#x1f577;', '&#x1f578;', '&#x1f579;', '&#x1f57a;', '&#x1f587;', '&#x1f58a;', '&#x1f58b;', '&#x1f58c;', '&#x1f58d;', '&#x1f590;', '&#x1f595;', '&#x1f596;', '&#x1f5a4;', '&#x1f5a5;', '&#x1f5a8;', '&#x1f5b1;', '&#x1f5b2;', '&#x1f5bc;', '&#x1f5c2;', '&#x1f5c3;', '&#x1f5c4;', '&#x1f5d1;', '&#x1f5d2;', '&#x1f5d3;', '&#x1f5dc;', '&#x1f5dd;', '&#x1f5de;', '&#x1f5e1;', '&#x1f5e3;', '&#x1f5ef;', '&#x1f5f3;', '&#x1f5fa;', '&#x1f5fb;', '&#x1f5fc;', '&#x1f5fd;', '&#x1f5fe;', '&#x1f5ff;', '&#x1f600;', '&#x1f601;', '&#x1f602;', '&#x1f603;', '&#x1f604;', '&#x1f605;', '&#x1f606;', '&#x1f607;', '&#x1f608;', '&#x1f609;', '&#x1f60a;', '&#x1f60b;', '&#x1f60c;', '&#x1f60d;', '&#x1f60e;', '&#x1f60f;', '&#x1f610;', '&#x1f611;', '&#x1f612;', '&#x1f613;', '&#x1f614;', '&#x1f615;', '&#x1f616;', '&#x1f617;', '&#x1f618;', '&#x1f619;', '&#x1f61a;', '&#x1f61b;', '&#x1f61c;', '&#x1f61d;', '&#x1f61e;', '&#x1f61f;', '&#x1f620;', '&#x1f621;', '&#x1f622;', '&#x1f623;', '&#x1f624;', '&#x1f625;', '&#x1f626;', '&#x1f627;', '&#x1f628;', '&#x1f629;', '&#x1f62a;', '&#x1f62b;', '&#x1f62c;', '&#x1f62d;', '&#x1f62e;', '&#x1f62f;', '&#x1f630;', '&#x1f631;', '&#x1f632;', '&#x1f633;', '&#x1f634;', '&#x1f635;', '&#x1f636;', '&#x1f637;', '&#x1f638;', '&#x1f639;', '&#x1f63a;', '&#x1f63b;', '&#x1f63c;', '&#x1f63d;', '&#x1f63e;', '&#x1f63f;', '&#x1f640;', '&#x1f641;', '&#x1f642;', '&#x1f643;', '&#x1f644;', '&#x1f645;', '&#x1f646;', '&#x1f647;', '&#x1f648;', '&#x1f649;', '&#x1f64a;', '&#x1f64b;', '&#x1f64c;', '&#x1f64d;', '&#x1f64e;', '&#x1f64f;', '&#x1f681;', '&#x1f682;', '&#x1f683;', '&#x1f684;', '&#x1f685;', '&#x1f686;', '&#x1f687;', '&#x1f688;', '&#x1f689;', '&#x1f68a;', '&#x1f68b;', '&#x1f68c;', '&#x1f68d;', '&#x1f68e;', '&#x1f68f;', '&#x1f690;', '&#x1f691;', '&#x1f693;', '&#x1f694;', '&#x1f695;', '&#x1f696;', '&#x1f697;', '&#x1f698;', '&#x1f699;', '&#x1f69a;', '&#x1f69b;', '&#x1f69c;', '&#x1f69d;', '&#x1f69e;', '&#x1f69f;', '&#x1f6a0;', '&#x1f6a1;', '&#x1f6a2;', '&#x1f6a3;', '&#x1f6a4;', '&#x1f6a5;', '&#x1f6a6;', '&#x1f6a7;', '&#x1f6a8;', '&#x1f6a9;', '&#x1f6aa;', '&#x1f6ab;', '&#x1f6ac;', '&#x1f6ad;', '&#x1f6ae;', '&#x1f6af;', '&#x1f6b0;', '&#x1f6b1;', '&#x1f6b2;', '&#x1f6b3;', '&#x1f6b4;', '&#x1f6b5;', '&#x1f6b6;', '&#x1f6b7;', '&#x1f6b8;', '&#x1f6b9;', '&#x1f6ba;', '&#x1f6bb;', '&#x1f6bc;', '&#x1f6bd;', '&#x1f6be;', '&#x1f6bf;', '&#x1f6c0;', '&#x1f6c1;', '&#x1f6c2;', '&#x1f6c3;', '&#x1f6c4;', '&#x1f6c5;', '&#x1f6cb;', '&#x1f6cc;', '&#x1f6cd;', '&#x1f6ce;', '&#x1f6cf;', '&#x1f6d0;', '&#x1f6d1;', '&#x1f6d2;', '&#x1f6d5;', '&#x1f6d6;', '&#x1f6d7;', '&#x1f6dd;', '&#x1f6de;', '&#x1f6df;', '&#x1f6e0;', '&#x1f6e1;', '&#x1f6e2;', '&#x1f6e3;', '&#x1f6e4;', '&#x1f6e5;', '&#x1f6e9;', '&#x1f6eb;', '&#x1f6ec;', '&#x1f6f0;', '&#x1f6f3;', '&#x1f6f4;', '&#x1f6f5;', '&#x1f6f6;', '&#x1f6f7;', '&#x1f6f8;', '&#x1f6f9;', '&#x1f6fa;', '&#x1f6fb;', '&#x1f6fc;', '&#x1f7e0;', '&#x1f7e1;', '&#x1f7e2;', '&#x1f7e3;', '&#x1f7e4;', '&#x1f7e5;', '&#x1f7e6;', '&#x1f7e7;', '&#x1f7e8;', '&#x1f7e9;', '&#x1f7ea;', '&#x1f7eb;', '&#x1f7f0;', '&#x1f90c;', '&#x1f90d;', '&#x1f90e;', '&#x1f90f;', '&#x1f910;', '&#x1f911;', '&#x1f912;', '&#x1f913;', '&#x1f914;', '&#x1f915;', '&#x1f916;', '&#x1f917;', '&#x1f918;', '&#x1f919;', '&#x1f91a;', '&#x1f91b;', '&#x1f91c;', '&#x1f91e;', '&#x1f91f;', '&#x1f920;', '&#x1f921;', '&#x1f922;', '&#x1f923;', '&#x1f924;', '&#x1f925;', '&#x1f926;', '&#x1f927;', '&#x1f928;', '&#x1f929;', '&#x1f92a;', '&#x1f92b;', '&#x1f92c;', '&#x1f92d;', '&#x1f92e;', '&#x1f92f;', '&#x1f930;', '&#x1f931;', '&#x1f932;', '&#x1f933;', '&#x1f934;', '&#x1f935;', '&#x1f936;', '&#x1f937;', '&#x1f938;', '&#x1f939;', '&#x1f93a;', '&#x1f93c;', '&#x1f93d;', '&#x1f93e;', '&#x1f93f;', '&#x1f940;', '&#x1f941;', '&#x1f942;', '&#x1f943;', '&#x1f944;', '&#x1f945;', '&#x1f947;', '&#x1f948;', '&#x1f949;', '&#x1f94a;', '&#x1f94b;', '&#x1f94c;', '&#x1f94d;', '&#x1f94e;', '&#x1f94f;', '&#x1f950;', '&#x1f951;', '&#x1f952;', '&#x1f953;', '&#x1f954;', '&#x1f955;', '&#x1f956;', '&#x1f957;', '&#x1f958;', '&#x1f959;', '&#x1f95a;', '&#x1f95b;', '&#x1f95c;', '&#x1f95d;', '&#x1f95e;', '&#x1f95f;', '&#x1f960;', '&#x1f961;', '&#x1f962;', '&#x1f963;', '&#x1f964;', '&#x1f965;', '&#x1f966;', '&#x1f967;', '&#x1f968;', '&#x1f969;', '&#x1f96a;', '&#x1f96b;', '&#x1f96c;', '&#x1f96d;', '&#x1f96e;', '&#x1f96f;', '&#x1f970;', '&#x1f971;', '&#x1f972;', '&#x1f973;', '&#x1f974;', '&#x1f975;', '&#x1f976;', '&#x1f977;', '&#x1f978;', '&#x1f979;', '&#x1f97a;', '&#x1f97b;', '&#x1f97c;', '&#x1f97d;', '&#x1f97e;', '&#x1f97f;', '&#x1f980;', '&#x1f981;', '&#x1f982;', '&#x1f983;', '&#x1f984;', '&#x1f985;', '&#x1f986;', '&#x1f987;', '&#x1f988;', '&#x1f989;', '&#x1f98a;', '&#x1f98b;', '&#x1f98c;', '&#x1f98d;', '&#x1f98e;', '&#x1f98f;', '&#x1f990;', '&#x1f991;', '&#x1f992;', '&#x1f993;', '&#x1f994;', '&#x1f995;', '&#x1f996;', '&#x1f997;', '&#x1f998;', '&#x1f999;', '&#x1f99a;', '&#x1f99b;', '&#x1f99c;', '&#x1f99d;', '&#x1f99e;', '&#x1f99f;', '&#x1f9a0;', '&#x1f9a1;', '&#x1f9a2;', '&#x1f9a3;', '&#x1f9a4;', '&#x1f9a5;', '&#x1f9a6;', '&#x1f9a7;', '&#x1f9a8;', '&#x1f9a9;', '&#x1f9aa;', '&#x1f9ab;', '&#x1f9ac;', '&#x1f9ad;', '&#x1f9ae;', '&#x1f9b4;', '&#x1f9b5;', '&#x1f9b6;', '&#x1f9b7;', '&#x1f9b8;', '&#x1f9b9;', '&#x1f9bb;', '&#x1f9be;', '&#x1f9bf;', '&#x1f9c0;', '&#x1f9c1;', '&#x1f9c2;', '&#x1f9c3;', '&#x1f9c4;', '&#x1f9c5;', '&#x1f9c6;', '&#x1f9c7;', '&#x1f9c8;', '&#x1f9c9;', '&#x1f9ca;', '&#x1f9cb;', '&#x1f9cc;', '&#x1f9cd;', '&#x1f9ce;', '&#x1f9cf;', '&#x1f9d0;', '&#x1f9d1;', '&#x1f9d2;', '&#x1f9d3;', '&#x1f9d4;', '&#x1f9d5;', '&#x1f9d6;', '&#x1f9d7;', '&#x1f9d8;', '&#x1f9d9;', '&#x1f9da;', '&#x1f9db;', '&#x1f9dc;', '&#x1f9dd;', '&#x1f9de;', '&#x1f9df;', '&#x1f9e0;', '&#x1f9e1;', '&#x1f9e2;', '&#x1f9e3;', '&#x1f9e4;', '&#x1f9e5;', '&#x1f9e6;', '&#x1f9e7;', '&#x1f9e8;', '&#x1f9e9;', '&#x1f9ea;', '&#x1f9eb;', '&#x1f9ec;', '&#x1f9ed;', '&#x1f9ee;', '&#x1f9ef;', '&#x1f9f0;', '&#x1f9f1;', '&#x1f9f2;', '&#x1f9f3;', '&#x1f9f4;', '&#x1f9f5;', '&#x1f9f6;', '&#x1f9f7;', '&#x1f9f8;', '&#x1f9f9;', '&#x1f9fa;', '&#x1f9fb;', '&#x1f9fc;', '&#x1f9fd;', '&#x1f9fe;', '&#x1f9ff;', '&#x1fa70;', '&#x1fa71;', '&#x1fa72;', '&#x1fa73;', '&#x1fa74;', '&#x1fa78;', '&#x1fa79;', '&#x1fa7a;', '&#x1fa7b;', '&#x1fa7c;', '&#x1fa80;', '&#x1fa81;', '&#x1fa82;', '&#x1fa83;', '&#x1fa84;', '&#x1fa85;', '&#x1fa86;', '&#x1fa90;', '&#x1fa91;', '&#x1fa92;', '&#x1fa93;', '&#x1fa94;', '&#x1fa95;', '&#x1fa96;', '&#x1fa97;', '&#x1fa98;', '&#x1fa99;', '&#x1fa9a;', '&#x1fa9b;', '&#x1fa9c;', '&#x1fa9d;', '&#x1fa9e;', '&#x1fa9f;', '&#x1faa0;', '&#x1faa1;', '&#x1faa2;', '&#x1faa3;', '&#x1faa4;', '&#x1faa5;', '&#x1faa6;', '&#x1faa7;', '&#x1faa8;', '&#x1faa9;', '&#x1faaa;', '&#x1faab;', '&#x1faac;', '&#x1fab0;', '&#x1fab1;', '&#x1fab2;', '&#x1fab3;', '&#x1fab4;', '&#x1fab5;', '&#x1fab6;', '&#x1fab7;', '&#x1fab8;', '&#x1fab9;', '&#x1faba;', '&#x1fac0;', '&#x1fac1;', '&#x1fac2;', '&#x1fac3;', '&#x1fac4;', '&#x1fac5;', '&#x1fad0;', '&#x1fad1;', '&#x1fad2;', '&#x1fad3;', '&#x1fad4;', '&#x1fad5;', '&#x1fad6;', '&#x1fad7;', '&#x1fad8;', '&#x1fad9;', '&#x1fae0;', '&#x1fae1;', '&#x1fae2;', '&#x1fae3;', '&#x1fae4;', '&#x1fae5;', '&#x1fae6;', '&#x1fae7;', '&#x1faf0;', '&#x1faf1;', '&#x1faf2;', '&#x1faf3;', '&#x1faf4;', '&#x1faf5;', '&#x1faf6;', '&#x203c;', '&#x2049;', '&#x2122;', '&#x2139;', '&#x2194;', '&#x2195;', '&#x2196;', '&#x2197;', '&#x2198;', '&#x2199;', '&#x21a9;', '&#x21aa;', '&#x20e3;', '&#x231a;', '&#x231b;', '&#x2328;', '&#x23cf;', '&#x23e9;', '&#x23ea;', '&#x23eb;', '&#x23ec;', '&#x23ed;', '&#x23ee;', '&#x23ef;', '&#x23f0;', '&#x23f1;', '&#x23f2;', '&#x23f3;', '&#x23f8;', '&#x23f9;', '&#x23fa;', '&#x24c2;', '&#x25aa;', '&#x25ab;', '&#x25b6;', '&#x25c0;', '&#x25fb;', '&#x25fc;', '&#x25fd;', '&#x25fe;', '&#x2600;', '&#x2601;', '&#x2602;', '&#x2603;', '&#x2604;', '&#x260e;', '&#x2611;', '&#x2614;', '&#x2615;', '&#x2618;', '&#x261d;', '&#x2622;', '&#x2623;', '&#x2626;', '&#x262a;', '&#x262e;', '&#x262f;', '&#x2638;', '&#x2639;', '&#x263a;', '&#x2648;', '&#x2649;', '&#x264a;', '&#x264b;', '&#x264c;', '&#x264d;', '&#x264e;', '&#x264f;', '&#x2650;', '&#x2651;', '&#x2652;', '&#x2653;', '&#x265f;', '&#x2660;', '&#x2663;', '&#x2665;', '&#x2666;', '&#x2668;', '&#x267b;', '&#x267e;', '&#x267f;', '&#x2692;', '&#x2693;', '&#x2694;', '&#x2697;', '&#x2699;', '&#x269b;', '&#x269c;', '&#x26a0;', '&#x26a1;', '&#x26aa;', '&#x26ab;', '&#x26b0;', '&#x26b1;', '&#x26bd;', '&#x26be;', '&#x26c4;', '&#x26c5;', '&#x26c8;', '&#x26ce;', '&#x26cf;', '&#x26d1;', '&#x26d3;', '&#x26d4;', '&#x26e9;', '&#x26ea;', '&#x26f0;', '&#x26f1;', '&#x26f2;', '&#x26f3;', '&#x26f4;', '&#x26f5;', '&#x26f7;', '&#x26f8;', '&#x26f9;', '&#x26fa;', '&#x26fd;', '&#x2702;', '&#x2705;', '&#x2709;', '&#x270a;', '&#x270b;', '&#x270c;', '&#x270d;', '&#x270f;', '&#x2712;', '&#x2714;', '&#x2716;', '&#x271d;', '&#x2721;', '&#x2728;', '&#x2733;', '&#x2734;', '&#x2747;', '&#x274c;', '&#x274e;', '&#x2753;', '&#x2754;', '&#x2755;', '&#x2757;', '&#x2763;', '&#x2795;', '&#x2796;', '&#x2797;', '&#x27a1;', '&#x27b0;', '&#x27bf;', '&#x2934;', '&#x2935;', '&#x2b05;', '&#x2b06;', '&#x2b07;', '&#x2b1c;', '&#x2b50;', '&#x2b55;', '&#x3030;', '&#x303d;', '&#x3297;', '&#x3299;', '&#xe50a;' ); // END: emoji arrays if ( 'entities' === $type ) { return $entities; } return $partials; } ``` | Used By | Description | | --- | --- | | [wp\_encode\_emoji()](wp_encode_emoji) wp-includes/formatting.php | Converts emoji characters to their equivalent HTML entity. | | [wp\_staticize\_emoji()](wp_staticize_emoji) wp-includes/formatting.php | Converts emoji to a static img element. | | Version | Description | | --- | --- | | [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
programming_docs
wordpress rest_application_password_check_errors( WP_Error|null|true $result ): WP_Error|null|true rest\_application\_password\_check\_errors( WP\_Error|null|true $result ): WP\_Error|null|true ============================================================================================== Checks for errors when using application password-based authentication. `$result` [WP\_Error](../classes/wp_error)|null|true Required Error from another authentication handler, null if we should handle it, or another value if not. [WP\_Error](../classes/wp_error)|null|true [WP\_Error](../classes/wp_error) if the application password is invalid, the $result, otherwise true. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_application_password_check_errors( $result ) { global $wp_rest_application_password_status; if ( ! empty( $result ) ) { return $result; } if ( is_wp_error( $wp_rest_application_password_status ) ) { $data = $wp_rest_application_password_status->get_error_data(); if ( ! isset( $data['status'] ) ) { $data['status'] = 401; } $wp_rest_application_password_status->add_data( $data ); return $wp_rest_application_password_status; } if ( $wp_rest_application_password_status instanceof WP_User ) { return true; } return $result; } ``` | Uses | Description | | --- | --- | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Version | Description | | --- | --- | | [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. | wordpress tinymce_include() tinymce\_include() ================== This function has been deprecated. Use [wp\_editor()](wp_editor) instead. * [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 tinymce_include() { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_editor()' ); wp_tiny_mce(); } ``` | Uses | Description | | --- | --- | | [wp\_tiny\_mce()](wp_tiny_mce) wp-admin/includes/deprecated.php | Outputs the TinyMCE editor. | | [\_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/) | Introduced. | wordpress add_option( string $option, mixed $value = '', string $deprecated = '', string|bool $autoload = 'yes' ): bool add\_option( string $option, mixed $value = '', string $deprecated = '', string|bool $autoload = 'yes' ): bool ============================================================================================================== Adds a new option. You do not need to serialize values. If the value needs to be serialized, then it will be serialized before it is inserted into the database. Remember, resources cannot be serialized or added as an option. You can create options without values and then update the values later. Existing options will not be updated and checks are performed to ensure that you aren’t adding a protected WordPress option. Care should be taken to not name options the same as the ones which are protected. `$option` string Required Name of the option to add. Expected to not be SQL-escaped. `$value` mixed Optional Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped. Default: `''` `$deprecated` string Optional Description. Not used anymore. Default: `''` `$autoload` string|bool Optional Whether to load the option when WordPress starts up. Default is enabled. Accepts `'no'` to disable for legacy reasons. Default: `'yes'` bool True if the option was added, false otherwise. File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/) ``` function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) { global $wpdb; if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.3.0' ); } if ( is_scalar( $option ) ) { $option = trim( $option ); } if ( empty( $option ) ) { return false; } /* * Until a proper _deprecated_option() function can be introduced, * redirect requests to deprecated keys to the new, correct ones. */ $deprecated_keys = array( 'blacklist_keys' => 'disallowed_keys', 'comment_whitelist' => 'comment_previously_approved', ); if ( isset( $deprecated_keys[ $option ] ) && ! wp_installing() ) { _deprecated_argument( __FUNCTION__, '5.5.0', sprintf( /* translators: 1: Deprecated option key, 2: New option key. */ __( 'The "%1$s" option key has been renamed to "%2$s".' ), $option, $deprecated_keys[ $option ] ) ); return add_option( $deprecated_keys[ $option ], $value, $deprecated, $autoload ); } wp_protect_special_option( $option ); if ( is_object( $value ) ) { $value = clone $value; } $value = sanitize_option( $option, $value ); // Make sure the option doesn't already exist. // We can check the 'notoptions' cache before we ask for a DB query. $notoptions = wp_cache_get( 'notoptions', 'options' ); if ( ! is_array( $notoptions ) || ! isset( $notoptions[ $option ] ) ) { /** This filter is documented in wp-includes/option.php */ if ( apply_filters( "default_option_{$option}", false, $option, false ) !== get_option( $option ) ) { return false; } } $serialized_value = maybe_serialize( $value ); $autoload = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes'; /** * Fires before an option is added. * * @since 2.9.0 * * @param string $option Name of the option to add. * @param mixed $value Value of the option. */ do_action( 'add_option', $option, $value ); $result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $serialized_value, $autoload ) ); if ( ! $result ) { return false; } if ( ! wp_installing() ) { if ( 'yes' === $autoload ) { $alloptions = wp_load_alloptions( true ); $alloptions[ $option ] = $serialized_value; wp_cache_set( 'alloptions', $alloptions, 'options' ); } else { wp_cache_set( $option, $serialized_value, 'options' ); } } // This option exists now. $notoptions = wp_cache_get( 'notoptions', 'options' ); // Yes, again... we need it to be fresh. if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { unset( $notoptions[ $option ] ); wp_cache_set( 'notoptions', $notoptions, 'options' ); } /** * Fires after a specific option has been added. * * The dynamic portion of the hook name, `$option`, refers to the option name. * * @since 2.5.0 As "add_option_{$name}" * @since 3.0.0 * * @param string $option Name of the option to add. * @param mixed $value Value of the option. */ do_action( "add_option_{$option}", $option, $value ); /** * Fires after an option has been added. * * @since 2.9.0 * * @param string $option Name of the added option. * @param mixed $value Value of the option. */ do_action( 'added_option', $option, $value ); return true; } ``` [do\_action( 'added\_option', string $option, mixed $value )](../hooks/added_option) Fires after an option has been added. [do\_action( 'add\_option', string $option, mixed $value )](../hooks/add_option) Fires before an option is added. [do\_action( "add\_option\_{$option}", string $option, mixed $value )](../hooks/add_option_option) Fires after a specific option has been added. [apply\_filters( "default\_option\_{$option}", mixed $default, string $option, bool $passed\_default )](../hooks/default_option_option) Filters the default value for an option. | 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. | | [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. | | [maybe\_serialize()](maybe_serialize) wp-includes/functions.php | Serializes data, if needed. | | [add\_option()](add_option) wp-includes/option.php | Adds a new option. | | [wp\_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::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. | | [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [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. | | [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. | | Used By | Description | | --- | --- | | [add\_network\_option()](add_network_option) wp-includes/option.php | Adds a new network option. | | [switch\_theme()](switch_theme) wp-includes/theme.php | Switches the theme. | | [set\_transient()](set_transient) wp-includes/option.php | Sets/updates the value of a transient. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [add\_option()](add_option) wp-includes/option.php | Adds a new option. | | [add\_blog\_option()](add_blog_option) wp-includes/ms-blogs.php | Add a new option for a given blog ID. | | Version | Description | | --- | --- | | [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. | wordpress do_settings_fields( string $page, string $section ) do\_settings\_fields( string $page, string $section ) ===================================================== Prints out the settings fields for a particular settings section. Part of the Settings API. Use this in a settings page to output a specific section. Should normally be called by [do\_settings\_sections()](do_settings_sections) rather than directly. `$page` string Required Slug title of the admin page whose settings fields you want to show. `$section` string Required Slug title of the settings section whose fields you want to show. File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/) ``` function do_settings_fields( $page, $section ) { global $wp_settings_fields; if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) { return; } foreach ( (array) $wp_settings_fields[ $page ][ $section ] as $field ) { $class = ''; if ( ! empty( $field['args']['class'] ) ) { $class = ' class="' . esc_attr( $field['args']['class'] ) . '"'; } echo "<tr{$class}>"; if ( ! empty( $field['args']['label_for'] ) ) { echo '<th scope="row"><label for="' . esc_attr( $field['args']['label_for'] ) . '">' . $field['title'] . '</label></th>'; } else { echo '<th scope="row">' . $field['title'] . '</th>'; } echo '<td>'; call_user_func( $field['callback'], $field['args'] ); echo '</td>'; echo '</tr>'; } } ``` | Uses | Description | | --- | --- | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | Used By | Description | | --- | --- | | [do\_settings\_sections()](do_settings_sections) wp-admin/includes/template.php | Prints out all settings sections added to a particular settings page. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress wp_version_check( array $extra_stats = array(), bool $force_check = false ) wp\_version\_check( array $extra\_stats = array(), bool $force\_check = false ) =============================================================================== Checks WordPress version against the newest version. The WordPress version, PHP version, and locale is sent. 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()` `$force_check` bool Optional Whether to bypass the transient cache and force a fresh update check. Defaults to false, true if $extra\_stats is set. Default: `false` File: `wp-includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/update.php/) ``` function wp_version_check( $extra_stats = array(), $force_check = false ) { global $wpdb, $wp_local_package; if ( wp_installing() ) { return; } // Include an unmodified $wp_version. require ABSPATH . WPINC . '/version.php'; $php_version = PHP_VERSION; $current = get_site_transient( 'update_core' ); $translations = wp_get_installed_translations( 'core' ); // Invalidate the transient when $wp_version changes. if ( is_object( $current ) && $wp_version !== $current->version_checked ) { $current = false; } if ( ! is_object( $current ) ) { $current = new stdClass; $current->updates = array(); $current->version_checked = $wp_version; } if ( ! empty( $extra_stats ) ) { $force_check = true; } // Wait 1 minute between multiple version check requests. $timeout = MINUTE_IN_SECONDS; $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked ); if ( ! $force_check && $time_not_changed ) { return; } /** * Filters the locale requested for WordPress core translations. * * @since 2.8.0 * * @param string $locale Current locale. */ $locale = apply_filters( 'core_version_check_locale', get_locale() ); // Update last_checked for current to prevent multiple blocking requests if request hangs. $current->last_checked = time(); set_site_transient( 'update_core', $current ); if ( method_exists( $wpdb, 'db_version' ) ) { $mysql_version = preg_replace( '/[^0-9.].*/', '', $wpdb->db_version() ); } else { $mysql_version = 'N/A'; } if ( is_multisite() ) { $num_blogs = get_blog_count(); $wp_install = network_site_url(); $multisite_enabled = 1; } else { $multisite_enabled = 0; $num_blogs = 1; $wp_install = home_url( '/' ); } $extensions = get_loaded_extensions(); sort( $extensions, SORT_STRING | SORT_FLAG_CASE ); $query = array( 'version' => $wp_version, 'php' => $php_version, 'locale' => $locale, 'mysql' => $mysql_version, 'local_package' => isset( $wp_local_package ) ? $wp_local_package : '', 'blogs' => $num_blogs, 'users' => get_user_count(), 'multisite_enabled' => $multisite_enabled, 'initial_db_version' => get_site_option( 'initial_db_version' ), 'extensions' => array_combine( $extensions, array_map( 'phpversion', $extensions ) ), 'platform_flags' => array( 'os' => PHP_OS, 'bits' => PHP_INT_SIZE === 4 ? 32 : 64, ), 'image_support' => array(), ); if ( function_exists( 'gd_info' ) ) { $gd_info = gd_info(); // Filter to supported values. $gd_info = array_filter( $gd_info ); // Add data for GD WebP and AVIF support. $query['image_support']['gd'] = array_keys( array_filter( array( 'webp' => isset( $gd_info['WebP Support'] ), 'avif' => isset( $gd_info['AVIF Support'] ), ) ) ); } if ( class_exists( 'Imagick' ) ) { // Add data for Imagick WebP and AVIF support. $query['image_support']['imagick'] = array_keys( array_filter( array( 'webp' => ! empty( Imagick::queryFormats( 'WEBP' ) ), 'avif' => ! empty( Imagick::queryFormats( 'AVIF' ) ), ) ) ); } /** * Filters the query arguments sent as part of the core version check. * * WARNING: Changing this data may result in your site not receiving security updates. * Please exercise extreme caution. * * @since 4.9.0 * * @param array $query { * Version check query arguments. * * @type string $version WordPress version number. * @type string $php PHP version number. * @type string $locale The locale to retrieve updates for. * @type string $mysql MySQL version number. * @type string $local_package The value of the $wp_local_package global, when set. * @type int $blogs Number of sites on this WordPress installation. * @type int $users Number of users on this WordPress installation. * @type int $multisite_enabled Whether this WordPress installation uses Multisite. * @type int $initial_db_version Database version of WordPress at time of installation. * } */ $query = apply_filters( 'core_version_check_query_args', $query ); $post_body = array( 'translations' => wp_json_encode( $translations ), ); if ( is_array( $extra_stats ) ) { $post_body = array_merge( $post_body, $extra_stats ); } // Allow for WP_AUTO_UPDATE_CORE to specify beta/RC/development releases. if ( defined( 'WP_AUTO_UPDATE_CORE' ) && in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true ) ) { $query['channel'] = WP_AUTO_UPDATE_CORE; } $url = 'http://api.wordpress.org/core/version-check/1.7/?' . http_build_query( $query, '', '&' ); $http_url = $url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $doing_cron = wp_doing_cron(); $options = array( 'timeout' => $doing_cron ? 30 : 3, 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), 'headers' => array( 'wp_install' => $wp_install, 'wp_blog' => home_url( '/' ), ), 'body' => $post_body, ); $response = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $response ) ) { trigger_error( sprintf( /* translators: %s: Support forums URL. */ __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;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 ); $response = wp_remote_post( $http_url, $options ); } if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { return; } $body = trim( wp_remote_retrieve_body( $response ) ); $body = json_decode( $body, true ); if ( ! is_array( $body ) || ! isset( $body['offers'] ) ) { return; } $offers = $body['offers']; foreach ( $offers as &$offer ) { foreach ( $offer as $offer_key => $value ) { if ( 'packages' === $offer_key ) { $offer['packages'] = (object) array_intersect_key( array_map( 'esc_url', $offer['packages'] ), array_fill_keys( array( 'full', 'no_content', 'new_bundled', 'partial', 'rollback' ), '' ) ); } elseif ( 'download' === $offer_key ) { $offer['download'] = esc_url( $value ); } else { $offer[ $offer_key ] = esc_html( $value ); } } $offer = (object) array_intersect_key( $offer, array_fill_keys( array( 'response', 'download', 'locale', 'packages', 'current', 'version', 'php_version', 'mysql_version', 'new_bundled', 'partial_version', 'notify_email', 'support_email', 'new_files', ), '' ) ); } $updates = new stdClass(); $updates->updates = $offers; $updates->last_checked = time(); $updates->version_checked = $wp_version; if ( isset( $body['translations'] ) ) { $updates->translations = $body['translations']; } set_site_transient( 'update_core', $updates ); if ( ! empty( $body['ttl'] ) ) { $ttl = (int) $body['ttl']; if ( $ttl && ( time() + $ttl < wp_next_scheduled( 'wp_version_check' ) ) ) { // Queue an event to re-run the update check in $ttl seconds. wp_schedule_single_event( time() + $ttl, 'wp_version_check' ); } } // Trigger background updates if running non-interactively, and we weren't called from the update handler. if ( $doing_cron && ! doing_action( 'wp_maybe_auto_update' ) ) { /** * Fires during wp_cron, starting the auto-update process. * * @since 3.9.0 */ do_action( 'wp_maybe_auto_update' ); } } ``` [apply\_filters( 'core\_version\_check\_locale', string $locale )](../hooks/core_version_check_locale) Filters the locale requested for WordPress core translations. [apply\_filters( 'core\_version\_check\_query\_args', array $query )](../hooks/core_version_check_query_args) Filters the query arguments sent as part of the core version check. [do\_action( 'wp\_maybe\_auto\_update' )](../hooks/wp_maybe_auto_update) Fires during wp\_cron, starting the auto-update process. | Uses | Description | | --- | --- | | [wp\_doing\_cron()](wp_doing_cron) wp-includes/load.php | Determines whether the current request is a WordPress cron request. | | [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. | | [wpdb::db\_version()](../classes/wpdb/db_version) wp-includes/class-wpdb.php | Retrieves the database server version. | | [get\_user\_count()](get_user_count) wp-includes/user.php | Returns the number of active users in your installation. | | [get\_blog\_count()](get_blog_count) wp-includes/ms-functions.php | Gets the number of active sites on the installation. | | [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. | | [doing\_action()](doing_action) wp-includes/plugin.php | Returns whether or not an action hook is currently being processed. | | [wp\_remote\_retrieve\_body()](wp_remote_retrieve_body) wp-includes/http.php | Retrieve only the body from the raw response. | | [wp\_remote\_retrieve\_response\_code()](wp_remote_retrieve_response_code) wp-includes/http.php | Retrieve only the response code from the raw response. | | [wp\_remote\_post()](wp_remote_post) wp-includes/http.php | Performs an HTTP request using the POST method and returns its response. | | [wp\_http\_supports()](wp_http_supports) wp-includes/http.php | Determines if there is an HTTP Transport that can process this request. | | [network\_site\_url()](network_site_url) wp-includes/link-template.php | Retrieves the site URL for the current network. | | [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. | | [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. | | [wp\_get\_installed\_translations()](wp_get_installed_translations) wp-includes/l10n.php | Gets installed translations. | | [wp\_schedule\_single\_event()](wp_schedule_single_event) wp-includes/cron.php | Schedules an event to run only once. | | [wp\_next\_scheduled()](wp_next_scheduled) wp-includes/cron.php | Retrieve the next timestamp for an event. | | [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | [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. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. | | [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\_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. | | [Core\_Upgrader::upgrade()](../classes/core_upgrader/upgrade) wp-admin/includes/class-core-upgrader.php | Upgrade WordPress core. | | [WP\_Upgrader::run()](../classes/wp_upgrader/run) wp-admin/includes/class-wp-upgrader.php | Run an upgrade/installation. | | [\_maybe\_update\_core()](_maybe_update_core) wp-includes/update.php | Determines whether core should be updated. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
programming_docs
wordpress wp_load_image( string $file ): resource|GdImage|string wp\_load\_image( string $file ): resource|GdImage|string ======================================================== This function has been deprecated. Use [wp\_get\_image\_editor()](wp_get_image_editor) instead. Load an image from a string, if PHP supports it. * [wp\_get\_image\_editor()](wp_get_image_editor) `$file` string Required Filename of the image to load. resource|GdImage|string The resulting image resource or GdImage instance on success, error string on failure. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function wp_load_image( $file ) { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); if ( is_numeric( $file ) ) $file = get_attached_file( $file ); if ( ! is_file( $file ) ) { /* translators: %s: File name. */ return sprintf( __( 'File &#8220;%s&#8221; does not exist?' ), $file ); } if ( ! function_exists('imagecreatefromstring') ) return __('The GD image library is not installed.'); // Set artificially high because GD uses uncompressed images in memory. wp_raise_memory_limit( 'image' ); $image = imagecreatefromstring( file_get_contents( $file ) ); if ( ! is_gd_image( $image ) ) { /* translators: %s: File name. */ return sprintf( __( 'File &#8220;%s&#8221; is not an image.' ), $file ); } return $image; } ``` | Uses | Description | | --- | --- | | [is\_gd\_image()](is_gd_image) wp-includes/media.php | Determines whether the value is an acceptable type for GD image functions. | | [wp\_raise\_memory\_limit()](wp_raise_memory_limit) wp-includes/functions.php | Attempts to raise the PHP memory limit for memory intensive processes. | | [get\_attached\_file()](get_attached_file) wp-includes/post.php | Retrieves attached file path based on attachment ID. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Use [wp\_get\_image\_editor()](wp_get_image_editor) | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress get_the_category( int $post_id = false ): WP_Term[] get\_the\_category( int $post\_id = false ): WP\_Term[] ======================================================= Retrieves post categories. This tag may be used outside The Loop by passing a post ID as the parameter. Note: This function only returns results from the default "category" taxonomy. For custom taxonomies use [get\_the\_terms()](get_the_terms) . `$post_id` int Optional The post ID. Defaults to current post ID. Default: `false` [WP\_Term](../classes/wp_term)[] Array of [WP\_Term](../classes/wp_term) objects, one for each category assigned to the post. File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/) ``` function get_the_category( $post_id = false ) { $categories = get_the_terms( $post_id, 'category' ); if ( ! $categories || is_wp_error( $categories ) ) { $categories = array(); } $categories = array_values( $categories ); foreach ( array_keys( $categories ) as $key ) { _make_cat_compat( $categories[ $key ] ); } /** * Filters the array of categories to return for a post. * * @since 3.1.0 * @since 4.4.0 Added the `$post_id` parameter. * * @param WP_Term[] $categories An array of categories to return for the post. * @param int|false $post_id The post ID. */ return apply_filters( 'get_the_categories', $categories, $post_id ); } ``` [apply\_filters( 'get\_the\_categories', WP\_Term[] $categories, int|false $post\_id )](../hooks/get_the_categories) Filters the array of categories to return for a 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. | | [\_make\_cat\_compat()](_make_cat_compat) wp-includes/category.php | Updates category structure to old pre-2.3 from new taxonomy structure. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [get\_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. | | [the\_category\_ID()](the_category_id) wp-includes/deprecated.php | Returns or prints a category ID. | | [the\_category\_head()](the_category_head) wp-includes/deprecated.php | Prints a category with optional text before and after. | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [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 | | --- | --- | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress wp_get_nav_menu_object( int|string|WP_Term $menu ): WP_Term|false wp\_get\_nav\_menu\_object( int|string|WP\_Term $menu ): WP\_Term|false ======================================================================= Returns a navigation menu object. `$menu` int|string|[WP\_Term](../classes/wp_term) Required Menu ID, slug, name, or object. [WP\_Term](../classes/wp_term)|false Menu object on success, false if $menu param isn't supplied or term does not exist. File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/) ``` function wp_get_nav_menu_object( $menu ) { $menu_obj = false; if ( is_object( $menu ) ) { $menu_obj = $menu; } if ( $menu && ! $menu_obj ) { $menu_obj = get_term( $menu, 'nav_menu' ); if ( ! $menu_obj ) { $menu_obj = get_term_by( 'slug', $menu, 'nav_menu' ); } if ( ! $menu_obj ) { $menu_obj = get_term_by( 'name', $menu, 'nav_menu' ); } } if ( ! $menu_obj || is_wp_error( $menu_obj ) ) { $menu_obj = false; } /** * Filters the nav_menu term retrieved for wp_get_nav_menu_object(). * * @since 4.3.0 * * @param WP_Term|false $menu_obj Term from nav_menu taxonomy, or false if nothing had been found. * @param int|string|WP_Term $menu The menu ID, slug, name, or object passed to wp_get_nav_menu_object(). */ return apply_filters( 'wp_get_nav_menu_object', $menu_obj, $menu ); } ``` [apply\_filters( 'wp\_get\_nav\_menu\_object', WP\_Term|false $menu\_obj, int|string|WP\_Term $menu )](../hooks/wp_get_nav_menu_object) Filters the nav\_menu term retrieved for [wp\_get\_nav\_menu\_object()](wp_get_nav_menu_object) . | Uses | Description | | --- | --- | | [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. | | [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [WP\_REST\_Menus\_Controller::get\_term()](../classes/wp_rest_menus_controller/get_term) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Gets the term, if the ID is valid. | | [WP\_REST\_Menus\_Controller::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\_get\_nav\_menu\_name()](wp_get_nav_menu_name) wp-includes/nav-menu.php | Returns the name of a navigation menu. | | [WP\_Customize\_Nav\_Menu\_Setting::value()](../classes/wp_customize_nav_menu_setting/value) wp-includes/customize/class-wp-customize-nav-menu-setting.php | Get the instance data for a given widget setting. | | [wp\_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\_Widget::widget()](../classes/wp_nav_menu_widget/widget) wp-includes/widgets/class-wp-nav-menu-widget.php | Outputs the content for the current Navigation Menu widget instance. | | [wp\_nav\_menu()](wp_nav_menu) wp-includes/nav-menu-template.php | Displays a navigation menu. | | [wp\_delete\_nav\_menu()](wp_delete_nav_menu) wp-includes/nav-menu.php | Deletes a navigation menu. | | [wp\_update\_nav\_menu\_object()](wp_update_nav_menu_object) wp-includes/nav-menu.php | Saves the properties of a menu or create a new menu with those properties. | | [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. | | [wp\_get\_nav\_menu\_items()](wp_get_nav_menu_items) wp-includes/nav-menu.php | Retrieves all menu items of a navigation menu. | | [is\_nav\_menu()](is_nav_menu) wp-includes/nav-menu.php | Determines whether the given ID is a navigation menu. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress set_site_transient( string $transient, mixed $value, int $expiration ): bool set\_site\_transient( string $transient, mixed $value, int $expiration ): bool ============================================================================== Sets/updates the value of a site transient. You do not need to serialize values. If the value needs to be serialized, then it will be serialized before it is set. * [set\_transient()](set_transient) `$transient` string Required Transient name. Expected to not be SQL-escaped. Must be 167 characters or fewer in length. `$value` mixed Required Transient value. Expected to not be SQL-escaped. `$expiration` int Optional Time until expiration in seconds. Default 0 (no expiration). bool True if the value was set, false otherwise. File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/) ``` function set_site_transient( $transient, $value, $expiration = 0 ) { /** * Filters the value of a specific site transient before it is set. * * The dynamic portion of the hook name, `$transient`, refers to the transient name. * * @since 3.0.0 * @since 4.4.0 The `$transient` parameter was added. * * @param mixed $value New value of site transient. * @param string $transient Transient name. */ $value = apply_filters( "pre_set_site_transient_{$transient}", $value, $transient ); $expiration = (int) $expiration; /** * Filters the expiration for a site transient before its value is set. * * The dynamic portion of the hook name, `$transient`, refers to the transient name. * * @since 4.4.0 * * @param int $expiration Time until expiration in seconds. Use 0 for no expiration. * @param mixed $value New value of site transient. * @param string $transient Transient name. */ $expiration = apply_filters( "expiration_of_site_transient_{$transient}", $expiration, $value, $transient ); if ( wp_using_ext_object_cache() || wp_installing() ) { $result = wp_cache_set( $transient, $value, 'site-transient', $expiration ); } else { $transient_timeout = '_site_transient_timeout_' . $transient; $option = '_site_transient_' . $transient; if ( false === get_site_option( $option ) ) { if ( $expiration ) { add_site_option( $transient_timeout, time() + $expiration ); } $result = add_site_option( $option, $value ); } else { if ( $expiration ) { update_site_option( $transient_timeout, time() + $expiration ); } $result = update_site_option( $option, $value ); } } if ( $result ) { /** * Fires after the value for a specific site transient has been set. * * The dynamic portion of the hook name, `$transient`, refers to the transient name. * * @since 3.0.0 * @since 4.4.0 The `$transient` parameter was added * * @param mixed $value Site transient value. * @param int $expiration Time until expiration in seconds. * @param string $transient Transient name. */ do_action( "set_site_transient_{$transient}", $value, $expiration, $transient ); /** * Fires after the value for a site transient has been set. * * @since 3.0.0 * * @param string $transient The name of the site transient. * @param mixed $value Site transient value. * @param int $expiration Time until expiration in seconds. */ do_action( 'setted_site_transient', $transient, $value, $expiration ); } return $result; } ``` [apply\_filters( "expiration\_of\_site\_transient\_{$transient}", int $expiration, mixed $value, string $transient )](../hooks/expiration_of_site_transient_transient) Filters the expiration for a site transient before its value is set. [apply\_filters( "pre\_set\_site\_transient\_{$transient}", mixed $value, string $transient )](../hooks/pre_set_site_transient_transient) Filters the value of a specific site transient before it is set. [do\_action( 'setted\_site\_transient', string $transient, mixed $value, int $expiration )](../hooks/setted_site_transient) Fires after the value for a site transient has been set. [do\_action( "set\_site\_transient\_{$transient}", mixed $value, int $expiration, string $transient )](../hooks/set_site_transient_transient) Fires after the value for a specific site transient has been set. | Uses | Description | | --- | --- | | [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. | | [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. | | [wp\_using\_ext\_object\_cache()](wp_using_ext_object_cache) wp-includes/load.php | Toggle `$_wp_using_ext_object_cache` on and off without directly touching global. | | [add\_site\_option()](add_site_option) wp-includes/option.php | Adds a new option for the current network. | | [update\_site\_option()](update_site_option) wp-includes/option.php | Updates the value of an option that was already added for the current network. | | [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\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. | | Used By | Description | | --- | --- | | [WP\_REST\_URL\_Details\_Controller::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\_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\_check\_php\_version()](wp_check_php_version) wp-admin/includes/misc.php | Checks if the user needs to update PHP. | | [WP\_Community\_Events::cache\_events()](../classes/wp_community_events/cache_events) wp-admin/includes/class-wp-community-events.php | Caches an array of events data from the Events API. | | [wp\_get\_available\_translations()](wp_get_available_translations) wp-admin/includes/translation-install.php | Get available translations from the WordPress.org API. | | [get\_theme\_feature\_list()](get_theme_feature_list) wp-admin/includes/theme.php | Retrieves list of WordPress theme features (aka theme tags). | | [wp\_check\_browser\_version()](wp_check_browser_version) wp-admin/includes/dashboard.php | Checks if the user needs a browser update. | | [install\_popular\_tags()](install_popular_tags) wp-admin/includes/plugin-install.php | Retrieves popular WordPress plugin tags. | | [delete\_plugins()](delete_plugins) wp-admin/includes/plugin.php | Removes directory and files of a plugin for a list of plugins. | | [wp\_get\_popular\_importers()](wp_get_popular_importers) wp-admin/includes/import.php | Returns a list from WordPress.org of popular importer plugins. | | [wp\_credits()](wp_credits) wp-admin/includes/credits.php | Retrieve the contributor credits. | | [search\_theme\_directories()](search_theme_directories) wp-includes/theme.php | Searches all registered theme directories for complete and valid themes. | | [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 | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress wp_find_widgets_sidebar( string $widget_id ): string|null wp\_find\_widgets\_sidebar( string $widget\_id ): string|null ============================================================= Finds the sidebar that a given widget belongs to. `$widget_id` string Required The widget ID to look for. string|null The found sidebar's ID, or null if it was not found. File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/) ``` function wp_find_widgets_sidebar( $widget_id ) { foreach ( wp_get_sidebars_widgets() as $sidebar_id => $widget_ids ) { foreach ( $widget_ids as $maybe_widget_id ) { if ( $maybe_widget_id === $widget_id ) { return (string) $sidebar_id; } } } return null; } ``` | Uses | Description | | --- | --- | | [wp\_get\_sidebars\_widgets()](wp_get_sidebars_widgets) wp-includes/widgets.php | Retrieve full list of sidebars and their widget instance IDs. | | Used By | Description | | --- | --- | | [WP\_REST\_Widgets\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_widgets_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Checks if a given request has access to get a widget. | | [WP\_REST\_Widgets\_Controller::get\_item()](../classes/wp_rest_widgets_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Gets an individual widget. | | [WP\_REST\_Widgets\_Controller::update\_item()](../classes/wp_rest_widgets_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Updates an existing widget. | | [WP\_REST\_Widgets\_Controller::delete\_item()](../classes/wp_rest_widgets_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Deletes a widget. | | Version | Description | | --- | --- | | [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
programming_docs
wordpress wp_ajax_trash_post( string $action ) wp\_ajax\_trash\_post( string $action ) ======================================= Ajax handler for sending a post to the Trash. `$action` string Required Action to perform. File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/) ``` function wp_ajax_trash_post( $action ) { if ( empty( $action ) ) { $action = 'trash-post'; } $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; check_ajax_referer( "{$action}_$id" ); if ( ! current_user_can( 'delete_post', $id ) ) { wp_die( -1 ); } if ( ! get_post( $id ) ) { wp_die( 1 ); } if ( 'trash-post' === $action ) { $done = wp_trash_post( $id ); } else { $done = wp_untrash_post( $id ); } if ( $done ) { wp_die( 1 ); } wp_die( 0 ); } ``` | Uses | Description | | --- | --- | | [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. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. | | [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Used By | Description | | --- | --- | | [wp\_ajax\_untrash\_post()](wp_ajax_untrash_post) wp-admin/includes/ajax-actions.php | Ajax handler to restore a post from the Trash. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress get_next_comments_link( string $label = '', int $max_page ): string|void get\_next\_comments\_link( string $label = '', int $max\_page ): string|void ============================================================================ Retrieves the link to the next comments page. `$label` string Optional Label for link text. Default: `''` `$max_page` int Optional Max page. Default 0. string|void HTML-formatted link for the next 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_next_comments_link( $label = '', $max_page = 0 ) { global $wp_query; if ( ! is_singular() ) { return; } $page = get_query_var( 'cpage' ); if ( ! $page ) { $page = 1; } $nextpage = (int) $page + 1; if ( empty( $max_page ) ) { $max_page = $wp_query->max_num_comment_pages; } if ( empty( $max_page ) ) { $max_page = get_comment_pages_count(); } if ( $nextpage > $max_page ) { return; } if ( empty( $label ) ) { $label = __( 'Newer Comments &raquo;' ); } /** * Filters the anchor tag attributes for the next comments page link. * * @since 2.7.0 * * @param string $attributes Attributes for the anchor tag. */ return '<a href="' . esc_url( get_comments_pagenum_link( $nextpage, $max_page ) ) . '" ' . apply_filters( 'next_comments_link_attributes', '' ) . '>' . preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label ) . '</a>'; } ``` [apply\_filters( 'next\_comments\_link\_attributes', string $attributes )](../hooks/next_comments_link_attributes) Filters the anchor tag attributes for the next 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. | | [get\_comment\_pages\_count()](get_comment_pages_count) wp-includes/comment.php | Calculates the total number of comment pages. | | [\_\_()](__) 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. | | [next\_comments\_link()](next_comments_link) wp-includes/link-template.php | Displays the link to the next comments page. | | Version | Description | | --- | --- | | [2.7.1](https://developer.wordpress.org/reference/since/2.7.1/) | Introduced. | wordpress install_theme_search_form( bool $type_selector = true ) install\_theme\_search\_form( bool $type\_selector = true ) =========================================================== Displays search form for searching themes. `$type_selector` bool Optional Default: `true` 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_search_form( $type_selector = true ) { $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; if ( ! $type_selector ) { echo '<p class="install-help">' . __( 'Search for themes by keyword.' ) . '</p>'; } ?> <form id="search-themes" method="get"> <input type="hidden" name="tab" value="search" /> <?php if ( $type_selector ) : ?> <label class="screen-reader-text" for="typeselector"><?php _e( 'Type of search' ); ?></label> <select name="type" id="typeselector"> <option value="term" <?php selected( 'term', $type ); ?>><?php _e( 'Keyword' ); ?></option> <option value="author" <?php selected( 'author', $type ); ?>><?php _e( 'Author' ); ?></option> <option value="tag" <?php selected( 'tag', $type ); ?>><?php _ex( 'Tag', 'Theme Installer' ); ?></option> </select> <label class="screen-reader-text" for="s"> <?php switch ( $type ) { case 'term': _e( 'Search by keyword' ); break; case 'author': _e( 'Search by author' ); break; case 'tag': _e( 'Search by tag' ); break; } ?> </label> <?php else : ?> <label class="screen-reader-text" for="s"><?php _e( 'Search by keyword' ); ?></label> <?php endif; ?> <input type="search" name="s" id="s" size="30" value="<?php echo esc_attr( $term ); ?>" autofocus="autofocus" /> <?php submit_button( __( 'Search' ), '', 'search', false ); ?> </form> <?php } ``` | Uses | Description | | --- | --- | | [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). | | [\_ex()](_ex) wp-includes/l10n.php | Displays translated string with gettext context. | | [selected()](selected) wp-includes/general-template.php | Outputs the HTML selected attribute. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [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 | | --- | --- | | [install\_themes\_dashboard()](install_themes_dashboard) wp-admin/includes/theme-install.php | Displays tags filter for themes. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress wp_check_invalid_utf8( string $string, bool $strip = false ): string wp\_check\_invalid\_utf8( string $string, bool $strip = false ): string ======================================================================= Checks for invalid UTF8 in a string. `$string` string Required The text which is to be checked. `$strip` bool Optional Whether to attempt to strip out invalid UTF8. Default: `false` string The checked text. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function wp_check_invalid_utf8( $string, $strip = false ) { $string = (string) $string; if ( 0 === strlen( $string ) ) { return ''; } // Store the site charset as a static to avoid multiple calls to get_option(). static $is_utf8 = null; if ( ! isset( $is_utf8 ) ) { $is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true ); } if ( ! $is_utf8 ) { return $string; } // Check for support for utf8 in the installed PCRE library once and store the result in a static. static $utf8_pcre = null; if ( ! isset( $utf8_pcre ) ) { // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged $utf8_pcre = @preg_match( '/^./u', 'a' ); } // We can't demand utf8 in the PCRE installation, so just return the string in those cases. if ( ! $utf8_pcre ) { return $string; } // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- preg_match fails when it encounters invalid UTF8 in $string. if ( 1 === @preg_match( '/^./us', $string ) ) { return $string; } // Attempt to strip the bad chars if requested (not recommended). if ( $strip && function_exists( 'iconv' ) ) { return iconv( 'utf-8', 'utf-8', $string ); } return ''; } ``` | Uses | Description | | --- | --- | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [esc\_xml()](esc_xml) wp-includes/formatting.php | Escaping for XML blocks. | | [\_sanitize\_text\_fields()](_sanitize_text_fields) wp-includes/formatting.php | Internal helper function to sanitize a string from user input or from the database. | | [esc\_js()](esc_js) wp-includes/formatting.php | Escapes single quotes, `"`, , `&amp;`, 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. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress type_url_form_file(): string type\_url\_form\_file(): 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 a generic 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_file() { _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('file')" ); return wp_media_insert_url_form( 'file' ); } ``` | 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 wp_nav_menu_item_taxonomy_meta_box( string $data_object, array $box ) wp\_nav\_menu\_item\_taxonomy\_meta\_box( string $data\_object, array $box ) ============================================================================ Displays a meta box for a taxonomy menu item. `$data_object` string Required Not used. `$box` array Required Taxonomy menu item meta box arguments. * `id`stringMeta box `'id'` attribute. * `title`stringMeta box title. * `callback`callableMeta box display callback. * `args`objectExtra meta box arguments (the taxonomy object for this meta box). File: `wp-admin/includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/nav-menu.php/) ``` function wp_nav_menu_item_taxonomy_meta_box( $data_object, $box ) { global $nav_menu_selected_id; $taxonomy_name = $box['args']->name; $taxonomy = get_taxonomy( $taxonomy_name ); $tab_name = $taxonomy_name . '-tab'; // Paginate browsing for large numbers of objects. $per_page = 50; $pagenum = isset( $_REQUEST[ $tab_name ] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0; $args = array( 'taxonomy' => $taxonomy_name, 'child_of' => 0, 'exclude' => '', 'hide_empty' => false, 'hierarchical' => 1, 'include' => '', 'number' => $per_page, 'offset' => $offset, 'order' => 'ASC', 'orderby' => 'name', 'pad_counts' => false, ); $terms = get_terms( $args ); if ( ! $terms || is_wp_error( $terms ) ) { echo '<p>' . __( 'No items.' ) . '</p>'; return; } $num_pages = ceil( wp_count_terms( array_merge( $args, array( 'number' => '', 'offset' => '', ) ) ) / $per_page ); $page_links = paginate_links( array( 'base' => add_query_arg( array( $tab_name => 'all', 'paged' => '%#%', 'item-type' => 'taxonomy', 'item-object' => $taxonomy_name, ) ), 'format' => '', 'prev_text' => '<span aria-label="' . esc_attr__( 'Previous page' ) . '">' . __( '&laquo;' ) . '</span>', 'next_text' => '<span aria-label="' . esc_attr__( 'Next page' ) . '">' . __( '&raquo;' ) . '</span>', 'before_page_number' => '<span class="screen-reader-text">' . __( 'Page' ) . '</span> ', 'total' => $num_pages, 'current' => $pagenum, ) ); $db_fields = false; if ( is_taxonomy_hierarchical( $taxonomy_name ) ) { $db_fields = array( 'parent' => 'parent', 'id' => 'term_id', ); } $walker = new Walker_Nav_Menu_Checklist( $db_fields ); $current_tab = 'most-used'; if ( isset( $_REQUEST[ $tab_name ] ) && in_array( $_REQUEST[ $tab_name ], array( 'all', 'most-used', 'search' ), true ) ) { $current_tab = $_REQUEST[ $tab_name ]; } if ( ! empty( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ) ) { $current_tab = 'search'; } $removed_args = array( 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ); $most_used_url = ''; $view_all_url = ''; $search_url = ''; if ( $nav_menu_selected_id ) { $most_used_url = esc_url( add_query_arg( $tab_name, 'most-used', remove_query_arg( $removed_args ) ) ); $view_all_url = esc_url( add_query_arg( $tab_name, 'all', remove_query_arg( $removed_args ) ) ); $search_url = esc_url( add_query_arg( $tab_name, 'search', remove_query_arg( $removed_args ) ) ); } ?> <div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv"> <ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs"> <li <?php echo ( 'most-used' === $current_tab ? ' class="tabs"' : '' ); ?>> <a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-pop" href="<?php echo $most_used_url; ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop"> <?php echo esc_html( $taxonomy->labels->most_used ); ?> </a> </li> <li <?php echo ( 'all' === $current_tab ? ' class="tabs"' : '' ); ?>> <a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-all" href="<?php echo $view_all_url; ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all"> <?php _e( 'View All' ); ?> </a> </li> <li <?php echo ( 'search' === $current_tab ? ' class="tabs"' : '' ); ?>> <a class="nav-tab-link" data-type="tabs-panel-search-taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>" href="<?php echo $search_url; ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>"> <?php _e( 'Search' ); ?> </a> </li> </ul><!-- .taxonomy-tabs --> <div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php echo ( 'most-used' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $taxonomy->labels->most_used; ?>" tabindex="0"> <ul id="<?php echo $taxonomy_name; ?>checklist-pop" class="categorychecklist form-no-clear" > <?php $popular_terms = get_terms( array( 'taxonomy' => $taxonomy_name, 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false, ) ); $args['walker'] = $walker; echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $popular_terms ), 0, (object) $args ); ?> </ul> </div><!-- /.tabs-panel --> <div id="tabs-panel-<?php echo $taxonomy_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php echo ( 'all' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $taxonomy->labels->all_items; ?>" tabindex="0"> <?php if ( ! empty( $page_links ) ) : ?> <div class="add-menu-item-pagelinks"> <?php echo $page_links; ?> </div> <?php endif; ?> <ul id="<?php echo $taxonomy_name; ?>checklist" data-wp-lists="list:<?php echo $taxonomy_name; ?>" class="categorychecklist form-no-clear"> <?php $args['walker'] = $walker; echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $terms ), 0, (object) $args ); ?> </ul> <?php if ( ! empty( $page_links ) ) : ?> <div class="add-menu-item-pagelinks"> <?php echo $page_links; ?> </div> <?php endif; ?> </div><!-- /.tabs-panel --> <div class="tabs-panel <?php echo ( 'search' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>" role="region" aria-label="<?php echo $taxonomy->labels->search_items; ?>" tabindex="0"> <?php if ( isset( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ) ) { $searched = esc_attr( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ); $search_results = get_terms( array( 'taxonomy' => $taxonomy_name, 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false, ) ); } else { $searched = ''; $search_results = array(); } ?> <p class="quick-search-wrap"> <label for="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" class="screen-reader-text"><?php _e( 'Search' ); ?></label> <input type="search" class="quick-search" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" id="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" /> <span class="spinner"></span> <?php submit_button( __( 'Search' ), 'small quick-search-submit hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?> </p> <ul id="<?php echo $taxonomy_name; ?>-search-checklist" data-wp-lists="list:<?php echo $taxonomy_name; ?>" class="categorychecklist form-no-clear"> <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?> <?php $args['walker'] = $walker; echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $search_results ), 0, (object) $args ); ?> <?php elseif ( is_wp_error( $search_results ) ) : ?> <li><?php echo $search_results->get_error_message(); ?></li> <?php elseif ( ! empty( $searched ) ) : ?> <li><?php _e( 'No results found.' ); ?></li> <?php endif; ?> </ul> </div><!-- /.tabs-panel --> <p class="button-controls wp-clearfix" data-items-type="taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>"> <span class="list-controls hide-if-no-js"> <input type="checkbox"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> id="<?php echo esc_attr( $tab_name ); ?>" class="select-all" /> <label for="<?php echo esc_attr( $tab_name ); ?>"><?php _e( 'Select All' ); ?></label> </span> <span class="add-to-menu"> <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu' ); ?>" name="add-taxonomy-menu-item" id="<?php echo esc_attr( 'submit-taxonomy-' . $taxonomy_name ); ?>" /> <span class="spinner"></span> </span> </p> </div><!-- /.taxonomydiv --> <?php } ``` | Uses | Description | | --- | --- | | [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). | | [Walker\_Nav\_Menu\_Checklist::\_\_construct()](../classes/walker_nav_menu_checklist/__construct) wp-admin/includes/class-walker-nav-menu-checklist.php | | | [walk\_nav\_menu\_tree()](walk_nav_menu_tree) wp-includes/nav-menu-template.php | Retrieves the HTML list content for nav menu items. | | [is\_taxonomy\_hierarchical()](is_taxonomy_hierarchical) wp-includes/taxonomy.php | Determines whether the taxonomy object is hierarchical. | | [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. | | [wp\_count\_terms()](wp_count_terms) wp-includes/taxonomy.php | Counts how many terms are in taxonomy. | | [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. | | [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. | | [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. | | [esc\_attr\_\_()](esc_attr__) wp-includes/l10n.php | Retrieves the translation of $text and escapes it for safe use in an attribute. | | [wp\_nav\_menu\_disabled\_check()](wp_nav_menu_disabled_check) wp-admin/includes/nav-menu.php | Check whether to disable the Menu Locations meta box submit button and inputs. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. | | [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
programming_docs
wordpress register_block_pattern_category( string $category_name, array $category_properties ): bool register\_block\_pattern\_category( string $category\_name, array $category\_properties ): bool =============================================================================================== Registers a new pattern category. `$category_name` string Required Pattern category name including namespace. `$category_properties` array Required List of properties for the block pattern. See [WP\_Block\_Pattern\_Categories\_Registry::register()](../classes/wp_block_pattern_categories_registry/register) for accepted arguments. More Arguments from WP\_Block\_Pattern\_Categories\_Registry::register( ... $category\_properties ) List of properties for the block pattern category. * `label`stringRequired. A human-readable label for the pattern category. bool True if the pattern category was registered with success and false otherwise. File: `wp-includes/class-wp-block-pattern-categories-registry.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-block-pattern-categories-registry.php/) ``` function register_block_pattern_category( $category_name, $category_properties ) { return WP_Block_Pattern_Categories_Registry::get_instance()->register( $category_name, $category_properties ); } ``` | Uses | Description | | --- | --- | | [WP\_Block\_Pattern\_Categories\_Registry::get\_instance()](../classes/wp_block_pattern_categories_registry/get_instance) wp-includes/class-wp-block-pattern-categories-registry.php | Utility method to retrieve the main instance of the class. | | Used By | Description | | --- | --- | | [\_register\_core\_block\_patterns\_and\_categories()](_register_core_block_patterns_and_categories) wp-includes/block-patterns.php | Registers the core block patterns and categories. | | Version | Description | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. | wordpress sanitize_text_field( string $str ): string sanitize\_text\_field( string $str ): string ============================================ Sanitizes a string from user input or from the database. * Checks for invalid UTF-8, * Converts single `<` characters to entities * Strips all tags * Removes line breaks, tabs, and extra whitespace * Strips octets * [sanitize\_textarea\_field()](sanitize_textarea_field) * [wp\_check\_invalid\_utf8()](wp_check_invalid_utf8) * [wp\_strip\_all\_tags()](wp_strip_all_tags) `$str` string Required String to sanitize. string Sanitized string. **Basic Usage** ``` <?php sanitize_text_field( $str ) ?> ``` File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function sanitize_text_field( $str ) { $filtered = _sanitize_text_fields( $str, false ); /** * Filters a sanitized text field string. * * @since 2.9.0 * * @param string $filtered The sanitized string. * @param string $str The string prior to being sanitized. */ return apply_filters( 'sanitize_text_field', $filtered, $str ); } ``` [apply\_filters( 'sanitize\_text\_field', string $filtered, string $str )](../hooks/sanitize_text_field) Filters a sanitized text field string. | Uses | Description | | --- | --- | | [\_sanitize\_text\_fields()](_sanitize_text_fields) wp-includes/formatting.php | Internal helper function to sanitize a string from user input or from the database. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [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\_Site\_Health\_Controller::get\_directory\_sizes()](../classes/wp_rest_site_health_controller/get_directory_sizes) wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php | Gets the current directory sizes for this install. | | [WP\_Application\_Passwords::create\_new\_application\_password()](../classes/wp_application_passwords/create_new_application_password) wp-includes/class-wp-application-passwords.php | Creates a new application password. | | [WP\_Application\_Passwords::update\_application\_password()](../classes/wp_application_passwords/update_application_password) wp-includes/class-wp-application-passwords.php | Updates an application password. | | [WP\_REST\_Plugins\_Controller::sanitize\_plugin\_param()](../classes/wp_rest_plugins_controller/sanitize_plugin_param) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Sanitizes the “plugin” parameter to be a proper plugin file with “.php” appended. | | [WP\_Sitemaps::render\_sitemaps()](../classes/wp_sitemaps/render_sitemaps) wp-includes/sitemaps/class-wp-sitemaps.php | Renders sitemap templates based on rewrite rules. | | [wp\_ajax\_toggle\_auto\_updates()](wp_ajax_toggle_auto_updates) wp-admin/includes/ajax-actions.php | Ajax handler to enable or disable plugin and theme auto-updates. | | [WP\_Debug\_Data::debug\_data()](../classes/wp_debug_data/debug_data) wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. | | [wp\_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. | | [determine\_locale()](determine_locale) wp-includes/l10n.php | Determines the current locale desired for the request. | | [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\_Privacy\_Requests\_Table::prepare\_items()](../classes/wp_privacy_requests_table/prepare_items) wp-admin/includes/class-wp-privacy-requests-table.php | Prepare items to output. | | [\_wp\_personal\_data\_handle\_actions()](_wp_personal_data_handle_actions) wp-admin/includes/privacy-tools.php | Handle list table actions. | | [WP\_Customize\_Manager::handle\_load\_themes\_request()](../classes/wp_customize_manager/handle_load_themes_request) wp-includes/class-wp-customize-manager.php | Loads themes into the theme browsing/installation UI. | | [WP\_Widget\_Custom\_HTML::update()](../classes/wp_widget_custom_html/update) wp-includes/widgets/class-wp-widget-custom-html.php | Handles updating settings for the current Custom HTML widget instance. | | [rest\_sanitize\_value\_from\_schema()](rest_sanitize_value_from_schema) wp-includes/rest-api.php | Sanitize a value based on a schema. | | [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\_ajax\_delete\_plugin()](wp_ajax_delete_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a plugin. | | [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::sanitize()](../classes/wp_customize_nav_menu_item_setting/sanitize) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Sanitize an input. | | [WP\_Customize\_Nav\_Menus::ajax\_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\_update\_plugin()](wp_ajax_update_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for updating a plugin. | | [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. | | [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST | | [media\_handle\_upload()](media_handle_upload) wp-admin/includes/media.php | Saves a file submitted from a POST request and create an attachment post for it. | | [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\_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\_Nav\_Menu\_Widget::update()](../classes/wp_nav_menu_widget/update) wp-includes/widgets/class-wp-nav-menu-widget.php | Handles updating settings for the current Navigation Menu widget instance. | | [WP\_Widget\_Recent\_Comments::update()](../classes/wp_widget_recent_comments/update) wp-includes/widgets/class-wp-widget-recent-comments.php | Handles updating settings for the current Recent Comments widget instance. | | [WP\_Widget\_Tag\_Cloud::update()](../classes/wp_widget_tag_cloud/update) wp-includes/widgets/class-wp-widget-tag-cloud.php | Handles updating settings for the current Tag Cloud widget instance. | | [WP\_Widget\_Recent\_Posts::update()](../classes/wp_widget_recent_posts/update) wp-includes/widgets/class-wp-widget-recent-posts.php | Handles updating the settings for the current Recent Posts widget instance. | | [WP\_Widget\_Categories::update()](../classes/wp_widget_categories/update) wp-includes/widgets/class-wp-widget-categories.php | Handles updating settings for the current Categories widget instance. | | [WP\_Widget\_Text::update()](../classes/wp_widget_text/update) wp-includes/widgets/class-wp-widget-text.php | Handles updating settings for the current Text widget instance. | | [WP\_Widget\_Calendar::update()](../classes/wp_widget_calendar/update) wp-includes/widgets/class-wp-widget-calendar.php | Handles updating settings for the current Calendar widget instance. | | [WP\_Widget\_Meta::update()](../classes/wp_widget_meta/update) wp-includes/widgets/class-wp-widget-meta.php | Handles updating settings for the current Meta widget instance. | | [WP\_Widget\_Archives::update()](../classes/wp_widget_archives/update) wp-includes/widgets/class-wp-widget-archives.php | Handles updating settings for the current Archives widget instance. | | [WP\_Widget\_Search::update()](../classes/wp_widget_search/update) wp-includes/widgets/class-wp-widget-search.php | Handles updating settings for the current Search widget instance. | | [WP\_Widget\_Pages::update()](../classes/wp_widget_pages/update) wp-includes/widgets/class-wp-widget-pages.php | Handles updating settings for the current Pages widget instance. | | [register\_new\_user()](register_new_user) wp-includes/user.php | Handles registering a new user. | | [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 | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress get_the_author_ID(): string|int get\_the\_author\_ID(): string|int ================================== This function has been deprecated. Use [get\_the\_author\_meta()](get_the_author_meta) instead. Retrieve the ID of the author of the current post. * [get\_the\_author\_meta()](get_the_author_meta) string|int The author's ID. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_the_author_ID() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'ID\')' ); return get_the_author_meta('ID'); } ``` | Uses | Description | | --- | --- | | [get\_the\_author\_meta()](get_the_author_meta) wp-includes/author-template.php | Retrieves the requested data of the author of the current post. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use [get\_the\_author\_meta()](get_the_author_meta) | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress wp_delete_user( int $id, int $reassign = null ): bool wp\_delete\_user( int $id, int $reassign = null ): bool ======================================================= Remove user and optionally reassign posts and links to another user. If the $reassign parameter is not assigned to a User ID, then all posts will be deleted of that user. The action [‘delete\_user’](../hooks/delete_user) that is passed the User ID being deleted will be run after the posts are either reassigned or deleted. The user meta will also be deleted that are for that User ID. `$id` int Required User ID. `$reassign` int Optional Reassign posts and links to new User ID. Default: `null` bool True when finished. * If you wish to use this function in a plugin then you must include the ./wp-admin/includes/user.php file in your plugin function, else it will throw a ‘call to undefined function’ error * Uses global: (object) [$[wpdb](../classes/wpdb)](https://codex.wordpress.org/Class_Reference/wpdb "Class Reference/wpdb") * This is an Admin function. * Uses: [[do\_action()](do_action)](do_action "Function Reference/do action") Calls [‘deleted\_user’](../hooks/deleted_user "Plugin API/Action Reference/deleted user") hook File: `wp-admin/includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/user.php/) ``` function wp_delete_user( $id, $reassign = null ) { global $wpdb; if ( ! is_numeric( $id ) ) { return false; } $id = (int) $id; $user = new WP_User( $id ); if ( ! $user->exists() ) { return false; } // Normalize $reassign to null or a user ID. 'novalue' was an older default. if ( 'novalue' === $reassign ) { $reassign = null; } elseif ( null !== $reassign ) { $reassign = (int) $reassign; } /** * Fires immediately before a user is deleted from the database. * * @since 2.0.0 * @since 5.5.0 Added the `$user` parameter. * * @param int $id ID of the user to delete. * @param int|null $reassign ID of the user to reassign posts and links to. * Default null, for no reassignment. * @param WP_User $user WP_User object of the user to delete. */ do_action( 'delete_user', $id, $reassign, $user ); if ( null === $reassign ) { $post_types_to_delete = array(); foreach ( get_post_types( array(), 'objects' ) as $post_type ) { if ( $post_type->delete_with_user ) { $post_types_to_delete[] = $post_type->name; } elseif ( null === $post_type->delete_with_user && post_type_supports( $post_type->name, 'author' ) ) { $post_types_to_delete[] = $post_type->name; } } /** * Filters the list of post types to delete with a user. * * @since 3.4.0 * * @param string[] $post_types_to_delete Array of post types to delete. * @param int $id User ID. */ $post_types_to_delete = apply_filters( 'post_types_to_delete_with_user', $post_types_to_delete, $id ); $post_types_to_delete = implode( "', '", $post_types_to_delete ); $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d AND post_type IN ('$post_types_to_delete')", $id ) ); if ( $post_ids ) { foreach ( $post_ids as $post_id ) { wp_delete_post( $post_id ); } } // Clean links. $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) ); if ( $link_ids ) { foreach ( $link_ids as $link_id ) { wp_delete_link( $link_id ); } } } else { $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) ); $wpdb->update( $wpdb->posts, array( 'post_author' => $reassign ), array( 'post_author' => $id ) ); if ( ! empty( $post_ids ) ) { foreach ( $post_ids as $post_id ) { clean_post_cache( $post_id ); } } $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) ); $wpdb->update( $wpdb->links, array( 'link_owner' => $reassign ), array( 'link_owner' => $id ) ); if ( ! empty( $link_ids ) ) { foreach ( $link_ids as $link_id ) { clean_bookmark_cache( $link_id ); } } } // FINALLY, delete user. if ( is_multisite() ) { remove_user_from_blog( $id, get_current_blog_id() ); } else { $meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) ); foreach ( $meta as $mid ) { delete_metadata_by_mid( 'user', $mid ); } $wpdb->delete( $wpdb->users, array( 'ID' => $id ) ); } clean_user_cache( $user ); /** * Fires immediately after a user is deleted from the database. * * @since 2.9.0 * @since 5.5.0 Added the `$user` parameter. * * @param int $id ID of the deleted user. * @param int|null $reassign ID of the user to reassign posts and links to. * Default null, for no reassignment. * @param WP_User $user WP_User object of the deleted user. */ do_action( 'deleted_user', $id, $reassign, $user ); return true; } ``` [do\_action( 'deleted\_user', int $id, int|null $reassign, WP\_User $user )](../hooks/deleted_user) Fires immediately after a user is deleted from the database. [do\_action( 'delete\_user', int $id, int|null $reassign, WP\_User $user )](../hooks/delete_user) Fires immediately before a user is deleted from the database. [apply\_filters( 'post\_types\_to\_delete\_with\_user', string[] $post\_types\_to\_delete, int $id )](../hooks/post_types_to_delete_with_user) Filters the list of post types to delete with a user. | Uses | Description | | --- | --- | | [wp\_delete\_link()](wp_delete_link) wp-admin/includes/bookmark.php | Deletes a specified link from the database. | | [WP\_User::\_\_construct()](../classes/wp_user/__construct) wp-includes/class-wp-user.php | Constructor. | | [wpdb::delete()](../classes/wpdb/delete) wp-includes/class-wpdb.php | Deletes a row in the table. | | [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. | | [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. | | [remove\_user\_from\_blog()](remove_user_from_blog) wp-includes/ms-functions.php | Removes a user from a blog. | | [clean\_bookmark\_cache()](clean_bookmark_cache) wp-includes/bookmark.php | Deletes the bookmark cache. | | [post\_type\_supports()](post_type_supports) wp-includes/post.php | Checks a post type’s support for a given feature. | | [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. | | [clean\_post\_cache()](clean_post_cache) wp-includes/post.php | Will clean the post in the cache. | | [clean\_user\_cache()](clean_user_cache) wp-includes/user.php | Cleans all user caches. | | [delete\_metadata\_by\_mid()](delete_metadata_by_mid) wp-includes/meta.php | Deletes metadata by meta ID. | | [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. | | Used By | Description | | --- | --- | | [WP\_REST\_Users\_Controller::delete\_item()](../classes/wp_rest_users_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Deletes a single user. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
programming_docs
wordpress unregister_block_type( string|WP_Block_Type $name ): WP_Block_Type|false unregister\_block\_type( string|WP\_Block\_Type $name ): WP\_Block\_Type|false ============================================================================== Unregisters a block type. `$name` string|[WP\_Block\_Type](../classes/wp_block_type) Required Block type name including namespace, or alternatively a complete [WP\_Block\_Type](../classes/wp_block_type) instance. [WP\_Block\_Type](../classes/wp_block_type)|false The unregistered block type on success, or false on failure. File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/) ``` function unregister_block_type( $name ) { return WP_Block_Type_Registry::get_instance()->unregister( $name ); } ``` | Uses | Description | | --- | --- | | [WP\_Block\_Type\_Registry::get\_instance()](../classes/wp_block_type_registry/get_instance) wp-includes/class-wp-block-type-registry.php | Utility method to retrieve the main instance of the class. | | Version | Description | | --- | --- | | [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. | wordpress get_custom_logo( int $blog_id ): string get\_custom\_logo( int $blog\_id ): string ========================================== Returns a custom logo, linked to home unless the theme supports removing the link on the home page. `$blog_id` int Optional ID of the blog in question. Default is the ID of the current blog. string Custom logo markup. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function get_custom_logo( $blog_id = 0 ) { $html = ''; $switched_blog = false; if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) { switch_to_blog( $blog_id ); $switched_blog = true; } $custom_logo_id = get_theme_mod( 'custom_logo' ); // We have a logo. Logo is go. if ( $custom_logo_id ) { $custom_logo_attr = array( 'class' => 'custom-logo', 'loading' => false, ); $unlink_homepage_logo = (bool) get_theme_support( 'custom-logo', 'unlink-homepage-logo' ); if ( $unlink_homepage_logo && is_front_page() && ! is_paged() ) { /* * If on the home page, set the logo alt attribute to an empty string, * as the image is decorative and doesn't need its purpose to be described. */ $custom_logo_attr['alt'] = ''; } else { /* * If the logo alt attribute is empty, get the site title and explicitly pass it * to the attributes used by wp_get_attachment_image(). */ $image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true ); if ( empty( $image_alt ) ) { $custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' ); } } /** * Filters the list of custom logo image attributes. * * @since 5.5.0 * * @param array $custom_logo_attr Custom logo image attributes. * @param int $custom_logo_id Custom logo attachment ID. * @param int $blog_id ID of the blog to get the custom logo for. */ $custom_logo_attr = apply_filters( 'get_custom_logo_image_attributes', $custom_logo_attr, $custom_logo_id, $blog_id ); /* * If the alt attribute is not empty, there's no need to explicitly pass it * because wp_get_attachment_image() already adds the alt attribute. */ $image = wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr ); if ( $unlink_homepage_logo && is_front_page() && ! is_paged() ) { // If on the home page, don't link the logo to home. $html = sprintf( '<span class="custom-logo-link">%1$s</span>', $image ); } else { $aria_current = is_front_page() && ! is_paged() ? ' aria-current="page"' : ''; $html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home"%2$s>%3$s</a>', esc_url( home_url( '/' ) ), $aria_current, $image ); } } elseif ( is_customize_preview() ) { // If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview). $html = sprintf( '<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo" alt="" /></a>', esc_url( home_url( '/' ) ) ); } if ( $switched_blog ) { restore_current_blog(); } /** * Filters the custom logo output. * * @since 4.5.0 * @since 4.6.0 Added the `$blog_id` parameter. * * @param string $html Custom logo HTML output. * @param int $blog_id ID of the blog to get the custom logo for. */ return apply_filters( 'get_custom_logo', $html, $blog_id ); } ``` [apply\_filters( 'get\_custom\_logo', string $html, int $blog\_id )](../hooks/get_custom_logo) Filters the custom logo output. [apply\_filters( 'get\_custom\_logo\_image\_attributes', array $custom\_logo\_attr, int $custom\_logo\_id, int $blog\_id )](../hooks/get_custom_logo_image_attributes) Filters the list of custom logo image attributes. | Uses | Description | | --- | --- | | [is\_customize\_preview()](is_customize_preview) wp-includes/theme.php | Whether the site is being previewed in the Customizer. | | [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. | | [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\_get\_attachment\_image()](wp_get_attachment_image) wp-includes/media.php | Gets an HTML img element representing an image attachment. | | [switch\_to\_blog()](switch_to_blog) wp-includes/ms-blogs.php | Switch the current blog. | | [restore\_current\_blog()](restore_current_blog) wp-includes/ms-blogs.php | Restore the current blog, after calling [switch\_to\_blog()](switch_to_blog) . | | [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. | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. | | [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. | | Used By | Description | | --- | --- | | [WP\_Customize\_Manager::\_render\_custom\_logo\_partial()](../classes/wp_customize_manager/_render_custom_logo_partial) wp-includes/class-wp-customize-manager.php | Callback for rendering the custom logo, used in the custom\_logo partial. | | [the\_custom\_logo()](the_custom_logo) wp-includes/general-template.php | Displays a custom logo, linked to home unless the theme supports removing the link on the home page. | | Version | Description | | --- | --- | | [5.5.1](https://developer.wordpress.org/reference/since/5.5.1/) | Disabled lazy-loading by default. | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Added option to remove the link on the home page with `unlink-homepage-logo` theme support for the `custom-logo` theme feature. | | [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. | wordpress index_rel_link() index\_rel\_link() ================== This function has been deprecated. Display relational link for the site index. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function index_rel_link() { _deprecated_function( __FUNCTION__, '3.3.0' ); echo get_index_rel_link(); } ``` | Uses | Description | | --- | --- | | [get\_index\_rel\_link()](get_index_rel_link) wp-includes/deprecated.php | Get site index relational link. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | This function has been deprecated. | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress rest_sanitize_request_arg( mixed $value, WP_REST_Request $request, string $param ): mixed rest\_sanitize\_request\_arg( mixed $value, WP\_REST\_Request $request, string $param ): mixed ============================================================================================== Sanitize 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 mixed File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_sanitize_request_arg( $value, $request, $param ) { $attributes = $request->get_attributes(); if ( ! isset( $attributes['args'][ $param ] ) || ! is_array( $attributes['args'][ $param ] ) ) { return $value; } $args = $attributes['args'][ $param ]; return rest_sanitize_value_from_schema( $value, $args, $param ); } ``` | Uses | Description | | --- | --- | | [rest\_sanitize\_value\_from\_schema()](rest_sanitize_value_from_schema) wp-includes/rest-api.php | Sanitize 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. | | [rest\_parse\_request\_arg()](rest_parse_request_arg) wp-includes/rest-api.php | Parse a request argument based on details registered to the route. | | Version | Description | | --- | --- | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. | wordpress get_children( mixed $args = '', string $output = OBJECT ): WP_Post[]|array[]|int[] get\_children( mixed $args = '', string $output = OBJECT ): WP\_Post[]|array[]|int[] ==================================================================================== Retrieves all children of the post parent ID. Normally, without any enhancements, the children would apply to pages. In the context of the inner workings of WordPress, pages, posts, and attachments share the same table, so therefore the functionality could apply to any one of them. It is then noted that while this function does not work on posts, it does not mean that it won’t work on posts. It is recommended that you know what context you wish to retrieve the children of. Attachments may also be made the child of a post, so if that is an accurate statement (which needs to be verified), it would then be possible to get all of the attachments for a post. Attachments have since changed since version 2.5, so this is most likely inaccurate, but serves generally as an example of what is possible. The arguments listed as defaults are for this function and also of the [get\_posts()](get_posts) function. The arguments are combined with the get\_children defaults and are then passed to the [get\_posts()](get_posts) function, which accepts additional arguments. You can replace the defaults in this function, listed below and the additional arguments listed in the [get\_posts()](get_posts) function. The ‘post\_parent’ is the most important argument and important attention needs to be paid to the $args parameter. If you pass either an object or an integer (number), then just the ‘post\_parent’ is grabbed and everything else is lost. If you don’t specify any arguments, then it is assumed that you are in The Loop and the post parent will be grabbed for from the current post. The ‘post\_parent’ argument is the ID to get the children. The ‘numberposts’ is the amount of posts to retrieve that has a default of ‘-1’, which is used to get all of the posts. Giving a number higher than 0 will only retrieve that amount of posts. The ‘post\_type’ and ‘post\_status’ arguments can be used to choose what criteria of posts to retrieve. The ‘post\_type’ can be anything, but WordPress post types are ‘post’, ‘pages’, and ‘attachments’. The ‘post\_status’ argument will accept any post status within the write administration panels. * [get\_posts()](get_posts) `$args` mixed Optional User defined arguments for replacing the defaults. Default: `''` `$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` [WP\_Post](../classes/wp_post)[]|array[]|int[] Array of post objects, arrays, or IDs, depending on `$output`. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function get_children( $args = '', $output = OBJECT ) { $kids = array(); if ( empty( $args ) ) { if ( isset( $GLOBALS['post'] ) ) { $args = array( 'post_parent' => (int) $GLOBALS['post']->post_parent ); } else { return $kids; } } elseif ( is_object( $args ) ) { $args = array( 'post_parent' => (int) $args->post_parent ); } elseif ( is_numeric( $args ) ) { $args = array( 'post_parent' => (int) $args ); } $defaults = array( 'numberposts' => -1, 'post_type' => 'any', 'post_status' => 'any', 'post_parent' => 0, ); $parsed_args = wp_parse_args( $args, $defaults ); $children = get_posts( $parsed_args ); if ( ! $children ) { return $kids; } if ( ! empty( $parsed_args['fields'] ) ) { return $children; } update_post_cache( $children ); foreach ( $children as $key => $child ) { $kids[ $child->ID ] = $children[ $key ]; } if ( OBJECT === $output ) { return $kids; } elseif ( ARRAY_A === $output ) { $weeuns = array(); foreach ( (array) $kids as $kid ) { $weeuns[ $kid->ID ] = get_object_vars( $kids[ $kid->ID ] ); } return $weeuns; } elseif ( ARRAY_N === $output ) { $babes = array(); foreach ( (array) $kids as $kid ) { $babes[ $kid->ID ] = array_values( get_object_vars( $kids[ $kid->ID ] ) ); } return $babes; } else { return $kids; } } ``` | Uses | Description | | --- | --- | | [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. | | [update\_post\_cache()](update_post_cache) wp-includes/post.php | Updates posts in cache. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | Used By | 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. | | [get\_media\_items()](get_media_items) wp-admin/includes/media.php | Retrieves HTML for media items of post gallery. | | [get\_attached\_media()](get_attached_media) wp-includes/media.php | Retrieves media attached to the passed post. | | [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\_get\_post\_revisions()](wp_get_post_revisions) wp-includes/revision.php | Returns all revisions of specified post. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress check_column( string $table_name, string $col_name, string $col_type, bool $is_null = null, mixed $key = null, mixed $default_value = null, mixed $extra = null ): bool check\_column( string $table\_name, string $col\_name, string $col\_type, bool $is\_null = null, mixed $key = null, mixed $default\_value = null, mixed $extra = null ): bool ============================================================================================================================================================================= Checks that database table column matches the criteria. Uses the SQL DESC for retrieving the table info for the column. It will help understand the parameters, if you do more research on what column information is returned by the SQL statement. Pass in null to skip checking that criteria. Column names returned from DESC table are case sensitive and are listed: Field Type Null Key Default Extra `$table_name` string Required Database table name. `$col_name` string Required Table column name. `$col_type` string Required Table column type. `$is_null` bool Optional Check is null. Default: `null` `$key` mixed Optional Key info. Default: `null` `$default_value` mixed Optional Default value. Default: `null` `$extra` mixed Optional Extra value. Default: `null` bool True, if matches. False, if not matching. File: `wp-admin/install-helper.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/install-helper.php/) ``` function check_column( $table_name, $col_name, $col_type, $is_null = null, $key = null, $default_value = null, $extra = null ) { global $wpdb; $diffs = 0; $results = $wpdb->get_results( "DESC $table_name" ); foreach ( $results as $row ) { if ( $row->Field === $col_name ) { // Got our column, check the params. if ( ( null !== $col_type ) && ( $row->Type !== $col_type ) ) { ++$diffs; } if ( ( null !== $is_null ) && ( $row->Null !== $is_null ) ) { ++$diffs; } if ( ( null !== $key ) && ( $row->Key !== $key ) ) { ++$diffs; } if ( ( null !== $default_value ) && ( $row->Default !== $default_value ) ) { ++$diffs; } if ( ( null !== $extra ) && ( $row->Extra !== $extra ) ) { ++$diffs; } if ( $diffs > 0 ) { return false; } return true; } // End if found our column. } return false; } ``` | Uses | Description | | --- | --- | | [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.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. | wordpress the_meta() the\_meta() =========== This function has been deprecated. Use [get\_post\_meta()](get_post_meta) to retrieve post meta and render manually instead. Displays a list of post custom fields. This is a simple built-in function for displaying custom fields for the current post, known as the “post-meta” (stored in the wp\_postmeta table). It formats the data into an unordered list (see output below). It must be used from within [The Loop](https://codex.wordpress.org/The_Loop "The Loop") or in a theme file that handles data from a single post (e.g. single.php). [the\_meta()](the_meta) will ignore meta\_keys (i.e. field names) that begin with an underscore. For more information on this tag, see [Custom Fields](https://wordpress.org/support/article/custom-fields/ "Custom Fields"). File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/) ``` function the_meta() { _deprecated_function( __FUNCTION__, '6.0.2', 'get_post_meta()' ); $keys = get_post_custom_keys(); if ( $keys ) { $li_html = ''; foreach ( (array) $keys as $key ) { $keyt = trim( $key ); if ( is_protected_meta( $keyt, 'post' ) ) { continue; } $values = array_map( 'trim', get_post_custom_values( $key ) ); $value = implode( ', ', $values ); $html = sprintf( "<li><span class='post-meta-key'>%s</span> %s</li>\n", /* translators: %s: Post custom field name. */ esc_html( sprintf( _x( '%s:', 'Post custom field name' ), $key ) ), esc_html( $value ) ); /** * Filters the HTML output of the li element in the post custom fields list. * * @since 2.2.0 * * @param string $html The HTML output for the li element. * @param string $key Meta key. * @param string $value Meta value. */ $li_html .= apply_filters( 'the_meta_key', $html, $key, $value ); } if ( $li_html ) { echo "<ul class='post-meta'>\n{$li_html}</ul>\n"; } } } ``` [apply\_filters( 'the\_meta\_key', string $html, string $key, string $value )](../hooks/the_meta_key) Filters the HTML output of the li element in the post custom fields list. | Uses | Description | | --- | --- | | [get\_post\_custom\_keys()](get_post_custom_keys) wp-includes/post.php | Retrieves meta field names for a post. | | [get\_post\_custom\_values()](get_post_custom_values) wp-includes/post.php | Retrieves values for a custom post field. | | [is\_protected\_meta()](is_protected_meta) wp-includes/meta.php | Determines whether a meta key is considered protected. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Version | Description | | --- | --- | | [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
programming_docs
wordpress get_udims( int $width, int $height ): array get\_udims( int $width, int $height ): array ============================================ This function has been deprecated. Use [wp\_constrain\_dimensions()](wp_constrain_dimensions) instead. Calculated 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 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 get_udims( $width, $height ) { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_constrain_dimensions()' ); return wp_constrain_dimensions( $width, $height, 128, 96 ); } ``` | 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.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Use [wp\_constrain\_dimensions()](wp_constrain_dimensions) | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress wp_update_urls_to_https(): bool wp\_update\_urls\_to\_https(): bool =================================== Update the ‘home’ and ‘siteurl’ option to use the HTTPS variant of their URL. If this update does not result in WordPress recognizing that the site is now using HTTPS (e.g. due to constants overriding the URLs used), the changes will be reverted. In such a case the function will return false. bool True on success, false on failure. File: `wp-includes/https-migration.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/https-migration.php/) ``` function wp_update_urls_to_https() { // Get current URL options. $orig_home = get_option( 'home' ); $orig_siteurl = get_option( 'siteurl' ); // Get current URL options, replacing HTTP with HTTPS. $home = str_replace( 'http://', 'https://', $orig_home ); $siteurl = str_replace( 'http://', 'https://', $orig_siteurl ); // Update the options. update_option( 'home', $home ); update_option( 'siteurl', $siteurl ); if ( ! wp_is_using_https() ) { // If this did not result in the site recognizing HTTPS as being used, // revert the change and return false. update_option( 'home', $orig_home ); update_option( 'siteurl', $orig_siteurl ); return false; } // Otherwise the URLs were successfully changed to use HTTPS. return true; } ``` | Uses | Description | | --- | --- | | [wp\_is\_using\_https()](wp_is_using_https) wp-includes/https-detection.php | Checks whether the website is using HTTPS. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Version | Description | | --- | --- | | [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. | wordpress wp_handle_upload_error( $file, $message ) wp\_handle\_upload\_error( $file, $message ) ============================================ File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/) ``` function wp_handle_upload_error( &$file, $message ) { return array( 'error' => $message ); } ``` wordpress wp_ajax_send_link_to_editor() wp\_ajax\_send\_link\_to\_editor() ================================== Ajax handler for sending a link to the editor. Generates the HTML to send a non-image embed link to the editor. Backward compatible with the following filters: * file\_send\_to\_editor\_url * audio\_send\_to\_editor\_url * video\_send\_to\_editor\_url 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_link_to_editor() { global $post, $wp_embed; check_ajax_referer( 'media-send-to-editor', 'nonce' ); $src = wp_unslash( $_POST['src'] ); if ( ! $src ) { wp_send_json_error(); } if ( ! strpos( $src, '://' ) ) { $src = 'http://' . $src; } $src = sanitize_url( $src ); if ( ! $src ) { wp_send_json_error(); } $link_text = trim( wp_unslash( $_POST['link_text'] ) ); if ( ! $link_text ) { $link_text = wp_basename( $src ); } $post = get_post( isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0 ); // Ping WordPress for an embed. $check_embed = $wp_embed->run_shortcode( '[embed]' . $src . '[/embed]' ); // Fallback that WordPress creates when no oEmbed was found. $fallback = $wp_embed->maybe_make_link( $src ); if ( $check_embed !== $fallback ) { // TinyMCE view for [embed] will parse this. $html = '[embed]' . $src . '[/embed]'; } elseif ( $link_text ) { $html = '<a href="' . esc_url( $src ) . '">' . $link_text . '</a>'; } else { $html = ''; } // Figure out what filter to run: $type = 'file'; $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ); if ( $ext ) { $ext_type = wp_ext2type( $ext ); if ( 'audio' === $ext_type || 'video' === $ext_type ) { $type = $ext_type; } } /** This filter is documented in wp-admin/includes/media.php */ $html = apply_filters( "{$type}_send_to_editor_url", $html, $src, $link_text ); wp_send_json_success( $html ); } ``` [apply\_filters( "{$type}\_send\_to\_editor\_url", string $html, string $src, string $title )](../hooks/type_send_to_editor_url) Filters the URL sent to the editor for a specific media type. | Uses | Description | | --- | --- | | [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. | | [wp\_ext2type()](wp_ext2type) wp-includes/functions.php | Retrieves the file type based on the extension name. | | [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::run\_shortcode()](../classes/wp_embed/run_shortcode) wp-includes/class-wp-embed.php | Processes the [embed] shortcode. | | [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. | | [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). | | [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 wp_image_src_get_dimensions( string $image_src, array $image_meta, int $attachment_id ): array|false wp\_image\_src\_get\_dimensions( string $image\_src, array $image\_meta, int $attachment\_id ): array|false =========================================================================================================== Determines an image’s width and height dimensions based on the source file. `$image_src` string Required The image source file. `$image_meta` array Required The image meta data as returned by '[wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) '. `$attachment_id` int Optional The image attachment ID. Default 0. array|false Array with first element being the width and second element being the height, or false if dimensions cannot be determined. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/) ``` function wp_image_src_get_dimensions( $image_src, $image_meta, $attachment_id = 0 ) { $dimensions = false; // Is it a full size image? if ( isset( $image_meta['file'] ) && strpos( $image_src, wp_basename( $image_meta['file'] ) ) !== false ) { $dimensions = array( (int) $image_meta['width'], (int) $image_meta['height'], ); } if ( ! $dimensions && ! empty( $image_meta['sizes'] ) ) { $src_filename = wp_basename( $image_src ); foreach ( $image_meta['sizes'] as $image_size_data ) { if ( $src_filename === $image_size_data['file'] ) { $dimensions = array( (int) $image_size_data['width'], (int) $image_size_data['height'], ); break; } } } /** * Filters the 'wp_image_src_get_dimensions' value. * * @since 5.7.0 * * @param array|false $dimensions Array with first element being the width * and second element being the height, or * false if dimensions could not be determined. * @param string $image_src The image source file. * @param array $image_meta The image meta data as returned by * 'wp_get_attachment_metadata()'. * @param int $attachment_id The image attachment ID. Default 0. */ return apply_filters( 'wp_image_src_get_dimensions', $dimensions, $image_src, $image_meta, $attachment_id ); } ``` [apply\_filters( 'wp\_image\_src\_get\_dimensions', array|false $dimensions, string $image\_src, array $image\_meta, int $attachment\_id )](../hooks/wp_image_src_get_dimensions) Filters the ‘wp\_image\_src\_get\_dimensions’ value. | Uses | Description | | --- | --- | | [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [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\_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. | | Version | Description | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. | wordpress wp_widgets_init() wp\_widgets\_init() =================== Registers all of the default WordPress widgets on startup. Calls [‘widgets\_init’](../hooks/widgets_init) action after all of the WordPress widgets have been registered. File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/) ``` function wp_widgets_init() { if ( ! is_blog_installed() ) { return; } register_widget( 'WP_Widget_Pages' ); register_widget( 'WP_Widget_Calendar' ); register_widget( 'WP_Widget_Archives' ); if ( get_option( 'link_manager_enabled' ) ) { register_widget( 'WP_Widget_Links' ); } register_widget( 'WP_Widget_Media_Audio' ); register_widget( 'WP_Widget_Media_Image' ); register_widget( 'WP_Widget_Media_Gallery' ); register_widget( 'WP_Widget_Media_Video' ); register_widget( 'WP_Widget_Meta' ); register_widget( 'WP_Widget_Search' ); register_widget( 'WP_Widget_Text' ); register_widget( 'WP_Widget_Categories' ); register_widget( 'WP_Widget_Recent_Posts' ); register_widget( 'WP_Widget_Recent_Comments' ); register_widget( 'WP_Widget_RSS' ); register_widget( 'WP_Widget_Tag_Cloud' ); register_widget( 'WP_Nav_Menu_Widget' ); register_widget( 'WP_Widget_Custom_HTML' ); register_widget( 'WP_Widget_Block' ); /** * Fires after all default WordPress widgets have been registered. * * @since 2.2.0 */ do_action( 'widgets_init' ); } ``` [do\_action( 'widgets\_init' )](../hooks/widgets_init) Fires after all default WordPress widgets have been registered. | Uses | Description | | --- | --- | | [is\_blog\_installed()](is_blog_installed) wp-includes/functions.php | Determines whether WordPress is already installed. | | [register\_widget()](register_widget) wp-includes/widgets.php | Register a widget | | [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. | | Version | Description | | --- | --- | | [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. | wordpress the_header_image_tag( array $attr = array() ) the\_header\_image\_tag( array $attr = array() ) ================================================ Displays the image markup for a custom header image. `$attr` array Optional Attributes for the image markup. Default: `array()` File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/) ``` function the_header_image_tag( $attr = array() ) { echo get_header_image_tag( $attr ); } ``` | Uses | Description | | --- | --- | | [get\_header\_image\_tag()](get_header_image_tag) wp-includes/theme.php | Creates image tag markup for a custom header image. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. | wordpress wp_preload_resources() wp\_preload\_resources() ======================== Prints resource preloads directives to browsers. Gives directive to browsers to preload specific resources that website will need very soon, this ensures that they are available earlier and are less likely to block the page’s render. Preload directives should not be used for non-render-blocking elements, as then they would compete with the render-blocking ones, slowing down the render. These performance improving indicators work by using `<link rel="preload">`. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function wp_preload_resources() { /** * Filters domains and URLs for resource preloads. * * @since 6.1.0 * * @param array $preload_resources { * Array of resources and their attributes, or URLs to print for resource preloads. * * @type array ...$0 { * Array of resource attributes. * * @type string $href URL to include in resource preloads. Required. * @type string $as How the browser should treat the resource * (`script`, `style`, `image`, `document`, etc). * @type string $crossorigin Indicates the CORS policy of the specified resource. * @type string $type Type of the resource (`text/html`, `text/css`, etc). * @type string $media Accepts media types or media queries. Allows responsive preloading. * @type string $imagesizes Responsive source size to the source Set. * @type string $imagesrcset Responsive image sources to the source set. * } * } */ $preload_resources = apply_filters( 'wp_preload_resources', array() ); if ( ! is_array( $preload_resources ) ) { return; } $unique_resources = array(); // Parse the complete resource list and extract unique resources. foreach ( $preload_resources as $resource ) { if ( ! is_array( $resource ) ) { continue; } $attributes = $resource; if ( isset( $resource['href'] ) ) { $href = $resource['href']; if ( isset( $unique_resources[ $href ] ) ) { continue; } $unique_resources[ $href ] = $attributes; // Media can use imagesrcset and not href. } elseif ( ( 'image' === $resource['as'] ) && ( isset( $resource['imagesrcset'] ) || isset( $resource['imagesizes'] ) ) ) { if ( isset( $unique_resources[ $resource['imagesrcset'] ] ) ) { continue; } $unique_resources[ $resource['imagesrcset'] ] = $attributes; } else { continue; } } // Build and output the HTML for each unique resource. foreach ( $unique_resources as $unique_resource ) { $html = ''; foreach ( $unique_resource as $resource_key => $resource_value ) { if ( ! is_scalar( $resource_value ) ) { continue; } // Ignore non-supported attributes. $non_supported_attributes = array( 'as', 'crossorigin', 'href', 'imagesrcset', 'imagesizes', 'type', 'media' ); if ( ! in_array( $resource_key, $non_supported_attributes, true ) && ! is_numeric( $resource_key ) ) { continue; } // imagesrcset only usable when preloading image, ignore otherwise. if ( ( 'imagesrcset' === $resource_key ) && ( ! isset( $unique_resource['as'] ) || ( 'image' !== $unique_resource['as'] ) ) ) { continue; } // imagesizes only usable when preloading image and imagesrcset present, ignore otherwise. if ( ( 'imagesizes' === $resource_key ) && ( ! isset( $unique_resource['as'] ) || ( 'image' !== $unique_resource['as'] ) || ! isset( $unique_resource['imagesrcset'] ) ) ) { continue; } $resource_value = ( 'href' === $resource_key ) ? esc_url( $resource_value, array( 'http', 'https' ) ) : esc_attr( $resource_value ); if ( ! is_string( $resource_key ) ) { $html .= " $resource_value"; } else { $html .= " $resource_key='$resource_value'"; } } $html = trim( $html ); printf( "<link rel='preload' %s />\n", $html ); } } ``` [apply\_filters( 'wp\_preload\_resources', array $preload\_resources )](../hooks/wp_preload_resources) Filters domains and URLs for resource preloads. | Uses | Description | | --- | --- | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Version | Description | | --- | --- | | [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. | wordpress get_boundary_post_rel_link( string $title = '%title', bool $in_same_cat = false, string $excluded_categories = '', bool $start = true ): string get\_boundary\_post\_rel\_link( string $title = '%title', bool $in\_same\_cat = false, string $excluded\_categories = '', bool $start = true ): string ====================================================================================================================================================== This function has been deprecated. Get boundary post relational link. Can either be start or end post relational link. `$title` string Optional Link title format. Default `'%title'`. Default: `'%title'` `$in_same_cat` bool Optional Whether link should be in a same category. Default: `false` `$excluded_categories` string Optional Excluded categories IDs. Default: `''` `$start` bool Optional Whether to display link to first or last post. Default: `true` string File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) { _deprecated_function( __FUNCTION__, '3.3.0' ); $posts = get_boundary_post($in_same_cat, $excluded_categories, $start); // If there is no post, stop. if ( empty($posts) ) return; // Even though we limited get_posts() to return only 1 item it still returns an array of objects. $post = $posts[0]; if ( empty($post->post_title) ) $post->post_title = $start ? __('First Post') : __('Last Post'); $date = mysql2date(get_option('date_format'), $post->post_date); $title = str_replace('%title', $post->post_title, $title); $title = str_replace('%date', $date, $title); $title = apply_filters('the_title', $title, $post->ID); $link = $start ? "<link rel='start' title='" : "<link rel='end' title='"; $link .= esc_attr($title); $link .= "' href='" . get_permalink($post) . "' />\n"; $boundary = $start ? 'start' : 'end'; return apply_filters( "{$boundary}_post_rel_link", $link ); } ``` [apply\_filters( 'the\_title', string $post\_title, int $post\_id )](../hooks/the_title) Filters the post title. | Uses | Description | | --- | --- | | [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. | | [get\_boundary\_post()](get_boundary_post) wp-includes/link-template.php | Retrieves the boundary post. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [start\_post\_rel\_link()](start_post_rel_link) wp-includes/deprecated.php | Display relational link for the first post. | | 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. |
programming_docs
wordpress _wp_delete_tax_menu_item( int $object_id, int $tt_id, string $taxonomy ) \_wp\_delete\_tax\_menu\_item( int $object\_id, int $tt\_id, string $taxonomy ) =============================================================================== This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Serves as a callback for handling a menu item when its original object is deleted. `$object_id` int Required The ID of the original object being trashed. `$tt_id` int Required Term taxonomy ID. Unused. `$taxonomy` string Required Taxonomy slug. File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/) ``` function _wp_delete_tax_menu_item( $object_id, $tt_id, $taxonomy ) { $object_id = (int) $object_id; $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'taxonomy', $taxonomy ); 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 clean_post_cache( int|WP_Post $post ) clean\_post\_cache( int|WP\_Post $post ) ======================================== Will clean the post in the cache. Cleaning means delete from the cache of the post. Will call to clean the term object cache associated with the post ID. This function not run if $\_wp\_suspend\_cache\_invalidation is not empty. See [wp\_suspend\_cache\_invalidation()](wp_suspend_cache_invalidation) . `$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object to remove from the cache. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function clean_post_cache( $post ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } $post = get_post( $post ); if ( ! $post ) { return; } wp_cache_delete( $post->ID, 'posts' ); wp_cache_delete( $post->ID, 'post_meta' ); clean_object_term_cache( $post->ID, $post->post_type ); wp_cache_delete( 'wp_get_archives', 'general' ); /** * Fires immediately after the given post's cache is cleaned. * * @since 2.5.0 * * @param int $post_id Post ID. * @param WP_Post $post Post object. */ do_action( 'clean_post_cache', $post->ID, $post ); if ( 'page' === $post->post_type ) { wp_cache_delete( 'all_page_ids', 'posts' ); /** * Fires immediately after the given page's cache is cleaned. * * @since 2.5.0 * * @param int $post_id Post ID. */ do_action( 'clean_page_cache', $post->ID ); } wp_cache_set( 'last_changed', microtime(), 'posts' ); } ``` [do\_action( 'clean\_page\_cache', int $post\_id )](../hooks/clean_page_cache) Fires immediately after the given page’s cache is cleaned. [do\_action( 'clean\_post\_cache', int $post\_id, WP\_Post $post )](../hooks/clean_post_cache) Fires immediately after the given post’s cache is cleaned. | Uses | Description | | --- | --- | | [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. | | [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. | | [clean\_object\_term\_cache()](clean_object_term_cache) wp-includes/taxonomy.php | Removes the taxonomy relationship to terms from the cache. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Used By | Description | | --- | --- | | [WP\_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\_keep\_alive\_customize\_changeset\_dependent\_auto\_drafts()](_wp_keep_alive_customize_changeset_dependent_auto_drafts) wp-includes/theme.php | Makes sure that auto-draft posts get their post\_date bumped or status changed to draft to prevent premature garbage-collection. | | [WP\_Customize\_Manager::\_publish\_changeset\_values()](../classes/wp_customize_manager/_publish_changeset_values) wp-includes/class-wp-customize-manager.php | Publishes the values of a changeset. | | [wp\_add\_trashed\_suffix\_to\_post\_name\_for\_post()](wp_add_trashed_suffix_to_post_name_for_post) wp-includes/post.php | Adds a trashed suffix for a given post. | | [wp\_delete\_user()](wp_delete_user) wp-admin/includes/user.php | Remove user and optionally reassign posts and links to another user. | | [WP\_Posts\_List\_Table::\_display\_rows\_hierarchical()](../classes/wp_posts_list_table/_display_rows_hierarchical) wp-admin/includes/class-wp-posts-list-table.php | | | [clean\_page\_cache()](clean_page_cache) wp-includes/deprecated.php | Will clean the page in the cache. | | [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. | | [wp\_publish\_post()](wp_publish_post) wp-includes/post.php | Publishes a post by transitioning the post status. | | [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. | | [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. | | [set\_post\_type()](set_post_type) wp-includes/post.php | Updates the post type for the post ID. | | [wp\_update\_comment\_count\_now()](wp_update_comment_count_now) wp-includes/comment.php | Updates the comment count for the post. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress user_admin_url( string $path = '', string $scheme = 'admin' ): string user\_admin\_url( string $path = '', string $scheme = 'admin' ): string ======================================================================= Retrieves the URL to the admin area for the current user. `$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 user_admin_url( $path = '', $scheme = 'admin' ) { $url = network_site_url( 'wp-admin/user/', $scheme ); if ( $path && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } /** * Filters the user admin URL for the current user. * * @since 3.1.0 * @since 5.8.0 The `$scheme` parameter was added. * * @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|null $scheme The scheme to use. Accepts 'http', 'https', * 'admin', or null. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). */ return apply_filters( 'user_admin_url', $url, $path, $scheme ); } ``` [apply\_filters( 'user\_admin\_url', string $url, string $path, string|null $scheme )](../hooks/user_admin_url) Filters the user admin URL for the current user. | Uses | Description | | --- | --- | | [network\_site\_url()](network_site_url) wp-includes/link-template.php | Retrieves the site URL for the current network. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | 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. | | [get\_edit\_profile\_url()](get_edit_profile_url) wp-includes/link-template.php | Retrieves the URL to the user’s profile editor. | | [WP\_Admin\_Bar::initialize()](../classes/wp_admin_bar/initialize) wp-includes/class-wp-admin-bar.php | Initializes the admin bar. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress wp_register_persisted_preferences_meta() wp\_register\_persisted\_preferences\_meta() ============================================ 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 user meta property for persisted preferences. This property is used to store user preferences across page reloads and is currently used by the block editor for preferences like ‘fullscreenMode’ and ‘fixedToolbar’. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function wp_register_persisted_preferences_meta() { /* * Create a meta key that incorporates the blog prefix so that each site * on a multisite can have distinct user preferences. */ global $wpdb; $meta_key = $wpdb->get_blog_prefix() . 'persisted_preferences'; register_meta( 'user', $meta_key, array( 'type' => 'object', 'single' => true, 'show_in_rest' => array( 'name' => 'persisted_preferences', 'type' => 'object', 'schema' => array( 'type' => 'object', 'context' => array( 'edit' ), 'properties' => array( '_modified' => array( 'description' => __( 'The date and time the preferences were updated.' ), 'type' => 'string', 'format' => 'date-time', 'readonly' => false, ), ), 'additionalProperties' => true, ), ), ) ); } ``` | Uses | Description | | --- | --- | | [register\_meta()](register_meta) wp-includes/meta.php | Registers a meta key. | | [wpdb::get\_blog\_prefix()](../classes/wpdb/get_blog_prefix) wp-includes/class-wpdb.php | Gets blog prefix. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | Version | Description | | --- | --- | | [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. | wordpress wp_parse_args( string|array|object $args, array $defaults = array() ): array wp\_parse\_args( string|array|object $args, array $defaults = array() ): array ============================================================================== Merges user defined arguments into defaults array. This function is used throughout WordPress to allow for both string or array to be merged into another array. `$args` string|array|object Required Value to merge with $defaults. `$defaults` array Optional Array that serves as the defaults. Default: `array()` array Merged user defined values with defaults. **wp\_parse\_args** is a generic utility for merging together an array of arguments and an array of default values. It can also be given a URL query type string which will be converted into an array (i.e. "id=5&status=draft"). It is used throughout WordPress to avoid having to worry about the logic of defaults and input and produces a stable pattern for passing arguments around. Functions like [query\_posts](query_posts "Template Tags/query posts"), [wp\_list\_comments](https://codex.wordpress.org/Template_Tags/wp_list_comments "Template Tags/wp list comments") and [get\_terms](get_terms "Function Reference/get terms") are common examples of the simplifying power of wp\_parse\_args. Functions that have an **$args** based setting are able to infinitely expand the number of values that can potentially be passed into them, avoiding the annoyance of super-long function calls because there are too many arguments to keep track of, many of whose only function is to override usually-good defaults on rare occasions. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp_parse_args( $args, $defaults = array() ) { if ( is_object( $args ) ) { $parsed_args = get_object_vars( $args ); } elseif ( is_array( $args ) ) { $parsed_args =& $args; } else { wp_parse_str( $args, $parsed_args ); } if ( is_array( $defaults ) && $defaults ) { return array_merge( $defaults, $parsed_args ); } return $parsed_args; } ``` | Uses | Description | | --- | --- | | [wp\_parse\_str()](wp_parse_str) wp-includes/formatting.php | Parses a string into variables to be stored in an array. | | Used By | Description | | --- | --- | | [\_wp\_build\_title\_and\_description\_for\_single\_post\_type\_block\_template()](_wp_build_title_and_description_for_single_post_type_block_template) wp-includes/block-template-utils.php | Builds the title and description of a post-specific template based on the underlying referenced post. | | [\_wp\_build\_title\_and\_description\_for\_taxonomy\_block\_template()](_wp_build_title_and_description_for_taxonomy_block_template) wp-includes/block-template-utils.php | Builds the title and description of a taxonomy-specific template based on the underlying entity referenced. | | [WP\_Style\_Engine\_Processor::get\_css()](../classes/wp_style_engine_processor/get_css) wp-includes/style-engine/class-wp-style-engine-processor.php | Gets the CSS rules as a string. | | [wp\_style\_engine\_get\_styles()](wp_style_engine_get_styles) wp-includes/style-engine.php | 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. | | [wp\_style\_engine\_get\_stylesheet\_from\_css\_rules()](wp_style_engine_get_stylesheet_from_css_rules) wp-includes/style-engine.php | Returns compiled CSS from a collection of selectors and declarations. | | [\_wp\_theme\_json\_webfonts\_handler()](_wp_theme_json_webfonts_handler) wp-includes/script-loader.php | Runs the theme.json webfonts handler. | | [wp\_json\_file\_decode()](wp_json_file_decode) wp-includes/functions.php | Reads and decodes a JSON file. | | [wp\_list\_users()](wp_list_users) wp-includes/user.php | Lists all the users of the site, with several options available. | | [wp\_enqueue\_block\_style()](wp_enqueue_block_style) wp-includes/script-loader.php | Enqueues a stylesheet for a specific block. | | [WP\_Widget\_Block::form()](../classes/wp_widget_block/form) wp-includes/widgets/class-wp-widget-block.php | Outputs the Block widget settings form. | | [WP\_Widget\_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\_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\_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\_Block::render()](../classes/wp_block/render) wp-includes/class-wp-block.php | Generates the render output for the block. | | [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. | | [register\_theme\_feature()](register_theme_feature) wp-includes/theme.php | Registers a theme feature for use in [add\_theme\_support()](add_theme_support) . | | [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\_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\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. | | [wp\_prepare\_site\_data()](wp_prepare_site_data) wp-includes/ms-site.php | Prepares site data for insertion or update in the database. | | [\_wp\_die\_process\_input()](_wp_die_process_input) wp-includes/functions.php | Processes arguments passed to [wp\_die()](wp_die) consistently for its handlers. | | [populate\_network\_meta()](populate_network_meta) wp-admin/includes/schema.php | Creates WordPress network meta and sets the default values. | | [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\_Block\_Type::set\_props()](../classes/wp_block_type/set_props) wp-includes/class-wp-block-type.php | Sets block type properties. | | [WP\_Widget\_Custom\_HTML::form()](../classes/wp_widget_custom_html/form) wp-includes/widgets/class-wp-widget-custom-html.php | Outputs the Custom HTML widget settings form. | | [get\_term\_parents\_list()](get_term_parents_list) wp-includes/category-template.php | Retrieves term parents with separator. | | [WP\_oEmbed::get\_data()](../classes/wp_oembed/get_data) wp-includes/class-wp-oembed.php | Takes a URL and attempts to return the oEmbed data. | | [WP\_Widget\_Media::form()](../classes/wp_widget_media/form) wp-includes/widgets/class-wp-widget-media.php | Outputs the settings update form. | | [WP\_Widget\_Media::widget()](../classes/wp_widget_media/widget) wp-includes/widgets/class-wp-widget-media.php | Displays the widget on the front-end. | | [WP\_Widget\_Media::\_\_construct()](../classes/wp_widget_media/__construct) wp-includes/widgets/class-wp-widget-media.php | Constructor. | | [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. | | [register\_rest\_field()](register_rest_field) wp-includes/rest-api.php | Registers a new field on an existing WordPress object type. | | [wp\_update\_custom\_css\_post()](wp_update_custom_css_post) wp-includes/theme.php | Updates the `custom_css` post for a given theme. | | [WP\_Taxonomy::set\_props()](../classes/wp_taxonomy/set_props) wp-includes/class-wp-taxonomy.php | Sets taxonomy properties. | | [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\_Term\_Query::query()](../classes/wp_term_query/query) wp-includes/class-wp-term-query.php | Sets up the query and retrieves the results. | | [WP\_Customize\_Manager::validate\_setting\_values()](../classes/wp_customize_manager/validate_setting_values) wp-includes/class-wp-customize-manager.php | Validates setting values. | | [WP\_Network\_Query::query()](../classes/wp_network_query/query) wp-includes/class-wp-network-query.php | Sets up the WordPress query for retrieving networks. | | [WP\_Network\_Query::parse\_query()](../classes/wp_network_query/parse_query) wp-includes/class-wp-network-query.php | Parses arguments passed to the network query with default query parameters. | | [WP\_Post\_Type::set\_props()](../classes/wp_post_type/set_props) wp-includes/class-wp-post-type.php | Sets post type properties. | | [WP\_Site\_Query::query()](../classes/wp_site_query/query) wp-includes/class-wp-site-query.php | Sets up the WordPress query for retrieving sites. | | [WP\_Site\_Query::parse\_query()](../classes/wp_site_query/parse_query) wp-includes/class-wp-site-query.php | Parses arguments passed to the site query with default query parameters. | | [network\_edit\_site\_nav()](network_edit_site_nav) wp-admin/includes/ms.php | Outputs the HTML for a network’s “Edit Site” tabular interface. | | [get\_header\_image\_tag()](get_header_image_tag) wp-includes/theme.php | Creates image tag markup for a custom header image. | | [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\_Comment::get\_children()](../classes/wp_comment/get_children) wp-includes/class-wp-comment.php | Get the children of a comment. | | [WP\_User\_Query::fill\_query\_vars()](../classes/wp_user_query/fill_query_vars) wp-includes/class-wp-user-query.php | Fills in missing query variables with default values. | | [get\_the\_comments\_navigation()](get_the_comments_navigation) wp-includes/link-template.php | Retrieves navigation to next/previous set of comments, when applicable. | | [get\_the\_comments\_pagination()](get_the_comments_pagination) wp-includes/link-template.php | Retrieves a paginated navigation to next/previous set of comments, when applicable. | | [WP\_Screen::set\_screen\_reader\_content()](../classes/wp_screen/set_screen_reader_content) wp-admin/includes/class-wp-screen.php | Adds accessible hidden headings and text for the screen. | | [WP\_Customize\_Media\_Control::\_\_construct()](../classes/wp_customize_media_control/__construct) wp-includes/customize/class-wp-customize-media-control.php | Constructor. | | [WP\_Comment\_Query::parse\_query()](../classes/wp_comment_query/parse_query) wp-includes/class-wp-comment-query.php | Parse arguments passed to the comment query with default query parameters. | | [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. | | [get\_children()](get_children) wp-includes/post.php | Retrieves all children of the post parent ID. | | [get\_the\_post\_navigation()](get_the_post_navigation) wp-includes/link-template.php | Retrieves the navigation to next/previous post, when applicable. | | [get\_the\_posts\_navigation()](get_the_posts_navigation) wp-includes/link-template.php | Returns the navigation to next/previous set of posts, when applicable. | | [get\_the\_posts\_pagination()](get_the_posts_pagination) wp-includes/link-template.php | Retrieves a paginated navigation to next/previous set of posts, when applicable. | | [WP\_oEmbed::get\_provider()](../classes/wp_oembed/get_provider) wp-includes/class-wp-oembed.php | Takes a URL and returns the corresponding oEmbed provider’s URL, if there is one. | | [wp\_dropdown\_languages()](wp_dropdown_languages) wp-includes/l10n.php | Displays or returns a Language selector. | | [Core\_Upgrader::upgrade()](../classes/core_upgrader/upgrade) wp-admin/includes/class-core-upgrader.php | Upgrade WordPress core. | | [Language\_Pack\_Upgrader::bulk\_upgrade()](../classes/language_pack_upgrader/bulk_upgrade) wp-admin/includes/class-language-pack-upgrader.php | Bulk upgrade language packs. | | [Plugin\_Upgrader::bulk\_upgrade()](../classes/plugin_upgrader/bulk_upgrade) wp-admin/includes/class-plugin-upgrader.php | Bulk upgrade several plugins at once. | | [Theme\_Upgrader::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::install\_package()](../classes/wp_upgrader/install_package) wp-admin/includes/class-wp-upgrader.php | Install a package. | | [WP\_Upgrader::run()](../classes/wp_upgrader/run) wp-admin/includes/class-wp-upgrader.php | Run an upgrade/installation. | | [Plugin\_Upgrader::install()](../classes/plugin_upgrader/install) wp-admin/includes/class-plugin-upgrader.php | Install a plugin package. | | [Plugin\_Upgrader::upgrade()](../classes/plugin_upgrader/upgrade) wp-admin/includes/class-plugin-upgrader.php | Upgrade a plugin. | | [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::add\_help\_tab()](../classes/wp_screen/add_help_tab) wp-admin/includes/class-wp-screen.php | Adds a help tab to the contextual help for the screen. | | [WP\_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. | | [Language\_Pack\_Upgrader\_Skin::\_\_construct()](../classes/language_pack_upgrader_skin/__construct) wp-admin/includes/class-language-pack-upgrader-skin.php | | | [Theme\_Upgrader\_Skin::\_\_construct()](../classes/theme_upgrader_skin/__construct) wp-admin/includes/class-theme-upgrader-skin.php | Constructor. | | [Plugin\_Installer\_Skin::\_\_construct()](../classes/plugin_installer_skin/__construct) wp-admin/includes/class-plugin-installer-skin.php | | | [Theme\_Installer\_Skin::\_\_construct()](../classes/theme_installer_skin/__construct) wp-admin/includes/class-theme-installer-skin.php | | | [Plugin\_Upgrader\_Skin::\_\_construct()](../classes/plugin_upgrader_skin/__construct) wp-admin/includes/class-plugin-upgrader-skin.php | Constructor. | | [Bulk\_Upgrader\_Skin::\_\_construct()](../classes/bulk_upgrader_skin/__construct) wp-admin/includes/class-bulk-upgrader-skin.php | | | [WP\_Upgrader\_Skin::\_\_construct()](../classes/wp_upgrader_skin/__construct) wp-admin/includes/class-wp-upgrader-skin.php | Constructor. | | [WP\_List\_Table::\_\_construct()](../classes/wp_list_table/__construct) wp-admin/includes/class-wp-list-table.php | Constructor. | | [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 | | [populate\_options()](populate_options) wp-admin/includes/schema.php | Create WordPress options and set the default values. | | [wp\_insert\_category()](wp_insert_category) wp-admin/includes/taxonomy.php | Updates an existing Category or creates a new Category. | | [register\_setting()](register_setting) wp-includes/option.php | Registers a setting and its data. | | [wp\_star\_rating()](wp_star_rating) wp-admin/includes/template.php | Outputs a HTML element with a star rating for a given rating. | | [add\_settings\_section()](add_settings_section) wp-admin/includes/template.php | Adds a new section to a settings page. | | [wp\_terms\_checklist()](wp_terms_checklist) wp-admin/includes/template.php | Outputs an unordered list of checkbox input elements labelled with term names. | | [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 | | | [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\_insert\_link()](wp_insert_link) wp-admin/includes/bookmark.php | Inserts a link into the database, or updates an existing link. | | [post\_tags\_meta\_box()](post_tags_meta_box) wp-admin/includes/meta-boxes.php | Displays post tags form fields. | | [post\_categories\_meta\_box()](post_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays post categories form fields. | | [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. | | [wp\_dropdown\_categories()](wp_dropdown_categories) wp-includes/category-template.php | Displays or retrieves the HTML dropdown list of categories. | | [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. | | [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. | | [get\_custom\_header()](get_custom_header) wp-includes/theme.php | Gets the header image 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. | | [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. | | [wp\_text\_diff()](wp_text_diff) wp-includes/pluggable.php | Displays a human readable HTML representation of the difference between two strings. | | [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. | | [feed\_links()](feed_links) wp-includes/general-template.php | Displays the links to the general feeds. | | [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. | | [wp\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. | | [wp\_login\_form()](wp_login_form) wp-includes/general-template.php | Provides a simple login form for use anywhere within WordPress. | | [get\_search\_form()](get_search_form) wp-includes/general-template.php | Displays search form. | | [wp\_get\_links()](wp_get_links) wp-includes/deprecated.php | Gets the links associated with category. | | [wp\_get\_linksbyname()](wp_get_linksbyname) wp-includes/deprecated.php | Gets the links associated with the named category. | | [wp\_list\_cats()](wp_list_cats) wp-includes/deprecated.php | Lists categories. | | [WP\_Query::query()](../classes/wp_query/query) wp-includes/class-wp-query.php | Sets up the WordPress query by parsing query string. | | [WP\_Query::parse\_query()](../classes/wp_query/parse_query) wp-includes/class-wp-query.php | Parse a query string and set query type booleans. | | [get\_tags()](get_tags) wp-includes/category.php | Retrieves all post tags. | | [get\_categories()](get_categories) wp-includes/category.php | Retrieves a list of category objects. | | [WP\_Http\_Streams::request()](../classes/wp_http_streams/request) wp-includes/class-wp-http-streams.php | Send a HTTP request to a URI using PHP Streams. | | [WP\_Http\_Curl::request()](../classes/wp_http_curl/request) wp-includes/class-wp-http-curl.php | Send a HTTP request to a URI using cURL extension. | | [WP\_Http::post()](../classes/wp_http/post) wp-includes/class-wp-http.php | Uses the POST HTTP method. | | [WP\_Http::get()](../classes/wp_http/get) wp-includes/class-wp-http.php | Uses the GET HTTP method. | | [WP\_Http::head()](../classes/wp_http/head) wp-includes/class-wp-http.php | Uses the HEAD HTTP method. | | [WP\_Http::request()](../classes/wp_http/request) wp-includes/class-wp-http.php | Send an HTTP request to a URI. | | [\_ajax\_wp\_die\_handler()](_ajax_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays Ajax response with an error message. | | [WP\_Widget\_Categories::form()](../classes/wp_widget_categories/form) wp-includes/widgets/class-wp-widget-categories.php | Outputs the settings form for the Categories widget. | | [WP\_Widget\_Text::update()](../classes/wp_widget_text/update) wp-includes/widgets/class-wp-widget-text.php | Handles updating settings for the current Text widget instance. | | [WP\_Widget\_Text::form()](../classes/wp_widget_text/form) wp-includes/widgets/class-wp-widget-text.php | Outputs the Text widget settings form. | | [WP\_Widget\_Calendar::form()](../classes/wp_widget_calendar/form) wp-includes/widgets/class-wp-widget-calendar.php | Outputs the settings form for the Calendar widget. | | [WP\_Widget\_Meta::form()](../classes/wp_widget_meta/form) wp-includes/widgets/class-wp-widget-meta.php | Outputs the settings form for the Meta widget. | | [WP\_Widget\_Archives::update()](../classes/wp_widget_archives/update) wp-includes/widgets/class-wp-widget-archives.php | Handles updating settings for the current Archives widget instance. | | [WP\_Widget\_Archives::form()](../classes/wp_widget_archives/form) wp-includes/widgets/class-wp-widget-archives.php | Outputs the settings form for the Archives widget. | | [WP\_Widget\_Search::form()](../classes/wp_widget_search/form) wp-includes/widgets/class-wp-widget-search.php | Outputs the settings form for the Search widget. | | [WP\_Widget\_Search::update()](../classes/wp_widget_search/update) wp-includes/widgets/class-wp-widget-search.php | Handles updating settings for the current Search widget instance. | | [WP\_Widget\_Links::form()](../classes/wp_widget_links/form) wp-includes/widgets/class-wp-widget-links.php | Outputs the settings form for the Links widget. | | [WP\_Widget\_Pages::form()](../classes/wp_widget_pages/form) wp-includes/widgets/class-wp-widget-pages.php | Outputs the settings form for the Pages widget. | | [wp\_widget\_rss\_output()](wp_widget_rss_output) wp-includes/widgets.php | Display the RSS entries in a list. | | [wp\_widget\_rss\_form()](wp_widget_rss_form) wp-includes/widgets.php | Display RSS widget options form. | | [WP\_Embed::shortcode()](../classes/wp_embed/shortcode) wp-includes/class-wp-embed.php | The [do\_shortcode()](do_shortcode) callback function. | | [the\_taxonomies()](the_taxonomies) wp-includes/taxonomy.php | Displays the taxonomies of a post with available options. | | [get\_the\_taxonomies()](get_the_taxonomies) wp-includes/taxonomy.php | Retrieves all taxonomies associated with a post. | | [wp\_update\_term()](wp_update_term) wp-includes/taxonomy.php | Updates term based on arguments provided. | | [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. | | [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. | | [wp\_count\_terms()](wp_count_terms) wp-includes/taxonomy.php | Counts how many terms are in taxonomy. | | [wp\_delete\_term()](wp_delete_term) wp-includes/taxonomy.php | Removes a term from the database. | | [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. | | [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. | | [register\_taxonomy()](register_taxonomy) wp-includes/taxonomy.php | Creates or modifies a taxonomy object. | | [get\_objects\_in\_term()](get_objects_in_term) wp-includes/taxonomy.php | Retrieves object IDs of valid taxonomy and term. | | [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\_Ajax\_Response::add()](../classes/wp_ajax_response/add) wp-includes/class-wp-ajax-response.php | Appends data to an XML response based on given arguments. | | [WP\_Admin\_Bar::add\_node()](../classes/wp_admin_bar/add_node) wp-includes/class-wp-admin-bar.php | Adds a node to the menu. | | [wp\_http\_supports()](wp_http_supports) wp-includes/http.php | Determines if there is an HTTP Transport that can process this request. | | [WP\_oEmbed::fetch()](../classes/wp_oembed/fetch) wp-includes/class-wp-oembed.php | Connects to a oEmbed provider and returns the result. | | [get\_users()](get_users) wp-includes/user.php | Retrieves list of users matching criteria. | | [wp\_dropdown\_users()](wp_dropdown_users) wp-includes/user.php | Creates dropdown HTML content of users. | | [\_walk\_bookmarks()](_walk_bookmarks) wp-includes/bookmark-template.php | The formatted output of a list of bookmarks. | | [wp\_list\_bookmarks()](wp_list_bookmarks) wp-includes/bookmark-template.php | Retrieves or echoes all of the bookmarks. | | [wp\_nav\_menu()](wp_nav_menu) wp-includes/nav-menu-template.php | Displays a navigation menu. | | [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. | | [the\_title\_attribute()](the_title_attribute) wp-includes/post-template.php | Sanitizes the current title when retrieving or displaying. | | [wp\_enqueue\_media()](wp_enqueue_media) wp-includes/media.php | Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. | | [wp\_get\_attachment\_image()](wp_get_attachment_image) wp-includes/media.php | Gets an HTML img element representing an image attachment. | | [wp\_insert\_attachment()](wp_insert_attachment) wp-includes/post.php | Inserts an attachment. | | [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). | | [wp\_get\_post\_categories()](wp_get_post_categories) wp-includes/post.php | Retrieves the list of categories for a post. | | [wp\_get\_post\_terms()](wp_get_post_terms) wp-includes/post.php | Retrieves the terms for a post. | | [wp\_get\_recent\_posts()](wp_get_recent_posts) wp-includes/post.php | Retrieves a number of recent posts. | | [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. | | [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. | | [register\_post\_status()](register_post_status) wp-includes/post.php | Registers a post status. Do not use before init. | | [WP\_Rewrite::add\_permastruct()](../classes/wp_rewrite/add_permastruct) wp-includes/class-wp-rewrite.php | Adds a new permalink structure. | | [wp\_get\_post\_revisions()](wp_get_post_revisions) wp-includes/revision.php | Returns all revisions of specified post. | | [wp\_get\_sites()](wp_get_sites) wp-includes/ms-deprecated.php | Return an array of sites for a network or networks. | | [wpmu\_create\_blog()](wpmu_create_blog) wp-includes/ms-functions.php | Creates a site. | | [get\_bookmarks()](get_bookmarks) wp-includes/bookmark.php | Retrieves the list of bookmarks. | | [wp\_list\_authors()](wp_list_authors) wp-includes/author-template.php | Lists all the authors of the site, with several options available. | | [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. | | [wp\_get\_nav\_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\_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\_Widget::display\_callback()](../classes/wp_widget/display_callback) wp-includes/class-wp-widget.php | Generates the actual widget content (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). | | [WP\_Widget::\_\_construct()](../classes/wp_widget/__construct) wp-includes/class-wp-widget.php | PHP5 constructor. | | [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. | | [wp\_register\_sidebar\_widget()](wp_register_sidebar_widget) wp-includes/widgets.php | Register an instance of a widget. | | [wp\_register\_widget\_control()](wp_register_widget_control) wp-includes/widgets.php | Registers widget control callback for customizing options. | | [\_register\_widget\_form\_callback()](_register_widget_form_callback) wp-includes/widgets.php | Registers the form callback for a widget. | | [get\_post\_reply\_link()](get_post_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to post link. | | [wp\_list\_comments()](wp_list_comments) wp-includes/comment-template.php | Displays a list of comments. | | [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. | | [get\_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\_Comment\_Query::query()](../classes/wp_comment_query/query) wp-includes/class-wp-comment-query.php | Sets up the WordPress query for retrieving comments. | | [get\_page\_of\_comment()](get_page_of_comment) wp-includes/comment.php | Calculates what page number a comment will appear on for comment paging. | | [register\_meta()](register_meta) wp-includes/meta.php | Registers a meta key. | | [get\_approved\_comments()](get_approved_comments) wp-includes/comment.php | Retrieves the approved comments for a post. | | [\_WP\_Editors::parse\_settings()](../classes/_wp_editors/parse_settings) wp-includes/class-wp-editor.php | Parse default arguments for the editor instance. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | `$args` can now also be an object. | | [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
programming_docs
wordpress wp_rel_callback( array $matches, string $rel ): string wp\_rel\_callback( array $matches, string $rel ): string ======================================================== Callback to add a rel attribute to HTML A element. Will remove already existing string before adding to prevent invalidating (X)HTML. `$matches` array Required Single match. `$rel` string Required The rel attribute to add. string HTML A element with the added rel attribute. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function wp_rel_callback( $matches, $rel ) { $text = $matches[1]; $atts = wp_kses_hair( $matches[1], wp_allowed_protocols() ); if ( ! empty( $atts['href'] ) ) { if ( in_array( strtolower( wp_parse_url( $atts['href']['value'], PHP_URL_SCHEME ) ), array( 'http', 'https' ), true ) ) { if ( strtolower( wp_parse_url( $atts['href']['value'], PHP_URL_HOST ) ) === strtolower( wp_parse_url( home_url(), PHP_URL_HOST ) ) ) { return "<a $text>"; } } } if ( ! empty( $atts['rel'] ) ) { $parts = array_map( 'trim', explode( ' ', $atts['rel']['value'] ) ); $rel_array = array_map( 'trim', explode( ' ', $rel ) ); $parts = array_unique( array_merge( $parts, $rel_array ) ); $rel = implode( ' ', $parts ); unset( $atts['rel'] ); $html = ''; foreach ( $atts as $name => $value ) { if ( isset( $value['vless'] ) && 'y' === $value['vless'] ) { $html .= $name . ' '; } else { $html .= "{$name}=\"" . esc_attr( $value['value'] ) . '" '; } } $text = trim( $html ); } return "<a $text rel=\"" . esc_attr( $rel ) . '">'; } ``` | 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. | | [wp\_kses\_hair()](wp_kses_hair) wp-includes/kses.php | Builds an attribute list from string containing attributes. | | [wp\_allowed\_protocols()](wp_allowed_protocols) wp-includes/functions.php | Retrieves a list of protocols to allow in HTML attributes. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [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 | | --- | --- | | [wp\_rel\_ugc()](wp_rel_ugc) wp-includes/formatting.php | Adds `rel="nofollow ugc"` string to all HTML A elements in content. | | [wp\_rel\_nofollow()](wp_rel_nofollow) wp-includes/formatting.php | Adds `rel="nofollow"` string to all HTML A elements in content. | | [wp\_rel\_nofollow\_callback()](wp_rel_nofollow_callback) wp-includes/formatting.php | Callback to add `rel="nofollow"` string to HTML A element. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. | wordpress _search_terms_tidy( string $t ): string \_search\_terms\_tidy( string $t ): 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. Formerly used internally to tidy up the search terms. `$t` string Required Search terms to "tidy", e.g. trim. string Trimmed search terms. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function _search_terms_tidy( $t ) { _deprecated_function( __FUNCTION__, '3.7.0' ); return trim( $t, "\"'\n\r " ); } ``` | 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.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress the_permalink_rss() the\_permalink\_rss() ===================== Displays the permalink to the post for use in feeds. File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/) ``` function the_permalink_rss() { /** * Filters the permalink to the post for use in feeds. * * @since 2.3.0 * * @param string $post_permalink The current post permalink. */ echo esc_url( apply_filters( 'the_permalink_rss', get_permalink() ) ); } ``` [apply\_filters( 'the\_permalink\_rss', string $post\_permalink )](../hooks/the_permalink_rss) Filters the permalink to the post for use in feeds. | Uses | Description | | --- | --- | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. | | [permalink\_single\_rss()](permalink_single_rss) wp-includes/deprecated.php | Print the permalink to the RSS feed. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress do_all_pingbacks() do\_all\_pingbacks() ==================== Performs all pingbacks. File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/) ``` function do_all_pingbacks() { $pings = get_posts( array( 'post_type' => get_post_types(), 'suppress_filters' => false, 'nopaging' => true, 'meta_key' => '_pingme', 'fields' => 'ids', ) ); foreach ( $pings as $ping ) { delete_post_meta( $ping, '_pingme' ); pingback( null, $ping ); } } ``` | Uses | Description | | --- | --- | | [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. | | [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. | | [pingback()](pingback) wp-includes/comment.php | Pings back the links found in a post. | | [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. | | Version | Description | | --- | --- | | [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. | wordpress wp_get_update_https_url(): string wp\_get\_update\_https\_url(): string ===================================== Gets the URL to learn more about updating the site to use HTTPS. This URL can be overridden by specifying an environment variable `WP_UPDATE_HTTPS_URL` or by using the [‘wp\_update\_https\_url’](../hooks/wp_update_https_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 to HTTPS. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp_get_update_https_url() { $default_url = wp_get_default_update_https_url(); $update_url = $default_url; if ( false !== getenv( 'WP_UPDATE_HTTPS_URL' ) ) { $update_url = getenv( 'WP_UPDATE_HTTPS_URL' ); } /** * Filters the URL to learn more about updating the HTTPS 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.7.0 * * @param string $update_url URL to learn more about updating HTTPS. */ $update_url = apply_filters( 'wp_update_https_url', $update_url ); if ( empty( $update_url ) ) { $update_url = $default_url; } return $update_url; } ``` [apply\_filters( 'wp\_update\_https\_url', string $update\_url )](../hooks/wp_update_https_url) Filters the URL to learn more about updating the HTTPS version the site is running on. | Uses | Description | | --- | --- | | [wp\_get\_default\_update\_https\_url()](wp_get_default_update_https_url) wp-includes/functions.php | Gets the default URL to learn more about updating the site to use HTTPS. | | [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 add_thickbox() add\_thickbox() =============== Enqueues the default ThickBox js and css. If any of the settings need to be changed, this can be done with another js file similar to media-upload.js. That file should require array(‘thickbox’) to ensure it is loaded after. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function add_thickbox() { wp_enqueue_script( 'thickbox' ); wp_enqueue_style( 'thickbox' ); if ( is_network_admin() ) { add_action( 'admin_head', '_thickbox_path_admin_subfolder' ); } } ``` | Uses | Description | | --- | --- | | [is\_network\_admin()](is_network_admin) wp-includes/load.php | Determines whether the current request is for the network administrative interface. | | [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. | | [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. | | [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. | | Used By | Description | | --- | --- | | [\_WP\_Editors::enqueue\_scripts()](../classes/_wp_editors/enqueue_scripts) wp-includes/class-wp-editor.php | | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress register_block_style_handle( array $metadata, string $field_name, int $index ): string|false register\_block\_style\_handle( array $metadata, string $field\_name, int $index ): string|false ================================================================================================ 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. `$metadata` array Required Block metadata. `$field_name` string Required Field name to pick from metadata. `$index` int Optional Index of the style to register when multiple items passed. Default 0. string|false Style handle provided directly or created through style's registration, or false on failure. File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/) ``` function register_block_style_handle( $metadata, $field_name, $index = 0 ) { if ( empty( $metadata[ $field_name ] ) ) { return false; } static $wpinc_path_norm = ''; if ( ! $wpinc_path_norm ) { $wpinc_path_norm = wp_normalize_path( realpath( ABSPATH . WPINC ) ); } $is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], $wpinc_path_norm ); // Skip registering individual styles for each core block when a bundled version provided. if ( $is_core_block && ! wp_should_load_separate_core_block_assets() ) { return false; } $style_handle = $metadata[ $field_name ]; if ( is_array( $style_handle ) ) { if ( empty( $style_handle[ $index ] ) ) { return false; } $style_handle = $style_handle[ $index ]; } $style_path = remove_block_asset_path_prefix( $style_handle ); $is_style_handle = $style_handle === $style_path; // Allow only passing style handles for core blocks. if ( $is_core_block && ! $is_style_handle ) { return false; } // Return the style handle unless it's the first item for every core block that requires special treatment. if ( $is_style_handle && ! ( $is_core_block && 0 === $index ) ) { return $style_handle; } // Check whether styles should have a ".min" suffix or not. $suffix = SCRIPT_DEBUG ? '' : '.min'; if ( $is_core_block ) { $style_path = "style$suffix.css"; } $style_path_norm = wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $style_path ) ); $has_style_file = '' !== $style_path_norm; if ( $has_style_file ) { $style_uri = plugins_url( $style_path, $metadata['file'] ); // Cache $theme_path_norm to avoid calling get_theme_file_path() multiple times. static $theme_path_norm = ''; if ( ! $theme_path_norm ) { $theme_path_norm = wp_normalize_path( get_theme_file_path() ); } $is_theme_block = str_starts_with( $style_path_norm, $theme_path_norm ); if ( $is_theme_block ) { $style_uri = get_theme_file_uri( str_replace( $theme_path_norm, '', $style_path_norm ) ); } elseif ( $is_core_block ) { $style_uri = includes_url( 'blocks/' . str_replace( 'core/', '', $metadata['name'] ) . "/style$suffix.css" ); } } else { $style_uri = false; } $style_handle = generate_block_asset_handle( $metadata['name'], $field_name, $index ); $version = ! $is_core_block && isset( $metadata['version'] ) ? $metadata['version'] : false; $result = wp_register_style( $style_handle, $style_uri, array(), $version ); if ( ! $result ) { return false; } if ( $has_style_file ) { wp_style_add_data( $style_handle, 'path', $style_path_norm ); $rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $style_path_norm ); if ( is_rtl() && file_exists( $rtl_file ) ) { wp_style_add_data( $style_handle, 'rtl', 'replace' ); wp_style_add_data( $style_handle, 'suffix', $suffix ); wp_style_add_data( $style_handle, 'path', $rtl_file ); } } return $style_handle; } ``` | Uses | Description | | --- | --- | | [wp\_should\_load\_separate\_core\_block\_assets()](wp_should_load_separate_core_block_assets) wp-includes/script-loader.php | Checks whether separate styles should be loaded for core blocks on-render. | | [generate\_block\_asset\_handle()](generate_block_asset_handle) wp-includes/blocks.php | Generates the name for an asset based on the name of the block and the field name provided. | | [remove\_block\_asset\_path\_prefix()](remove_block_asset_path_prefix) wp-includes/blocks.php | Removes the block asset’s path prefix if provided. | | [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\_normalize\_path()](wp_normalize_path) wp-includes/functions.php | Normalizes a filesystem path. | | [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). | | [plugins\_url()](plugins_url) wp-includes/link-template.php | Retrieves a URL within the plugins or mu-plugins directory. | | [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. | | [wp\_register\_style()](wp_register_style) wp-includes/functions.wp-styles.php | Register a CSS stylesheet. | | [wp\_style\_add\_data()](wp_style_add_data) wp-includes/functions.wp-styles.php | Add metadata to a CSS stylesheet. | | 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 | | --- | --- | | [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Added `$index` parameter. | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. | wordpress rest_add_application_passwords_to_index( WP_REST_Response $response ): WP_REST_Response rest\_add\_application\_passwords\_to\_index( WP\_REST\_Response $response ): WP\_REST\_Response ================================================================================================ Adds Application Passwords info to the REST API index. `$response` [WP\_REST\_Response](../classes/wp_rest_response) Required The index response object. [WP\_REST\_Response](../classes/wp_rest_response) File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_add_application_passwords_to_index( $response ) { if ( ! wp_is_application_passwords_available() ) { return $response; } $response->data['authentication']['application-passwords'] = array( 'endpoints' => array( 'authorization' => admin_url( 'authorize-application.php' ), ), ); return $response; } ``` | Uses | Description | | --- | --- | | [wp\_is\_application\_passwords\_available()](wp_is_application_passwords_available) wp-includes/user.php | Checks if Application Passwords is globally available. | | [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. | | Version | Description | | --- | --- | | [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. | wordpress wp_register_style( string $handle, string|false $src, string[] $deps = array(), string|bool|null $ver = false, string $media = 'all' ): bool wp\_register\_style( string $handle, string|false $src, string[] $deps = array(), string|bool|null $ver = false, string $media = 'all' ): bool ============================================================================================================================================== Register a CSS stylesheet. * [WP\_Dependencies::add()](../classes/wp_dependencies/add) `$handle` string Required Name of the stylesheet. Should be unique. `$src` string|false Required Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory. If source is set to false, stylesheet is an alias of other stylesheets it depends on. `$deps` string[] Optional An array of registered stylesheet handles this stylesheet depends on. Default: `array()` `$ver` string|bool|null Optional String specifying stylesheet version number, if it has one, which is added to the URL as a query string for cache busting purposes. If version is set to false, a version number is automatically added equal to current installed WordPress version. If set to null, no version is added. Default: `false` `$media` string Optional The media for which this stylesheet has been defined. Default `'all'`. Accepts media types like `'all'`, `'print'` and `'screen'`, or media queries like '(orientation: portrait)' and '(max-width: 640px)'. Default: `'all'` bool Whether the style has been registered. True on success, false on failure. File: `wp-includes/functions.wp-styles.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-styles.php/) ``` function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); return wp_styles()->add( $handle, $src, $deps, $ver, $media ); } ``` | Uses | Description | | --- | --- | | [wp\_styles()](wp_styles) wp-includes/functions.wp-styles.php | Initialize $wp\_styles if it has not been set. | | Used By | Description | | --- | --- | | [wp\_enqueue\_classic\_theme\_styles()](wp_enqueue_classic_theme_styles) wp-includes/script-loader.php | Loads classic theme styles on classic themes in the frontend. | | [wp\_enqueue\_stored\_styles()](wp_enqueue_stored_styles) wp-includes/script-loader.php | Fetches, processes and compiles stored core styles, then combines and renders them to the page. | | [\_wp\_theme\_json\_webfonts\_handler()](_wp_theme_json_webfonts_handler) wp-includes/script-loader.php | Runs the theme.json webfonts handler. | | [wp\_enqueue\_global\_styles\_css\_custom\_properties()](wp_enqueue_global_styles_css_custom_properties) wp-includes/script-loader.php | Function that enqueues the CSS Custom Properties coming from theme.json. | | [wp\_enqueue\_block\_style()](wp_enqueue_block_style) wp-includes/script-loader.php | Enqueues a stylesheet for a specific block. | | [wp\_enqueue\_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. | | Version | Description | | --- | --- | | [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | A return value was added. | | [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
programming_docs
wordpress core_auto_updates_settings() core\_auto\_updates\_settings() =============================== Display WordPress auto-updates settings. File: `wp-admin/update-core.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/update-core.php/) ``` function core_auto_updates_settings() { if ( isset( $_GET['core-major-auto-updates-saved'] ) ) { if ( 'enabled' === $_GET['core-major-auto-updates-saved'] ) { $notice_text = __( 'Automatic updates for all WordPress versions have been enabled. Thank you!' ); echo '<div class="notice notice-success is-dismissible"><p>' . $notice_text . '</p></div>'; } elseif ( 'disabled' === $_GET['core-major-auto-updates-saved'] ) { $notice_text = __( 'WordPress will only receive automatic security and maintenance releases from now on.' ); echo '<div class="notice notice-success is-dismissible"><p>' . $notice_text . '</p></div>'; } } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $updater = new WP_Automatic_Updater(); // Defaults: $upgrade_dev = get_site_option( 'auto_update_core_dev', 'enabled' ) === 'enabled'; $upgrade_minor = get_site_option( 'auto_update_core_minor', 'enabled' ) === 'enabled'; $upgrade_major = get_site_option( 'auto_update_core_major', 'unset' ) === 'enabled'; $can_set_update_option = true; // WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'development', 'branch-development', 'minor', false. if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { if ( false === WP_AUTO_UPDATE_CORE ) { // Defaults to turned off, unless a filter allows it. $upgrade_dev = false; $upgrade_minor = false; $upgrade_major = false; } elseif ( true === WP_AUTO_UPDATE_CORE || in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true ) ) { // ALL updates for core. $upgrade_dev = true; $upgrade_minor = true; $upgrade_major = true; } elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) { // Only minor updates for core. $upgrade_dev = false; $upgrade_minor = true; $upgrade_major = false; } // The UI is overridden by the `WP_AUTO_UPDATE_CORE` constant. $can_set_update_option = false; } if ( $updater->is_disabled() ) { $upgrade_dev = false; $upgrade_minor = false; $upgrade_major = false; /* * The UI is overridden by the `AUTOMATIC_UPDATER_DISABLED` constant * or the `automatic_updater_disabled` filter, * or by `wp_is_file_mod_allowed( 'automatic_updater' )`. * See `WP_Automatic_Updater::is_disabled()`. */ $can_set_update_option = false; } // Is the UI overridden by a plugin using the `allow_major_auto_core_updates` filter? if ( has_filter( 'allow_major_auto_core_updates' ) ) { $can_set_update_option = false; } /** This filter is documented in wp-admin/includes/class-core-upgrader.php */ $upgrade_dev = apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev ); /** This filter is documented in wp-admin/includes/class-core-upgrader.php */ $upgrade_minor = apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor ); /** This filter is documented in wp-admin/includes/class-core-upgrader.php */ $upgrade_major = apply_filters( 'allow_major_auto_core_updates', $upgrade_major ); $auto_update_settings = array( 'dev' => $upgrade_dev, 'minor' => $upgrade_minor, 'major' => $upgrade_major, ); if ( $upgrade_major ) { $wp_version = get_bloginfo( 'version' ); $updates = get_core_updates(); if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { echo '<p>' . wp_get_auto_update_message() . '</p>'; } } $action_url = self_admin_url( 'update-core.php?action=core-major-auto-updates-settings' ); ?> <p class="auto-update-status"> <?php if ( $updater->is_vcs_checkout( ABSPATH ) ) { _e( 'This site appears to be under version control. Automatic updates are disabled.' ); } elseif ( $upgrade_major ) { _e( 'This site is automatically kept up to date with each new version of WordPress.' ); if ( $can_set_update_option ) { echo '<br>'; printf( '<a href="%s" class="core-auto-update-settings-link core-auto-update-settings-link-disable">%s</a>', wp_nonce_url( add_query_arg( 'value', 'disable', $action_url ), 'core-major-auto-updates-nonce' ), __( 'Switch to automatic updates for maintenance and security releases only.' ) ); } } elseif ( $upgrade_minor ) { _e( 'This site is automatically kept up to date with maintenance and security releases of WordPress only.' ); if ( $can_set_update_option ) { echo '<br>'; printf( '<a href="%s" class="core-auto-update-settings-link core-auto-update-settings-link-enable">%s</a>', wp_nonce_url( add_query_arg( 'value', 'enable', $action_url ), 'core-major-auto-updates-nonce' ), __( 'Enable automatic updates for all new versions of WordPress.' ) ); } } else { _e( 'This site will not receive automatic updates for new versions of WordPress.' ); } ?> </p> <?php /** * Fires after the major core auto-update settings. * * @since 5.6.0 * * @param array $auto_update_settings { * Array of core auto-update settings. * * @type bool $dev Whether to enable automatic updates for development versions. * @type bool $minor Whether to enable minor automatic core updates. * @type bool $major Whether to enable major automatic core updates. * } */ do_action( 'after_core_auto_updates_settings', $auto_update_settings ); } ``` [do\_action( 'after\_core\_auto\_updates\_settings', array $auto\_update\_settings )](../hooks/after_core_auto_updates_settings) Fires after the major core auto-update settings. [apply\_filters( 'allow\_dev\_auto\_core\_updates', bool $upgrade\_dev )](../hooks/allow_dev_auto_core_updates) Filters whether to enable automatic core updates for development versions. [apply\_filters( 'allow\_major\_auto\_core\_updates', bool $upgrade\_major )](../hooks/allow_major_auto_core_updates) Filters whether to enable major automatic core updates. [apply\_filters( 'allow\_minor\_auto\_core\_updates', bool $upgrade\_minor )](../hooks/allow_minor_auto_core_updates) Filters whether to enable minor automatic core updates. | Uses | Description | | --- | --- | | [wp\_get\_auto\_update\_message()](wp_get_auto_update_message) wp-admin/includes/update.php | Determines the appropriate auto-update message to be displayed. | | [get\_core\_updates()](get_core_updates) wp-admin/includes/update.php | Gets available core updates. | | [self\_admin\_url()](self_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for either the current site or the network depending on context. | | [has\_filter()](has_filter) wp-includes/plugin.php | Checks if any filter has been registered for a hook. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | [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. | | [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\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. | | Version | Description | | --- | --- | | [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. | wordpress the_post() the\_post() =========== Iterate the post index in the loop. **Basic Usage** ``` if ( have_posts() ) { while ( have_posts() ) { the_post(); ?> <h2><?php the_title(); ?></h2> <?php the_content(); ?> <?php } } ``` File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/) ``` function the_post() { global $wp_query; if ( ! isset( $wp_query ) ) { return; } $wp_query->the_post(); } ``` | Uses | Description | | --- | --- | | [WP\_Query::the\_post()](../classes/wp_query/the_post) wp-includes/class-wp-query.php | Sets up the current post. | | Used By | Description | | --- | --- | | [WP\_Media\_List\_Table::display\_rows()](../classes/wp_media_list_table/display_rows) wp-admin/includes/class-wp-media-list-table.php | | | Version | Description | | --- | --- | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress wp_generate_attachment_metadata( int $attachment_id, string $file ): array wp\_generate\_attachment\_metadata( int $attachment\_id, string $file ): array ============================================================================== Generates attachment meta data and create image sub-sizes for images. `$attachment_id` int Required Attachment ID to process. `$file` string Required Filepath of the attached image. array Metadata for attachment. This function generates metadata for an image attachment. It also creates a thumbnail and other intermediate sizes of the image attachment based on the sizes defined on the [Settings\_Media\_Screen](https://wordpress.org/support/article/settings-media-screen/ "Settings Media Screen"). Parameter `$file` is the location of the file on the server. Use absolute path and not the URI of the file. The file MUST be in the uploads directory. See [wp\_upload\_dir()](wp_upload_dir) . This function returns array of attachment metadata in the format required by [wp\_update\_attachment\_metadata()](wp_update_attachment_metadata) . The elements returned in the array are: ["width"] (*string*) Horizontal size of image attachment, in pixels. ["height"] (*string*) Vertical size of image attachment, in pixels. ["file"] (*string*) Path to image attachment, relative to the currently configured uploads directory. ["hwstring\_small"] (*string*) Height/width string for HTML img tag used to display the Small size of this image. For example: height='96' width='126' ["sizes"]["thumbnail"]["file"] (*string*) File name of Thumbnail-sized copy of image attachment. ["sizes"]["thumbnail"]["width"] (*string*) Horizontal size of Thumbnail-sized copy of image attachment, in pixels. ["sizes"]["thumbnail"]["height"] (*string*) Vertical size of Thumbnail-sized copy of image attachment, in pixels. ["sizes"]["medium"] (*array*) Same three elements as ["sizes"]["thumbnail"] but for Medium-sized copy of image attachment. ["sizes"]["large"] (*array*) Same three elements as ["sizes"]["thumbnail"] but for Large-sized copy of image attachment. ["sizes"]["post-thumbnail"] (*array*) Same three elements as ["sizes"]["thumbnail"] but for Post Thumbnail-sized copy of image attachment. ["sizes"]["large-feature"] (*array*) Same three elements as ["sizes"]["thumbnail"] but for Large Feature-sized copy of image attachment. ["sizes"]["small-feature"] (*array*) Same three elements as ["sizes"]["thumbnail"] but for Small Feature-sized copy of image attachment. ["image\_meta"] (*array*) Image attachment Metadata returned by [wp\_read\_image\_metadata()](wp_read_image_metadata) This function can be used to regenerate thumbnail and intermediate sizes of the image after changes have been made on the [Settings\_Media\_Screen](https://wordpress.org/support/article/settings-media-screen/ "Settings Media Screen") but it does not check or delete intermediate sizes it previously created for the same image. Thumbnail and intermediate sizes of the image, and [“sizes”] elements in the array returned by this function, are only generated when the intermediate size is smaller than the size of the image. The function should be used in conjunction with [wp\_update\_attachment\_metadata()](wp_update_attachment_metadata) . If this function is undefined in the environment where it is to be used, such as within a Shortcode, use the include function: ``` if ( ! function_exists( 'wp_crop_image' ) ) { include( ABSPATH . 'wp-admin/includes/image.php' ); } ``` File: `wp-admin/includes/image.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image.php/) ``` function wp_generate_attachment_metadata( $attachment_id, $file ) { $attachment = get_post( $attachment_id ); $metadata = array(); $support = false; $mime_type = get_post_mime_type( $attachment ); if ( preg_match( '!^image/!', $mime_type ) && file_is_displayable_image( $file ) ) { // Make thumbnails and other intermediate sizes. $metadata = wp_create_image_subsizes( $file, $attachment_id ); } elseif ( wp_attachment_is( 'video', $attachment ) ) { $metadata = wp_read_video_metadata( $file ); $support = current_theme_supports( 'post-thumbnails', 'attachment:video' ) || post_type_supports( 'attachment:video', 'thumbnail' ); } elseif ( wp_attachment_is( 'audio', $attachment ) ) { $metadata = wp_read_audio_metadata( $file ); $support = current_theme_supports( 'post-thumbnails', 'attachment:audio' ) || post_type_supports( 'attachment:audio', 'thumbnail' ); } /* * wp_read_video_metadata() and wp_read_audio_metadata() return `false` * if the attachment does not exist in the local filesystem, * so make sure to convert the value to an array. */ if ( ! is_array( $metadata ) ) { $metadata = array(); } if ( $support && ! empty( $metadata['image']['data'] ) ) { // Check for existing cover. $hash = md5( $metadata['image']['data'] ); $posts = get_posts( array( 'fields' => 'ids', 'post_type' => 'attachment', 'post_mime_type' => $metadata['image']['mime'], 'post_status' => 'inherit', 'posts_per_page' => 1, 'meta_key' => '_cover_hash', 'meta_value' => $hash, ) ); $exists = reset( $posts ); if ( ! empty( $exists ) ) { update_post_meta( $attachment_id, '_thumbnail_id', $exists ); } else { $ext = '.jpg'; switch ( $metadata['image']['mime'] ) { case 'image/gif': $ext = '.gif'; break; case 'image/png': $ext = '.png'; break; case 'image/webp': $ext = '.webp'; break; } $basename = str_replace( '.', '-', wp_basename( $file ) ) . '-image' . $ext; $uploaded = wp_upload_bits( $basename, '', $metadata['image']['data'] ); if ( false === $uploaded['error'] ) { $image_attachment = array( 'post_mime_type' => $metadata['image']['mime'], 'post_type' => 'attachment', 'post_content' => '', ); /** * Filters the parameters for the attachment thumbnail creation. * * @since 3.9.0 * * @param array $image_attachment An array of parameters to create the thumbnail. * @param array $metadata Current attachment metadata. * @param array $uploaded { * Information about the newly-uploaded file. * * @type string $file Filename of the newly-uploaded file. * @type string $url URL of the uploaded file. * @type string $type File type. * } */ $image_attachment = apply_filters( 'attachment_thumbnail_args', $image_attachment, $metadata, $uploaded ); $sub_attachment_id = wp_insert_attachment( $image_attachment, $uploaded['file'] ); add_post_meta( $sub_attachment_id, '_cover_hash', $hash ); $attach_data = wp_generate_attachment_metadata( $sub_attachment_id, $uploaded['file'] ); wp_update_attachment_metadata( $sub_attachment_id, $attach_data ); update_post_meta( $attachment_id, '_thumbnail_id', $sub_attachment_id ); } } } elseif ( 'application/pdf' === $mime_type ) { // Try to create image thumbnails for PDFs. $fallback_sizes = array( 'thumbnail', 'medium', 'large', ); /** * Filters the image sizes generated for non-image mime types. * * @since 4.7.0 * * @param string[] $fallback_sizes An array of image size names. * @param array $metadata Current attachment metadata. */ $fallback_sizes = apply_filters( 'fallback_intermediate_image_sizes', $fallback_sizes, $metadata ); $registered_sizes = wp_get_registered_image_subsizes(); $merged_sizes = array_intersect_key( $registered_sizes, array_flip( $fallback_sizes ) ); // Force thumbnails to be soft crops. if ( isset( $merged_sizes['thumbnail'] ) && is_array( $merged_sizes['thumbnail'] ) ) { $merged_sizes['thumbnail']['crop'] = false; } // Only load PDFs in an image editor if we're processing sizes. if ( ! empty( $merged_sizes ) ) { $editor = wp_get_image_editor( $file ); if ( ! is_wp_error( $editor ) ) { // No support for this type of file. /* * PDFs may have the same file filename as JPEGs. * Ensure the PDF preview image does not overwrite any JPEG images that already exist. */ $dirname = dirname( $file ) . '/'; $ext = '.' . pathinfo( $file, PATHINFO_EXTENSION ); $preview_file = $dirname . wp_unique_filename( $dirname, wp_basename( $file, $ext ) . '-pdf.jpg' ); $uploaded = $editor->save( $preview_file, 'image/jpeg' ); unset( $editor ); // Resize based on the full size image, rather than the source. if ( ! is_wp_error( $uploaded ) ) { $image_file = $uploaded['path']; unset( $uploaded['path'] ); $metadata['sizes'] = array( 'full' => $uploaded, ); // Save the meta data before any image post-processing errors could happen. wp_update_attachment_metadata( $attachment_id, $metadata ); // Create sub-sizes saving the image meta after each. $metadata = _wp_make_subsizes( $merged_sizes, $image_file, $metadata, $attachment_id ); } } } } // Remove the blob of binary data from the array. unset( $metadata['image']['data'] ); // Capture file size for cases where it has not been captured yet, such as PDFs. if ( ! isset( $metadata['filesize'] ) && file_exists( $file ) ) { $metadata['filesize'] = wp_filesize( $file ); } /** * Filters the generated attachment meta data. * * @since 2.1.0 * @since 5.3.0 The `$context` parameter was added. * * @param array $metadata An array of attachment meta data. * @param int $attachment_id Current attachment ID. * @param string $context Additional context. Can be 'create' when metadata was initially created for new attachment * or 'update' when the metadata was updated. */ return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id, 'create' ); } ``` [apply\_filters( 'attachment\_thumbnail\_args', array $image\_attachment, array $metadata, array $uploaded )](../hooks/attachment_thumbnail_args) Filters the parameters for the attachment thumbnail creation. [apply\_filters( 'fallback\_intermediate\_image\_sizes', string[] $fallback\_sizes, array $metadata )](../hooks/fallback_intermediate_image_sizes) Filters the image sizes generated for non-image mime types. [apply\_filters( 'wp\_generate\_attachment\_metadata', array $metadata, int $attachment\_id, string $context )](../hooks/wp_generate_attachment_metadata) Filters the generated attachment meta data. | Uses | Description | | --- | --- | | [wp\_filesize()](wp_filesize) wp-includes/functions.php | Wrapper for PHP filesize with filters and casting the result as an integer. | | [wp\_get\_registered\_image\_subsizes()](wp_get_registered_image_subsizes) wp-includes/media.php | Returns a normalized list of all currently registered image sub-sizes. | | [get\_post\_mime\_type()](get_post_mime_type) wp-includes/post.php | Retrieves the mime type of an attachment based on the ID. | | [add\_post\_meta()](add_post_meta) wp-includes/post.php | Adds a meta field to the given post. | | [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. | | [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. | | [post\_type\_supports()](post_type_supports) wp-includes/post.php | Checks a post type’s support for a given feature. | | [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\_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\_unique\_filename()](wp_unique_filename) wp-includes/functions.php | Gets a filename that is sanitized and unique for the given directory. | | [wp\_upload\_bits()](wp_upload_bits) wp-includes/functions.php | Creates a file in the upload folder with given content. | | [wp\_read\_audio\_metadata()](wp_read_audio_metadata) wp-admin/includes/media.php | Retrieves metadata from an audio file’s ID3 tags. | | [wp\_read\_video\_metadata()](wp_read_video_metadata) wp-admin/includes/media.php | Retrieves metadata from a video file’s ID3 tags. | | [wp\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. | | [file\_is\_displayable\_image()](file_is_displayable_image) wp-admin/includes/image.php | Validates that file is suitable for displaying within a web page. | | [wp\_attachment\_is()](wp_attachment_is) wp-includes/post.php | Verifies an attachment is of a given type. | | [\_wp\_make\_subsizes()](_wp_make_subsizes) wp-admin/includes/image.php | Low-level function to create image sub-sizes. | | [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\_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. | | [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [WP\_REST\_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\_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\_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) . | | [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 | | --- | --- | | [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | The `$filesize` value was added to the returned array. | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
programming_docs
wordpress get_parent_theme_file_path( string $file = '' ): string get\_parent\_theme\_file\_path( string $file = '' ): string =========================================================== Retrieves the path of a file in the parent theme. `$file` string Optional File to return the path for in the template directory. Default: `''` string The path of the file. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function get_parent_theme_file_path( $file = '' ) { $file = ltrim( $file, '/' ); if ( empty( $file ) ) { $path = get_template_directory(); } else { $path = get_template_directory() . '/' . $file; } /** * Filters the path to a file in the parent theme. * * @since 4.7.0 * * @param string $path The file path. * @param string $file The requested file to search for. */ return apply_filters( 'parent_theme_file_path', $path, $file ); } ``` [apply\_filters( 'parent\_theme\_file\_path', string $path, string $file )](../hooks/parent_theme_file_path) Filters the path to a file in the parent theme. | Uses | Description | | --- | --- | | [get\_template\_directory()](get_template_directory) wp-includes/theme.php | Retrieves template directory path for the active theme. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Version | Description | | --- | --- | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. | wordpress serialize_block_attributes( array $block_attributes ): string serialize\_block\_attributes( array $block\_attributes ): string ================================================================ Given an array of attributes, returns a string in the serialized attributes format prepared for post content. The serialized result is a JSON-encoded string, with unicode escape sequence substitution for characters which might otherwise interfere with embedding the result in an HTML comment. This function must produce output that remains in sync with the output of the serializeAttributes JavaScript function in the block editor in order to ensure consistent operation between PHP and JavaScript. `$block_attributes` array Required Attributes object. string Serialized attributes. File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/) ``` function serialize_block_attributes( $block_attributes ) { $encoded_attributes = wp_json_encode( $block_attributes, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); $encoded_attributes = preg_replace( '/--/', '\\u002d\\u002d', $encoded_attributes ); $encoded_attributes = preg_replace( '/</', '\\u003c', $encoded_attributes ); $encoded_attributes = preg_replace( '/>/', '\\u003e', $encoded_attributes ); $encoded_attributes = preg_replace( '/&/', '\\u0026', $encoded_attributes ); // Regex: /\\"/ $encoded_attributes = preg_replace( '/\\\\"/', '\\u0022', $encoded_attributes ); return $encoded_attributes; } ``` | Uses | Description | | --- | --- | | [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. | | Used By | Description | | --- | --- | | [get\_comment\_delimited\_block\_content()](get_comment_delimited_block_content) wp-includes/blocks.php | Returns the content of a block, including comment delimiters. | | Version | Description | | --- | --- | | [5.3.1](https://developer.wordpress.org/reference/since/5.3.1/) | Introduced. | wordpress request_filesystem_credentials( string $form_post, string $type = '', bool|WP_Error $error = false, string $context = '', array $extra_fields = null, bool $allow_relaxed_file_ownership = false ): bool|array request\_filesystem\_credentials( string $form\_post, string $type = '', bool|WP\_Error $error = false, string $context = '', array $extra\_fields = null, bool $allow\_relaxed\_file\_ownership = false ): bool|array ====================================================================================================================================================================================================================== Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. All chosen/entered details are saved, excluding the password. Hostnames may be in the form of hostname:portnumber (eg: wordpress.org:2467) to specify an alternate FTP/SSH port. Plugins may override this form by returning true|false via the [‘request\_filesystem\_credentials’](../hooks/request_filesystem_credentials) filter. `$form_post` string Required The URL to post the form to. `$type` string Optional Chosen type of filesystem. Default: `''` `$error` bool|[WP\_Error](../classes/wp_error) Optional Whether the current request has failed to connect, or an error object. Default: `false` `$context` string Optional Full path to the directory that is tested for being writable. Default: `''` `$extra_fields` array Optional Extra `POST` fields to be checked for inclusion in the post. Default: `null` `$allow_relaxed_file_ownership` bool Optional Whether to allow Group/World writable. Default: `false` bool|array True if no filesystem credentials are required, false if they are required but have not been provided, array of credentials if they are required and have been provided. File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/) ``` function request_filesystem_credentials( $form_post, $type = '', $error = false, $context = '', $extra_fields = null, $allow_relaxed_file_ownership = false ) { global $pagenow; /** * Filters the filesystem credentials. * * Returning anything other than an empty string will effectively short-circuit * output of the filesystem credentials form, returning that value instead. * * A filter should return true if no filesystem credentials are required, false if they are required but have not been * provided, or an array of credentials if they are required and have been provided. * * @since 2.5.0 * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string. * * @param mixed $credentials Credentials to return instead. Default empty string. * @param string $form_post The URL to post the form to. * @param string $type Chosen type of filesystem. * @param bool|WP_Error $error Whether the current request has failed to connect, * or an error object. * @param string $context Full path to the directory that is tested for * being writable. * @param array $extra_fields Extra POST fields. * @param bool $allow_relaxed_file_ownership Whether to allow Group/World writable. */ $req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields, $allow_relaxed_file_ownership ); if ( '' !== $req_cred ) { return $req_cred; } if ( empty( $type ) ) { $type = get_filesystem_method( array(), $context, $allow_relaxed_file_ownership ); } if ( 'direct' === $type ) { return true; } if ( is_null( $extra_fields ) ) { $extra_fields = array( 'version', 'locale' ); } $credentials = get_option( 'ftp_credentials', array( 'hostname' => '', 'username' => '', ) ); $submitted_form = wp_unslash( $_POST ); // Verify nonce, or unset submitted form field values on failure. if ( ! isset( $_POST['_fs_nonce'] ) || ! wp_verify_nonce( $_POST['_fs_nonce'], 'filesystem-credentials' ) ) { unset( $submitted_form['hostname'], $submitted_form['username'], $submitted_form['password'], $submitted_form['public_key'], $submitted_form['private_key'], $submitted_form['connection_type'] ); } $ftp_constants = array( 'hostname' => 'FTP_HOST', 'username' => 'FTP_USER', 'password' => 'FTP_PASS', 'public_key' => 'FTP_PUBKEY', 'private_key' => 'FTP_PRIKEY', ); // If defined, set it to that. Else, if POST'd, set it to that. If not, set it to an empty string. // Otherwise, keep it as it previously was (saved details in option). foreach ( $ftp_constants as $key => $constant ) { if ( defined( $constant ) ) { $credentials[ $key ] = constant( $constant ); } elseif ( ! empty( $submitted_form[ $key ] ) ) { $credentials[ $key ] = $submitted_form[ $key ]; } elseif ( ! isset( $credentials[ $key ] ) ) { $credentials[ $key ] = ''; } } // Sanitize the hostname, some people might pass in odd data. $credentials['hostname'] = preg_replace( '|\w+://|', '', $credentials['hostname'] ); // Strip any schemes off. if ( strpos( $credentials['hostname'], ':' ) ) { list( $credentials['hostname'], $credentials['port'] ) = explode( ':', $credentials['hostname'], 2 ); if ( ! is_numeric( $credentials['port'] ) ) { unset( $credentials['port'] ); } } else { unset( $credentials['port'] ); } if ( ( defined( 'FTP_SSH' ) && FTP_SSH ) || ( defined( 'FS_METHOD' ) && 'ssh2' === FS_METHOD ) ) { $credentials['connection_type'] = 'ssh'; } elseif ( ( defined( 'FTP_SSL' ) && FTP_SSL ) && 'ftpext' === $type ) { // Only the FTP Extension understands SSL. $credentials['connection_type'] = 'ftps'; } elseif ( ! empty( $submitted_form['connection_type'] ) ) { $credentials['connection_type'] = $submitted_form['connection_type']; } elseif ( ! isset( $credentials['connection_type'] ) ) { // All else fails (and it's not defaulted to something else saved), default to FTP. $credentials['connection_type'] = 'ftp'; } if ( ! $error && ( ! empty( $credentials['hostname'] ) && ! empty( $credentials['username'] ) && ! empty( $credentials['password'] ) || 'ssh' === $credentials['connection_type'] && ! empty( $credentials['public_key'] ) && ! empty( $credentials['private_key'] ) ) ) { $stored_credentials = $credentials; if ( ! empty( $stored_credentials['port'] ) ) { // Save port as part of hostname to simplify above code. $stored_credentials['hostname'] .= ':' . $stored_credentials['port']; } unset( $stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key'] ); if ( ! wp_installing() ) { update_option( 'ftp_credentials', $stored_credentials ); } return $credentials; } $hostname = isset( $credentials['hostname'] ) ? $credentials['hostname'] : ''; $username = isset( $credentials['username'] ) ? $credentials['username'] : ''; $public_key = isset( $credentials['public_key'] ) ? $credentials['public_key'] : ''; $private_key = isset( $credentials['private_key'] ) ? $credentials['private_key'] : ''; $port = isset( $credentials['port'] ) ? $credentials['port'] : ''; $connection_type = isset( $credentials['connection_type'] ) ? $credentials['connection_type'] : ''; if ( $error ) { $error_string = __( '<strong>Error:</strong> Could not connect to the server. Please verify the settings are correct.' ); if ( is_wp_error( $error ) ) { $error_string = esc_html( $error->get_error_message() ); } echo '<div id="message" class="error"><p>' . $error_string . '</p></div>'; } $types = array(); if ( extension_loaded( 'ftp' ) || extension_loaded( 'sockets' ) || function_exists( 'fsockopen' ) ) { $types['ftp'] = __( 'FTP' ); } if ( extension_loaded( 'ftp' ) ) { // Only this supports FTPS. $types['ftps'] = __( 'FTPS (SSL)' ); } if ( extension_loaded( 'ssh2' ) ) { $types['ssh'] = __( 'SSH2' ); } /** * Filters the connection types to output to the filesystem credentials form. * * @since 2.9.0 * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string. * * @param string[] $types Types of connections. * @param array $credentials Credentials to connect with. * @param string $type Chosen filesystem method. * @param bool|WP_Error $error Whether the current request has failed to connect, * or an error object. * @param string $context Full path to the directory that is tested for being writable. */ $types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context ); ?> <form action="<?php echo esc_url( $form_post ); ?>" method="post"> <div id="request-filesystem-credentials-form" class="request-filesystem-credentials-form"> <?php // Print a H1 heading in the FTP credentials modal dialog, default is a H2. $heading_tag = 'h2'; if ( 'plugins.php' === $pagenow || 'plugin-install.php' === $pagenow ) { $heading_tag = 'h1'; } echo "<$heading_tag id='request-filesystem-credentials-title'>" . __( 'Connection Information' ) . "</$heading_tag>"; ?> <p id="request-filesystem-credentials-desc"> <?php $label_user = __( 'Username' ); $label_pass = __( 'Password' ); _e( 'To perform the requested action, WordPress needs to access your web server.' ); echo ' '; if ( ( isset( $types['ftp'] ) || isset( $types['ftps'] ) ) ) { if ( isset( $types['ssh'] ) ) { _e( 'Please enter your FTP or SSH credentials to proceed.' ); $label_user = __( 'FTP/SSH Username' ); $label_pass = __( 'FTP/SSH Password' ); } else { _e( 'Please enter your FTP credentials to proceed.' ); $label_user = __( 'FTP Username' ); $label_pass = __( 'FTP Password' ); } echo ' '; } _e( 'If you do not remember your credentials, you should contact your web host.' ); $hostname_value = esc_attr( $hostname ); if ( ! empty( $port ) ) { $hostname_value .= ":$port"; } $password_value = ''; if ( defined( 'FTP_PASS' ) ) { $password_value = '*****'; } ?> </p> <label for="hostname"> <span class="field-title"><?php _e( 'Hostname' ); ?></span> <input name="hostname" type="text" id="hostname" aria-describedby="request-filesystem-credentials-desc" class="code" placeholder="<?php esc_attr_e( 'example: www.wordpress.org' ); ?>" value="<?php echo $hostname_value; ?>"<?php disabled( defined( 'FTP_HOST' ) ); ?> /> </label> <div class="ftp-username"> <label for="username"> <span class="field-title"><?php echo $label_user; ?></span> <input name="username" type="text" id="username" value="<?php echo esc_attr( $username ); ?>"<?php disabled( defined( 'FTP_USER' ) ); ?> /> </label> </div> <div class="ftp-password"> <label for="password"> <span class="field-title"><?php echo $label_pass; ?></span> <input name="password" type="password" id="password" value="<?php echo $password_value; ?>"<?php disabled( defined( 'FTP_PASS' ) ); ?> /> <?php if ( ! defined( 'FTP_PASS' ) ) { _e( 'This password will not be stored on the server.' );} ?> </label> </div> <fieldset> <legend><?php _e( 'Connection Type' ); ?></legend> <?php $disabled = disabled( ( defined( 'FTP_SSL' ) && FTP_SSL ) || ( defined( 'FTP_SSH' ) && FTP_SSH ), true, false ); foreach ( $types as $name => $text ) : ?> <label for="<?php echo esc_attr( $name ); ?>"> <input type="radio" name="connection_type" id="<?php echo esc_attr( $name ); ?>" value="<?php echo esc_attr( $name ); ?>" <?php checked( $name, $connection_type ); ?> <?php echo $disabled; ?> /> <?php echo $text; ?> </label> <?php endforeach; ?> </fieldset> <?php if ( isset( $types['ssh'] ) ) { $hidden_class = ''; if ( 'ssh' !== $connection_type || empty( $connection_type ) ) { $hidden_class = ' class="hidden"'; } ?> <fieldset id="ssh-keys"<?php echo $hidden_class; ?>> <legend><?php _e( 'Authentication Keys' ); ?></legend> <label for="public_key"> <span class="field-title"><?php _e( 'Public Key:' ); ?></span> <input name="public_key" type="text" id="public_key" aria-describedby="auth-keys-desc" value="<?php echo esc_attr( $public_key ); ?>"<?php disabled( defined( 'FTP_PUBKEY' ) ); ?> /> </label> <label for="private_key"> <span class="field-title"><?php _e( 'Private Key:' ); ?></span> <input name="private_key" type="text" id="private_key" value="<?php echo esc_attr( $private_key ); ?>"<?php disabled( defined( 'FTP_PRIKEY' ) ); ?> /> </label> <p id="auth-keys-desc"><?php _e( 'Enter the location on the server where the public and private keys are located. If a passphrase is needed, enter that in the password field above.' ); ?></p> </fieldset> <?php } foreach ( (array) $extra_fields as $field ) { if ( isset( $submitted_form[ $field ] ) ) { echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( $submitted_form[ $field ] ) . '" />'; } } // Make sure the `submit_button()` function is available during the REST API call // from WP_Site_Health_Auto_Updates::test_check_wp_filesystem_method(). if ( ! function_exists( 'submit_button' ) ) { require_once ABSPATH . '/wp-admin/includes/template.php'; } ?> <p class="request-filesystem-credentials-action-buttons"> <?php wp_nonce_field( 'filesystem-credentials', '_fs_nonce', false, true ); ?> <button class="button cancel-button" data-js-action="close" type="button"><?php _e( 'Cancel' ); ?></button> <?php submit_button( __( 'Proceed' ), '', 'upgrade', false ); ?> </p> </div> </form> <?php return false; } ``` [apply\_filters( 'fs\_ftp\_connection\_types', string[] $types, array $credentials, string $type, bool|WP\_Error $error, string $context )](../hooks/fs_ftp_connection_types) Filters the connection types to output to the filesystem credentials form. [apply\_filters( 'request\_filesystem\_credentials', mixed $credentials, string $form\_post, string $type, bool|WP\_Error $error, string $context, array $extra\_fields, bool $allow\_relaxed\_file\_ownership )](../hooks/request_filesystem_credentials) Filters the filesystem credentials. | Uses | Description | | --- | --- | | [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. | | [disabled()](disabled) wp-includes/general-template.php | Outputs the HTML disabled attribute. | | [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. | | [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. | | [checked()](checked) wp-includes/general-template.php | Outputs the HTML checked attribute. | | [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). | | [wp\_verify\_nonce()](wp_verify_nonce) wp-includes/pluggable.php | Verifies that a correct security nonce was used with time limit. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [esc\_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\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. | | [\_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 | | --- | --- | | [WP\_REST\_Plugins\_Controller::is\_filesystem\_available()](../classes/wp_rest_plugins_controller/is_filesystem_available) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Determine if the endpoints are available. | | [wp\_ajax\_delete\_plugin()](wp_ajax_delete_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a plugin. | | [wp\_ajax\_delete\_theme()](wp_ajax_delete_theme) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a theme. | | [WP\_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\_print\_request\_filesystem\_credentials\_modal()](wp_print_request_filesystem_credentials_modal) wp-admin/includes/file.php | Prints the filesystem credentials modal when needed. | | [delete\_theme()](delete_theme) wp-admin/includes/theme.php | Removes a theme. | | [WP\_Upgrader\_Skin::request\_filesystem\_credentials()](../classes/wp_upgrader_skin/request_filesystem_credentials) wp-admin/includes/class-wp-upgrader-skin.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. | | [delete\_plugins()](delete_plugins) wp-admin/includes/plugin.php | Removes directory and files of a plugin for a list of plugins. | | [do\_core\_upgrade()](do_core_upgrade) wp-admin/update-core.php | Upgrade WordPress core display. | | Version | Description | | --- | --- | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | The `$context` parameter default changed from `false` to an empty string. | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
programming_docs
wordpress get_others_unpublished_posts( int $user_id, string $type = 'any' ): array get\_others\_unpublished\_posts( int $user\_id, string $type = 'any' ): array ============================================================================= This function has been deprecated. Use [get\_posts()](get_posts) instead. Retrieves editable posts from other users. * [get\_posts()](get_posts) `$user_id` int Required User ID to not retrieve posts from. `$type` string Optional Post type to retrieve. Accepts `'draft'`, `'pending'` or `'any'` (all). Default `'any'`. Default: `'any'` array List of posts from others. File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/) ``` function get_others_unpublished_posts( $user_id, $type = 'any' ) { _deprecated_function( __FUNCTION__, '3.1.0' ); global $wpdb; $editable = get_editable_user_ids( $user_id ); if ( in_array($type, array('draft', 'pending')) ) $type_sql = " post_status = '$type' "; else $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) "; $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC'; if ( !$editable ) { $other_unpubs = ''; } else { $editable = join(',', $editable); $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) ); } return apply_filters('get_others_drafts', $other_unpubs); } ``` | Uses | Description | | --- | --- | | [get\_editable\_user\_ids()](get_editable_user_ids) wp-admin/includes/deprecated.php | Gets the IDs of any users who can edit posts. | | [\_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. | | [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). | | [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. | | Used By | Description | | --- | --- | | [get\_others\_drafts()](get_others_drafts) wp-admin/includes/deprecated.php | Retrieve drafts from other users. | | [get\_others\_pending()](get_others_pending) wp-admin/includes/deprecated.php | Retrieve pending review posts from other users. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Use [get\_posts()](get_posts) | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress wp_revisions_enabled( WP_Post $post ): bool wp\_revisions\_enabled( WP\_Post $post ): bool ============================================== Determines whether revisions are enabled for a given post. `$post` [WP\_Post](../classes/wp_post) Required The post object. bool True if number of revisions to keep isn't zero, false otherwise. File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/) ``` function wp_revisions_enabled( $post ) { return wp_revisions_to_keep( $post ) !== 0; } ``` | Uses | Description | | --- | --- | | [wp\_revisions\_to\_keep()](wp_revisions_to_keep) wp-includes/revision.php | Determines how many revisions to retain for a given post. | | Used By | 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. | | [wp\_get\_post\_revisions\_url()](wp_get_post_revisions_url) wp-includes/revision.php | Returns the url for viewing and potentially restoring revisions of a given post. | | [\_wp\_customize\_publish\_changeset()](_wp_customize_publish_changeset) wp-includes/theme.php | Publishes a snapshot’s changes. | | [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\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. | | [wp\_get\_post\_revisions()](wp_get_post_revisions) wp-includes/revision.php | Returns all revisions of specified post. | | [wp\_save\_post\_revision()](wp_save_post_revision) wp-includes/revision.php | Creates a revision for the current version of a post. | | [wp\_xmlrpc\_server::wp\_getRevisions()](../classes/wp_xmlrpc_server/wp_getrevisions) wp-includes/class-wp-xmlrpc-server.php | Retrieve revisions for a specific post. | | [wp\_xmlrpc\_server::wp\_restoreRevision()](../classes/wp_xmlrpc_server/wp_restorerevision) wp-includes/class-wp-xmlrpc-server.php | Restore a post revision | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress wp_widget_control( array $sidebar_args ): array wp\_widget\_control( array $sidebar\_args ): array ================================================== Meta widget used to display the control form for a widget. Called from [dynamic\_sidebar()](dynamic_sidebar) . `$sidebar_args` array Required array File: `wp-admin/includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/widgets.php/) ``` function wp_widget_control( $sidebar_args ) { global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets; $widget_id = $sidebar_args['widget_id']; $sidebar_id = isset( $sidebar_args['id'] ) ? $sidebar_args['id'] : false; $key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[ $sidebar_id ], true ) : '-1'; // Position of widget in sidebar. $control = isset( $wp_registered_widget_controls[ $widget_id ] ) ? $wp_registered_widget_controls[ $widget_id ] : array(); $widget = $wp_registered_widgets[ $widget_id ]; $id_format = $widget['id']; $widget_number = isset( $control['params'][0]['number'] ) ? $control['params'][0]['number'] : ''; $id_base = isset( $control['id_base'] ) ? $control['id_base'] : $widget_id; $width = isset( $control['width'] ) ? $control['width'] : ''; $height = isset( $control['height'] ) ? $control['height'] : ''; $multi_number = isset( $sidebar_args['_multi_num'] ) ? $sidebar_args['_multi_num'] : ''; $add_new = isset( $sidebar_args['_add'] ) ? $sidebar_args['_add'] : ''; $before_form = isset( $sidebar_args['before_form'] ) ? $sidebar_args['before_form'] : '<form method="post">'; $after_form = isset( $sidebar_args['after_form'] ) ? $sidebar_args['after_form'] : '</form>'; $before_widget_content = isset( $sidebar_args['before_widget_content'] ) ? $sidebar_args['before_widget_content'] : '<div class="widget-content">'; $after_widget_content = isset( $sidebar_args['after_widget_content'] ) ? $sidebar_args['after_widget_content'] : '</div>'; $query_arg = array( 'editwidget' => $widget['id'] ); if ( $add_new ) { $query_arg['addnew'] = 1; if ( $multi_number ) { $query_arg['num'] = $multi_number; $query_arg['base'] = $id_base; } } else { $query_arg['sidebar'] = $sidebar_id; $query_arg['key'] = $key; } /* * We aren't showing a widget control, we're outputting a template * for a multi-widget control. */ if ( isset( $sidebar_args['_display'] ) && 'template' === $sidebar_args['_display'] && $widget_number ) { // number == -1 implies a template where id numbers are replaced by a generic '__i__'. $control['params'][0]['number'] = -1; // With id_base widget ID's are constructed like {$id_base}-{$id_number}. if ( isset( $control['id_base'] ) ) { $id_format = $control['id_base'] . '-__i__'; } } $wp_registered_widgets[ $widget_id ]['callback'] = $wp_registered_widgets[ $widget_id ]['_callback']; unset( $wp_registered_widgets[ $widget_id ]['_callback'] ); $widget_title = esc_html( strip_tags( $sidebar_args['widget_name'] ) ); $has_form = 'noform'; echo $sidebar_args['before_widget']; ?> <div class="widget-top"> <div class="widget-title-action"> <button type="button" class="widget-action hide-if-no-js" aria-expanded="false"> <span class="screen-reader-text edit"> <?php /* translators: %s: Widget title. */ printf( __( 'Edit widget: %s' ), $widget_title ); ?> </span> <span class="screen-reader-text add"> <?php /* translators: %s: Widget title. */ printf( __( 'Add widget: %s' ), $widget_title ); ?> </span> <span class="toggle-indicator" aria-hidden="true"></span> </button> <a class="widget-control-edit hide-if-js" href="<?php echo esc_url( add_query_arg( $query_arg ) ); ?>"> <span class="edit"><?php _ex( 'Edit', 'widget' ); ?></span> <span class="add"><?php _ex( 'Add', 'widget' ); ?></span> <span class="screen-reader-text"><?php echo $widget_title; ?></span> </a> </div> <div class="widget-title"><h3><?php echo $widget_title; ?><span class="in-widget-title"></span></h3></div> </div> <div class="widget-inside"> <?php echo $before_form; ?> <?php echo $before_widget_content; ?> <?php if ( isset( $control['callback'] ) ) { $has_form = call_user_func_array( $control['callback'], $control['params'] ); } else { echo "\t\t<p>" . __( 'There are no options for this widget.' ) . "</p>\n"; } $noform_class = ''; if ( 'noform' === $has_form ) { $noform_class = ' widget-control-noform'; } ?> <?php echo $after_widget_content; ?> <input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr( $id_format ); ?>" /> <input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr( $id_base ); ?>" /> <input type="hidden" name="widget-width" class="widget-width" value="<?php echo esc_attr( $width ); ?>" /> <input type="hidden" name="widget-height" class="widget-height" value="<?php echo esc_attr( $height ); ?>" /> <input type="hidden" name="widget_number" class="widget_number" value="<?php echo esc_attr( $widget_number ); ?>" /> <input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr( $multi_number ); ?>" /> <input type="hidden" name="add_new" class="add_new" value="<?php echo esc_attr( $add_new ); ?>" /> <div class="widget-control-actions"> <div class="alignleft"> <button type="button" class="button-link button-link-delete widget-control-remove"><?php _e( 'Delete' ); ?></button> <span class="widget-control-close-wrapper"> | <button type="button" class="button-link widget-control-close"><?php _e( 'Done' ); ?></button> </span> </div> <div class="alignright<?php echo $noform_class; ?>"> <?php submit_button( __( 'Save' ), 'primary widget-control-save right', 'savewidget', false, array( 'id' => 'widget-' . esc_attr( $id_format ) . '-savewidget' ) ); ?> <span class="spinner"></span> </div> <br class="clear" /> </div> <?php echo $after_form; ?> </div> <div class="widget-description"> <?php $widget_description = wp_widget_description( $widget_id ); echo ( $widget_description ) ? "$widget_description\n" : "$widget_title\n"; ?> </div> <?php echo $sidebar_args['after_widget']; return $sidebar_args; } ``` | Uses | Description | | --- | --- | | [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). | | [\_ex()](_ex) wp-includes/l10n.php | Displays translated string with gettext context. | | [wp\_widget\_description()](wp_widget_description) wp-includes/widgets.php | Retrieve description for widget. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. | | Used By | Description | | --- | --- | | [wp\_list\_widgets()](wp_list_widgets) wp-admin/includes/widgets.php | Display list of the available widgets. | | [WP\_Customize\_Widgets::get\_widget\_control()](../classes/wp_customize_widgets/get_widget_control) wp-includes/class-wp-customize-widgets.php | Retrieves the widget control markup. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress get_user_by_email( string $email ): bool|object get\_user\_by\_email( string $email ): bool|object ================================================== This function has been deprecated. Use [get\_user\_by()](get_user_by) instead. Retrieve user info by email. * [get\_user\_by()](get_user_by) `$email` string Required User's email address bool|object False on failure, User DB row object File: `wp-includes/pluggable-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable-deprecated.php/) ``` function get_user_by_email($email) { _deprecated_function( __FUNCTION__, '3.3.0', "get_user_by('email')" ); return get_user_by('email', $email); } ``` | Uses | Description | | --- | --- | | [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.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Use [get\_user\_by()](get_user_by) | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress wp_new_user_notification( int $user_id, null $deprecated = null, string $notify = '' ) wp\_new\_user\_notification( int $user\_id, null $deprecated = null, string $notify = '' ) ========================================================================================== Emails login credentials to a newly-registered user. A new user registration notification is also sent to admin email. `$user_id` int Required User ID. `$deprecated` null Optional Not used (argument deprecated). Default: `null` `$notify` string Optional Type of notification that should happen. Accepts `'admin'` or an empty string (admin only), `'user'`, or `'both'` (admin and user). Default: `''` * This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead. File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/) ``` function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) { if ( null !== $deprecated ) { _deprecated_argument( __FUNCTION__, '4.3.1' ); } // Accepts only 'user', 'admin' , 'both' or default '' as $notify. if ( ! in_array( $notify, array( 'user', 'admin', 'both', '' ), true ) ) { return; } $user = get_userdata( $user_id ); // The blogname option is escaped with esc_html() on the way into the database in sanitize_option(). // We want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); /** * Filters whether the admin is notified of a new user registration. * * @since 6.1.0 * * @param bool $send Whether to send the email. Default true. * @param WP_User $user User object for new user. */ $send_notification_to_admin = apply_filters( 'wp_send_new_user_notification_to_admin', true, $user ); if ( 'user' !== $notify && true === $send_notification_to_admin ) { $switched_locale = switch_to_locale( get_locale() ); /* translators: %s: Site title. */ $message = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n"; /* translators: %s: User login. */ $message .= sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n"; /* translators: %s: User email address. */ $message .= sprintf( __( 'Email: %s' ), $user->user_email ) . "\r\n"; $wp_new_user_notification_email_admin = array( 'to' => get_option( 'admin_email' ), /* translators: New user registration notification email subject. %s: Site title. */ 'subject' => __( '[%s] New User Registration' ), 'message' => $message, 'headers' => '', ); /** * Filters the contents of the new user notification email sent to the site admin. * * @since 4.9.0 * * @param array $wp_new_user_notification_email_admin { * Used to build wp_mail(). * * @type string $to The intended recipient - site admin 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. * } * @param WP_User $user User object for new user. * @param string $blogname The site title. */ $wp_new_user_notification_email_admin = apply_filters( 'wp_new_user_notification_email_admin', $wp_new_user_notification_email_admin, $user, $blogname ); wp_mail( $wp_new_user_notification_email_admin['to'], wp_specialchars_decode( sprintf( $wp_new_user_notification_email_admin['subject'], $blogname ) ), $wp_new_user_notification_email_admin['message'], $wp_new_user_notification_email_admin['headers'] ); if ( $switched_locale ) { restore_previous_locale(); } } /** * Filters whether the user is notified of their new user registration. * * @since 6.1.0 * * @param bool $send Whether to send the email. Default true. * @param WP_User $user User object for new user. */ $send_notification_to_user = apply_filters( 'wp_send_new_user_notification_to_user', true, $user ); // `$deprecated` was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notification. if ( 'admin' === $notify || true !== $send_notification_to_user || ( empty( $deprecated ) && empty( $notify ) ) ) { return; } $key = get_password_reset_key( $user ); if ( is_wp_error( $key ) ) { return; } $switched_locale = switch_to_locale( get_user_locale( $user ) ); /* translators: %s: User login. */ $message = sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n"; $message .= __( 'To set your password, visit the following address:' ) . "\r\n\r\n"; $message .= network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user->user_login ), 'login' ) . "\r\n\r\n"; $message .= wp_login_url() . "\r\n"; $wp_new_user_notification_email = array( 'to' => $user->user_email, /* translators: Login details notification email subject. %s: Site title. */ 'subject' => __( '[%s] Login Details' ), 'message' => $message, 'headers' => '', ); /** * Filters the contents of the new user notification email sent to the new user. * * @since 4.9.0 * * @param array $wp_new_user_notification_email { * Used to build wp_mail(). * * @type string $to The intended recipient - New 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. * } * @param WP_User $user User object for new user. * @param string $blogname The site title. */ $wp_new_user_notification_email = apply_filters( 'wp_new_user_notification_email', $wp_new_user_notification_email, $user, $blogname ); wp_mail( $wp_new_user_notification_email['to'], wp_specialchars_decode( sprintf( $wp_new_user_notification_email['subject'], $blogname ) ), $wp_new_user_notification_email['message'], $wp_new_user_notification_email['headers'] ); if ( $switched_locale ) { restore_previous_locale(); } } ``` [apply\_filters( 'wp\_new\_user\_notification\_email', array $wp\_new\_user\_notification\_email, WP\_User $user, string $blogname )](../hooks/wp_new_user_notification_email) Filters the contents of the new user notification email sent to the new user. [apply\_filters( 'wp\_new\_user\_notification\_email\_admin', array $wp\_new\_user\_notification\_email\_admin, WP\_User $user, string $blogname )](../hooks/wp_new_user_notification_email_admin) Filters the contents of the new user notification email sent to the site admin. [apply\_filters( 'wp\_send\_new\_user\_notification\_to\_admin', bool $send, WP\_User $user )](../hooks/wp_send_new_user_notification_to_admin) Filters whether the admin is notified of a new user registration. [apply\_filters( 'wp\_send\_new\_user\_notification\_to\_user', bool $send, WP\_User $user )](../hooks/wp_send_new_user_notification_to_user) Filters whether the user is notified of their new user registration. | Uses | Description | | --- | --- | | [restore\_previous\_locale()](restore_previous_locale) wp-includes/l10n.php | Restores the translations according to the previous locale. | | [switch\_to\_locale()](switch_to_locale) wp-includes/l10n.php | Switches the translations according to the given locale. | | [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. | | [get\_password\_reset\_key()](get_password_reset_key) wp-includes/user.php | Creates, stores, then returns a password reset key for user. | | [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. | | [wp\_specialchars\_decode()](wp_specialchars_decode) wp-includes/formatting.php | Converts a number of HTML entities into their special characters. | | [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. | | [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. | | [network\_site\_url()](network_site_url) wp-includes/link-template.php | Retrieves the site URL for the current network. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. | | [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Used By | Description | | --- | --- | | [wp\_send\_new\_user\_notifications()](wp_send_new_user_notifications) wp-includes/user.php | Initiates email notifications related to the creation of new users. | | Version | Description | | --- | --- | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | The `$notify` parameter accepts `'user'` for sending notification only to the user created. | | [4.3.1](https://developer.wordpress.org/reference/since/4.3.1/) | The `$plaintext_pass` parameter was deprecated. `$notify` added as a third parameter. | | [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | The `$plaintext_pass` parameter was changed to `$notify`. | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
programming_docs
wordpress register_block_pattern( string $pattern_name, array $pattern_properties ): bool register\_block\_pattern( string $pattern\_name, array $pattern\_properties ): bool =================================================================================== Registers a new block pattern. `$pattern_name` string Required Block pattern name including namespace. `$pattern_properties` array Required List of properties for the block pattern. See [WP\_Block\_Patterns\_Registry::register()](../classes/wp_block_patterns_registry/register) for accepted arguments. More Arguments from WP\_Block\_Patterns\_Registry::register( ... $pattern\_properties ) List of properties for the block pattern. * `title`stringRequired. A human-readable title for the pattern. * `content`stringRequired. Block HTML markup for the pattern. * `description`stringOptional. Visually hidden text used to describe the pattern in the inserter. A description is optional, but is strongly encouraged when the title does not fully describe what the pattern does. The description will help users discover the pattern while searching. * `viewportWidth`intOptional. The intended width of the pattern to allow for a scaled preview within the pattern inserter. * `categories`arrayOptional. A list of registered pattern categories used to group block patterns. Block patterns can be shown on multiple categories. A category must be registered separately in order to be used here. * `blockTypes`arrayOptional. A list of block names including namespace that could use the block pattern in certain contexts (placeholder, transforms). The block pattern is available in the block editor inserter regardless of this list of block names. Certain blocks support further specificity besides the block name (e.g. for `core/template-part` you can specify areas like `core/template-part/header` or `core/template-part/footer`). * `keywords`arrayOptional. A list of aliases or keywords that help users discover the pattern while searching. bool True if the pattern was registered with success and false otherwise. File: `wp-includes/class-wp-block-patterns-registry.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-block-patterns-registry.php/) ``` function register_block_pattern( $pattern_name, $pattern_properties ) { return WP_Block_Patterns_Registry::get_instance()->register( $pattern_name, $pattern_properties ); } ``` | 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. | | Used By | Description | | --- | --- | | [\_register\_remote\_theme\_patterns()](_register_remote_theme_patterns) wp-includes/block-patterns.php | Registers patterns from Pattern Directory provided by a theme’s `theme.json` file. | | [\_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: | | [\_load\_remote\_featured\_patterns()](_load_remote_featured_patterns) wp-includes/block-patterns.php | Register `Featured` (category) patterns from wordpress.org/patterns. | | [\_load\_remote\_block\_patterns()](_load_remote_block_patterns) wp-includes/block-patterns.php | Register Core’s official patterns from wordpress.org/patterns. | | [\_register\_core\_block\_patterns\_and\_categories()](_register_core_block_patterns_and_categories) wp-includes/block-patterns.php | Registers the core block patterns and categories. | | Version | Description | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. | wordpress unzip_file( string $file, string $to ): true|WP_Error unzip\_file( string $file, string $to ): true|WP\_Error ======================================================= Unzips a specified ZIP file to a location on the filesystem via the WordPress Filesystem Abstraction. Assumes that [WP\_Filesystem()](wp_filesystem) has already been called and set up. Does not extract a root-level \_\_MACOSX directory, if present. Attempts to increase the PHP memory limit to 256M before uncompressing. However, the most memory required shouldn’t be much larger than the archive itself. `$file` string Required Full path and filename of ZIP archive. `$to` string Required Full path on the filesystem to extract archive to. true|[WP\_Error](../classes/wp_error) True on success, [WP\_Error](../classes/wp_error) on failure. File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/) ``` function unzip_file( $file, $to ) { global $wp_filesystem; if ( ! $wp_filesystem || ! is_object( $wp_filesystem ) ) { return new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) ); } // Unzip can use a lot of memory, but not this much hopefully. wp_raise_memory_limit( 'admin' ); $needed_dirs = array(); $to = trailingslashit( $to ); // Determine any parent directories needed (of the upgrade directory). if ( ! $wp_filesystem->is_dir( $to ) ) { // Only do parents if no children exist. $path = preg_split( '![/\\\]!', untrailingslashit( $to ) ); for ( $i = count( $path ); $i >= 0; $i-- ) { if ( empty( $path[ $i ] ) ) { continue; } $dir = implode( '/', array_slice( $path, 0, $i + 1 ) ); if ( preg_match( '!^[a-z]:$!i', $dir ) ) { // Skip it if it looks like a Windows Drive letter. continue; } if ( ! $wp_filesystem->is_dir( $dir ) ) { $needed_dirs[] = $dir; } else { break; // A folder exists, therefore we don't need to check the levels below this. } } } /** * Filters whether to use ZipArchive to unzip archives. * * @since 3.0.0 * * @param bool $ziparchive Whether to use ZipArchive. Default true. */ if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) { $result = _unzip_file_ziparchive( $file, $to, $needed_dirs ); if ( true === $result ) { return $result; } elseif ( is_wp_error( $result ) ) { if ( 'incompatible_archive' !== $result->get_error_code() ) { return $result; } } } // Fall through to PclZip if ZipArchive is not available, or encountered an error opening the file. return _unzip_file_pclzip( $file, $to, $needed_dirs ); } ``` [apply\_filters( 'unzip\_file\_use\_ziparchive', bool $ziparchive )](../hooks/unzip_file_use_ziparchive) Filters whether to use ZipArchive to unzip archives. | 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. | | [\_unzip\_file\_ziparchive()](_unzip_file_ziparchive) wp-admin/includes/file.php | Attempts to unzip an archive using the ZipArchive class. | | [\_unzip\_file\_pclzip()](_unzip_file_pclzip) wp-admin/includes/file.php | Attempts to unzip an archive using the PclZip library. | | [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [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. | | [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\_Upgrader::unpack\_package()](../classes/wp_upgrader/unpack_package) wp-admin/includes/class-wp-upgrader.php | Unpack a compressed package file. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress export_date_options( string $post_type = 'post' ) export\_date\_options( string $post\_type = 'post' ) ==================================================== Create the date options fields for exporting a given post type. `$post_type` string Optional The post type. Default `'post'`. Default: `'post'` File: `wp-admin/export.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/export.php/) ``` function export_date_options( $post_type = 'post' ) { global $wpdb, $wp_locale; $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 AND post_status != 'auto-draft' ORDER BY post_date DESC ", $post_type ) ); $month_count = count( $months ); if ( ! $month_count || ( 1 === $month_count && 0 === (int) $months[0]->month ) ) { return; } foreach ( $months as $date ) { if ( 0 === (int) $date->year ) { continue; } $month = zeroise( $date->month, 2 ); echo '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>'; } } ``` | Uses | Description | | --- | --- | | [zeroise()](zeroise) wp-includes/formatting.php | Add leading zeros when necessary. | | [WP\_Locale::get\_month()](../classes/wp_locale/get_month) wp-includes/class-wp-locale.php | Retrieves the full translated month by month number. | | [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). | | [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress get_avatar_url( mixed $id_or_email, array $args = null ): string|false get\_avatar\_url( mixed $id\_or\_email, array $args = null ): string|false ========================================================================== Retrieves the avatar URL. `$id_or_email` mixed Required The Gravatar to retrieve a URL for. Accepts a user\_id, gravatar md5 hash, user email, [WP\_User](../classes/wp_user) object, [WP\_Post](../classes/wp_post) object, or [WP\_Comment](../classes/wp_comment) object. `$args` array Optional Arguments to use instead of the default arguments. * `size`intHeight and width of the avatar in pixels. Default 96. * `default`stringURL for the default image or a default type. Accepts `'404'` (return a 404 instead of a default image), `'retro'` (8bit), `'monsterid'` (monster), `'wavatar'` (cartoon face), `'indenticon'` (the "quilt"), `'mystery'`, `'mm'`, or `'mysteryman'` (The Oyster Man), `'blank'` (transparent GIF), or `'gravatar_default'` (the Gravatar logo). Default is the value of the `'avatar_default'` option, with a fallback of `'mystery'`. * `force_default`boolWhether to always show the default image, never the Gravatar. Default false. * `rating`stringWhat rating to display avatars up to. Accepts `'G'`, `'PG'`, `'R'`, `'X'`, and are judged in that order. Default is the value of the `'avatar_rating'` option. * `scheme`stringURL scheme to use. See [set\_url\_scheme()](set_url_scheme) for accepted values. * `processed_args`arrayWhen the function returns, the value will be the processed/sanitized $args plus a "found\_avatar" guess. Pass as a reference. Default: `null` string|false The URL of the avatar on success, false on failure. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function get_avatar_url( $id_or_email, $args = null ) { $args = get_avatar_data( $id_or_email, $args ); return $args['url']; } ``` | Uses | Description | | --- | --- | | [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. | | 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. | | [WP\_Customize\_Manager::get\_lock\_user\_data()](../classes/wp_customize_manager/get_lock_user_data) wp-includes/class-wp-customize-manager.php | Gets lock user data. | | [rest\_get\_avatar\_urls()](rest_get_avatar_urls) wp-includes/rest-api.php | Retrieves the avatar urls in various sizes. | | [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. | | [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. | | Version | Description | | --- | --- | | [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. | wordpress wp_list_widget_controls_dynamic_sidebar( array $params ): array wp\_list\_widget\_controls\_dynamic\_sidebar( array $params ): array ==================================================================== Retrieves the widget control arguments. `$params` array Required array File: `wp-admin/includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/widgets.php/) ``` function wp_list_widget_controls_dynamic_sidebar( $params ) { global $wp_registered_widgets; static $i = 0; $i++; $widget_id = $params[0]['widget_id']; $id = isset( $params[0]['_temp_id'] ) ? $params[0]['_temp_id'] : $widget_id; $hidden = isset( $params[0]['_hide'] ) ? ' style="display:none;"' : ''; $params[0]['before_widget'] = "<div id='widget-{$i}_{$id}' class='widget'$hidden>"; $params[0]['after_widget'] = '</div>'; $params[0]['before_title'] = '%BEG_OF_TITLE%'; // Deprecated. $params[0]['after_title'] = '%END_OF_TITLE%'; // Deprecated. if ( is_callable( $wp_registered_widgets[ $widget_id ]['callback'] ) ) { $wp_registered_widgets[ $widget_id ]['_callback'] = $wp_registered_widgets[ $widget_id ]['callback']; $wp_registered_widgets[ $widget_id ]['callback'] = 'wp_widget_control'; } return $params; } ``` | Used By | Description | | --- | --- | | [wp\_list\_widgets()](wp_list_widgets) wp-admin/includes/widgets.php | Display list of the available widgets. | | [WP\_Widget\_Form\_Customize\_Control::to\_json()](../classes/wp_widget_form_customize_control/to_json) wp-includes/customize/class-wp-widget-form-customize-control.php | Gather control params for exporting to JavaScript. | | [WP\_Customize\_Widgets::get\_available\_widgets()](../classes/wp_customize_widgets/get_available_widgets) wp-includes/class-wp-customize-widgets.php | Builds up an index of all available widgets for use in Backbone models. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress determine_locale(): string determine\_locale(): string =========================== Determines the current locale desired for the request. string The determined locale. File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/) ``` function determine_locale() { /** * Filters the locale for the current request prior to the default determination process. * * Using this filter allows to override the default logic, effectively short-circuiting the function. * * @since 5.0.0 * * @param string|null $locale The locale to return and short-circuit. Default null. */ $determined_locale = apply_filters( 'pre_determine_locale', null ); if ( ! empty( $determined_locale ) && is_string( $determined_locale ) ) { return $determined_locale; } $determined_locale = get_locale(); if ( is_admin() ) { $determined_locale = get_user_locale(); } if ( isset( $_GET['_locale'] ) && 'user' === $_GET['_locale'] && wp_is_json_request() ) { $determined_locale = get_user_locale(); } $wp_lang = ''; if ( ! empty( $_GET['wp_lang'] ) ) { $wp_lang = sanitize_text_field( $_GET['wp_lang'] ); } elseif ( ! empty( $_COOKIE['wp_lang'] ) ) { $wp_lang = sanitize_text_field( $_COOKIE['wp_lang'] ); } if ( ! empty( $wp_lang ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) { $determined_locale = $wp_lang; } /** * Filters the locale for the current request. * * @since 5.0.0 * * @param string $locale The locale. */ return apply_filters( 'determine_locale', $determined_locale ); } ``` [apply\_filters( 'determine\_locale', string $locale )](../hooks/determine_locale) Filters the locale for the current request. [apply\_filters( 'pre\_determine\_locale', string|null $locale )](../hooks/pre_determine_locale) Filters the locale for the current request prior to the default determination process. | 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. | | [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. | | [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\_REST\_Site\_Health\_Controller::load\_admin\_textdomain()](../classes/wp_rest_site_health_controller/load_admin_textdomain) wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php | Loads the admin textdomain for Site Health tests. | | [load\_script\_textdomain()](load_script_textdomain) wp-includes/l10n.php | Loads the script translated strings. | | [\_get\_path\_to\_translation\_from\_lang\_dir()](_get_path_to_translation_from_lang_dir) wp-includes/deprecated.php | Gets the path to a translation file in the languages directory for the current locale. | | [WP\_Locale\_Switcher::switch\_to\_locale()](../classes/wp_locale_switcher/switch_to_locale) wp-includes/class-wp-locale-switcher.php | Switches the translations according to the given locale. | | [WP\_Locale\_Switcher::\_\_construct()](../classes/wp_locale_switcher/__construct) wp-includes/class-wp-locale-switcher.php | Constructor. | | [\_load\_textdomain\_just\_in\_time()](_load_textdomain_just_in_time) wp-includes/l10n.php | Loads plugin and theme text domains just-in-time. | | [login\_footer()](login_footer) wp-login.php | Outputs the footer for the login page. | | [load\_textdomain()](load_textdomain) wp-includes/l10n.php | Loads a .mo file into the text domain $domain. | | [load\_default\_textdomain()](load_default_textdomain) wp-includes/l10n.php | Loads default translated strings based on locale. | | [load\_plugin\_textdomain()](load_plugin_textdomain) wp-includes/l10n.php | Loads a plugin’s translated strings. | | [load\_muplugin\_textdomain()](load_muplugin_textdomain) wp-includes/l10n.php | Loads the translated strings for a plugin residing in the mu-plugins directory. | | [load\_theme\_textdomain()](load_theme_textdomain) wp-includes/l10n.php | Loads the theme’s translated strings. | | [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | [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. |
programming_docs
wordpress content_url( string $path = '' ): string content\_url( string $path = '' ): string ========================================= Retrieves the URL to the content directory. `$path` string Optional Path relative to the content URL. Default: `''` string Content 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 content_url( $path = '' ) { $url = set_url_scheme( WP_CONTENT_URL ); if ( $path && is_string( $path ) ) { $url .= '/' . ltrim( $path, '/' ); } /** * Filters the URL to the content directory. * * @since 2.8.0 * * @param string $url The complete URL to the content directory including scheme and path. * @param string $path Path relative to the URL to the content directory. Blank string * if no path is specified. */ return apply_filters( 'content_url', $url, $path ); } ``` [apply\_filters( 'content\_url', string $url, string $path )](../hooks/content_url) Filters the URL to the content directory. | Uses | Description | | --- | --- | | [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [load\_script\_textdomain()](load_script_textdomain) wp-includes/l10n.php | Loads the script translated strings. | | [get\_theme\_root\_uri()](get_theme_root_uri) wp-includes/theme.php | Retrieves URI for themes directory. | | [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | | | Version | Description | | --- | --- | | [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. | wordpress get_allowed_http_origins(): string[] get\_allowed\_http\_origins(): string[] ======================================= Retrieve list of allowed HTTP origins. string[] Array of origin URLs. File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/) ``` function get_allowed_http_origins() { $admin_origin = parse_url( admin_url() ); $home_origin = parse_url( home_url() ); // @todo Preserve port? $allowed_origins = array_unique( array( 'http://' . $admin_origin['host'], 'https://' . $admin_origin['host'], 'http://' . $home_origin['host'], 'https://' . $home_origin['host'], ) ); /** * Change the origin types allowed for HTTP requests. * * @since 3.4.0 * * @param string[] $allowed_origins { * Array of default allowed HTTP origins. * * @type string $0 Non-secure URL for admin origin. * @type string $1 Secure URL for admin origin. * @type string $2 Non-secure URL for home origin. * @type string $3 Secure URL for home origin. * } */ return apply_filters( 'allowed_http_origins', $allowed_origins ); } ``` [apply\_filters( 'allowed\_http\_origins', string[] $allowed\_origins )](../hooks/allowed_http_origins) Change the origin types allowed for HTTP requests. | Uses | Description | | --- | --- | | [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. | | [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [is\_allowed\_http\_origin()](is_allowed_http_origin) wp-includes/http.php | Determines if the HTTP origin is an authorized one. | | Version | Description | | --- | --- | | [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. | wordpress comment_time( string $format = '' ) comment\_time( string $format = '' ) ==================================== Displays the comment time of the current comment. `$format` string Optional PHP time format. Defaults to the `'time_format'` option. Default: `''` For time format, see [Formatting Date and Time](https://wordpress.org/support/article/formatting-date-and-time/). File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function comment_time( $format = '' ) { echo get_comment_time( $format ); } ``` | Uses | Description | | --- | --- | | [get\_comment\_time()](get_comment_time) wp-includes/comment-template.php | Retrieves the comment time of the current comment. | | Version | Description | | --- | --- | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress the_category_ID( bool $display = true ): int the\_category\_ID( bool $display = true ): int ============================================== This function has been deprecated. Use [get\_the\_category()](get_the_category) instead. Returns or prints a category ID. * [get\_the\_category()](get_the_category) `$display` bool Optional Whether to display the output. Default: `true` int Category ID. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function the_category_ID($display = true) { _deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' ); // Grab the first cat in the list. $categories = get_the_category(); $cat = $categories[0]->term_id; if ( $display ) echo $cat; return $cat; } ``` | Uses | Description | | --- | --- | | [get\_the\_category()](get_the_category) wp-includes/category-template.php | Retrieves post categories. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress wp_ajax_image_editor() wp\_ajax\_image\_editor() ========================= Ajax handler for image editing. 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_image_editor() { $attachment_id = (int) $_POST['postid']; if ( empty( $attachment_id ) || ! current_user_can( 'edit_post', $attachment_id ) ) { wp_die( -1 ); } check_ajax_referer( "image_editor-$attachment_id" ); include_once ABSPATH . 'wp-admin/includes/image-edit.php'; $msg = false; switch ( $_POST['do'] ) { case 'save': $msg = wp_save_image( $attachment_id ); if ( ! empty( $msg->error ) ) { wp_send_json_error( $msg ); } wp_send_json_success( $msg ); break; case 'scale': $msg = wp_save_image( $attachment_id ); break; case 'restore': $msg = wp_restore_image( $attachment_id ); break; } ob_start(); wp_image_editor( $attachment_id, $msg ); $html = ob_get_clean(); if ( ! empty( $msg->error ) ) { wp_send_json_error( array( 'message' => $msg, 'html' => $html, ) ); } wp_send_json_success( array( 'message' => $msg, 'html' => $html, ) ); } ``` | Uses | Description | | --- | --- | | [wp\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. | | [wp\_restore\_image()](wp_restore_image) wp-admin/includes/image-edit.php | Restores the metadata for a given attachment. | | [wp\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. | | [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. | | [wp\_send\_json\_success()](wp_send_json_success) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating success. | | [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 unescape_invalid_shortcodes( string $content ): string unescape\_invalid\_shortcodes( string $content ): string ======================================================== Removes placeholders added by [do\_shortcodes\_in\_html\_tags()](do_shortcodes_in_html_tags) . `$content` string Required Content to search for placeholders. string Content with placeholders removed. File: `wp-includes/shortcodes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/shortcodes.php/) ``` function unescape_invalid_shortcodes( $content ) { // Clean up entire string, avoids re-parsing HTML. $trans = array( '&#91;' => '[', '&#93;' => ']', ); $content = strtr( $content, $trans ); return $content; } ``` | Used By | Description | | --- | --- | | [do\_shortcode()](do_shortcode) wp-includes/shortcodes.php | Searches content for shortcodes and filter shortcodes through their hooks. | | [strip\_shortcodes()](strip_shortcodes) wp-includes/shortcodes.php | Removes all shortcode tags from the given content. | | Version | Description | | --- | --- | | [4.2.3](https://developer.wordpress.org/reference/since/4.2.3/) | Introduced. | wordpress get_page_templates( WP_Post|null $post = null, string $post_type = 'page' ): string[] get\_page\_templates( WP\_Post|null $post = null, string $post\_type = 'page' ): string[] ========================================================================================= Gets the page templates available in this theme. `$post` [WP\_Post](../classes/wp_post)|null Optional The post being edited, provided for context. Default: `null` `$post_type` string Optional Post type to get the templates for. Default `'page'`. Default: `'page'` string[] Array of template file names keyed by the template header name. The function searches all the current theme’s template files for the commented “Template Name: name of template”. See also [wp\_get\_theme()](wp_get_theme) and the [wp\_get\_theme()](wp_get_theme) ->[get\_page\_templates()](get_page_templates) method of the [WP\_Theme](../classes/wp_theme) class. File: `wp-admin/includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme.php/) ``` function get_page_templates( $post = null, $post_type = 'page' ) { return array_flip( wp_get_theme()->get_page_templates( $post, $post_type ) ); } ``` | Uses | Description | | --- | --- | | [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\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. | | Used By | Description | | --- | --- | | [register\_and\_do\_post\_meta\_boxes()](register_and_do_post_meta_boxes) wp-admin/includes/meta-boxes.php | Registers the default post meta boxes, and runs the `do_meta_boxes` actions. | | [page\_template\_dropdown()](page_template_dropdown) wp-admin/includes/template.php | Prints out option HTML elements for the page templates drop-down. | | [page\_attributes\_meta\_box()](page_attributes_meta_box) wp-admin/includes/meta-boxes.php | Displays page attributes form fields. | | [WP\_Posts\_List\_Table::inline\_edit()](../classes/wp_posts_list_table/inline_edit) wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing | | [wp\_xmlrpc\_server::wp\_getPageTemplates()](../classes/wp_xmlrpc_server/wp_getpagetemplates) wp-includes/class-wp-xmlrpc-server.php | Retrieve page templates. | | Version | Description | | --- | --- | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Added the `$post_type` parameter. | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress wp_calculate_image_sizes( string|int[] $size, string $image_src = null, array $image_meta = null, int $attachment_id ): string|false wp\_calculate\_image\_sizes( string|int[] $size, string $image\_src = null, array $image\_meta = null, int $attachment\_id ): string|false ========================================================================================================================================== Creates a ‘sizes’ attribute value for an image. `$size` string|int[] Required Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). `$image_src` string Optional The URL to the image file. Default: `null` `$image_meta` array Optional The image meta data as returned by '[wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) '. Default: `null` `$attachment_id` int Optional Image attachment ID. Either `$image_meta` or `$attachment_id` is needed when using the image size name as argument for `$size`. Default 0. string|false A valid source size value for use in a `'sizes'` attribute or false. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/) ``` function wp_calculate_image_sizes( $size, $image_src = null, $image_meta = null, $attachment_id = 0 ) { $width = 0; if ( is_array( $size ) ) { $width = absint( $size[0] ); } elseif ( is_string( $size ) ) { if ( ! $image_meta && $attachment_id ) { $image_meta = wp_get_attachment_metadata( $attachment_id ); } if ( is_array( $image_meta ) ) { $size_array = _wp_get_image_size_from_meta( $size, $image_meta ); if ( $size_array ) { $width = absint( $size_array[0] ); } } } if ( ! $width ) { return false; } // Setup the default 'sizes' attribute. $sizes = sprintf( '(max-width: %1$dpx) 100vw, %1$dpx', $width ); /** * Filters the output of 'wp_calculate_image_sizes()'. * * @since 4.4.0 * * @param string $sizes A source size value for use in a 'sizes' attribute. * @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|null $image_src The URL to the image file or null. * @param array|null $image_meta The image meta data as returned by wp_get_attachment_metadata() or null. * @param int $attachment_id Image attachment ID of the original image or 0. */ return apply_filters( 'wp_calculate_image_sizes', $sizes, $size, $image_src, $image_meta, $attachment_id ); } ``` [apply\_filters( 'wp\_calculate\_image\_sizes', string $sizes, string|int[] $size, string|null $image\_src, array|null $image\_meta, int $attachment\_id )](../hooks/wp_calculate_image_sizes) Filters the output of ‘[wp\_calculate\_image\_sizes()](wp_calculate_image_sizes) ’. | Uses | Description | | --- | --- | | [\_wp\_get\_image\_size\_from\_meta()](_wp_get_image_size_from_meta) wp-includes/media.php | Gets the image size as array from its meta data. | | [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. | | [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [get\_header\_image\_tag()](get_header_image_tag) wp-includes/theme.php | Creates image tag markup for a custom header image. | | [wp\_image\_add\_srcset\_and\_sizes()](wp_image_add_srcset_and_sizes) wp-includes/media.php | Adds ‘srcset’ and ‘sizes’ attributes to an existing ‘img’ element. | | [wp\_get\_attachment\_image\_sizes()](wp_get_attachment_image_sizes) wp-includes/media.php | Retrieves the value for an image attachment’s ‘sizes’ attribute. | | [wp\_get\_attachment\_image()](wp_get_attachment_image) wp-includes/media.php | Gets an HTML img element representing an image attachment. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. | wordpress plugin_sandbox_scrape( string $plugin ) plugin\_sandbox\_scrape( string $plugin ) ========================================= Loads a given plugin attempt to generate errors. `$plugin` string Required Path to the plugin file relative to the plugins directory. File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/) ``` function plugin_sandbox_scrape( $plugin ) { if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) { define( 'WP_SANDBOX_SCRAPING', true ); } wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); include_once WP_PLUGIN_DIR . '/' . $plugin; } ``` | Uses | Description | | --- | --- | | [wp\_register\_plugin\_realpath()](wp_register_plugin_realpath) wp-includes/plugin.php | Register a plugin’s real path. | | Used By | Description | | --- | --- | | [resume\_plugin()](resume_plugin) wp-admin/includes/plugin.php | Tries to resume a single plugin. | | [activate\_plugin()](activate_plugin) wp-admin/includes/plugin.php | Attempts activation of plugin in a “sandbox” and redirects on success. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Function was moved into the `wp-admin/includes/plugin.php` file. | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress unstick_post( int $post_id ) unstick\_post( int $post\_id ) ============================== Un-sticks a post. Sticky posts should be displayed at the top of the front page. `$post_id` int Required Post ID. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function unstick_post( $post_id ) { $post_id = (int) $post_id; $stickies = get_option( 'sticky_posts' ); if ( ! is_array( $stickies ) ) { return; } $stickies = array_values( array_unique( array_map( 'intval', $stickies ) ) ); if ( ! in_array( $post_id, $stickies, true ) ) { return; } $offset = array_search( $post_id, $stickies, true ); if ( false === $offset ) { return; } array_splice( $stickies, $offset, 1 ); $updated = update_option( 'sticky_posts', $stickies ); if ( $updated ) { /** * Fires once a post has been removed from the sticky list. * * @since 4.6.0 * * @param int $post_id ID of the post that was unstuck. */ do_action( 'post_unstuck', $post_id ); } } ``` [do\_action( 'post\_unstuck', int $post\_id )](../hooks/post_unstuck) Fires once a post has been removed from the sticky list. | Uses | Description | | --- | --- | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [WP\_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\_xmlrpc\_server::\_toggle\_sticky()](../classes/wp_xmlrpc_server/_toggle_sticky) wp-includes/class-wp-xmlrpc-server.php | Encapsulate the logic for sticking a post and determining if the user has permission to do so | | [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. | | [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. | | [\_reset\_front\_page\_settings\_for\_post()](_reset_front_page_settings_for_post) wp-includes/post.php | Resets the page\_on\_front, show\_on\_front, and page\_for\_post settings when a linked page is deleted or trashed. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
programming_docs
wordpress get_users_drafts( int $user_id ): array get\_users\_drafts( int $user\_id ): array ========================================== Retrieve the user’s drafts. `$user_id` int Required User ID. array File: `wp-admin/includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/user.php/) ``` function get_users_drafts( $user_id ) { global $wpdb; $query = $wpdb->prepare( "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id ); /** * Filters the user's drafts query string. * * @since 2.0.0 * * @param string $query The user's drafts query string. */ $query = apply_filters( 'get_users_drafts', $query ); return $wpdb->get_results( $query ); } ``` [apply\_filters( 'get\_users\_drafts', string $query )](../hooks/get_users_drafts) Filters the user’s drafts query string. | Uses | Description | | --- | --- | | [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. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress pingback_ping_source_uri( string $source_uri ): string pingback\_ping\_source\_uri( string $source\_uri ): string ========================================================== Default filter attached to pingback\_ping\_source\_uri to validate the pingback’s Source URI. * [wp\_http\_validate\_url()](wp_http_validate_url) `$source_uri` string Required string File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/) ``` function pingback_ping_source_uri( $source_uri ) { return (string) wp_http_validate_url( $source_uri ); } ``` | Uses | Description | | --- | --- | | [wp\_http\_validate\_url()](wp_http_validate_url) wp-includes/http.php | Validate a URL for safe use in the HTTP API. | | Version | Description | | --- | --- | | [3.5.1](https://developer.wordpress.org/reference/since/3.5.1/) | Introduced. | wordpress media_upload_gallery(): string|null media\_upload\_gallery(): string|null ===================================== Retrieves the legacy media uploader form in an iframe. string|null File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/) ``` function media_upload_gallery() { $errors = array(); if ( ! empty( $_POST ) ) { $return = media_upload_form_handler(); if ( is_string( $return ) ) { return $return; } if ( is_array( $return ) ) { $errors = $return; } } wp_enqueue_script( 'admin-gallery' ); return wp_iframe( 'media_upload_gallery_form', $errors ); } ``` | Uses | Description | | --- | --- | | [media\_upload\_form\_handler()](media_upload_form_handler) wp-admin/includes/media.php | Handles form submissions for the legacy media uploader. | | [wp\_iframe()](wp_iframe) wp-admin/includes/media.php | Outputs the iframe to display the media upload page. | | [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress _wp_footer_scripts() \_wp\_footer\_scripts() ======================= Private, for use in \*\_footer\_scripts hooks File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/) ``` function _wp_footer_scripts() { print_late_styles(); print_footer_scripts(); } ``` | Uses | Description | | --- | --- | | [print\_late\_styles()](print_late_styles) wp-includes/script-loader.php | Prints the styles that were queued too late for the HTML head. | | [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. | | Version | Description | | --- | --- | | [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. | wordpress wp_default_styles( WP_Styles $styles ) wp\_default\_styles( WP\_Styles $styles ) ========================================= Assigns default styles to $styles object. Nothing is returned, because the $styles parameter is passed by reference. Meaning that whatever object is passed will be updated without having to reassign the variable that was passed back to the same value. This saves memory. Adding default styles is not the only task, it also assigns the base\_url property, the default version, and text direction for the object. `$styles` [WP\_Styles](../classes/wp_styles) Required File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/) ``` function wp_default_styles( $styles ) { global $editor_styles; // Include an unmodified $wp_version. require ABSPATH . WPINC . '/version.php'; if ( ! defined( 'SCRIPT_DEBUG' ) ) { define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) ); } $guessurl = site_url(); if ( ! $guessurl ) { $guessurl = wp_guess_url(); } $styles->base_url = $guessurl; $styles->content_url = defined( 'WP_CONTENT_URL' ) ? WP_CONTENT_URL : ''; $styles->default_version = get_bloginfo( 'version' ); $styles->text_direction = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr'; $styles->default_dirs = array( '/wp-admin/', '/wp-includes/css/' ); // Open Sans is no longer used by core, but may be relied upon by themes and plugins. $open_sans_font_url = ''; /* * translators: If there are characters in your language that are not supported * by Open Sans, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Open Sans font: on or off' ) ) { $subsets = 'latin,latin-ext'; /* * translators: To add an additional Open Sans character subset specific to your language, * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language. */ $subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)' ); if ( 'cyrillic' === $subset ) { $subsets .= ',cyrillic,cyrillic-ext'; } elseif ( 'greek' === $subset ) { $subsets .= ',greek,greek-ext'; } elseif ( 'vietnamese' === $subset ) { $subsets .= ',vietnamese'; } // Hotlink Open Sans, for now. $open_sans_font_url = "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets&display=fallback"; } // Register a stylesheet for the selected admin color scheme. $styles->add( 'colors', true, array( 'wp-admin', 'buttons' ) ); $suffix = SCRIPT_DEBUG ? '' : '.min'; // Admin CSS. $styles->add( 'common', "/wp-admin/css/common$suffix.css" ); $styles->add( 'forms', "/wp-admin/css/forms$suffix.css" ); $styles->add( 'admin-menu', "/wp-admin/css/admin-menu$suffix.css" ); $styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css" ); $styles->add( 'list-tables', "/wp-admin/css/list-tables$suffix.css" ); $styles->add( 'edit', "/wp-admin/css/edit$suffix.css" ); $styles->add( 'revisions', "/wp-admin/css/revisions$suffix.css" ); $styles->add( 'media', "/wp-admin/css/media$suffix.css" ); $styles->add( 'themes', "/wp-admin/css/themes$suffix.css" ); $styles->add( 'about', "/wp-admin/css/about$suffix.css" ); $styles->add( 'nav-menus', "/wp-admin/css/nav-menus$suffix.css" ); $styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css", array( 'wp-pointer' ) ); $styles->add( 'site-icon', "/wp-admin/css/site-icon$suffix.css" ); $styles->add( 'l10n', "/wp-admin/css/l10n$suffix.css" ); $styles->add( 'code-editor', "/wp-admin/css/code-editor$suffix.css", array( 'wp-codemirror' ) ); $styles->add( 'site-health', "/wp-admin/css/site-health$suffix.css" ); $styles->add( 'wp-admin', false, array( 'dashicons', 'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus', 'widgets', 'site-icon', 'l10n' ) ); $styles->add( 'login', "/wp-admin/css/login$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n' ) ); $styles->add( 'install', "/wp-admin/css/install$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n' ) ); $styles->add( 'wp-color-picker', "/wp-admin/css/color-picker$suffix.css" ); $styles->add( 'customize-controls', "/wp-admin/css/customize-controls$suffix.css", array( 'wp-admin', 'colors', 'imgareaselect' ) ); $styles->add( 'customize-widgets', "/wp-admin/css/customize-widgets$suffix.css", array( 'wp-admin', 'colors' ) ); $styles->add( 'customize-nav-menus', "/wp-admin/css/customize-nav-menus$suffix.css", array( 'wp-admin', 'colors' ) ); // Common dependencies. $styles->add( 'buttons', "/wp-includes/css/buttons$suffix.css" ); $styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" ); // Includes CSS. $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array( 'dashicons' ) ); $styles->add( 'wp-auth-check', "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) ); $styles->add( 'editor-buttons', "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) ); $styles->add( 'media-views', "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) ); $styles->add( 'wp-pointer', "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) ); $styles->add( 'customize-preview', "/wp-includes/css/customize-preview$suffix.css", array( 'dashicons' ) ); $styles->add( 'wp-embed-template-ie', "/wp-includes/css/wp-embed-template-ie$suffix.css" ); $styles->add_data( 'wp-embed-template-ie', 'conditional', 'lte IE 8' ); // External libraries and friends. $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' ); $styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) ); $styles->add( 'mediaelement', '/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css', array(), '4.2.17' ); $styles->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.css", array( 'mediaelement' ) ); $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) ); $styles->add( 'wp-codemirror', '/wp-includes/js/codemirror/codemirror.min.css', array(), '5.29.1-alpha-ee20357' ); // Deprecated CSS. $styles->add( 'deprecated-media', "/wp-admin/css/deprecated-media$suffix.css" ); $styles->add( 'farbtastic', "/wp-admin/css/farbtastic$suffix.css", array(), '1.3u1' ); $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.min.css', array(), '0.9.15' ); $styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle. $styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6. // Noto Serif is no longer used by core, but may be relied upon by themes and plugins. $fonts_url = ''; /* * translators: Use this to specify the proper Google Font name and variants * to load that is supported by your language. Do not translate. * Set to 'off' to disable loading. */ $font_family = _x( 'Noto Serif:400,400i,700,700i', 'Google Font Name and Variants' ); if ( 'off' !== $font_family ) { $fonts_url = 'https://fonts.googleapis.com/css?family=' . urlencode( $font_family ); } $styles->add( 'wp-editor-font', $fonts_url ); // No longer used in core as of 5.7. $block_library_theme_path = WPINC . "/css/dist/block-library/theme$suffix.css"; $styles->add( 'wp-block-library-theme', "/$block_library_theme_path" ); $styles->add_data( 'wp-block-library-theme', 'path', ABSPATH . $block_library_theme_path ); $styles->add( 'wp-reset-editor-styles', "/wp-includes/css/dist/block-library/reset$suffix.css", array( 'common', 'forms' ) // Make sure the reset is loaded after the default WP Admin styles. ); $styles->add( 'wp-editor-classic-layout-styles', "/wp-includes/css/dist/edit-post/classic$suffix.css", array() ); $wp_edit_blocks_dependencies = array( 'wp-components', 'wp-editor', // This need to be added before the block library styles, // The block library styles override the "reset" styles. 'wp-reset-editor-styles', 'wp-block-library', 'wp-reusable-blocks', ); // Only load the default layout and margin styles for themes without theme.json file. if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) { $wp_edit_blocks_dependencies[] = 'wp-editor-classic-layout-styles'; } if ( ! is_array( $editor_styles ) || count( $editor_styles ) === 0 ) { // Include opinionated block styles if no $editor_styles are declared, so the editor never appears broken. $wp_edit_blocks_dependencies[] = 'wp-block-library-theme'; } $styles->add( 'wp-edit-blocks', "/wp-includes/css/dist/block-library/editor$suffix.css", $wp_edit_blocks_dependencies ); $package_styles = array( 'block-editor' => array( 'wp-components' ), 'block-library' => array(), 'block-directory' => array(), 'components' => array(), 'edit-post' => array( 'wp-components', 'wp-block-editor', 'wp-editor', 'wp-edit-blocks', 'wp-block-library', 'wp-nux', ), 'editor' => array( 'wp-components', 'wp-block-editor', 'wp-nux', 'wp-reusable-blocks', ), 'format-library' => array(), 'list-reusable-blocks' => array( 'wp-components' ), 'reusable-blocks' => array( 'wp-components' ), 'nux' => array( 'wp-components' ), 'widgets' => array( 'wp-components', ), 'edit-widgets' => array( 'wp-widgets', 'wp-block-editor', 'wp-edit-blocks', 'wp-block-library', 'wp-reusable-blocks', ), 'customize-widgets' => array( 'wp-widgets', 'wp-block-editor', 'wp-edit-blocks', 'wp-block-library', 'wp-reusable-blocks', ), 'edit-site' => array( 'wp-components', 'wp-block-editor', 'wp-edit-blocks', ), ); foreach ( $package_styles as $package => $dependencies ) { $handle = 'wp-' . $package; $path = "/wp-includes/css/dist/$package/style$suffix.css"; if ( 'block-library' === $package && wp_should_load_separate_core_block_assets() ) { $path = "/wp-includes/css/dist/$package/common$suffix.css"; } $styles->add( $handle, $path, $dependencies ); $styles->add_data( $handle, 'path', ABSPATH . $path ); } // RTL CSS. $rtl_styles = array( // Admin CSS. 'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus', 'widgets', 'site-icon', 'l10n', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'customize-preview', 'login', 'site-health', // Includes CSS. 'buttons', 'admin-bar', 'wp-auth-check', 'editor-buttons', 'media-views', 'wp-pointer', 'wp-jquery-ui-dialog', // Package styles. 'wp-reset-editor-styles', 'wp-editor-classic-layout-styles', 'wp-block-library-theme', 'wp-edit-blocks', 'wp-block-editor', 'wp-block-library', 'wp-block-directory', 'wp-components', 'wp-customize-widgets', 'wp-edit-post', 'wp-edit-site', 'wp-edit-widgets', 'wp-editor', 'wp-format-library', 'wp-list-reusable-blocks', 'wp-reusable-blocks', 'wp-nux', 'wp-widgets', // Deprecated CSS. 'deprecated-media', 'farbtastic', ); foreach ( $rtl_styles as $rtl_style ) { $styles->add_data( $rtl_style, 'rtl', 'replace' ); if ( $suffix ) { $styles->add_data( $rtl_style, 'suffix', $suffix ); } } } ``` | Uses | Description | | --- | --- | | [WP\_Theme\_JSON\_Resolver::theme\_has\_support()](../classes/wp_theme_json_resolver/theme_has_support) wp-includes/class-wp-theme-json-resolver.php | Determines whether the active theme has a theme.json file. | | [wp\_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\_guess\_url()](wp_guess_url) wp-includes/functions.php | Guesses the URL for the site. | | [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). | | [site\_url()](site_url) wp-includes/link-template.php | Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | Version | Description | | --- | --- | | [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. | wordpress _wp_handle_upload( array $file, array|false $overrides, string $time, string $action ): array \_wp\_handle\_upload( array $file, array|false $overrides, string $time, string $action ): array ================================================================================================ This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use <wp_handle_upload_error> instead. Handles PHP uploads in WordPress. Sanitizes file names, checks extensions for mime type, and moves the file to the appropriate directory within the uploads directory. * <wp_handle_upload_error> `$file` array Required Reference to a single element from `$_FILES`. Call the function once for each uploaded file. * `name`stringThe original name of the file on the client machine. * `type`stringThe mime type of the file, if the browser provided this information. * `tmp_name`stringThe temporary filename of the file in which the uploaded file was stored on the server. * `size`intThe size, in bytes, of the uploaded file. * `error`intThe error code associated with this file upload. `$overrides` array|false Required An array of override parameters for this file, or boolean false if none are provided. * `upload_error_handler`callableFunction to call when there is an error during the upload process. @see [wp\_handle\_upload\_error()](wp_handle_upload_error) . * `unique_filename_callback`callableFunction to call when determining a unique file name for the file. @see [wp\_unique\_filename()](wp_unique_filename) . * `upload_error_strings`string[]The strings that describe the error indicated in `$_FILES[{form field}]['error']`. * `test_form`boolWhether to test that the `$_POST['action']` parameter is as expected. * `test_size`boolWhether to test that the file size is greater than zero bytes. * `test_type`boolWhether to test that the mime type of the file is as expected. * `mimes`string[]Array of allowed mime types keyed by their file extension regex. `$time` string Required Time formatted in `'yyyy/mm'`. `$action` string Required Expected value for `$_POST['action']`. array On success, returns an associative array of file attributes. On failure, returns `$overrides['upload_error_handler']( &$file, $message )` or `array( 'error' => $message )`. * `file`stringFilename of the newly-uploaded file. * `url`stringURL of the newly-uploaded file. * `type`stringMime type of the newly-uploaded file. File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/) ``` function _wp_handle_upload( &$file, $overrides, $time, $action ) { // The default error handler. if ( ! function_exists( 'wp_handle_upload_error' ) ) { function wp_handle_upload_error( &$file, $message ) { return array( 'error' => $message ); } } /** * Filters the data for a file before it is uploaded to WordPress. * * The dynamic portion of the hook name, `$action`, refers to the post action. * * Possible hook names include: * * - `wp_handle_sideload_prefilter` * - `wp_handle_upload_prefilter` * * @since 2.9.0 as 'wp_handle_upload_prefilter'. * @since 4.0.0 Converted to a dynamic hook with `$action`. * * @param array $file { * Reference to a single element from `$_FILES`. * * @type string $name The original name of the file on the client machine. * @type string $type The mime type of the file, if the browser provided this information. * @type string $tmp_name The temporary filename of the file in which the uploaded file was stored on the server. * @type int $size The size, in bytes, of the uploaded file. * @type int $error The error code associated with this file upload. * } */ $file = apply_filters( "{$action}_prefilter", $file ); /** * Filters the override parameters for a file before it is uploaded to WordPress. * * The dynamic portion of the hook name, `$action`, refers to the post action. * * Possible hook names include: * * - `wp_handle_sideload_overrides` * - `wp_handle_upload_overrides` * * @since 5.7.0 * * @param array|false $overrides An array of override parameters for this file. Boolean false if none are * provided. @see _wp_handle_upload(). * @param array $file { * Reference to a single element from `$_FILES`. * * @type string $name The original name of the file on the client machine. * @type string $type The mime type of the file, if the browser provided this information. * @type string $tmp_name The temporary filename of the file in which the uploaded file was stored on the server. * @type int $size The size, in bytes, of the uploaded file. * @type int $error The error code associated with this file upload. * } */ $overrides = apply_filters( "{$action}_overrides", $overrides, $file ); // You may define your own function and pass the name in $overrides['upload_error_handler']. $upload_error_handler = 'wp_handle_upload_error'; if ( isset( $overrides['upload_error_handler'] ) ) { $upload_error_handler = $overrides['upload_error_handler']; } // You may have had one or more 'wp_handle_upload_prefilter' functions error out the file. Handle that gracefully. if ( isset( $file['error'] ) && ! is_numeric( $file['error'] ) && $file['error'] ) { return call_user_func_array( $upload_error_handler, array( &$file, $file['error'] ) ); } // Install user overrides. Did we mention that this voids your warranty? // You may define your own function and pass the name in $overrides['unique_filename_callback']. $unique_filename_callback = null; if ( isset( $overrides['unique_filename_callback'] ) ) { $unique_filename_callback = $overrides['unique_filename_callback']; } /* * This may not have originally been intended to be overridable, * but historically has been. */ if ( isset( $overrides['upload_error_strings'] ) ) { $upload_error_strings = $overrides['upload_error_strings']; } else { // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error']. $upload_error_strings = array( false, sprintf( /* translators: 1: upload_max_filesize, 2: php.ini */ __( 'The uploaded file exceeds the %1$s directive in %2$s.' ), 'upload_max_filesize', 'php.ini' ), sprintf( /* translators: %s: MAX_FILE_SIZE */ __( 'The uploaded file exceeds the %s directive that was specified in the HTML form.' ), 'MAX_FILE_SIZE' ), __( 'The uploaded file was only partially uploaded.' ), __( 'No file was uploaded.' ), '', __( 'Missing a temporary folder.' ), __( 'Failed to write file to disk.' ), __( 'File upload stopped by extension.' ), ); } // All tests are on by default. Most can be turned off by $overrides[{test_name}] = false; $test_form = isset( $overrides['test_form'] ) ? $overrides['test_form'] : true; $test_size = isset( $overrides['test_size'] ) ? $overrides['test_size'] : true; // If you override this, you must provide $ext and $type!! $test_type = isset( $overrides['test_type'] ) ? $overrides['test_type'] : true; $mimes = isset( $overrides['mimes'] ) ? $overrides['mimes'] : false; // A correct form post will pass this test. if ( $test_form && ( ! isset( $_POST['action'] ) || $_POST['action'] !== $action ) ) { return call_user_func_array( $upload_error_handler, array( &$file, __( 'Invalid form submission.' ) ) ); } // A successful upload will pass this test. It makes no sense to override this one. if ( isset( $file['error'] ) && $file['error'] > 0 ) { return call_user_func_array( $upload_error_handler, array( &$file, $upload_error_strings[ $file['error'] ] ) ); } // A properly uploaded file will pass this test. There should be no reason to override this one. $test_uploaded_file = 'wp_handle_upload' === $action ? is_uploaded_file( $file['tmp_name'] ) : @is_readable( $file['tmp_name'] ); if ( ! $test_uploaded_file ) { return call_user_func_array( $upload_error_handler, array( &$file, __( 'Specified file failed upload test.' ) ) ); } $test_file_size = 'wp_handle_upload' === $action ? $file['size'] : filesize( $file['tmp_name'] ); // A non-empty file will pass this test. if ( $test_size && ! ( $test_file_size > 0 ) ) { if ( is_multisite() ) { $error_msg = __( 'File is empty. Please upload something more substantial.' ); } else { $error_msg = sprintf( /* translators: 1: php.ini, 2: post_max_size, 3: upload_max_filesize */ __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your %1$s file or by %2$s being defined as smaller than %3$s in %1$s.' ), 'php.ini', 'post_max_size', 'upload_max_filesize' ); } return call_user_func_array( $upload_error_handler, array( &$file, $error_msg ) ); } // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter. if ( $test_type ) { $wp_filetype = wp_check_filetype_and_ext( $file['tmp_name'], $file['name'], $mimes ); $ext = empty( $wp_filetype['ext'] ) ? '' : $wp_filetype['ext']; $type = empty( $wp_filetype['type'] ) ? '' : $wp_filetype['type']; $proper_filename = empty( $wp_filetype['proper_filename'] ) ? '' : $wp_filetype['proper_filename']; // Check to see if wp_check_filetype_and_ext() determined the filename was incorrect. if ( $proper_filename ) { $file['name'] = $proper_filename; } if ( ( ! $type || ! $ext ) && ! current_user_can( 'unfiltered_upload' ) ) { return call_user_func_array( $upload_error_handler, array( &$file, __( 'Sorry, you are not allowed to upload this file type.' ) ) ); } if ( ! $type ) { $type = $file['type']; } } else { $type = ''; } /* * A writable uploads dir will pass this test. Again, there's no point * overriding this one. */ $uploads = wp_upload_dir( $time ); if ( ! ( $uploads && false === $uploads['error'] ) ) { return call_user_func_array( $upload_error_handler, array( &$file, $uploads['error'] ) ); } $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); // Move the file to the uploads dir. $new_file = $uploads['path'] . "/$filename"; /** * Filters whether to short-circuit moving the uploaded file after passing all checks. * * If a non-null value is returned from the filter, moving the file and any related * error reporting will be completely skipped. * * @since 4.9.0 * * @param mixed $move_new_file If null (default) move the file after the upload. * @param array $file { * Reference to a single element from `$_FILES`. * * @type string $name The original name of the file on the client machine. * @type string $type The mime type of the file, if the browser provided this information. * @type string $tmp_name The temporary filename of the file in which the uploaded file was stored on the server. * @type int $size The size, in bytes, of the uploaded file. * @type int $error The error code associated with this file upload. * } * @param string $new_file Filename of the newly-uploaded file. * @param string $type Mime type of the newly-uploaded file. */ $move_new_file = apply_filters( 'pre_move_uploaded_file', null, $file, $new_file, $type ); if ( null === $move_new_file ) { if ( 'wp_handle_upload' === $action ) { $move_new_file = @move_uploaded_file( $file['tmp_name'], $new_file ); } else { // Use copy and unlink because rename breaks streams. // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged $move_new_file = @copy( $file['tmp_name'], $new_file ); unlink( $file['tmp_name'] ); } if ( false === $move_new_file ) { if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) { $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir']; } else { $error_path = basename( $uploads['basedir'] ) . $uploads['subdir']; } return $upload_error_handler( $file, sprintf( /* translators: %s: Destination file path. */ __( 'The uploaded file could not be moved to %s.' ), $error_path ) ); } } // Set correct file permissions. $stat = stat( dirname( $new_file ) ); $perms = $stat['mode'] & 0000666; chmod( $new_file, $perms ); // Compute the URL. $url = $uploads['url'] . "/$filename"; if ( is_multisite() ) { clean_dirsize_cache( $new_file ); } /** * Filters the data array for the uploaded file. * * @since 2.1.0 * * @param array $upload { * Array of upload data. * * @type string $file Filename of the newly-uploaded file. * @type string $url URL of the newly-uploaded file. * @type string $type Mime type of the newly-uploaded file. * } * @param string $context The type of upload action. Values include 'upload' or 'sideload'. */ return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type, ), 'wp_handle_sideload' === $action ? 'sideload' : 'upload' ); } ``` [apply\_filters( 'pre\_move\_uploaded\_file', mixed $move\_new\_file, array $file, string $new\_file, string $type )](../hooks/pre_move_uploaded_file) Filters whether to short-circuit moving the uploaded file after passing all checks. [apply\_filters( 'wp\_handle\_upload', array $upload, string $context )](../hooks/wp_handle_upload) Filters the data array for the uploaded file. [apply\_filters( "{$action}\_overrides", array|false $overrides, array $file )](../hooks/action_overrides) Filters the override parameters for a file before it is uploaded to WordPress. [apply\_filters( "{$action}\_prefilter", array $file )](../hooks/action_prefilter) Filters the data for a file before it is uploaded to WordPress. | Uses | Description | | --- | --- | | [clean\_dirsize\_cache()](clean_dirsize_cache) wp-includes/functions.php | Cleans directory size cache used by [recurse\_dirsize()](recurse_dirsize) . | | [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\_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. | | [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. | | [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 | Wrapper for [\_wp\_handle\_upload()](_wp_handle_upload) . | | [wp\_handle\_sideload()](wp_handle_sideload) wp-admin/includes/file.php | Wrapper for [\_wp\_handle\_upload()](_wp_handle_upload) . | | Version | Description | | --- | --- | | [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
programming_docs
wordpress comments_rss_link( string $link_text = 'Comments RSS' ) comments\_rss\_link( string $link\_text = 'Comments RSS' ) ========================================================== This function has been deprecated. Use [post\_comments\_feed\_link()](post_comments_feed_link) instead. Print RSS comment feed link. * [post\_comments\_feed\_link()](post_comments_feed_link) `$link_text` string Optional Default: `'Comments RSS'` File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function comments_rss_link($link_text = 'Comments RSS') { _deprecated_function( __FUNCTION__, '2.5.0', 'post_comments_feed_link()' ); post_comments_feed_link($link_text); } ``` | Uses | Description | | --- | --- | | [post\_comments\_feed\_link()](post_comments_feed_link) wp-includes/link-template.php | Displays the comment feed link for a post. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Use [post\_comments\_feed\_link()](post_comments_feed_link) | | [1.0.1](https://developer.wordpress.org/reference/since/1.0.1/) | Introduced. | wordpress wp_count_posts( string $type = 'post', string $perm = '' ): stdClass wp\_count\_posts( string $type = 'post', string $perm = '' ): stdClass ====================================================================== Counts number of posts of a post type and if user has permissions to view. This function provides an efficient method of finding the amount of post’s type a blog has. Another method is to count the amount of items in [get\_posts()](get_posts) , but that method has a lot of overhead with doing so. Therefore, when developing for 2.5+, use this function instead. The $perm parameter checks for ‘readable’ value and if the user can read private posts, it will display that for the user that is signed in. `$type` string Optional Post type to retrieve count. Default `'post'`. Default: `'post'` `$perm` string Optional `'readable'` or empty. Default: `''` stdClass Number of posts for each status. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function wp_count_posts( $type = 'post', $perm = '' ) { global $wpdb; if ( ! post_type_exists( $type ) ) { return new stdClass; } $cache_key = _count_posts_cache_key( $type, $perm ); $counts = wp_cache_get( $cache_key, 'counts' ); if ( false !== $counts ) { // We may have cached this before every status was registered. foreach ( get_post_stati() as $status ) { if ( ! isset( $counts->{$status} ) ) { $counts->{$status} = 0; } } /** This filter is documented in wp-includes/post.php */ return apply_filters( 'wp_count_posts', $counts, $type, $perm ); } $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s"; if ( 'readable' === $perm && is_user_logged_in() ) { $post_type_object = get_post_type_object( $type ); if ( ! current_user_can( $post_type_object->cap->read_private_posts ) ) { $query .= $wpdb->prepare( " AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))", get_current_user_id() ); } } $query .= ' GROUP BY post_status'; $results = (array) $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A ); $counts = array_fill_keys( get_post_stati(), 0 ); foreach ( $results as $row ) { $counts[ $row['post_status'] ] = $row['num_posts']; } $counts = (object) $counts; wp_cache_set( $cache_key, $counts, 'counts' ); /** * Modifies returned post counts by status for the current post type. * * @since 3.7.0 * * @param stdClass $counts An object containing the current post_type's post * counts by status. * @param string $type Post type. * @param string $perm The permission to determine if the posts are 'readable' * by the current user. */ return apply_filters( 'wp_count_posts', $counts, $type, $perm ); } ``` [apply\_filters( 'wp\_count\_posts', stdClass $counts, string $type, string $perm )](../hooks/wp_count_posts) Modifies returned post counts by status for the current post type. | Uses | Description | | --- | --- | | [\_count\_posts\_cache\_key()](_count_posts_cache_key) wp-includes/post.php | Returns the cache key for [wp\_count\_posts()](wp_count_posts) based on the passed arguments. | | [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. | | [post\_type\_exists()](post_type_exists) wp-includes/post.php | Determines whether a post type is registered. | | [get\_post\_stati()](get_post_stati) wp-includes/post.php | Gets a list of post statuses. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. | | [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. | | [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. | | [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. | | [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\_dashboard\_right\_now()](wp_dashboard_right_now) wp-admin/includes/dashboard.php | Dashboard widget that displays some basic stats about the site. | | [get\_available\_post\_statuses()](get_available_post_statuses) wp-admin/includes/post.php | Returns all the possible statuses for a post type. | | [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::prepare\_items()](../classes/wp_posts_list_table/prepare_items) wp-admin/includes/class-wp-posts-list-table.php | | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress display_setup_form( string|null $error = null ) display\_setup\_form( string|null $error = null ) ================================================= Displays installer setup form. `$error` string|null Optional Default: `null` File: `wp-admin/install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/install.php/) ``` function display_setup_form( $error = null ) { global $wpdb; $user_table = ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->users ) ) ) !== null ); // Ensure that sites appear in search engines by default. $blog_public = 1; if ( isset( $_POST['weblog_title'] ) ) { $blog_public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : $blog_public; } $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; $user_name = isset( $_POST['user_name'] ) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; $admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : ''; if ( ! is_null( $error ) ) { ?> <h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> <p class="message"><?php echo $error; ?></p> <?php } ?> <form id="setup" method="post" action="install.php?step=2" novalidate="novalidate"> <table class="form-table" role="presentation"> <tr> <th scope="row"><label for="weblog_title"><?php _e( 'Site Title' ); ?></label></th> <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td> </tr> <tr> <th scope="row"><label for="user_login"><?php _e( 'Username' ); ?></label></th> <td> <?php if ( $user_table ) { _e( 'User(s) already exists.' ); echo '<input name="user_name" type="hidden" value="admin" />'; } else { ?> <input name="user_name" type="text" id="user_login" size="25" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" /> <p><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p> <?php } ?> </td> </tr> <?php if ( ! $user_table ) : ?> <tr class="form-field form-required user-pass1-wrap"> <th scope="row"> <label for="pass1"> <?php _e( 'Password' ); ?> </label> </th> <td> <div class="wp-pwd"> <?php $initial_password = isset( $_POST['admin_password'] ) ? stripslashes( $_POST['admin_password'] ) : wp_generate_password( 18 ); ?> <input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="new-password" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" /> <button type="button" class="button wp-hide-pw hide-if-no-js" data-start-masked="<?php echo (int) isset( $_POST['admin_password'] ); ?>" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> <span class="dashicons dashicons-hidden"></span> <span class="text"><?php _e( 'Hide' ); ?></span> </button> <div id="pass-strength-result" aria-live="polite"></div> </div> <p><span class="description important hide-if-no-js"> <strong><?php _e( 'Important:' ); ?></strong> <?php /* translators: The non-breaking space prevents 1Password from thinking the text "log in" should trigger a password save prompt. */ ?> <?php _e( 'You will need this password to log&nbsp;in. Please store it in a secure location.' ); ?></span></p> </td> </tr> <tr class="form-field form-required user-pass2-wrap hide-if-js"> <th scope="row"> <label for="pass2"><?php _e( 'Repeat Password' ); ?> <span class="description"><?php _e( '(required)' ); ?></span> </label> </th> <td> <input name="admin_password2" type="password" id="pass2" autocomplete="new-password" /> </td> </tr> <tr class="pw-weak"> <th scope="row"><?php _e( 'Confirm Password' ); ?></th> <td> <label> <input type="checkbox" name="pw_weak" class="pw-checkbox" /> <?php _e( 'Confirm use of weak password' ); ?> </label> </td> </tr> <?php endif; ?> <tr> <th scope="row"><label for="admin_email"><?php _e( 'Your Email' ); ?></label></th> <td><input name="admin_email" type="email" id="admin_email" size="25" value="<?php echo esc_attr( $admin_email ); ?>" /> <p><?php _e( 'Double-check your email address before continuing.' ); ?></p></td> </tr> <tr> <th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site visibility' ) : _e( 'Search engine visibility' ); ?></th> <td> <fieldset> <legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site visibility' ) : _e( 'Search engine visibility' ); ?> </span></legend> <?php if ( has_action( 'blog_privacy_selector' ) ) { ?> <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( 1, $blog_public ); ?> /> <label for="blog-public"><?php _e( 'Allow search engines to index this site' ); ?></label><br /> <input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( 0, $blog_public ); ?> /> <label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label> <p class="description"><?php _e( 'Note: Neither of these options blocks access to your site &mdash; it is up to search engines to honor your request.' ); ?></p> <?php /** This action is documented in wp-admin/options-reading.php */ do_action( 'blog_privacy_selector' ); } else { ?> <label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( 0, $blog_public ); ?> /> <?php _e( 'Discourage search engines from indexing this site' ); ?></label> <p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p> <?php } ?> </fieldset> </td> </tr> </table> <p class="step"><?php submit_button( __( 'Install WordPress' ), 'large', 'Submit', false, array( 'id' => 'submit' ) ); ?></p> <input type="hidden" name="language" value="<?php echo isset( $_REQUEST['language'] ) ? esc_attr( $_REQUEST['language'] ) : ''; ?>" /> </form> <?php } // End display_setup_form(). ``` [do\_action( 'blog\_privacy\_selector' )](../hooks/blog_privacy_selector) Enables the legacy ‘Site visibility’ privacy options. | Uses | Description | | --- | --- | | [wpdb::esc\_like()](../classes/wpdb/esc_like) wp-includes/class-wpdb.php | First half of escaping for `LIKE` special characters `%` and `_` before preparing for SQL. | | [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). | | [\_ex()](_ex) wp-includes/l10n.php | Displays translated string with gettext context. | | [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. | | [sanitize\_user()](sanitize_user) wp-includes/formatting.php | Sanitizes a username, stripping out unsafe characters. | | [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. | | [checked()](checked) wp-includes/general-template.php | Outputs the HTML checked attribute. | | [has\_action()](has_action) wp-includes/plugin.php | Checks if any action has been registered for a hook. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [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. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress wp_dashboard_site_activity() wp\_dashboard\_site\_activity() =============================== Callback function for Activity 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_activity() { echo '<div id="activity-widget">'; $future_posts = wp_dashboard_recent_posts( array( 'max' => 5, 'status' => 'future', 'order' => 'ASC', 'title' => __( 'Publishing Soon' ), 'id' => 'future-posts', ) ); $recent_posts = wp_dashboard_recent_posts( array( 'max' => 5, 'status' => 'publish', 'order' => 'DESC', 'title' => __( 'Recently Published' ), 'id' => 'published-posts', ) ); $recent_comments = wp_dashboard_recent_comments(); if ( ! $future_posts && ! $recent_posts && ! $recent_comments ) { echo '<div class="no-activity">'; echo '<p>' . __( 'No activity yet!' ) . '</p>'; echo '</div>'; } echo '</div>'; } ``` | Uses | Description | | --- | --- | | [wp\_dashboard\_recent\_posts()](wp_dashboard_recent_posts) wp-admin/includes/dashboard.php | Generates Publishing Soon and Recently Published sections. | | [wp\_dashboard\_recent\_comments()](wp_dashboard_recent_comments) wp-admin/includes/dashboard.php | Show Comments section. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | Version | Description | | --- | --- | | [3.8.0](https://developer.wordpress.org/reference/since/3.8.0/) | Introduced. | wordpress wp_style_engine_get_stylesheet_from_css_rules( array $css_rules, array $options = array() ): string wp\_style\_engine\_get\_stylesheet\_from\_css\_rules( array $css\_rules, array $options = array() ): string =========================================================================================================== Returns compiled CSS from a collection of selectors and declarations. Useful for returning a compiled stylesheet from any collection of CSS selector + declarations. Example usage: $css\_rules = array( array( ‘selector’ => ‘.elephant-are-cool’, ‘declarations’ => array( ‘color’ => ‘gray’, ‘width’ => ‘3em’ ) ) ); $css = wp\_style\_engine\_get\_stylesheet\_from\_css\_rules( $css\_rules ); // Returns `.elephant-are-cool{color:gray;width:3em}`. `$css_rules` array Required Required. A collection of CSS rules. * `...$0`array + `selector`stringA CSS selector. + `declarations`string[]An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ). `$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 `'block-supports'`. When set, the style engine will attempt to store the CSS rules. + `optimize`boolWhether to optimize the CSS output, e.g., combine rules. Default is `false`. + `prettify`boolWhether to add new lines and indents to output. Default is the test of whether the global constant `SCRIPT_DEBUG` is defined. Default: `array()` string A string of compiled CSS declarations, or empty string. 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_stylesheet_from_css_rules( $css_rules, $options = array() ) { if ( empty( $css_rules ) ) { return ''; } $options = wp_parse_args( $options, array( 'context' => null, ) ); $css_rule_objects = array(); foreach ( $css_rules as $css_rule ) { if ( empty( $css_rule['selector'] ) || empty( $css_rule['declarations'] ) || ! is_array( $css_rule['declarations'] ) ) { continue; } if ( ! empty( $options['context'] ) ) { WP_Style_Engine::store_css_rule( $options['context'], $css_rule['selector'], $css_rule['declarations'] ); } $css_rule_objects[] = new WP_Style_Engine_CSS_Rule( $css_rule['selector'], $css_rule['declarations'] ); } if ( empty( $css_rule_objects ) ) { return ''; } return WP_Style_Engine::compile_stylesheet_from_css_rules( $css_rule_objects, $options ); } ``` | Uses | Description | | --- | --- | | [WP\_Style\_Engine\_CSS\_Rule::\_\_construct()](../classes/wp_style_engine_css_rule/__construct) wp-includes/style-engine/class-wp-style-engine-css-rule.php | Constructor | | [WP\_Style\_Engine::compile\_stylesheet\_from\_css\_rules()](../classes/wp_style_engine/compile_stylesheet_from_css_rules) wp-includes/style-engine/class-wp-style-engine.php | Returns a compiled stylesheet from stored CSS rules. | | [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. |
programming_docs
wordpress register_widget( string|WP_Widget $widget ) register\_widget( string|WP\_Widget $widget ) ============================================= Register a widget Registers a [WP\_Widget](../classes/wp_widget) widget * [WP\_Widget](../classes/wp_widget) `$widget` string|[WP\_Widget](../classes/wp_widget) Required Either the name of a `WP_Widget` subclass or an instance of a `WP_Widget` subclass. File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/) ``` function register_widget( $widget ) { global $wp_widget_factory; $wp_widget_factory->register( $widget ); } ``` | Uses | Description | | --- | --- | | [WP\_Widget\_Factory::register()](../classes/wp_widget_factory/register) wp-includes/class-wp-widget-factory.php | Registers a widget subclass. | | Used By | Description | | --- | --- | | [wp\_widgets\_init()](wp_widgets_init) wp-includes/widgets.php | Registers all of the default WordPress widgets on startup. | | Version | Description | | --- | --- | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Updated the `$widget` parameter to also accept a [WP\_Widget](../classes/wp_widget) instance object instead of simply a `WP_Widget` subclass name. | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress rest_is_boolean( bool|string $maybe_bool ): bool rest\_is\_boolean( bool|string $maybe\_bool ): bool =================================================== Determines if a given value is boolean-like. `$maybe_bool` bool|string Required The value being evaluated. bool True if a boolean, otherwise false. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_is_boolean( $maybe_bool ) { if ( is_bool( $maybe_bool ) ) { return true; } if ( is_string( $maybe_bool ) ) { $maybe_bool = strtolower( $maybe_bool ); $valid_boolean_values = array( 'false', 'true', '0', '1', ); return in_array( $maybe_bool, $valid_boolean_values, true ); } if ( is_int( $maybe_bool ) ) { return in_array( $maybe_bool, array( 0, 1 ), true ); } return false; } ``` | Used By | Description | | --- | --- | | [rest\_validate\_boolean\_value\_from\_schema()](rest_validate_boolean_value_from_schema) wp-includes/rest-api.php | Validates a boolean value based on a schema. | | Version | Description | | --- | --- | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. | wordpress image_get_intermediate_size( int $post_id, string|int[] $size = 'thumbnail' ): array|false image\_get\_intermediate\_size( int $post\_id, string|int[] $size = 'thumbnail' ): array|false ============================================================================================== Retrieves the image’s intermediate size (resized) path, width, and height. The $size parameter can be an array with the width and height respectively. If the size matches the ‘sizes’ metadata array for width and height, then it will be used. If there is no direct match, then the nearest image size larger than the specified size will be used. If nothing is found, then the function will break out and return false. The metadata ‘sizes’ is used for compatible sizes that can be used for the parameter $size value. The url path will be given, when the $size parameter is a string. If you are passing an array for the $size, you should consider using [add\_image\_size()](add_image_size) so that a cropped version is generated. It’s much more efficient than having to find the closest-sized image and then having the browser scale down the image. `$post_id` int Required Attachment ID. `$size` string|int[] Optional Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default `'thumbnail'`. Default: `'thumbnail'` array|false Array of file relative path, width, and height on success. Additionally includes absolute path and URL if registered size is passed to `$size` parameter. False on failure. * `file`stringPath of image relative to uploads directory. * `width`intWidth of image in pixels. * `height`intHeight of image in pixels. * `path`stringAbsolute filesystem path of image. * `url`stringURL of image. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/) ``` function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) { $imagedata = wp_get_attachment_metadata( $post_id ); if ( ! $size || ! is_array( $imagedata ) || empty( $imagedata['sizes'] ) ) { return false; } $data = array(); // Find the best match when '$size' is an array. if ( is_array( $size ) ) { $candidates = array(); if ( ! isset( $imagedata['file'] ) && isset( $imagedata['sizes']['full'] ) ) { $imagedata['height'] = $imagedata['sizes']['full']['height']; $imagedata['width'] = $imagedata['sizes']['full']['width']; } foreach ( $imagedata['sizes'] as $_size => $data ) { // If there's an exact match to an existing image size, short circuit. if ( (int) $data['width'] === (int) $size[0] && (int) $data['height'] === (int) $size[1] ) { $candidates[ $data['width'] * $data['height'] ] = $data; break; } // If it's not an exact match, consider larger sizes with the same aspect ratio. if ( $data['width'] >= $size[0] && $data['height'] >= $size[1] ) { // If '0' is passed to either size, we test ratios against the original file. if ( 0 === $size[0] || 0 === $size[1] ) { $same_ratio = wp_image_matches_ratio( $data['width'], $data['height'], $imagedata['width'], $imagedata['height'] ); } else { $same_ratio = wp_image_matches_ratio( $data['width'], $data['height'], $size[0], $size[1] ); } if ( $same_ratio ) { $candidates[ $data['width'] * $data['height'] ] = $data; } } } if ( ! empty( $candidates ) ) { // Sort the array by size if we have more than one candidate. if ( 1 < count( $candidates ) ) { ksort( $candidates ); } $data = array_shift( $candidates ); /* * When the size requested is smaller than the thumbnail dimensions, we * fall back to the thumbnail size to maintain backward compatibility with * pre 4.6 versions of WordPress. */ } elseif ( ! empty( $imagedata['sizes']['thumbnail'] ) && $imagedata['sizes']['thumbnail']['width'] >= $size[0] && $imagedata['sizes']['thumbnail']['width'] >= $size[1] ) { $data = $imagedata['sizes']['thumbnail']; } else { return false; } // Constrain the width and height attributes to the requested values. list( $data['width'], $data['height'] ) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); } elseif ( ! empty( $imagedata['sizes'][ $size ] ) ) { $data = $imagedata['sizes'][ $size ]; } // If we still don't have a match at this point, return false. if ( empty( $data ) ) { return false; } // Include the full filesystem path of the intermediate file. if ( empty( $data['path'] ) && ! empty( $data['file'] ) && ! empty( $imagedata['file'] ) ) { $file_url = wp_get_attachment_url( $post_id ); $data['path'] = path_join( dirname( $imagedata['file'] ), $data['file'] ); $data['url'] = path_join( dirname( $file_url ), $data['file'] ); } /** * Filters the output of image_get_intermediate_size() * * @since 4.4.0 * * @see image_get_intermediate_size() * * @param array $data Array of file relative path, width, and height on success. May also include * file absolute path and URL. * @param int $post_id The ID of the image attachment. * @param string|int[] $size Requested image size. Can be any registered image size name, or * an array of width and height values in pixels (in that order). */ return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size ); } ``` [apply\_filters( 'image\_get\_intermediate\_size', array $data, int $post\_id, string|int[] $size )](../hooks/image_get_intermediate_size) Filters the output of [image\_get\_intermediate\_size()](image_get_intermediate_size) | Uses | Description | | --- | --- | | [wp\_image\_matches\_ratio()](wp_image_matches_ratio) wp-includes/media.php | Helper function to test if aspect ratios for two images match. | | [path\_join()](path_join) wp-includes/functions.php | Joins two filesystem paths together. | | [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\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. | | [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. | | [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\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. | | [\_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. | | [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 is_network_admin(): bool is\_network\_admin(): bool ========================== Determines whether the current request is for the network administrative interface. e.g. `/wp-admin/network/` Does not check if the user is an administrator; use [current\_user\_can()](current_user_can) for checking roles and capabilities. Does not check if the site is a Multisite network; use [is\_multisite()](is_multisite) for checking if Multisite is enabled. bool True if inside WordPress network administration pages. File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/) ``` function is_network_admin() { if ( isset( $GLOBALS['current_screen'] ) ) { return $GLOBALS['current_screen']->in_admin( 'network' ); } elseif ( defined( 'WP_NETWORK_ADMIN' ) ) { return WP_NETWORK_ADMIN; } return false; } ``` | Used By | Description | | --- | --- | | [WP\_Site\_Health\_Auto\_Updates::test\_wp\_version\_check\_attached()](../classes/wp_site_health_auto_updates/test_wp_version_check_attached) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if updates are intercepted by a filter. | | [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. | | [\_access\_denied\_splash()](_access_denied_splash) wp-admin/includes/ms.php | Displays an access denied message when a user tries to view a site’s dashboard they do not have access to. | | [wp\_plugin\_update\_row()](wp_plugin_update_row) wp-admin/includes/update.php | Displays update information for a plugin. | | [wp\_dashboard\_right\_now()](wp_dashboard_right_now) wp-admin/includes/dashboard.php | Dashboard widget that displays some basic stats about the site. | | [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. | | [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 | | | [load\_default\_textdomain()](load_default_textdomain) wp-includes/l10n.php | Loads default translated strings based on locale. | | [add\_thickbox()](add_thickbox) wp-includes/general-template.php | Enqueues the default ThickBox js and css. | | [self\_admin\_url()](self_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for either the current site or the network depending on context. | | [get\_edit\_profile\_url()](get_edit_profile_url) wp-includes/link-template.php | Retrieves the URL to the user’s profile editor. | | [WP\_Admin\_Bar::add\_menus()](../classes/wp_admin_bar/add_menus) wp-includes/class-wp-admin-bar.php | Adds menus to the admin bar. | | [wp\_admin\_bar\_site\_menu()](wp_admin_bar_site_menu) wp-includes/admin-bar.php | Adds the “Site Name” menu. | | [wp\_validate\_logged\_in\_cookie()](wp_validate_logged_in_cookie) wp-includes/user.php | Validates the logged-in cookie. | | Version | Description | | --- | --- | | [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. | wordpress rest_cookie_collect_status() rest\_cookie\_collect\_status() =============================== Collects cookie authentication status. Collects errors from wp\_validate\_auth\_cookie for use by rest\_cookie\_check\_errors. * [current\_action()](current_action) File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_cookie_collect_status() { global $wp_rest_auth_cookie; $status_type = current_action(); if ( 'auth_cookie_valid' !== $status_type ) { $wp_rest_auth_cookie = substr( $status_type, 12 ); return; } $wp_rest_auth_cookie = true; } ``` | Uses | Description | | --- | --- | | [current\_action()](current_action) wp-includes/plugin.php | Retrieves the name of the current action hook. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. | wordpress wp_verify_nonce( string $nonce, string|int $action = -1 ): int|false wp\_verify\_nonce( string $nonce, string|int $action = -1 ): int|false ====================================================================== Verifies that a correct security nonce was used with time limit. A nonce is valid for 24 hours (by default). `$nonce` string Required Nonce value that was used for verification, usually via a form field. `$action` string|int Optional Should give context to what is taking place and be the same when nonce was created. Default: `-1` int|false 1 if the nonce is valid and generated between 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago. False if the nonce is invalid. The function is used to verify the nonce sent in the current request usually accessed by the [$\_REQUEST](http://php.net/manual/en/reserved.variables.request.php) PHP variable. Nonces should never be relied on for authentication or authorization, access control. Protect your functions using [[current\_user\_can()](current_user_can)](current_user_can "Function Reference/current user can") , always assume Nonces can be compromised. File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/) ``` function wp_verify_nonce( $nonce, $action = -1 ) { $nonce = (string) $nonce; $user = wp_get_current_user(); $uid = (int) $user->ID; if ( ! $uid ) { /** * Filters whether the user who generated the nonce is logged out. * * @since 3.5.0 * * @param int $uid ID of the nonce-owning user. * @param string|int $action The nonce action, or -1 if none was provided. */ $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); } if ( empty( $nonce ) ) { return false; } $token = wp_get_session_token(); $i = wp_nonce_tick( $action ); // Nonce generated 0-12 hours ago. $expected = substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 ); if ( hash_equals( $expected, $nonce ) ) { return 1; } // Nonce generated 12-24 hours ago. $expected = substr( wp_hash( ( $i - 1 ) . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 ); if ( hash_equals( $expected, $nonce ) ) { return 2; } /** * Fires when nonce verification fails. * * @since 4.4.0 * * @param string $nonce The invalid nonce. * @param string|int $action The nonce action. * @param WP_User $user The current user object. * @param string $token The user's session token. */ do_action( 'wp_verify_nonce_failed', $nonce, $action, $user, $token ); // Invalid nonce. return false; } ``` [apply\_filters( 'nonce\_user\_logged\_out', int $uid, string|int $action )](../hooks/nonce_user_logged_out) Filters whether the user who generated the nonce is logged out. [do\_action( 'wp\_verify\_nonce\_failed', string $nonce, string|int $action, WP\_User $user, string $token )](../hooks/wp_verify_nonce_failed) Fires when nonce verification fails. | Uses | Description | | --- | --- | | [wp\_get\_session\_token()](wp_get_session_token) wp-includes/user.php | Retrieves the current session token from the logged\_in cookie. | | [wp\_nonce\_tick()](wp_nonce_tick) wp-includes/pluggable.php | Returns the time-dependent variable for nonce creation. | | [wp\_hash()](wp_hash) wp-includes/pluggable.php | Gets hash of given string. | | [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. | | [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\_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\_edit\_theme\_plugin\_file()](wp_edit_theme_plugin_file) wp-admin/includes/file.php | Attempts to edit a file for a theme or plugin. | | [rest\_cookie\_check\_errors()](rest_cookie_check_errors) wp-includes/rest-api.php | Checks for errors when using cookie-based authentication. | | [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\_destroy\_sessions()](wp_ajax_destroy_sessions) wp-admin/includes/ajax-actions.php | Ajax handler for destroying multiple open sessions for a 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 | | | [wp\_autosave()](wp_autosave) wp-admin/includes/post.php | Saves a post submitted with XHR. | | [wp\_ajax\_heartbeat()](wp_ajax_heartbeat) wp-admin/includes/ajax-actions.php | Ajax handler for the Heartbeat API. | | [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. | | [Custom\_Image\_Header::step()](../classes/custom_image_header/step) wp-admin/includes/class-custom-image-header.php | Get the current step. | | [check\_admin\_referer()](check_admin_referer) wp-includes/pluggable.php | Ensures intent by verifying that a user was referred from another admin page with the correct security nonce. | | [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. | | [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. | | [\_show\_post\_preview()](_show_post_preview) wp-includes/revision.php | Filters the latest content for preview from the post autosave. | | [signup\_nonce\_check()](signup_nonce_check) wp-includes/ms-functions.php | Processes the signup nonce created in [signup\_nonce\_fields()](signup_nonce_fields) . | | Version | Description | | --- | --- | | [2.0.3](https://developer.wordpress.org/reference/since/2.0.3/) | Introduced. |
programming_docs
wordpress translate_with_gettext_context( string $text, string $context, string $domain = 'default' ): string translate\_with\_gettext\_context( string $text, string $context, string $domain = 'default' ): string ====================================================================================================== Retrieves the translation of $text in the context defined in $context. If there is no translation, or the text domain isn’t loaded, the original text is returned. \_Note:\_ Don’t use [translate\_with\_gettext\_context()](translate_with_gettext_context) directly, use [\_x()](_x) or related functions. `$text` string Required Text to translate. `$context` string Required Context information for the translators. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings. Default `'default'`. Default: `'default'` string Translated text on success, original text on failure. File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/) ``` function translate_with_gettext_context( $text, $context, $domain = 'default' ) { $translations = get_translations_for_domain( $domain ); $translation = $translations->translate( $text, $context ); /** * Filters text with its translation based on context information. * * @since 2.8.0 * * @param string $translation Translated text. * @param string $text Text to translate. * @param string $context Context information for the translators. * @param string $domain Text domain. Unique identifier for retrieving translated strings. */ $translation = apply_filters( 'gettext_with_context', $translation, $text, $context, $domain ); /** * Filters text with its translation based on context information for a domain. * * The dynamic portion of the hook name, `$domain`, refers to the text domain. * * @since 5.5.0 * * @param string $translation Translated text. * @param string $text Text to translate. * @param string $context Context information for the translators. * @param string $domain Text domain. Unique identifier for retrieving translated strings. */ $translation = apply_filters( "gettext_with_context_{$domain}", $translation, $text, $context, $domain ); return $translation; } ``` [apply\_filters( 'gettext\_with\_context', string $translation, string $text, string $context, string $domain )](../hooks/gettext_with_context) Filters text with its translation based on context information. [apply\_filters( "gettext\_with\_context\_{$domain}", string $translation, string $text, string $context, string $domain )](../hooks/gettext_with_context_domain) Filters text with its translation based on context information for a domain. | Uses | Description | | --- | --- | | [get\_translations\_for\_domain()](get_translations_for_domain) wp-includes/l10n.php | Returns the Translations instance for a text domain. | | [Translations::translate()](../classes/translations/translate) wp-includes/pomo/translations.php | | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [\_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: | | [translate\_settings\_using\_i18n\_schema()](translate_settings_using_i18n_schema) wp-includes/l10n.php | Translates the provided settings value using its i18n schema. | | [translate\_user\_role()](translate_user_role) wp-includes/l10n.php | Translates role name. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | [esc\_attr\_x()](esc_attr_x) wp-includes/l10n.php | Translates string with gettext context, and escapes it for safe use in an attribute. | | [esc\_html\_x()](esc_html_x) wp-includes/l10n.php | Translates string with gettext context, and escapes it for safe use in HTML output. | | Version | Description | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced gettext\_with\_context-{$domain} filter. | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress wp_get_post_categories( int $post_id, array $args = array() ): array|WP_Error wp\_get\_post\_categories( int $post\_id, array $args = array() ): array|WP\_Error ================================================================================== Retrieves the list of categories for a post. Compatibility layer for themes and plugins. Also an easy layer of abstraction away from the complexity of the taxonomy layer. * [wp\_get\_object\_terms()](wp_get_object_terms) `$post_id` int Optional The Post ID. Does not default to the ID of the global $post. Default 0. `$args` array Optional Category query parameters. See [WP\_Term\_Query::\_\_construct()](../classes/wp_term_query/__construct) for supported arguments. More Arguments from WP\_Term\_Query::\_\_construct( ... $query ) Array or query string of term query parameters. * `taxonomy`string|string[]Taxonomy name, or array of taxonomy names, to which results should be limited. * `object_ids`int|int[]Object ID, or array of object IDs. Results will be limited to terms associated with these objects. * `orderby`stringField(s) to order terms by. Accepts: + Term fields (`'name'`, `'slug'`, `'term_group'`, `'term_id'`, `'id'`, `'description'`, `'parent'`, `'term_order'`). Unless `$object_ids` is not empty, `'term_order'` is treated the same as `'term_id'`. + `'count'` to use the number of objects associated with the term. + `'include'` to match the `'order'` of the `$include` param. + `'slug__in'` to match the `'order'` of the `$slug` param. + `'meta_value'` + `'meta_value_num'`. + The value of `$meta_key`. + The array keys of `$meta_query`. + `'none'` to omit the ORDER BY clause. Default `'name'`. * `order`stringWhether to order terms in ascending or descending order. Accepts `'ASC'` (ascending) or `'DESC'` (descending). Default `'ASC'`. * `hide_empty`bool|intWhether to hide terms not assigned to any posts. Accepts `1|true` or `0|false`. Default `1|true`. * `include`int[]|stringArray or comma/space-separated string of term IDs to include. Default empty array. * `exclude`int[]|stringArray or comma/space-separated string of term IDs to exclude. If `$include` is non-empty, `$exclude` is ignored. Default empty array. * `exclude_tree`int[]|stringArray or comma/space-separated string of term IDs to exclude along with all of their descendant terms. If `$include` is non-empty, `$exclude_tree` is ignored. Default empty array. * `number`int|stringMaximum number of terms to return. Accepts ``''`|0` (all) or any positive number. Default ``''`|0` (all). Note that `$number` may not return accurate results when coupled with `$object_ids`. See #41796 for details. * `offset`intThe number by which to offset the terms query. * `fields`stringTerm fields to query for. Accepts: + `'all'` Returns an array of complete term objects (`WP_Term[]`). + `'all_with_object_id'` Returns an array of term objects with the `'object_id'` param (`WP_Term[]`). Works only when the `$object_ids` parameter is populated. + `'ids'` Returns an array of term IDs (`int[]`). + `'tt_ids'` Returns an array of term taxonomy IDs (`int[]`). + `'names'` Returns an array of term names (`string[]`). + `'slugs'` Returns an array of term slugs (`string[]`). + `'count'` Returns the number of matching terms (`int`). + `'id=>parent'` Returns an associative array of parent term IDs, keyed by term ID (`int[]`). + `'id=>name'` Returns an associative array of term names, keyed by term ID (`string[]`). + `'id=>slug'` Returns an associative array of term slugs, keyed by term ID (`string[]`). Default `'all'`. * `count`boolWhether to return a term count. If true, will take precedence over `$fields`. Default false. * `name`string|string[]Name or array of names to return term(s) for. * `slug`string|string[]Slug or array of slugs to return term(s) for. * `term_taxonomy_id`int|int[]Term taxonomy ID, or array of term taxonomy IDs, to match when querying terms. * `hierarchical`boolWhether to include terms that have non-empty descendants (even if `$hide_empty` is set to true). Default true. * `search`stringSearch criteria to match terms. Will be SQL-formatted with wildcards before and after. * `name__like`stringRetrieve terms with criteria by which a term is LIKE `$name__like`. * `description__like`stringRetrieve terms where the description is LIKE `$description__like`. * `pad_counts`boolWhether to pad the quantity of a term's children in the quantity of each term's "count" object variable. Default false. * `get`stringWhether to return terms regardless of ancestry or whether the terms are empty. Accepts `'all'` or `''` (disabled). Default `''`. * `child_of`intTerm ID to retrieve child terms of. If multiple taxonomies are passed, `$child_of` is ignored. Default 0. * `parent`intParent term ID to retrieve direct-child terms of. * `childless`boolTrue to limit results to terms that have no children. This parameter has no effect on non-hierarchical taxonomies. Default false. * `cache_domain`stringUnique cache key to be produced when this query is stored in an object cache. Default `'core'`. * `update_term_meta_cache`boolWhether to prime meta caches for matched terms. Default true. * `meta_key`string|string[]Meta key or keys to filter by. * `meta_value`string|string[]Meta value or values to filter by. * `meta_compare`stringMySQL operator used for comparing the meta value. See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value. * `meta_compare_key`stringMySQL operator used for comparing the meta key. See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value. * `meta_type`stringMySQL data type that the meta\_value column will be CAST to for comparisons. See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value. * `meta_type_key`stringMySQL data type that the meta\_key column will be CAST to for comparisons. See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value. * `meta_query`arrayAn associative array of [WP\_Meta\_Query](../classes/wp_meta_query) arguments. See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values. Default: `array()` array|[WP\_Error](../classes/wp_error) List of categories. If the `$fields` argument passed via `$args` is `'all'` or `'all_with_object_id'`, an array of [WP\_Term](../classes/wp_term) objects will be returned. If `$fields` is `'ids'`, an array of category IDs. If `$fields` is `'names'`, an array of category names. [WP\_Error](../classes/wp_error) object if `'category'` taxonomy doesn't exist. The results from [wp\_get\_post\_categories()](wp_get_post_categories) aren’t cached which will result in a database call being made every time this function is called. Use this function with care. For performance, functions like [get\_the\_category()](get_the_category) should be used to return categories attached to a post. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function wp_get_post_categories( $post_id = 0, $args = array() ) { $post_id = (int) $post_id; $defaults = array( 'fields' => 'ids' ); $args = wp_parse_args( $args, $defaults ); $cats = wp_get_object_terms( $post_id, 'category', $args ); return $cats; } ``` | Uses | Description | | --- | --- | | [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | Used By | Description | | --- | --- | | [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. | | [wp\_get\_post\_cats()](wp_get_post_cats) wp-includes/deprecated.php | Retrieves a list of post categories. | | [wp\_xmlrpc\_server::mt\_getPostCategories()](../classes/wp_xmlrpc_server/mt_getpostcategories) wp-includes/class-wp-xmlrpc-server.php | Retrieve post categories. | | [wp\_xmlrpc\_server::mt\_publishPost()](../classes/wp_xmlrpc_server/mt_publishpost) wp-includes/class-wp-xmlrpc-server.php | Sets a post’s publish status to ‘publish’. | | [wp\_xmlrpc\_server::mw\_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::blogger\_getPost()](../classes/wp_xmlrpc_server/blogger_getpost) wp-includes/class-wp-xmlrpc-server.php | Retrieve post. | | [wp\_xmlrpc\_server::blogger\_getRecentPosts()](../classes/wp_xmlrpc_server/blogger_getrecentposts) wp-includes/class-wp-xmlrpc-server.php | Retrieve list of recent posts. | | [wp\_xmlrpc\_server::\_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 | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress wp_old_slug_redirect() wp\_old\_slug\_redirect() ========================= Redirect old slugs to the correct permalink. Attempts to find the current slug from the past slugs. File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/) ``` function wp_old_slug_redirect() { if ( is_404() && '' !== get_query_var( 'name' ) ) { // Guess the current post type based on the query vars. if ( get_query_var( 'post_type' ) ) { $post_type = get_query_var( 'post_type' ); } elseif ( get_query_var( 'attachment' ) ) { $post_type = 'attachment'; } elseif ( get_query_var( 'pagename' ) ) { $post_type = 'page'; } else { $post_type = 'post'; } if ( is_array( $post_type ) ) { if ( count( $post_type ) > 1 ) { return; } $post_type = reset( $post_type ); } // Do not attempt redirect for hierarchical post types. if ( is_post_type_hierarchical( $post_type ) ) { return; } $id = _find_post_by_old_slug( $post_type ); if ( ! $id ) { $id = _find_post_by_old_date( $post_type ); } /** * Filters the old slug redirect post ID. * * @since 4.9.3 * * @param int $id The redirect post ID. */ $id = apply_filters( 'old_slug_redirect_post_id', $id ); if ( ! $id ) { return; } $link = get_permalink( $id ); if ( get_query_var( 'paged' ) > 1 ) { $link = user_trailingslashit( trailingslashit( $link ) . 'page/' . get_query_var( 'paged' ) ); } elseif ( is_embed() ) { $link = user_trailingslashit( trailingslashit( $link ) . 'embed' ); } /** * Filters the old slug redirect URL. * * @since 4.4.0 * * @param string $link The redirect URL. */ $link = apply_filters( 'old_slug_redirect_url', $link ); if ( ! $link ) { return; } wp_redirect( $link, 301 ); // Permanent redirect. exit; } } ``` [apply\_filters( 'old\_slug\_redirect\_post\_id', int $id )](../hooks/old_slug_redirect_post_id) Filters the old slug redirect post ID. [apply\_filters( 'old\_slug\_redirect\_url', string $link )](../hooks/old_slug_redirect_url) Filters the old slug redirect URL. | Uses | Description | | --- | --- | | [\_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. | | [is\_embed()](is_embed) wp-includes/query.php | Is the query for an embedded post? | | [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. | | [is\_404()](is_404) wp-includes/query.php | Determines whether the query has resulted in a 404 (returns no results). | | [get\_query\_var()](get_query_var) wp-includes/query.php | Retrieves the value of a query variable in the [WP\_Query](../classes/wp_query) class. | | [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. | | [is\_post\_type\_hierarchical()](is_post_type_hierarchical) wp-includes/post.php | Determines whether the post type is hierarchical. | | [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress get_post_datetime( int|WP_Post $post = null, string $field = 'date', string $source = 'local' ): DateTimeImmutable|false get\_post\_datetime( int|WP\_Post $post = null, string $field = 'date', string $source = 'local' ): DateTimeImmutable|false =========================================================================================================================== Retrieves post published or modified time as a `DateTimeImmutable` object instance. The object will be set to the timezone from WordPress settings. For legacy reasons, this function allows to choose to instantiate from local or UTC time in database. Normally this should make no difference to the result. However, the values might get out of sync in database, typically because of timezone setting changes. The parameter ensures the ability to reproduce backwards compatible behaviors in such cases. `$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Default is global `$post` object. Default: `null` `$field` string Optional Published or modified time to use from database. Accepts `'date'` or `'modified'`. Default `'date'`. Default: `'date'` `$source` string Optional Local or UTC time to use from database. Accepts `'local'` or `'gmt'`. Default `'local'`. Default: `'local'` DateTimeImmutable|false Time object on success, false on failure. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function get_post_datetime( $post = null, $field = 'date', $source = 'local' ) { $post = get_post( $post ); if ( ! $post ) { return false; } $wp_timezone = wp_timezone(); if ( 'gmt' === $source ) { $time = ( 'modified' === $field ) ? $post->post_modified_gmt : $post->post_date_gmt; $timezone = new DateTimeZone( 'UTC' ); } else { $time = ( 'modified' === $field ) ? $post->post_modified : $post->post_date; $timezone = $wp_timezone; } if ( empty( $time ) || '0000-00-00 00:00:00' === $time ) { return false; } $datetime = date_create_immutable_from_format( 'Y-m-d H:i:s', $time, $timezone ); if ( false === $datetime ) { return false; } return $datetime->setTimezone( $wp_timezone ); } ``` | Uses | Description | | --- | --- | | [wp\_timezone()](wp_timezone) wp-includes/functions.php | Retrieves the timezone of the site as a `DateTimeZone` object. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Used By | Description | | --- | --- | | [get\_post\_timestamp()](get_post_timestamp) wp-includes/general-template.php | Retrieves post published or modified time as a Unix timestamp. | | [get\_post\_time()](get_post_time) wp-includes/general-template.php | Retrieves the time at which the post was written. | | [get\_post\_modified\_time()](get_post_modified_time) wp-includes/general-template.php | Retrieves the time at which the post was last modified. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
programming_docs
wordpress wp_unslash( string|array $value ): string|array wp\_unslash( string|array $value ): string|array ================================================ Removes slashes from a string or recursively removes slashes from strings within an array. This should be used to remove slashes from data passed to core API that expects data to be unslashed. `$value` string|array Required String or array of data to unslash. string|array Unslashed `$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_unslash( $value ) { return stripslashes_deep( $value ); } ``` | Uses | Description | | --- | --- | | [stripslashes\_deep()](stripslashes_deep) wp-includes/formatting.php | Navigates through an array, object, or scalar, and removes slashes from the values. | | 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\_filter\_global\_styles\_post()](wp_filter_global_styles_post) wp-includes/kses.php | Sanitizes global styles user content removing unsafe rules. | | [get\_self\_link()](get_self_link) wp-includes/feed.php | Returns the link for the currently displayed feed. | | [WP\_MS\_Sites\_List\_Table::site\_states()](../classes/wp_ms_sites_list_table/site_states) wp-admin/includes/class-wp-ms-sites-list-table.php | Maybe output comma-separated site states. | | [WP\_MS\_Sites\_List\_Table::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\_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::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\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. | | [WP\_Privacy\_Requests\_Table::process\_bulk\_action()](../classes/wp_privacy_requests_table/process_bulk_action) wp-admin/includes/class-wp-privacy-requests-table.php | Process bulk actions. | | [\_wp\_personal\_data\_handle\_actions()](_wp_personal_data_handle_actions) wp-admin/includes/privacy-tools.php | Handle list table actions. | | [wp\_xmlrpc\_server::set\_term\_custom\_fields()](../classes/wp_xmlrpc_server/set_term_custom_fields) wp-includes/class-wp-xmlrpc-server.php | Set custom fields for a term. | | [wp\_start\_scraping\_edited\_file\_errors()](wp_start_scraping_edited_file_errors) wp-includes/load.php | Start scraping edited file errors. | | [WP\_Customize\_Manager::handle\_load\_themes\_request()](../classes/wp_customize_manager/handle_load_themes_request) wp-includes/class-wp-customize-manager.php | Loads themes into the theme browsing/installation UI. | | [wp\_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\_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\_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\_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\_get\_raw\_referer()](wp_get_raw_referer) wp-includes/functions.php | Retrieves unvalidated referer from ‘\_wp\_http\_referer’ or HTTP referer. | | [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\_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\_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\_Menu\_Item\_Setting::sanitize()](../classes/wp_customize_nav_menu_item_setting/sanitize) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Sanitize an input. | | [WP\_Customize\_Nav\_Menus::ajax\_load\_available\_items()](../classes/wp_customize_nav_menus/ajax_load_available_items) wp-includes/class-wp-customize-nav-menus.php | Ajax handler for loading available menu items. | | [WP\_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\_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\_User\_Search::\_\_construct()](../classes/wp_user_search/__construct) wp-admin/includes/deprecated.php | PHP5 Constructor – Sets up the object properties. | | [WP\_Customize\_Manager::unsanitized\_post\_values()](../classes/wp_customize_manager/unsanitized_post_values) wp-includes/class-wp-customize-manager.php | Gets dirty pre-sanitized setting values in the current customized state. | | [WP\_Customize\_Widgets::register\_settings()](../classes/wp_customize_widgets/register_settings) wp-includes/class-wp-customize-widgets.php | Inspects the incoming customized data for any widget settings, and dynamically adds them up-front so widgets will be initialized properly. | | [wp\_ajax\_update\_plugin()](wp_ajax_update_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for updating a plugin. | | [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\_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 | | | [retrieve\_password()](retrieve_password) wp-includes/user.php | Handles sending a password retrieval email to a user. | | [validate\_another\_blog\_signup()](validate_another_blog_signup) wp-signup.php | Validates a new site sign-up for an existing user. | | [validate\_blog\_signup()](validate_blog_signup) wp-signup.php | Validates new site signup. | | [display\_setup\_form()](display_setup_form) wp-admin/install.php | Displays installer setup form. | | [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\_prepare\_themes\_for\_js()](wp_prepare_themes_for_js) wp-admin/includes/theme.php | Prepares themes for JavaScript. | | [WP\_Plugins\_List\_Table::\_\_construct()](../classes/wp_plugins_list_table/__construct) wp-admin/includes/class-wp-plugins-list-table.php | Constructor. | | [WP\_Plugins\_List\_Table::no\_items()](../classes/wp_plugins_list_table/no_items) wp-admin/includes/class-wp-plugins-list-table.php | | | [install\_theme\_search\_form()](install_theme_search_form) wp-admin/includes/theme-install.php | Displays search form for searching themes. | | [install\_theme\_information()](install_theme_information) wp-admin/includes/theme-install.php | Displays theme information in dialog box form. | | [Plugin\_Installer\_Skin::after()](../classes/plugin_installer_skin/after) wp-admin/includes/class-plugin-installer-skin.php | Action to perform following a plugin install. | | [stream\_preview\_image()](stream_preview_image) wp-admin/includes/image-edit.php | Streams image in post to browser, along with enqueued changes in `$_REQUEST['history']`. | | [wp\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. | | [WP\_MS\_Themes\_List\_Table::\_search\_callback()](../classes/wp_ms_themes_list_table/_search_callback) wp-admin/includes/class-wp-ms-themes-list-table.php | | | [WP\_Theme\_Install\_List\_Table::prepare\_items()](../classes/wp_theme_install_list_table/prepare_items) wp-admin/includes/class-wp-theme-install-list-table.php | | | [install\_search\_form()](install_search_form) wp-admin/includes/plugin-install.php | Displays a search form for searching plugins. | | [install\_plugin\_install\_status()](install_plugin_install_status) wp-admin/includes/plugin-install.php | Determines the status we can perform on a plugin. | | [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. | | [wp\_dashboard\_rss\_control()](wp_dashboard_rss_control) wp-admin/includes/dashboard.php | The RSS dashboard widget control. | | [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST | | [WP\_Plugin\_Install\_List\_Table::prepare\_items()](../classes/wp_plugin_install_list_table/prepare_items) wp-admin/includes/class-wp-plugin-install-list-table.php | | | [\_admin\_search\_query()](_admin_search_query) wp-admin/includes/template.php | Displays the search query. | | [WP\_Themes\_List\_Table::prepare\_items()](../classes/wp_themes_list_table/prepare_items) wp-admin/includes/class-wp-themes-list-table.php | | | [WP\_Themes\_List\_Table::\_js\_vars()](../classes/wp_themes_list_table/_js_vars) wp-admin/includes/class-wp-themes-list-table.php | Send required variables to JavaScript land | | [WP\_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\_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. | | [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. | | [wp\_create\_post\_autosave()](wp_create_post_autosave) wp-admin/includes/post.php | Creates autosave data for the specified post from `$_POST` data. | | [add\_meta()](add_meta) wp-admin/includes/post.php | Adds post meta data defined in the `$_POST` superglobal for a post with given ID. | | [update\_meta()](update_meta) wp-admin/includes/post.php | Updates post meta data by meta ID. | | [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. | | [post\_exists()](post_exists) wp-admin/includes/post.php | Determines if a post exists based on title, content, date and type. | | [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\_save\_widget()](wp_ajax_save_widget) wp-admin/includes/ajax-actions.php | Ajax handler for saving a widget. | | [wp\_ajax\_date\_format()](wp_ajax_date_format) wp-admin/includes/ajax-actions.php | Ajax handler for date formatting. | | [wp\_ajax\_time\_format()](wp_ajax_time_format) wp-admin/includes/ajax-actions.php | Ajax handler for time formatting. | | [wp\_ajax\_save\_attachment()](wp_ajax_save_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for updating attachment attributes. | | [wp\_ajax\_add\_meta()](wp_ajax_add_meta) wp-admin/includes/ajax-actions.php | Ajax handler for adding meta. | | [wp\_ajax\_wp\_link\_ajax()](wp_ajax_wp_link_ajax) wp-admin/includes/ajax-actions.php | Ajax handler for internal linking. | | [wp\_ajax\_find\_posts()](wp_ajax_find_posts) wp-admin/includes/ajax-actions.php | Ajax handler for querying posts for the Find Posts modal. | | [wp\_ajax\_widgets\_order()](wp_ajax_widgets_order) wp-admin/includes/ajax-actions.php | Ajax handler for saving the widgets order. | | [wp\_ajax\_add\_link\_category()](wp_ajax_add_link_category) wp-admin/includes/ajax-actions.php | Ajax handler for adding a link category. | | [wp\_ajax\_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\_insert\_link()](wp_insert_link) wp-admin/includes/bookmark.php | Inserts a link into the database, or updates an existing link. | | [get\_default\_link\_to\_edit()](get_default_link_to_edit) wp-admin/includes/bookmark.php | Retrieves the default link for editing. | | [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::prepare\_items()](../classes/wp_terms_list_table/prepare_items) wp-admin/includes/class-wp-terms-list-table.php | | | [request\_filesystem\_credentials()](request_filesystem_credentials) wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. | | [WP\_Customize\_Manager::customize\_preview\_settings()](../classes/wp_customize_manager/customize_preview_settings) wp-includes/class-wp-customize-manager.php | Prints JavaScript settings for preview frame. | | [WP\_Customize\_Manager::save()](../classes/wp_customize_manager/save) wp-includes/class-wp-customize-manager.php | Handles customize\_save WP Ajax request to save/update a changeset. | | [WP\_Customize\_Manager::\_\_construct()](../classes/wp_customize_manager/__construct) wp-includes/class-wp-customize-manager.php | Constructor. | | [WP\_Customize\_Manager::doing\_ajax()](../classes/wp_customize_manager/doing_ajax) wp-includes/class-wp-customize-manager.php | Returns true if it’s an Ajax request. | | [spawn\_cron()](spawn_cron) wp-includes/cron.php | Sends a request to run cron through HTTP request that doesn’t halt page loading. | | [\_wp\_customize\_include()](_wp_customize_include) wp-includes/theme.php | Includes and instantiates the [WP\_Customize\_Manager](../classes/wp_customize_manager) class. | | [WP::send\_headers()](../classes/wp/send_headers) wp-includes/class-wp.php | Sends additional HTTP headers for caching, content type, etc. | | [wp\_original\_referer\_field()](wp_original_referer_field) wp-includes/functions.php | Retrieves or displays original referer hidden field for forms. | | [wp\_get\_referer()](wp_get_referer) wp-includes/functions.php | Retrieves referer from ‘\_wp\_http\_referer’ or HTTP referer. | | [wp\_get\_original\_referer()](wp_get_original_referer) wp-includes/functions.php | Retrieves original referer that was posted, if it exists. | | [wp\_update\_term()](wp_update_term) wp-includes/taxonomy.php | Updates term based on arguments provided. | | [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. | | [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. | | [wp\_insert\_user()](wp_insert_user) wp-includes/user.php | Inserts a user into the database. | | [wp\_signon()](wp_signon) wp-includes/user.php | Authenticates and logs a user in with ‘remember’ capability. | | [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\_page()](_wp_link_page) wp-includes/post-template.php | Helper function for [wp\_link\_pages()](wp_link_pages) . | | [trackback\_url\_list()](trackback_url_list) wp-includes/post.php | Does trackbacks for a list of URLs. | | [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. | | [wpmu\_log\_new\_registrations()](wpmu_log_new_registrations) wp-includes/ms-functions.php | Logs the user email, IP, and registration date of a new site. | | [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. | | [newblog\_notify\_siteadmin()](newblog_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new site has been activated. | | [newuser\_notify\_siteadmin()](newuser_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new user has been activated. | | [wpmu\_welcome\_notification()](wpmu_welcome_notification) wp-includes/ms-functions.php | Notifies the site administrator that their site activation was successful. | | [wpmu\_validate\_blog\_signup()](wpmu_validate_blog_signup) wp-includes/ms-functions.php | Processes new site registrations. | | [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. | | [wp\_xmlrpc\_server::blogger\_getPost()](../classes/wp_xmlrpc_server/blogger_getpost) wp-includes/class-wp-xmlrpc-server.php | Retrieve post. | | [wp\_xmlrpc\_server::blogger\_getRecentPosts()](../classes/wp_xmlrpc_server/blogger_getrecentposts) wp-includes/class-wp-xmlrpc-server.php | Retrieve list of recent posts. | | [wp\_xmlrpc\_server::wp\_setOptions()](../classes/wp_xmlrpc_server/wp_setoptions) wp-includes/class-wp-xmlrpc-server.php | Update blog options. | | [wp\_xmlrpc\_server::set\_custom\_fields()](../classes/wp_xmlrpc_server/set_custom_fields) wp-includes/class-wp-xmlrpc-server.php | Set custom fields for post. | | [WP\_Customize\_Widgets::get\_post\_value()](../classes/wp_customize_widgets/get_post_value) wp-includes/class-wp-customize-widgets.php | Retrieves an unslashed post value or return a default. | | [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. | | [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. | | [check\_comment()](check_comment) wp-includes/comment.php | Checks whether a comment passes internal checks to be allowed to add. | | [delete\_metadata()](delete_metadata) wp-includes/meta.php | Deletes metadata for the specified object. | | [add\_metadata()](add_metadata) wp-includes/meta.php | Adds metadata for the specified object. | | [update\_metadata()](update_metadata) wp-includes/meta.php | Updates metadata for the specified object. If no value already exists for the specified object ID and metadata key, the metadata will be added. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
programming_docs
wordpress get_category_rss_link( bool $display = false, int $cat_ID = 1 ): string get\_category\_rss\_link( bool $display = false, int $cat\_ID = 1 ): string =========================================================================== This function has been deprecated. Use [get\_category\_feed\_link()](get_category_feed_link) instead. Print/Return link to category RSS2 feed. * [get\_category\_feed\_link()](get_category_feed_link) `$display` bool Optional Default: `false` `$cat_ID` int Optional Default: `1` string File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_category_rss_link($display = false, $cat_ID = 1) { _deprecated_function( __FUNCTION__, '2.5.0', 'get_category_feed_link()' ); $link = get_category_feed_link($cat_ID, 'rss2'); if ( $display ) echo $link; return $link; } ``` | Uses | Description | | --- | --- | | [get\_category\_feed\_link()](get_category_feed_link) wp-includes/link-template.php | Retrieves the feed link for a category. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Use [get\_category\_feed\_link()](get_category_feed_link) | | [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. | wordpress wp_unregister_GLOBALS() wp\_unregister\_GLOBALS() ========================= 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. Turn register globals off. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function wp_unregister_GLOBALS() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid // register_globals was deprecated in PHP 5.3 and removed entirely in PHP 5.4. _deprecated_function( __FUNCTION__, '5.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 | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | This function has been deprecated. | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress wp_ajax_heartbeat() wp\_ajax\_heartbeat() ===================== Ajax handler for the Heartbeat API. Runs when the user is logged in. File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/) ``` function wp_ajax_heartbeat() { if ( empty( $_POST['_nonce'] ) ) { wp_send_json_error(); } $response = array(); $data = array(); $nonce_state = wp_verify_nonce( $_POST['_nonce'], 'heartbeat-nonce' ); // 'screen_id' is the same as $current_screen->id and the JS global 'pagenow'. if ( ! empty( $_POST['screen_id'] ) ) { $screen_id = sanitize_key( $_POST['screen_id'] ); } else { $screen_id = 'front'; } if ( ! empty( $_POST['data'] ) ) { $data = wp_unslash( (array) $_POST['data'] ); } if ( 1 !== $nonce_state ) { /** * Filters the nonces to send to the New/Edit Post screen. * * @since 4.3.0 * * @param array $response The Heartbeat response. * @param array $data The $_POST data sent. * @param string $screen_id The screen ID. */ $response = apply_filters( 'wp_refresh_nonces', $response, $data, $screen_id ); if ( false === $nonce_state ) { // User is logged in but nonces have expired. $response['nonces_expired'] = true; wp_send_json( $response ); } } if ( ! empty( $data ) ) { /** * Filters the Heartbeat response received. * * @since 3.6.0 * * @param array $response The Heartbeat response. * @param array $data The $_POST data sent. * @param string $screen_id The screen ID. */ $response = apply_filters( 'heartbeat_received', $response, $data, $screen_id ); } /** * Filters the Heartbeat response sent. * * @since 3.6.0 * * @param array $response The Heartbeat response. * @param string $screen_id The screen ID. */ $response = apply_filters( 'heartbeat_send', $response, $screen_id ); /** * Fires when Heartbeat ticks in logged-in environments. * * Allows the transport to be easily replaced with long-polling. * * @since 3.6.0 * * @param array $response The Heartbeat response. * @param string $screen_id The screen ID. */ do_action( 'heartbeat_tick', $response, $screen_id ); // Send the current time according to the server. $response['server_time'] = time(); wp_send_json( $response ); } ``` [apply\_filters( 'heartbeat\_received', array $response, array $data, string $screen\_id )](../hooks/heartbeat_received) Filters the Heartbeat response received. [apply\_filters( 'heartbeat\_send', array $response, string $screen\_id )](../hooks/heartbeat_send) Filters the Heartbeat response sent. [do\_action( 'heartbeat\_tick', array $response, string $screen\_id )](../hooks/heartbeat_tick) Fires when Heartbeat ticks in logged-in environments. [apply\_filters( 'wp\_refresh\_nonces', array $response, array $data, string $screen\_id )](../hooks/wp_refresh_nonces) Filters the nonces to send to the New/Edit Post screen. | Uses | Description | | --- | --- | | [wp\_verify\_nonce()](wp_verify_nonce) wp-includes/pluggable.php | Verifies that a correct security nonce was used with time limit. | | [wp\_send\_json()](wp_send_json) wp-includes/functions.php | Sends a JSON response back to an Ajax request. | | [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. | | [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. | | [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress media_upload_video(): null|string media\_upload\_video(): null|string =================================== This function has been deprecated. Use [wp\_media\_upload\_handler()](wp_media_upload_handler) instead. Handles uploading a video file. * [wp\_media\_upload\_handler()](wp_media_upload_handler) null|string File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/) ``` function media_upload_video() { _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 wp_list_authors( string|array $args = '' ): void|string wp\_list\_authors( string|array $args = '' ): void|string ========================================================= Lists all the authors of the site, with several options available. `$args` string|array Optional Array or string of default arguments. * `orderby`stringHow to sort the authors. Accepts `'nicename'`, `'email'`, `'url'`, `'registered'`, `'user_nicename'`, `'user_email'`, `'user_url'`, `'user_registered'`, `'name'`, `'display_name'`, `'post_count'`, `'ID'`, `'meta_value'`, `'user_login'`. Default `'name'`. * `order`stringSorting direction for $orderby. Accepts `'ASC'`, `'DESC'`. Default `'ASC'`. * `number`intMaximum authors to return or display. Default empty (all authors). * `optioncount`boolShow the count in parenthesis next to the author's name. Default false. * `exclude_admin`boolWhether to exclude the `'admin'` account, if it exists. Default true. * `show_fullname`boolWhether to show the author's full name. Default false. * `hide_empty`boolWhether to hide any authors with no posts. Default true. * `feed`stringIf not empty, show a link to the author's feed and use this text as the alt parameter of the link. * `feed_image`stringIf not empty, show a link to the author's feed and use this image URL as clickable anchor. * `feed_type`stringThe feed type to link to. Possible values include `'rss2'`, `'atom'`. Default is the value of [get\_default\_feed()](get_default_feed) . * `echo`boolWhether to output the result or instead return it. Default true. * `style`stringIf `'list'`, each author is wrapped in an `<li>` element, otherwise the authors will be separated by commas. * `html`boolWhether to list the items in HTML form or plaintext. Default true. * `exclude`int[]|stringArray or comma/space-separated list of author IDs to exclude. * `include`int[]|stringArray or comma/space-separated list of author IDs to include. Default: `''` void|string Void if `'echo'` argument is true, list of authors if `'echo'` is false. Displays a list of the sites’s authors (users), and if the user has authored any posts, the author name is displayed as a link to their posts. Optionally this tag displays each author’s post count and [RSS](https://wordpress.org/support/article/glossary/ "Glossary") feed link. File: `wp-includes/author-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/author-template.php/) ``` function wp_list_authors( $args = '' ) { global $wpdb; $defaults = array( 'orderby' => 'name', 'order' => 'ASC', 'number' => '', 'optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true, 'style' => 'list', 'html' => true, 'exclude' => '', 'include' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); $return = ''; $query_args = wp_array_slice_assoc( $parsed_args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) ); $query_args['fields'] = 'ids'; /** * Filters the query arguments for the list of all authors of the site. * * @since 6.1.0 * * @param array $query_args The query arguments for get_users(). * @param array $parsed_args The arguments passed to wp_list_authors() combined with the defaults. */ $query_args = apply_filters( 'wp_list_authors_args', $query_args, $parsed_args ); $authors = get_users( $query_args ); $post_counts = array(); /** * Filters whether to short-circuit performing the query for author post counts. * * @since 6.1.0 * * @param int[]|false $post_counts Array of post counts, keyed by author ID. * @param array $parsed_args The arguments passed to wp_list_authors() combined with the defaults. */ $post_counts = apply_filters( 'pre_wp_list_authors_post_counts_query', false, $parsed_args ); if ( ! is_array( $post_counts ) ) { $post_counts = $wpdb->get_results( "SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE " . get_private_posts_cap_sql( 'post' ) . ' GROUP BY post_author' ); foreach ( (array) $post_counts as $row ) { $post_counts[ $row->post_author ] = $row->count; } } foreach ( $authors as $author_id ) { $posts = isset( $post_counts[ $author_id ] ) ? $post_counts[ $author_id ] : 0; if ( ! $posts && $parsed_args['hide_empty'] ) { continue; } $author = get_userdata( $author_id ); if ( $parsed_args['exclude_admin'] && 'admin' === $author->display_name ) { continue; } if ( $parsed_args['show_fullname'] && $author->first_name && $author->last_name ) { $name = sprintf( /* translators: 1: User's first name, 2: Last name. */ _x( '%1$s %2$s', 'Display name based on first name and last name' ), $author->first_name, $author->last_name ); } else { $name = $author->display_name; } if ( ! $parsed_args['html'] ) { $return .= $name . ', '; continue; // No need to go further to process HTML. } if ( 'list' === $parsed_args['style'] ) { $return .= '<li>'; } $link = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', esc_url( get_author_posts_url( $author->ID, $author->user_nicename ) ), /* translators: %s: Author's display name. */ esc_attr( sprintf( __( 'Posts by %s' ), $author->display_name ) ), $name ); if ( ! empty( $parsed_args['feed_image'] ) || ! empty( $parsed_args['feed'] ) ) { $link .= ' '; if ( empty( $parsed_args['feed_image'] ) ) { $link .= '('; } $link .= '<a href="' . get_author_feed_link( $author->ID, $parsed_args['feed_type'] ) . '"'; $alt = ''; if ( ! empty( $parsed_args['feed'] ) ) { $alt = ' alt="' . esc_attr( $parsed_args['feed'] ) . '"'; $name = $parsed_args['feed']; } $link .= '>'; if ( ! empty( $parsed_args['feed_image'] ) ) { $link .= '<img src="' . esc_url( $parsed_args['feed_image'] ) . '" style="border: none;"' . $alt . ' />'; } else { $link .= $name; } $link .= '</a>'; if ( empty( $parsed_args['feed_image'] ) ) { $link .= ')'; } } if ( $parsed_args['optioncount'] ) { $link .= ' (' . $posts . ')'; } $return .= $link; $return .= ( 'list' === $parsed_args['style'] ) ? '</li>' : ', '; } $return = rtrim( $return, ', ' ); if ( $parsed_args['echo'] ) { echo $return; } else { return $return; } } ``` [apply\_filters( 'pre\_wp\_list\_authors\_post\_counts\_query', int[]|false $post\_counts, array $parsed\_args )](../hooks/pre_wp_list_authors_post_counts_query) Filters whether to short-circuit performing the query for author post counts. [apply\_filters( 'wp\_list\_authors\_args', array $query\_args, array $parsed\_args )](../hooks/wp_list_authors_args) Filters the query arguments for the list of all authors of the site. | Uses | Description | | --- | --- | | [wp\_array\_slice\_assoc()](wp_array_slice_assoc) wp-includes/functions.php | Extracts a slice of an array, given a list of keys. | | [get\_author\_feed\_link()](get_author_feed_link) wp-includes/link-template.php | Retrieves the feed link for a given author. | | [get\_users()](get_users) wp-includes/user.php | Retrieves list of users matching criteria. | | [get\_private\_posts\_cap\_sql()](get_private_posts_cap_sql) wp-includes/post.php | Retrieves the private post SQL based on capability. | | [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. | | [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. | | [\_\_()](__) 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. | | [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [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 | | --- | --- | | [list\_authors()](list_authors) wp-includes/deprecated.php | Lists authors. | | Version | Description | | --- | --- | | [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. | wordpress post_type_supports( string $post_type, string $feature ): bool post\_type\_supports( string $post\_type, string $feature ): bool ================================================================= Checks a post type’s support for a given feature. `$post_type` string Required The post type being checked. `$feature` string Required The feature being checked. bool Whether the post type supports the given feature. The $feature variable in the function will accept the following string values: * ‘title’ * ‘editor’ (content) * ‘author’ * ‘thumbnail’ (featured image) (current theme must also support Post Thumbnails) * ‘excerpt’ * ‘trackbacks’ * ‘custom-fields’ (see Custom\_Fields, aka meta-data) * ‘comments’ (also will see comment count balloon on edit screen) * ‘revisions’ (will store revisions) * ‘page-attributes’ (template and menu order) (hierarchical must be true) * ‘post-formats’ (see Post\_Formats) Please note in the ‘thumbnail’ value you can also use ‘attachment:audio’ and ‘attachment:video’ . If the value is not available it will return false. You can send any string in this field and it will return false unless you are checking for an accepted value. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function post_type_supports( $post_type, $feature ) { global $_wp_post_type_features; return ( isset( $_wp_post_type_features[ $post_type ][ $feature ] ) ); } ``` | Used By | Description | | --- | --- | | [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. | | [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. | | [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\_Posts\_Controller::get\_schema\_links()](../classes/wp_rest_posts_controller/get_schema_links) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves Link Description Objects that should be added to the Schema for the posts collection. | | [create\_initial\_rest\_routes()](create_initial_rest_routes) wp-includes/rest-api.php | Registers default REST API routes. | | [WP\_REST\_Users\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_users_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Permissions check for getting all users. | | [WP\_REST\_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\_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::get\_items()](../classes/wp_rest_posts_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves a collection of posts. | | [get\_default\_comment\_status()](get_default_comment_status) wp-includes/comment.php | Gets the default comment status for a post type. | | [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\_delete\_user()](wp_delete_user) wp-admin/includes/user.php | Remove user and optionally reassign posts and links to another user. | | [get\_inline\_data()](get_inline_data) wp-admin/includes/template.php | Adds hidden fields with the data for use in the inline editor for posts and pages. | | [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. | | [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. | | [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. | | [page\_attributes\_meta\_box()](page_attributes_meta_box) wp-admin/includes/meta-boxes.php | Displays page attributes form fields. | | [post\_format\_meta\_box()](post_format_meta_box) wp-admin/includes/meta-boxes.php | Displays post format form elements. | | [WP\_Media\_List\_Table::get\_columns()](../classes/wp_media_list_table/get_columns) wp-admin/includes/class-wp-media-list-table.php | | | [WP\_Posts\_List\_Table::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::\_display\_rows()](../classes/wp_posts_list_table/_display_rows) wp-admin/includes/class-wp-posts-list-table.php | | | [get\_post\_class()](get_post_class) wp-includes/post-template.php | Retrieves an array of the class names for the post container element. | | [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. | | [wp\_enqueue\_media()](wp_enqueue_media) wp-includes/media.php | Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. | | [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. | | [wp\_revisions\_to\_keep()](wp_revisions_to_keep) wp-includes/revision.php | Determines how many revisions to retain for a given post. | | [wp\_save\_post\_revision()](wp_save_post_revision) wp-includes/revision.php | Creates a revision for the current version of a post. | | [get\_post\_format()](get_post_format) wp-includes/post-formats.php | Retrieve the format slug for a post | | [wp\_xmlrpc\_server::wp\_getComments()](../classes/wp_xmlrpc_server/wp_getcomments) wp-includes/class-wp-xmlrpc-server.php | Retrieve comments. | | [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | | | [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
programming_docs
wordpress comment_author_link( int|WP_Comment $comment_ID ) comment\_author\_link( int|WP\_Comment $comment\_ID ) ===================================================== Displays the HTML link to the URL of the author of the current comment. `$comment_ID` int|[WP\_Comment](../classes/wp_comment) Optional [WP\_Comment](../classes/wp_comment) or the ID of the comment for which to print the author's link. Default current comment. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function comment_author_link( $comment_ID = 0 ) { echo get_comment_author_link( $comment_ID ); } ``` | Uses | Description | | --- | --- | | [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. | | 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. | | [Walker\_Comment::ping()](../classes/walker_comment/ping) wp-includes/class-walker-comment.php | Outputs a pingback 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. | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress wp_plugin_directory_constants() wp\_plugin\_directory\_constants() ================================== Defines plugin directory WordPress constants. Defines must-use plugin directory constants, which may be overridden in the sunrise.php drop-in. File: `wp-includes/default-constants.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/default-constants.php/) ``` function wp_plugin_directory_constants() { if ( ! defined( 'WP_CONTENT_URL' ) ) { define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' ); // Full URL - WP_CONTENT_DIR is defined further up. } /** * Allows for the plugins directory to be moved from the default location. * * @since 2.6.0 */ if ( ! defined( 'WP_PLUGIN_DIR' ) ) { define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // Full path, no trailing slash. } /** * Allows for the plugins directory to be moved from the default location. * * @since 2.6.0 */ if ( ! defined( 'WP_PLUGIN_URL' ) ) { define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // Full URL, no trailing slash. } /** * Allows for the plugins directory to be moved from the default location. * * @since 2.1.0 * @deprecated */ if ( ! defined( 'PLUGINDIR' ) ) { define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat. } /** * Allows for the mu-plugins directory to be moved from the default location. * * @since 2.8.0 */ if ( ! defined( 'WPMU_PLUGIN_DIR' ) ) { define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // Full path, no trailing slash. } /** * Allows for the mu-plugins directory to be moved from the default location. * * @since 2.8.0 */ if ( ! defined( 'WPMU_PLUGIN_URL' ) ) { define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // Full URL, no trailing slash. } /** * Allows for the mu-plugins directory to be moved from the default location. * * @since 2.8.0 * @deprecated */ if ( ! defined( 'MUPLUGINDIR' ) ) { define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat. } } ``` | Uses | Description | | --- | --- | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress register_block_script_handle( array $metadata, string $field_name, int $index ): string|false register\_block\_script\_handle( array $metadata, string $field\_name, int $index ): string|false ================================================================================================= 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. `$metadata` array Required Block metadata. `$field_name` string Required Field name to pick from metadata. `$index` int Optional Index of the script to register when multiple items passed. Default 0. string|false Script handle provided directly or created through script's registration, or false on failure. File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/) ``` function register_block_script_handle( $metadata, $field_name, $index = 0 ) { if ( empty( $metadata[ $field_name ] ) ) { return false; } $script_handle = $metadata[ $field_name ]; if ( is_array( $script_handle ) ) { if ( empty( $script_handle[ $index ] ) ) { return false; } $script_handle = $script_handle[ $index ]; } $script_path = remove_block_asset_path_prefix( $script_handle ); if ( $script_handle === $script_path ) { return $script_handle; } $script_handle = generate_block_asset_handle( $metadata['name'], $field_name, $index ); $script_asset_path = wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . substr_replace( $script_path, '.asset.php', - strlen( '.js' ) ) ) ); if ( ! file_exists( $script_asset_path ) ) { _doing_it_wrong( __FUNCTION__, sprintf( /* translators: 1: Field name, 2: Block name. */ __( 'The asset file for the "%1$s" defined in "%2$s" block definition is missing.' ), $field_name, $metadata['name'] ), '5.5.0' ); return false; } // Path needs to be normalized to work in Windows env. static $wpinc_path_norm = ''; if ( ! $wpinc_path_norm ) { $wpinc_path_norm = wp_normalize_path( realpath( ABSPATH . WPINC ) ); } $theme_path_norm = wp_normalize_path( get_theme_file_path() ); $script_path_norm = wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $script_path ) ); $is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], $wpinc_path_norm ); $is_theme_block = 0 === strpos( $script_path_norm, $theme_path_norm ); $script_uri = plugins_url( $script_path, $metadata['file'] ); if ( $is_core_block ) { $script_uri = includes_url( str_replace( $wpinc_path_norm, '', $script_path_norm ) ); } elseif ( $is_theme_block ) { $script_uri = get_theme_file_uri( str_replace( $theme_path_norm, '', $script_path_norm ) ); } $script_asset = require $script_asset_path; $script_dependencies = isset( $script_asset['dependencies'] ) ? $script_asset['dependencies'] : array(); $result = wp_register_script( $script_handle, $script_uri, $script_dependencies, isset( $script_asset['version'] ) ? $script_asset['version'] : false ); if ( ! $result ) { return false; } if ( ! empty( $metadata['textdomain'] ) && in_array( 'wp-i18n', $script_dependencies, true ) ) { wp_set_script_translations( $script_handle, $metadata['textdomain'] ); } return $script_handle; } ``` | Uses | Description | | --- | --- | | [generate\_block\_asset\_handle()](generate_block_asset_handle) wp-includes/blocks.php | Generates the name for an asset based on the name of the block and the field name provided. | | [remove\_block\_asset\_path\_prefix()](remove_block_asset_path_prefix) wp-includes/blocks.php | Removes the block asset’s path prefix if provided. | | [wp\_set\_script\_translations()](wp_set_script_translations) wp-includes/functions.wp-scripts.php | Sets translated strings for a script. | | [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\_register\_script()](wp_register_script) wp-includes/functions.wp-scripts.php | Register a new script. | | [wp\_normalize\_path()](wp_normalize_path) wp-includes/functions.php | Normalizes a filesystem path. | | [plugins\_url()](plugins_url) wp-includes/link-template.php | Retrieves a URL within the plugins or mu-plugins directory. | | [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. | | Used By | Description | | --- | --- | | [register\_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 | | --- | --- | | [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Added `$index` parameter. | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. | wordpress wp_cache_set_posts_last_changed() wp\_cache\_set\_posts\_last\_changed() ====================================== Sets the last changed time for the ‘posts’ cache group. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function wp_cache_set_posts_last_changed() { wp_cache_set( 'last_changed', microtime(), 'posts' ); } ``` | Uses | Description | | --- | --- | | [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. | | Version | Description | | --- | --- | | [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. | wordpress wp_raise_memory_limit( string $context = 'admin' ): int|string|false wp\_raise\_memory\_limit( string $context = 'admin' ): int|string|false ======================================================================= Attempts to raise the PHP memory limit for memory intensive processes. Only allows raising the existing limit and prevents lowering it. `$context` string Optional Context in which the function is called. Accepts either `'admin'`, `'image'`, or an arbitrary other context. If an arbitrary context is passed, the similarly arbitrary ['$context\_memory\_limit'](../hooks/context_memory_limit) filter will be invoked. Default `'admin'`. Default: `'admin'` int|string|false The limit that was set or false on failure. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp_raise_memory_limit( $context = 'admin' ) { // Exit early if the limit cannot be changed. if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) { return false; } $current_limit = ini_get( 'memory_limit' ); $current_limit_int = wp_convert_hr_to_bytes( $current_limit ); if ( -1 === $current_limit_int ) { return false; } $wp_max_limit = WP_MAX_MEMORY_LIMIT; $wp_max_limit_int = wp_convert_hr_to_bytes( $wp_max_limit ); $filtered_limit = $wp_max_limit; switch ( $context ) { case 'admin': /** * Filters the maximum memory limit available for administration screens. * * This only applies to administrators, who may require more memory for tasks * like updates. Memory limits when processing images (uploaded or edited by * users of any role) are handled separately. * * The `WP_MAX_MEMORY_LIMIT` constant specifically defines the maximum memory * limit available when in the administration back end. The default is 256M * (256 megabytes of memory) or the original `memory_limit` php.ini value if * this is higher. * * @since 3.0.0 * @since 4.6.0 The default now takes the original `memory_limit` into account. * * @param int|string $filtered_limit The maximum WordPress memory limit. Accepts an integer * (bytes), or a shorthand string notation, such as '256M'. */ $filtered_limit = apply_filters( 'admin_memory_limit', $filtered_limit ); break; case 'image': /** * Filters the memory limit allocated for image manipulation. * * @since 3.5.0 * @since 4.6.0 The default now takes the original `memory_limit` into account. * * @param int|string $filtered_limit Maximum memory limit to allocate for images. * Default `WP_MAX_MEMORY_LIMIT` or the original * php.ini `memory_limit`, whichever is higher. * Accepts an integer (bytes), or a shorthand string * notation, such as '256M'. */ $filtered_limit = apply_filters( 'image_memory_limit', $filtered_limit ); break; default: /** * Filters the memory limit allocated for arbitrary contexts. * * The dynamic portion of the hook name, `$context`, refers to an arbitrary * context passed on calling the function. This allows for plugins to define * their own contexts for raising the memory limit. * * @since 4.6.0 * * @param int|string $filtered_limit Maximum memory limit to allocate for images. * Default '256M' or the original php.ini `memory_limit`, * whichever is higher. Accepts an integer (bytes), or a * shorthand string notation, such as '256M'. */ $filtered_limit = apply_filters( "{$context}_memory_limit", $filtered_limit ); break; } $filtered_limit_int = wp_convert_hr_to_bytes( $filtered_limit ); if ( -1 === $filtered_limit_int || ( $filtered_limit_int > $wp_max_limit_int && $filtered_limit_int > $current_limit_int ) ) { if ( false !== ini_set( 'memory_limit', $filtered_limit ) ) { return $filtered_limit; } else { return false; } } elseif ( -1 === $wp_max_limit_int || $wp_max_limit_int > $current_limit_int ) { if ( false !== ini_set( 'memory_limit', $wp_max_limit ) ) { return $wp_max_limit; } else { return false; } } return false; } ``` [apply\_filters( 'admin\_memory\_limit', int|string $filtered\_limit )](../hooks/admin_memory_limit) Filters the maximum memory limit available for administration screens. [apply\_filters( 'image\_memory\_limit', int|string $filtered\_limit )](../hooks/image_memory_limit) Filters the memory limit allocated for image manipulation. [apply\_filters( "{$context}\_memory\_limit", int|string $filtered\_limit )](../hooks/context_memory_limit) Filters the memory limit allocated for arbitrary contexts. | Uses | Description | | --- | --- | | [wp\_is\_ini\_value\_changeable()](wp_is_ini_value_changeable) wp-includes/load.php | Determines whether a PHP ini value is changeable at runtime. | | [wp\_convert\_hr\_to\_bytes()](wp_convert_hr_to_bytes) wp-includes/load.php | Converts a shorthand byte value to an integer byte value. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | 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']`. | | [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\_load\_image()](wp_load_image) wp-includes/deprecated.php | Load an image from a string, if PHP supports it. | | [WP\_Image\_Editor\_Imagick::load()](../classes/wp_image_editor_imagick/load) wp-includes/class-wp-image-editor-imagick.php | Loads image from $this->file into new Imagick Object. | | [WP\_Image\_Editor\_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. | | Version | Description | | --- | --- | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. | wordpress wp_category_checklist( int $post_id, int $descendants_and_self, int[]|false $selected_cats = false, int[]|false $popular_cats = false, Walker $walker = null, bool $checked_ontop = true ) wp\_category\_checklist( int $post\_id, int $descendants\_and\_self, int[]|false $selected\_cats = false, int[]|false $popular\_cats = false, Walker $walker = null, bool $checked\_ontop = true ) ================================================================================================================================================================================================== Outputs an unordered list of checkbox input elements labeled with category names. * [wp\_terms\_checklist()](wp_terms_checklist) `$post_id` int Optional Post to generate a categories checklist for. Default 0. $selected\_cats must not be an array. Default 0. `$descendants_and_self` int Optional ID of the category to output along with its descendants. Default 0. `$selected_cats` int[]|false Optional Array of category IDs to mark as checked. Default: `false` `$popular_cats` int[]|false Optional Array of category IDs to receive the "popular-category" class. Default: `false` `$walker` [Walker](../classes/walker) Optional [Walker](../classes/walker) object to use to build the output. Default is a [Walker\_Category\_Checklist](../classes/walker_category_checklist) instance. Default: `null` `$checked_ontop` bool Optional Whether to move checked items out of the hierarchy and to the top of the list. Default: `true` File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/) ``` function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) { wp_terms_checklist( $post_id, array( 'taxonomy' => 'category', 'descendants_and_self' => $descendants_and_self, 'selected_cats' => $selected_cats, 'popular_cats' => $popular_cats, 'walker' => $walker, 'checked_ontop' => $checked_ontop, ) ); } ``` | Uses | Description | | --- | --- | | [wp\_terms\_checklist()](wp_terms_checklist) wp-admin/includes/template.php | Outputs an unordered list of checkbox input elements labelled with term names. | | Used By | Description | | --- | --- | | [dropdown\_categories()](dropdown_categories) wp-admin/includes/deprecated.php | Legacy function used to generate the categories checklist control. | | Version | Description | | --- | --- | | [2.5.1](https://developer.wordpress.org/reference/since/2.5.1/) | Introduced. | wordpress sanitize_term_field( string $field, string $value, int $term_id, string $taxonomy, string $context ): mixed sanitize\_term\_field( string $field, string $value, int $term\_id, string $taxonomy, string $context ): mixed ============================================================================================================== Sanitizes the field value in the term based on the context. Passing a term field value through the function should be assumed to have cleansed the value for whatever context the term field is going to be used. If no context or an unsupported context is given, then default filters will be applied. There are enough filters for each context to support a custom filtering without creating your own filter function. Simply create a function that hooks into the filter you need. `$field` string Required Term field to sanitize. `$value` string Required Search for this term value. `$term_id` int Required Term ID. `$taxonomy` string Required Taxonomy name. `$context` string Required Context in which to sanitize the term field. Accepts `'raw'`, `'edit'`, `'db'`, `'display'`, `'rss'`, `'attribute'`, or `'js'`. Default `'display'`. mixed Sanitized field. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/) ``` function sanitize_term_field( $field, $value, $term_id, $taxonomy, $context ) { $int_fields = array( 'parent', 'term_id', 'count', 'term_group', 'term_taxonomy_id', 'object_id' ); if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; if ( $value < 0 ) { $value = 0; } } $context = strtolower( $context ); if ( 'raw' === $context ) { return $value; } if ( 'edit' === $context ) { /** * Filters a term field to edit before it is sanitized. * * The dynamic portion of the hook name, `$field`, refers to the term field. * * @since 2.3.0 * * @param mixed $value Value of the term field. * @param int $term_id Term ID. * @param string $taxonomy Taxonomy slug. */ $value = apply_filters( "edit_term_{$field}", $value, $term_id, $taxonomy ); /** * Filters the taxonomy field to edit before it is sanitized. * * The dynamic portions of the filter name, `$taxonomy` and `$field`, refer * to the taxonomy slug and taxonomy field, respectively. * * @since 2.3.0 * * @param mixed $value Value of the taxonomy field to edit. * @param int $term_id Term ID. */ $value = apply_filters( "edit_{$taxonomy}_{$field}", $value, $term_id ); if ( 'description' === $field ) { $value = esc_html( $value ); // textarea_escaped } else { $value = esc_attr( $value ); } } elseif ( 'db' === $context ) { /** * Filters a term field value before it is sanitized. * * The dynamic portion of the hook name, `$field`, refers to the term field. * * @since 2.3.0 * * @param mixed $value Value of the term field. * @param string $taxonomy Taxonomy slug. */ $value = apply_filters( "pre_term_{$field}", $value, $taxonomy ); /** * Filters a taxonomy field before it is sanitized. * * The dynamic portions of the filter name, `$taxonomy` and `$field`, refer * to the taxonomy slug and field name, respectively. * * @since 2.3.0 * * @param mixed $value Value of the taxonomy field. */ $value = apply_filters( "pre_{$taxonomy}_{$field}", $value ); // Back compat filters. if ( 'slug' === $field ) { /** * Filters the category nicename before it is sanitized. * * Use the {@see 'pre_$taxonomy_$field'} hook instead. * * @since 2.0.3 * * @param string $value The category nicename. */ $value = apply_filters( 'pre_category_nicename', $value ); } } elseif ( 'rss' === $context ) { /** * Filters the term field for use in RSS. * * The dynamic portion of the hook name, `$field`, refers to the term field. * * @since 2.3.0 * * @param mixed $value Value of the term field. * @param string $taxonomy Taxonomy slug. */ $value = apply_filters( "term_{$field}_rss", $value, $taxonomy ); /** * Filters the taxonomy field for use in RSS. * * The dynamic portions of the hook name, `$taxonomy`, and `$field`, refer * to the taxonomy slug and field name, respectively. * * @since 2.3.0 * * @param mixed $value Value of the taxonomy field. */ $value = apply_filters( "{$taxonomy}_{$field}_rss", $value ); } else { // Use display filters by default. /** * Filters the term field sanitized for display. * * The dynamic portion of the hook name, `$field`, refers to the term field name. * * @since 2.3.0 * * @param mixed $value Value of the term field. * @param int $term_id Term ID. * @param string $taxonomy Taxonomy slug. * @param string $context Context to retrieve the term field value. */ $value = apply_filters( "term_{$field}", $value, $term_id, $taxonomy, $context ); /** * Filters the taxonomy field sanitized for display. * * The dynamic portions of the filter name, `$taxonomy`, and `$field`, refer * to the taxonomy slug and taxonomy field, respectively. * * @since 2.3.0 * * @param mixed $value Value of the taxonomy field. * @param int $term_id Term ID. * @param string $context Context to retrieve the taxonomy field value. */ $value = apply_filters( "{$taxonomy}_{$field}", $value, $term_id, $context ); } if ( 'attribute' === $context ) { $value = esc_attr( $value ); } elseif ( 'js' === $context ) { $value = esc_js( $value ); } // Restore the type for integer fields after esc_attr(). if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } return $value; } ``` [apply\_filters( "edit\_term\_{$field}", mixed $value, int $term\_id, string $taxonomy )](../hooks/edit_term_field) Filters a term field to edit before it is sanitized. [apply\_filters( "edit\_{$taxonomy}\_{$field}", mixed $value, int $term\_id )](../hooks/edit_taxonomy_field) Filters the taxonomy field to edit before it is sanitized. [apply\_filters( 'pre\_category\_nicename', string $value )](../hooks/pre_category_nicename) Filters the category nicename before it is sanitized. [apply\_filters( "pre\_term\_{$field}", mixed $value, string $taxonomy )](../hooks/pre_term_field) Filters a term field value before it is sanitized. [apply\_filters( "pre\_{$taxonomy}\_{$field}", mixed $value )](../hooks/pre_taxonomy_field) Filters a taxonomy field before it is sanitized. [apply\_filters( "term\_{$field}", mixed $value, int $term\_id, string $taxonomy, string $context )](../hooks/term_field) Filters the term field sanitized for display. [apply\_filters( "term\_{$field}\_rss", mixed $value, string $taxonomy )](../hooks/term_field_rss) Filters the term field for use in RSS. [apply\_filters( "{$taxonomy}\_{$field}", mixed $value, int $term\_id, string $context )](../hooks/taxonomy_field) Filters the taxonomy field sanitized for display. [apply\_filters( "{$taxonomy}\_{$field}\_rss", mixed $value )](../hooks/taxonomy_field_rss) Filters the taxonomy field for use in RSS. | Uses | Description | | --- | --- | | [esc\_js()](esc_js) wp-includes/formatting.php | Escapes single quotes, `"`, , `&amp;`, and fixes line endings. | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [WP\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. | | [WP\_Posts\_List\_Table::column\_default()](../classes/wp_posts_list_table/column_default) wp-admin/includes/class-wp-posts-list-table.php | Handles the default column output. | | [WP\_Media\_List\_Table::column\_default()](../classes/wp_media_list_table/column_default) wp-admin/includes/class-wp-media-list-table.php | Handles output for the default column. | | [WP\_Query::parse\_tax\_query()](../classes/wp_query/parse_tax_query) wp-includes/class-wp-query.php | Parses various taxonomy related query vars. | | [sanitize\_category\_field()](sanitize_category_field) wp-includes/category.php | Sanitizes data in single category key field. | | [get\_term\_field()](get_term_field) wp-includes/taxonomy.php | Gets sanitized term field. | | [sanitize\_term()](sanitize_term) wp-includes/taxonomy.php | Sanitizes all term fields. | | [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. |
programming_docs
wordpress wp_render_widget( string $widget_id, string $sidebar_id ): string wp\_render\_widget( string $widget\_id, string $sidebar\_id ): string ===================================================================== Calls the render callback of a widget and returns the output. `$widget_id` string Required Widget ID. `$sidebar_id` string Required Sidebar ID. string File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/) ``` function wp_render_widget( $widget_id, $sidebar_id ) { global $wp_registered_widgets, $wp_registered_sidebars; if ( ! isset( $wp_registered_widgets[ $widget_id ] ) ) { return ''; } if ( isset( $wp_registered_sidebars[ $sidebar_id ] ) ) { $sidebar = $wp_registered_sidebars[ $sidebar_id ]; } elseif ( 'wp_inactive_widgets' === $sidebar_id ) { $sidebar = array(); } else { return ''; } $params = array_merge( array( array_merge( $sidebar, array( 'widget_id' => $widget_id, 'widget_name' => $wp_registered_widgets[ $widget_id ]['name'], ) ), ), (array) $wp_registered_widgets[ $widget_id ]['params'] ); // Substitute HTML `id` and `class` attributes into `before_widget`. $classname_ = ''; foreach ( (array) $wp_registered_widgets[ $widget_id ]['classname'] as $cn ) { if ( is_string( $cn ) ) { $classname_ .= '_' . $cn; } elseif ( is_object( $cn ) ) { $classname_ .= '_' . get_class( $cn ); } } $classname_ = ltrim( $classname_, '_' ); $params[0]['before_widget'] = sprintf( $params[0]['before_widget'], $widget_id, $classname_ ); /** This filter is documented in wp-includes/widgets.php */ $params = apply_filters( 'dynamic_sidebar_params', $params ); $callback = $wp_registered_widgets[ $widget_id ]['callback']; ob_start(); /** This filter is documented in wp-includes/widgets.php */ do_action( 'dynamic_sidebar', $wp_registered_widgets[ $widget_id ] ); if ( is_callable( $callback ) ) { call_user_func_array( $callback, $params ); } return ob_get_clean(); } ``` [do\_action( 'dynamic\_sidebar', array $widget )](../hooks/dynamic_sidebar) Fires before a widget’s display callback is called. [apply\_filters( 'dynamic\_sidebar\_params', array $params )](../hooks/dynamic_sidebar_params) Filters the parameters passed to a widget’s display callback. | Uses | Description | | --- | --- | | [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\_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 wp( string|array $query_vars = '' ) wp( string|array $query\_vars = '' ) ==================================== Sets up the WordPress query. `$query_vars` string|array Optional Default [WP\_Query](../classes/wp_query) arguments. Default: `''` File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function wp( $query_vars = '' ) { global $wp, $wp_query, $wp_the_query; $wp->main( $query_vars ); if ( ! isset( $wp_the_query ) ) { $wp_the_query = $wp_query; } } ``` | Uses | Description | | --- | --- | | [WP::main()](../classes/wp/main) wp-includes/class-wp.php | Sets up all of the variables required by the WordPress environment. | | Used By | Description | | --- | --- | | [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\_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.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress wp_refresh_metabox_loader_nonces( array $response, array $data ): array wp\_refresh\_metabox\_loader\_nonces( array $response, array $data ): array =========================================================================== Refresh nonces used with meta boxes in the block editor. `$response` array Required The Heartbeat response. `$data` array Required The $\_POST data sent. array The Heartbeat response. File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/) ``` function wp_refresh_metabox_loader_nonces( $response, $data ) { if ( empty( $data['wp-refresh-metabox-loader-nonces'] ) ) { return $response; } $received = $data['wp-refresh-metabox-loader-nonces']; $post_id = (int) $received['post_id']; if ( ! $post_id ) { return $response; } if ( ! current_user_can( 'edit_post', $post_id ) ) { return $response; } $response['wp-refresh-metabox-loader-nonces'] = array( 'replace' => array( 'metabox_loader_nonce' => wp_create_nonce( 'meta-box-loader' ), '_wpnonce' => wp_create_nonce( 'update-post_' . $post_id ), ), ); return $response; } ``` | Uses | Description | | --- | --- | | [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | Version | Description | | --- | --- | | [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. | wordpress attribute_escape( string $text ): string attribute\_escape( string $text ): string ========================================= This function has been deprecated. Use [esc\_attr()](esc_attr) instead. Escaping for HTML attributes. * [esc\_attr()](esc_attr) `$text` string Required string File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function attribute_escape( $text ) { _deprecated_function( __FUNCTION__, '2.8.0', 'esc_attr()' ); return esc_attr( $text ); } ``` | Uses | Description | | --- | --- | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use [esc\_attr()](esc_attr) | | [2.0.6](https://developer.wordpress.org/reference/since/2.0.6/) | Introduced. | wordpress serialize_block( array $block ): string serialize\_block( array $block ): string ======================================== Returns the content of a block, including comment delimiters, serializing all attributes from the given parsed block. This should be used when preparing a block to be saved to post content. Prefer `render_block` when preparing a block for display. Unlike `render_block`, this does not evaluate a block’s `render_callback`, and will instead preserve the markup as parsed. `$block` array Required A representative array of a single parsed block object. See WP\_Block\_Parser\_Block. string String of rendered HTML. File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/) ``` function serialize_block( $block ) { $block_content = ''; $index = 0; foreach ( $block['innerContent'] as $chunk ) { $block_content .= is_string( $chunk ) ? $chunk : serialize_block( $block['innerBlocks'][ $index++ ] ); } if ( ! is_array( $block['attrs'] ) ) { $block['attrs'] = array(); } return get_comment_delimited_block_content( $block['blockName'], $block['attrs'], $block_content ); } ``` | Uses | Description | | --- | --- | | [serialize\_block()](serialize_block) wp-includes/blocks.php | Returns the content of a block, including comment delimiters, serializing all attributes from the given parsed block. | | [get\_comment\_delimited\_block\_content()](get_comment_delimited_block_content) wp-includes/blocks.php | Returns the content of a block, including comment delimiters. | | Used By | Description | | --- | --- | | [\_inject\_theme\_attribute\_in\_block\_template\_content()](_inject_theme_attribute_in_block_template_content) wp-includes/block-template-utils.php | Parses wp\_template content and injects the active theme’s stylesheet as a theme attribute into each wp\_template\_part | | [\_remove\_theme\_attribute\_in\_block\_template\_content()](_remove_theme_attribute_in_block_template_content) wp-includes/block-template-utils.php | Parses a block template and removes the theme attribute from each template part. | | [filter\_block\_content()](filter_block_content) wp-includes/blocks.php | Filters and sanitizes block content to remove non-allowable HTML from parsed block attribute values. | | [serialize\_block()](serialize_block) wp-includes/blocks.php | Returns the content of a block, including comment delimiters, serializing all attributes from the given parsed block. | | Version | Description | | --- | --- | | [5.3.1](https://developer.wordpress.org/reference/since/5.3.1/) | Introduced. | wordpress the_block_editor_meta_boxes() the\_block\_editor\_meta\_boxes() ================================= Renders the meta boxes forms. File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/) ``` function the_block_editor_meta_boxes() { global $post, $current_screen, $wp_meta_boxes; // Handle meta box state. $_original_meta_boxes = $wp_meta_boxes; /** * Fires right before the meta boxes are rendered. * * This allows for the filtering of meta box data, that should already be * present by this point. Do not use as a means of adding meta box data. * * @since 5.0.0 * * @param array $wp_meta_boxes Global meta box state. */ $wp_meta_boxes = apply_filters( 'filter_block_editor_meta_boxes', $wp_meta_boxes ); $locations = array( 'side', 'normal', 'advanced' ); $priorities = array( 'high', 'sorted', 'core', 'default', 'low' ); // Render meta boxes. ?> <form class="metabox-base-form"> <?php the_block_editor_meta_box_post_form_hidden_fields( $post ); ?> </form> <form id="toggle-custom-fields-form" method="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>"> <?php wp_nonce_field( 'toggle-custom-fields', 'toggle-custom-fields-nonce' ); ?> <input type="hidden" name="action" value="toggle-custom-fields" /> </form> <?php foreach ( $locations as $location ) : ?> <form class="metabox-location-<?php echo esc_attr( $location ); ?>" onsubmit="return false;"> <div id="poststuff" class="sidebar-open"> <div id="postbox-container-2" class="postbox-container"> <?php do_meta_boxes( $current_screen, $location, $post ); ?> </div> </div> </form> <?php endforeach; ?> <?php $meta_boxes_per_location = array(); foreach ( $locations as $location ) { $meta_boxes_per_location[ $location ] = array(); if ( ! isset( $wp_meta_boxes[ $current_screen->id ][ $location ] ) ) { continue; } foreach ( $priorities as $priority ) { if ( ! isset( $wp_meta_boxes[ $current_screen->id ][ $location ][ $priority ] ) ) { continue; } $meta_boxes = (array) $wp_meta_boxes[ $current_screen->id ][ $location ][ $priority ]; foreach ( $meta_boxes as $meta_box ) { if ( false == $meta_box || ! $meta_box['title'] ) { continue; } // If a meta box is just here for back compat, don't show it in the block editor. if ( isset( $meta_box['args']['__back_compat_meta_box'] ) && $meta_box['args']['__back_compat_meta_box'] ) { continue; } $meta_boxes_per_location[ $location ][] = array( 'id' => $meta_box['id'], 'title' => $meta_box['title'], ); } } } /* * Sadly we probably cannot add this data directly into editor settings. * * Some meta boxes need `admin_head` to fire for meta box registry. * `admin_head` fires after `admin_enqueue_scripts`, which is where we create * our editor instance. */ $script = 'window._wpLoadBlockEditor.then( function() { wp.data.dispatch( \'core/edit-post\' ).setAvailableMetaBoxesPerLocation( ' . wp_json_encode( $meta_boxes_per_location ) . ' ); } );'; wp_add_inline_script( 'wp-edit-post', $script ); /* * When `wp-edit-post` is output in the `<head>`, the inline script needs to be manually printed. * Otherwise, meta boxes will not display because inline scripts for `wp-edit-post` * will not be printed again after this point. */ if ( wp_script_is( 'wp-edit-post', 'done' ) ) { printf( "<script type='text/javascript'>\n%s\n</script>\n", trim( $script ) ); } /* * If the 'postcustom' meta box is enabled, then we need to perform * some extra initialization on it. */ $enable_custom_fields = (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ); if ( $enable_custom_fields ) { $script = "( function( $ ) { if ( $('#postcustom').length ) { $( '#the-list' ).wpList( { addBefore: function( s ) { s.data += '&post_id=$post->ID'; return s; }, addAfter: function() { $('table#list-table').show(); } }); } } )( jQuery );"; wp_enqueue_script( 'wp-lists' ); wp_add_inline_script( 'wp-lists', $script ); } /* * Refresh nonces used by the meta box loader. * * The logic is very similar to that provided by post.js for the classic editor. */ $script = "( function( $ ) { var check, timeout; function schedule() { check = false; window.clearTimeout( timeout ); timeout = window.setTimeout( function() { check = true; }, 300000 ); } $( document ).on( 'heartbeat-send.wp-refresh-nonces', function( e, data ) { var post_id, \$authCheck = $( '#wp-auth-check-wrap' ); if ( check || ( \$authCheck.length && ! \$authCheck.hasClass( 'hidden' ) ) ) { if ( ( post_id = $( '#post_ID' ).val() ) && $( '#_wpnonce' ).val() ) { data['wp-refresh-metabox-loader-nonces'] = { post_id: post_id }; } } }).on( 'heartbeat-tick.wp-refresh-nonces', function( e, data ) { var nonces = data['wp-refresh-metabox-loader-nonces']; if ( nonces ) { if ( nonces.replace ) { if ( nonces.replace.metabox_loader_nonce && window._wpMetaBoxUrl && wp.url ) { window._wpMetaBoxUrl= wp.url.addQueryArgs( window._wpMetaBoxUrl, { 'meta-box-loader-nonce': nonces.replace.metabox_loader_nonce } ); } if ( nonces.replace._wpnonce ) { $( '#_wpnonce' ).val( nonces.replace._wpnonce ); } } } }).ready( function() { schedule(); }); } )( jQuery );"; wp_add_inline_script( 'heartbeat', $script ); // Reset meta box data. $wp_meta_boxes = $_original_meta_boxes; } ``` [apply\_filters( 'filter\_block\_editor\_meta\_boxes', array $wp\_meta\_boxes )](../hooks/filter_block_editor_meta_boxes) Fires right before the meta boxes are rendered. | Uses | Description | | --- | --- | | [the\_block\_editor\_meta\_box\_post\_form\_hidden\_fields()](the_block_editor_meta_box_post_form_hidden_fields) wp-admin/includes/post.php | Renders the hidden form required for the meta boxes form. | | [wp\_add\_inline\_script()](wp_add_inline_script) wp-includes/functions.wp-scripts.php | Adds extra code to a registered script. | | [do\_meta\_boxes()](do_meta_boxes) wp-admin/includes/template.php | Meta-Box template function. | | [wp\_script\_is()](wp_script_is) wp-includes/functions.wp-scripts.php | Determines whether a script has been added to the queue. | | [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. | | [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. | | [get\_user\_meta()](get_user_meta) wp-includes/user.php | Retrieves user meta field for a user. | | [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. | | [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. | | [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. | | Version | Description | | --- | --- | | [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. | wordpress get_term_link( WP_Term|int|string $term, string $taxonomy = '' ): string|WP_Error get\_term\_link( WP\_Term|int|string $term, string $taxonomy = '' ): string|WP\_Error ===================================================================================== Generates a permalink for a taxonomy term archive. `$term` [WP\_Term](../classes/wp_term)|int|string Required The term object, ID, or slug whose link will be retrieved. `$taxonomy` string Optional Taxonomy. Default: `''` string|[WP\_Error](../classes/wp_error) URL of the taxonomy term archive on success, [WP\_Error](../classes/wp_error) if term does not exist. * Since the term can be an object, integer, or string, make sure that any numbers you pass in are explicitly converted to an integer (example: (int) $term\_id). Otherwise the function will assume that $term is a slug instead of a term ID. * PHP may halt if you attempt to print an error result ("Catchable fatal error: Object of class [WP\_Error](../classes/wp_error) could not be converted to string"). You should always use [is\_wp\_error()](is_wp_error) to check the result of this function, in case the term does not exist. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/) ``` function get_term_link( $term, $taxonomy = '' ) { global $wp_rewrite; if ( ! is_object( $term ) ) { if ( is_int( $term ) ) { $term = get_term( $term, $taxonomy ); } else { $term = get_term_by( 'slug', $term, $taxonomy ); } } if ( ! is_object( $term ) ) { $term = new WP_Error( 'invalid_term', __( 'Empty Term.' ) ); } if ( is_wp_error( $term ) ) { return $term; } $taxonomy = $term->taxonomy; $termlink = $wp_rewrite->get_extra_permastruct( $taxonomy ); /** * Filters the permalink structure for a term before token replacement occurs. * * @since 4.9.0 * * @param string $termlink The permalink structure for the term's taxonomy. * @param WP_Term $term The term object. */ $termlink = apply_filters( 'pre_term_link', $termlink, $term ); $slug = $term->slug; $t = get_taxonomy( $taxonomy ); if ( empty( $termlink ) ) { if ( 'category' === $taxonomy ) { $termlink = '?cat=' . $term->term_id; } elseif ( $t->query_var ) { $termlink = "?$t->query_var=$slug"; } else { $termlink = "?taxonomy=$taxonomy&term=$slug"; } $termlink = home_url( $termlink ); } else { if ( ! empty( $t->rewrite['hierarchical'] ) ) { $hierarchical_slugs = array(); $ancestors = get_ancestors( $term->term_id, $taxonomy, 'taxonomy' ); foreach ( (array) $ancestors as $ancestor ) { $ancestor_term = get_term( $ancestor, $taxonomy ); $hierarchical_slugs[] = $ancestor_term->slug; } $hierarchical_slugs = array_reverse( $hierarchical_slugs ); $hierarchical_slugs[] = $slug; $termlink = str_replace( "%$taxonomy%", implode( '/', $hierarchical_slugs ), $termlink ); } else { $termlink = str_replace( "%$taxonomy%", $slug, $termlink ); } $termlink = home_url( user_trailingslashit( $termlink, 'category' ) ); } // Back compat filters. if ( 'post_tag' === $taxonomy ) { /** * Filters the tag link. * * @since 2.3.0 * @since 2.5.0 Deprecated in favor of {@see 'term_link'} filter. * @since 5.4.1 Restored (un-deprecated). * * @param string $termlink Tag link URL. * @param int $term_id Term ID. */ $termlink = apply_filters( 'tag_link', $termlink, $term->term_id ); } elseif ( 'category' === $taxonomy ) { /** * Filters the category link. * * @since 1.5.0 * @since 2.5.0 Deprecated in favor of {@see 'term_link'} filter. * @since 5.4.1 Restored (un-deprecated). * * @param string $termlink Category link URL. * @param int $term_id Term ID. */ $termlink = apply_filters( 'category_link', $termlink, $term->term_id ); } /** * Filters the term link. * * @since 2.5.0 * * @param string $termlink Term link URL. * @param WP_Term $term Term object. * @param string $taxonomy Taxonomy slug. */ return apply_filters( 'term_link', $termlink, $term, $taxonomy ); } ``` [apply\_filters( 'category\_link', string $termlink, int $term\_id )](../hooks/category_link) Filters the category link. [apply\_filters( 'pre\_term\_link', string $termlink, WP\_Term $term )](../hooks/pre_term_link) Filters the permalink structure for a term before token replacement occurs. [apply\_filters( 'tag\_link', string $termlink, int $term\_id )](../hooks/tag_link) Filters the tag link. [apply\_filters( 'term\_link', string $termlink, WP\_Term $term, string $taxonomy )](../hooks/term_link) Filters the term link. | Uses | Description | | --- | --- | | [get\_ancestors()](get_ancestors) wp-includes/taxonomy.php | Gets an array of ancestor IDs for a given object. | | [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. | | [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\_extra\_permastruct()](../classes/wp_rewrite/get_extra_permastruct) wp-includes/class-wp-rewrite.php | Retrieves an extra permalink structure by name. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. | | [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. | | [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\_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\_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. | | [get\_term\_parents\_list()](get_term_parents_list) wp-includes/category-template.php | Retrieves term parents with separator. | | [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\_Customize\_Nav\_Menu\_Item\_Setting::value\_as\_wp\_post\_nav\_menu\_item()](../classes/wp_customize_nav_menu_item_setting/value_as_wp_post_nav_menu_item) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get the value emulated into a [WP\_Post](../classes/wp_post) and set up as a nav\_menu\_item. | | [WP\_Customize\_Nav\_Menus::search\_available\_items\_query()](../classes/wp_customize_nav_menus/search_available_items_query) wp-includes/class-wp-customize-nav-menus.php | Performs post queries for available-item searching. | | [WP\_Customize\_Nav\_Menus::load\_available\_items\_query()](../classes/wp_customize_nav_menus/load_available_items_query) wp-includes/class-wp-customize-nav-menus.php | Performs the post\_type and taxonomy queries for loading available menu items. | | [WP\_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. | | [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. | | [wp\_tag\_cloud()](wp_tag_cloud) wp-includes/category-template.php | Displays a tag cloud. | | [get\_category\_link()](get_category_link) wp-includes/category-template.php | Retrieves category link URL. | | [get\_the\_taxonomies()](get_the_taxonomies) wp-includes/taxonomy.php | Retrieves all taxonomies associated with a post. | | [get\_term\_feed\_link()](get_term_feed_link) wp-includes/link-template.php | Retrieves the feed link for a term. | | [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. | | [get\_post\_format\_link()](get_post_format_link) wp-includes/post-formats.php | Returns a link to a post format index. | | [wp\_setup\_nav\_menu\_item()](wp_setup_nav_menu_item) wp-includes/nav-menu.php | Decorates a menu item object with the shared navigation menu item properties. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
programming_docs
wordpress _find_post_by_old_date( string $post_type ): int \_find\_post\_by\_old\_date( string $post\_type ): 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. Use [wp\_old\_slug\_redirect()](wp_old_slug_redirect) instead. Find the post ID for redirecting an old date. * [wp\_old\_slug\_redirect()](wp_old_slug_redirect) `$post_type` string Required The current post type based on the query vars. int The Post ID. File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/) ``` function _find_post_by_old_date( $post_type ) { global $wpdb; $date_query = ''; if ( get_query_var( 'year' ) ) { $date_query .= $wpdb->prepare( ' AND YEAR(pm_date.meta_value) = %d', get_query_var( 'year' ) ); } if ( get_query_var( 'monthnum' ) ) { $date_query .= $wpdb->prepare( ' AND MONTH(pm_date.meta_value) = %d', get_query_var( 'monthnum' ) ); } if ( get_query_var( 'day' ) ) { $date_query .= $wpdb->prepare( ' AND DAYOFMONTH(pm_date.meta_value) = %d', get_query_var( 'day' ) ); } $id = 0; if ( $date_query ) { $query = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta AS pm_date, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_date' AND post_name = %s" . $date_query, $post_type, get_query_var( 'name' ) ); $key = md5( $query ); $last_changed = wp_cache_get_last_changed( 'posts' ); $cache_key = "find_post_by_old_date:$key:$last_changed"; $cache = wp_cache_get( $cache_key, 'posts' ); if ( false !== $cache ) { $id = $cache; } else { $id = (int) $wpdb->get_var( $query ); if ( ! $id ) { // Check to see if an old slug matches the old date. $id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts, $wpdb->postmeta AS pm_slug, $wpdb->postmeta AS pm_date WHERE ID = pm_slug.post_id AND ID = pm_date.post_id AND post_type = %s AND pm_slug.meta_key = '_wp_old_slug' AND pm_slug.meta_value = %s AND pm_date.meta_key = '_wp_old_date'" . $date_query, $post_type, get_query_var( 'name' ) ) ); } wp_cache_set( $cache_key, $id, 'posts' ); } } return $id; } ``` | 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. | | [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\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. | | [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. | | [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. | | Used By | Description | | --- | --- | | [wp\_old\_slug\_redirect()](wp_old_slug_redirect) wp-includes/query.php | Redirect old slugs to the correct permalink. | | Version | Description | | --- | --- | | [4.9.3](https://developer.wordpress.org/reference/since/4.9.3/) | Introduced. | wordpress get_user_count( int|null $network_id = null ): int get\_user\_count( int|null $network\_id = null ): int ===================================================== Returns the number of active users in your installation. Note that on a large site the count may be cached and only updated twice daily. `$network_id` int|null Optional ID of the network. Defaults to the current network. Default: `null` int Number of active users on the network. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function get_user_count( $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' ); } return (int) get_network_option( $network_id, 'user_count', -1 ); } ``` | Uses | Description | | --- | --- | | [get\_network\_option()](get_network_option) wp-includes/option.php | Retrieves a network’s option value based on the option name. | | [\_\_()](__) 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. | | Used By | 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\_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\_MS\_Users\_List\_Table::get\_views()](../classes/wp_ms_users_list_table/get_views) wp-admin/includes/class-wp-ms-users-list-table.php | | | [wp\_network\_dashboard\_right\_now()](wp_network_dashboard_right_now) wp-admin/includes/dashboard.php | | | [wp\_version\_check()](wp_version_check) wp-includes/update.php | Checks WordPress version against the newest version. | | [wp\_is\_large\_network()](wp_is_large_network) wp-includes/ms-functions.php | Determines whether or not we have a large network. | | [get\_sitestats()](get_sitestats) wp-includes/ms-functions.php | Gets the network’s site and user counts. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | MU (3.0.0) | | [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Moved to wp-includes/user.php. | | [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Introduced. | wordpress add_pages_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', int $position = null ): string|false add\_pages\_page( string $page\_title, string $menu\_title, string $capability, string $menu\_slug, callable $callback = '', int $position = null ): string|false ================================================================================================================================================================= Adds a submenu page to the Pages main menu. This function takes a capability which will be used to determine whether or not a page is included in the menu. The function which is hooked in to handle the output of the page must check that the user has the required capability as well. `$page_title` string Required The text to be displayed in the title tags of the page when the menu is selected. `$menu_title` string Required The text to be used for the menu. `$capability` string Required The capability required for this menu to be displayed to the user. `$menu_slug` string Required The slug name to refer to this menu by (should be unique for this menu). `$callback` callable Optional The function to be called to output the content for this page. Default: `''` `$position` int Optional The position in the menu order this item should appear. Default: `null` string|false The resulting page's hook\_suffix, or false if the user does not have the capability required. * If you’re running into the »*You do not have sufficient permissions to access this page.*« message in a [wp\_die()](wp_die) screen, then you’ve hooked too early. The hook you should use is `admin_menu`. * This function is a simple wrapper for a call to [add\_submenu\_page()](add_submenu_page) , passing the received arguments and specifying ‘`edit.php?post_type=page`‘ as the `$parent_slug` argument. This means the new page will be added as a sub menu to the *Pages* menu. File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/) ``` function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } ``` | Uses | Description | | --- | --- | | [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added the `$position` parameter. | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress do_block_editor_incompatible_meta_box( mixed $data_object, array $box ) do\_block\_editor\_incompatible\_meta\_box( mixed $data\_object, array $box ) ============================================================================= Renders a “fake” meta box with an information message, shown on the block editor, when an incompatible meta box is found. `$data_object` mixed Required The data object being rendered on this screen. `$box` array Required Custom formats meta box arguments. * `id`stringMeta box `'id'` attribute. * `title`stringMeta box title. * `old_callback`callableThe original callback for this meta box. * `args`arrayExtra meta box arguments. File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/) ``` function do_block_editor_incompatible_meta_box( $data_object, $box ) { $plugin = _get_plugin_from_callback( $box['old_callback'] ); $plugins = get_plugins(); echo '<p>'; if ( $plugin ) { /* translators: %s: The name of the plugin that generated this meta box. */ printf( __( 'This meta box, from the %s plugin, is not compatible with the block editor.' ), "<strong>{$plugin['Name']}</strong>" ); } else { _e( 'This meta box is not compatible with the block editor.' ); } echo '</p>'; if ( empty( $plugins['classic-editor/classic-editor.php'] ) ) { if ( current_user_can( 'install_plugins' ) ) { $install_url = wp_nonce_url( self_admin_url( 'plugin-install.php?tab=favorites&user=wordpressdotorg&save=0' ), 'save_wporg_username_' . get_current_user_id() ); echo '<p>'; /* translators: %s: A link to install the Classic Editor plugin. */ printf( __( 'Please install the <a href="%s">Classic Editor plugin</a> to use this meta box.' ), esc_url( $install_url ) ); echo '</p>'; } } elseif ( is_plugin_inactive( 'classic-editor/classic-editor.php' ) ) { if ( current_user_can( 'activate_plugins' ) ) { $activate_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php' ), 'activate-plugin_classic-editor/classic-editor.php' ); echo '<p>'; /* translators: %s: A link to activate the Classic Editor plugin. */ printf( __( 'Please activate the <a href="%s">Classic Editor plugin</a> to use this meta box.' ), esc_url( $activate_url ) ); echo '</p>'; } } elseif ( $data_object instanceof WP_Post ) { $edit_url = add_query_arg( array( 'classic-editor' => '', 'classic-editor__forget' => '', ), get_edit_post_link( $data_object ) ); echo '<p>'; /* translators: %s: A link to use the Classic Editor plugin. */ printf( __( 'Please open the <a href="%s">classic editor</a> to use this meta box.' ), esc_url( $edit_url ) ); echo '</p>'; } } ``` | Uses | Description | | --- | --- | | [\_get\_plugin\_from\_callback()](_get_plugin_from_callback) wp-admin/includes/template.php | Internal helper function to find the plugin from a meta box callback. | | [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. | | [get\_edit\_post\_link()](get_edit_post_link) wp-includes/link-template.php | Retrieves the edit post link for post. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_e()](_e) wp-includes/l10n.php | Displays translated 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. | | [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. | | Version | Description | | --- | --- | | [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. | wordpress wp_update_network_user_counts( int|null $network_id = null ) wp\_update\_network\_user\_counts( int|null $network\_id = null ) ================================================================= Updates the network-wide user count. `$network_id` int|null Optional ID of the network. Default is the current network. Default: `null` File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/) ``` function wp_update_network_user_counts( $network_id = null ) { wp_update_user_counts( $network_id ); } ``` | Uses | Description | | --- | --- | | [wp\_update\_user\_counts()](wp_update_user_counts) wp-includes/user.php | Updates the total count of users on the site. | | Used By | Description | | --- | --- | | [wp\_update\_network\_counts()](wp_update_network_counts) wp-includes/ms-functions.php | Updates the network-wide counts for the current network. | | [wp\_maybe\_update\_network\_user\_counts()](wp_maybe_update_network_user_counts) wp-includes/ms-functions.php | Updates the network-wide users count. | | Version | Description | | --- | --- | | [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | This function is now a wrapper for [wp\_update\_user\_counts()](wp_update_user_counts) . | | [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 _page_traverse_name( int $page_id, array $children, string[] $result ) \_page\_traverse\_name( int $page\_id, array $children, string[] $result ) ========================================================================== 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 [\_page\_traverse\_name()](_page_traverse_name) instead. Traverses and return all the nested children post names of a root page. $children contains parent-children relations * [\_page\_traverse\_name()](_page_traverse_name) `$page_id` int Required Page ID. `$children` array Required Parent-children relations (passed by reference). `$result` string[] Required Array of page names keyed by ID (passed by reference). File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function _page_traverse_name( $page_id, &$children, &$result ) { if ( isset( $children[ $page_id ] ) ) { foreach ( (array) $children[ $page_id ] as $child ) { $result[ $child->ID ] = $child->post_name; _page_traverse_name( $child->ID, $children, $result ); } } } ``` | Uses | Description | | --- | --- | | [\_page\_traverse\_name()](_page_traverse_name) wp-includes/post.php | Traverses and return all the nested children post names of a root page. | | Used By | Description | | --- | --- | | [get\_page\_hierarchy()](get_page_hierarchy) wp-includes/post.php | Orders the pages with children under parents in a flat list. | | [\_page\_traverse\_name()](_page_traverse_name) wp-includes/post.php | Traverses and return all the nested children post names of a root page. | | Version | Description | | --- | --- | | [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. | wordpress get_the_author_msn(): string get\_the\_author\_msn(): string =============================== This function has been deprecated. Use [get\_the\_author\_meta()](get_the_author_meta) instead. Retrieve the MSN address of the author of the current post. * [get\_the\_author\_meta()](get_the_author_meta) string The author's MSN address. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_the_author_msn() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'msn\')' ); return get_the_author_meta('msn'); } ``` | 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 add_management_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', int $position = null ): string|false add\_management\_page( string $page\_title, string $menu\_title, string $capability, string $menu\_slug, callable $callback = '', int $position = null ): string|false ====================================================================================================================================================================== Adds a submenu page to the Tools main menu. This function takes a capability which will be used to determine whether or not a page is included in the menu. The function which is hooked in to handle the output of the page must check that the user has the required capability as well. `$page_title` string Required The text to be displayed in the title tags of the page when the menu is selected. `$menu_title` string Required The text to be used for the menu. `$capability` string Required The capability required for this menu to be displayed to the user. `$menu_slug` string Required The slug name to refer to this menu by (should be unique for this menu). `$callback` callable Optional The function to be called to output the content for this page. Default: `''` `$position` int Optional The position in the menu order this item should appear. Default: `null` string|false The resulting page's hook\_suffix, or false if the user does not have the capability required. ##### Example: `add_management_page( 'Custom Permalinks', 'Custom Permalinks', 'manage_options', 'my-unique-identifier', 'custom_permalinks_options_page' );` ##### Notes: If you’re running into the »`You do not have sufficient permissions to access this page.`« message in a ``wp_die()`` screen, then you’ve hooked too early. The hook you should use is ``admin_menu``. File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/) ``` function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } ``` | Uses | Description | | --- | --- | | [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added the `$position` parameter. | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
programming_docs
wordpress got_url_rewrite(): bool got\_url\_rewrite(): bool ========================= Returns whether the server supports URL rewriting. Detects Apache’s mod\_rewrite, IIS 7.0+ permalink support, and nginx. bool Whether the server supports URL rewriting. File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/) ``` function got_url_rewrite() { $got_url_rewrite = ( got_mod_rewrite() || $GLOBALS['is_nginx'] || iis7_supports_permalinks() ); /** * Filters whether URL rewriting is available. * * @since 3.7.0 * * @param bool $got_url_rewrite Whether URL rewriting is available. */ return apply_filters( 'got_url_rewrite', $got_url_rewrite ); } ``` [apply\_filters( 'got\_url\_rewrite', bool $got\_url\_rewrite )](../hooks/got_url_rewrite) Filters whether URL rewriting is available. | Uses | Description | | --- | --- | | [got\_mod\_rewrite()](got_mod_rewrite) wp-admin/includes/misc.php | Returns whether the server is running Apache with the mod\_rewrite module loaded. | | [iis7\_supports\_permalinks()](iis7_supports_permalinks) wp-includes/functions.php | Checks if IIS 7+ supports pretty permalinks. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [WP\_Debug\_Data::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 | | --- | --- | | [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. | wordpress wp_insert_comment( array $commentdata ): int|false wp\_insert\_comment( array $commentdata ): int|false ==================================================== Inserts a comment into the database. `$commentdata` array Required Array of arguments for inserting a new comment. * `comment_agent`stringThe HTTP user agent of the `$comment_author` when the comment was submitted. Default empty. * `comment_approved`int|stringWhether the comment has been approved. Default 1. * `comment_author`stringThe name of the author of the comment. Default empty. * `comment_author_email`stringThe email address of the `$comment_author`. Default empty. * `comment_author_IP`stringThe IP address of the `$comment_author`. Default empty. * `comment_author_url`stringThe URL address of the `$comment_author`. Default empty. * `comment_content`stringThe content of the comment. Default empty. * `comment_date`stringThe date the comment was submitted. To set the date manually, `$comment_date_gmt` must also be specified. Default is the current time. * `comment_date_gmt`stringThe date the comment was submitted in the GMT timezone. Default is `$comment_date` in the site's GMT timezone. * `comment_karma`intThe karma of the comment. Default 0. * `comment_parent`intID of this comment's parent, if any. Default 0. * `comment_post_ID`intID of the post that relates to the comment, if any. Default 0. * `comment_type`stringComment type. Default `'comment'`. * `comment_meta`arrayOptional. Array of key/value pairs to be stored in commentmeta for the new comment. * `user_id`intID of the user who submitted the comment. Default 0. int|false The new comment's ID 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_insert_comment( $commentdata ) { global $wpdb; $data = wp_unslash( $commentdata ); $comment_author = ! isset( $data['comment_author'] ) ? '' : $data['comment_author']; $comment_author_email = ! isset( $data['comment_author_email'] ) ? '' : $data['comment_author_email']; $comment_author_url = ! isset( $data['comment_author_url'] ) ? '' : $data['comment_author_url']; $comment_author_ip = ! isset( $data['comment_author_IP'] ) ? '' : $data['comment_author_IP']; $comment_date = ! isset( $data['comment_date'] ) ? current_time( 'mysql' ) : $data['comment_date']; $comment_date_gmt = ! isset( $data['comment_date_gmt'] ) ? get_gmt_from_date( $comment_date ) : $data['comment_date_gmt']; $comment_post_id = ! isset( $data['comment_post_ID'] ) ? 0 : $data['comment_post_ID']; $comment_content = ! isset( $data['comment_content'] ) ? '' : $data['comment_content']; $comment_karma = ! isset( $data['comment_karma'] ) ? 0 : $data['comment_karma']; $comment_approved = ! isset( $data['comment_approved'] ) ? 1 : $data['comment_approved']; $comment_agent = ! isset( $data['comment_agent'] ) ? '' : $data['comment_agent']; $comment_type = empty( $data['comment_type'] ) ? 'comment' : $data['comment_type']; $comment_parent = ! isset( $data['comment_parent'] ) ? 0 : $data['comment_parent']; $user_id = ! isset( $data['user_id'] ) ? 0 : $data['user_id']; $compacted = array( 'comment_post_ID' => $comment_post_id, 'comment_author_IP' => $comment_author_ip, ); $compacted += compact( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_karma', 'comment_approved', 'comment_agent', 'comment_type', 'comment_parent', 'user_id' ); if ( ! $wpdb->insert( $wpdb->comments, $compacted ) ) { return false; } $id = (int) $wpdb->insert_id; if ( 1 == $comment_approved ) { wp_update_comment_count( $comment_post_id ); $data = array(); foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) { $data[] = "lastcommentmodified:$timezone"; } wp_cache_delete_multiple( $data, 'timeinfo' ); } clean_comment_cache( $id ); $comment = get_comment( $id ); // If metadata is provided, store it. if ( isset( $commentdata['comment_meta'] ) && is_array( $commentdata['comment_meta'] ) ) { foreach ( $commentdata['comment_meta'] as $meta_key => $meta_value ) { add_comment_meta( $comment->comment_ID, $meta_key, $meta_value, true ); } } /** * Fires immediately after a comment is inserted into the database. * * @since 2.8.0 * * @param int $id The comment ID. * @param WP_Comment $comment Comment object. */ do_action( 'wp_insert_comment', $id, $comment ); return $id; } ``` [do\_action( 'wp\_insert\_comment', int $id, WP\_Comment $comment )](../hooks/wp_insert_comment) Fires immediately after a comment is inserted into the database. | Uses | Description | | --- | --- | | [wp\_cache\_delete\_multiple()](wp_cache_delete_multiple) wp-includes/cache.php | Deletes multiple values from the cache in one call. | | [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. | | [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. | | [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). | | [add\_comment\_meta()](add_comment_meta) wp-includes/comment.php | Adds meta data field to a comment. | | [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. | | 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/) | Default value for `$comment_type` argument changed to `comment`. | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced the `$comment_meta` argument. | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress wp_add_editor_classic_theme_styles( array $editor_settings ): array wp\_add\_editor\_classic\_theme\_styles( array $editor\_settings ): array ========================================================================= Loads classic theme styles on classic themes in the editor. This is needed for backwards compatibility for button blocks specifically. `$editor_settings` array Required The array of editor settings. array A filtered array of editor settings. File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/) ``` function wp_add_editor_classic_theme_styles( $editor_settings ) { if ( WP_Theme_JSON_Resolver::theme_has_support() ) { return $editor_settings; } $suffix = wp_scripts_get_suffix(); $classic_theme_styles = ABSPATH . WPINC . "/css/classic-themes$suffix.css"; // This follows the pattern of get_block_editor_theme_styles, // but we can't use get_block_editor_theme_styles directly as it // only handles external files or theme files. $classic_theme_styles_settings = array( 'css' => file_get_contents( $classic_theme_styles ), '__unstableType' => 'core', 'isGlobalStyles' => false, ); // Add these settings to the start of the array so that themes can override them. array_unshift( $editor_settings['styles'], $classic_theme_styles_settings ); return $editor_settings; } ``` | Uses | Description | | --- | --- | | [WP\_Theme\_JSON\_Resolver::theme\_has\_support()](../classes/wp_theme_json_resolver/theme_has_support) wp-includes/class-wp-theme-json-resolver.php | Determines whether the active theme has a theme.json file. | | [wp\_scripts\_get\_suffix()](wp_scripts_get_suffix) wp-includes/script-loader.php | Returns the suffix that can be used for the scripts. | | Version | Description | | --- | --- | | [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. | wordpress wp_ajax_dim_comment() wp\_ajax\_dim\_comment() ======================== Ajax handler to dim a comment. File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/) ``` function wp_ajax_dim_comment() { $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; $comment = get_comment( $id ); if ( ! $comment ) { $x = new WP_Ajax_Response( array( 'what' => 'comment', 'id' => new WP_Error( 'invalid_comment', /* translators: %d: Comment ID. */ sprintf( __( 'Comment %d does not exist' ), $id ) ), ) ); $x->send(); } if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) && ! current_user_can( 'moderate_comments' ) ) { wp_die( -1 ); } $current = wp_get_comment_status( $comment ); if ( isset( $_POST['new'] ) && $_POST['new'] == $current ) { wp_die( time() ); } check_ajax_referer( "approve-comment_$id" ); if ( in_array( $current, array( 'unapproved', 'spam' ), true ) ) { $result = wp_set_comment_status( $comment, 'approve', true ); } else { $result = wp_set_comment_status( $comment, 'hold', true ); } if ( is_wp_error( $result ) ) { $x = new WP_Ajax_Response( array( 'what' => 'comment', 'id' => $result, ) ); $x->send(); } // Decide if we need to send back '1' or a more complicated response including page links and comment counts. _wp_ajax_delete_comment_response( $comment->comment_ID ); wp_die( 0 ); } ``` | Uses | Description | | --- | --- | | [\_wp\_ajax\_delete\_comment\_response()](_wp_ajax_delete_comment_response) wp-admin/includes/ajax-actions.php | Sends back current comment total and new page links if they need to be updated. | | [WP\_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). | | [wp\_set\_comment\_status()](wp_set_comment_status) wp-includes/comment.php | Sets the status of a comment. | | [wp\_get\_comment\_status()](wp_get_comment_status) wp-includes/comment.php | Retrieves the status of a comment by comment ID. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. | | [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. | | [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | [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 get_embed_template(): string get\_embed\_template(): string ============================== Retrieves an embed template path in the current or parent template. The hierarchy for this template looks like: 1. embed-{post\_type}-{post\_format}.php 2. embed-{post\_type}.php 3. embed.php An example of this is: 1. embed-post-audio.php 2. embed-post.php 3. embed.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 ’embed’. * [get\_query\_template()](get_query_template) string Full path to embed template file. File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/) ``` function get_embed_template() { $object = get_queried_object(); $templates = array(); if ( ! empty( $object->post_type ) ) { $post_format = get_post_format( $object ); if ( $post_format ) { $templates[] = "embed-{$object->post_type}-{$post_format}.php"; } $templates[] = "embed-{$object->post_type}.php"; } $templates[] = 'embed.php'; return get_query_template( 'embed', $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. | | [get\_post\_format()](get_post_format) wp-includes/post-formats.php | Retrieve the format slug for a post | | Version | Description | | --- | --- | | [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. | wordpress get_theme_file_uri( string $file = '' ): string get\_theme\_file\_uri( string $file = '' ): string ================================================== Retrieves the URL of a file in the theme. Searches in the stylesheet directory before the template directory so themes which inherit from a parent theme can just override one file. `$file` string Optional File to search for in the stylesheet directory. Default: `''` string The 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_theme_file_uri( $file = '' ) { $file = ltrim( $file, '/' ); if ( empty( $file ) ) { $url = get_stylesheet_directory_uri(); } elseif ( file_exists( get_stylesheet_directory() . '/' . $file ) ) { $url = get_stylesheet_directory_uri() . '/' . $file; } else { $url = get_template_directory_uri() . '/' . $file; } /** * Filters the URL to a file in the theme. * * @since 4.7.0 * * @param string $url The file URL. * @param string $file The requested file to search for. */ return apply_filters( 'theme_file_uri', $url, $file ); } ``` [apply\_filters( 'theme\_file\_uri', string $url, string $file )](../hooks/theme_file_uri) Filters the URL to a file in the theme. | Uses | Description | | --- | --- | | [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) wp-includes/theme.php | Retrieves stylesheet directory URI for the active theme. | | [get\_stylesheet\_directory()](get_stylesheet_directory) wp-includes/theme.php | Retrieves stylesheet directory path for the active theme. | | [get\_template\_directory\_uri()](get_template_directory_uri) wp-includes/theme.php | Retrieves template directory URI for the active theme. | | [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\_webfonts\_handler()](_wp_theme_json_webfonts_handler) wp-includes/script-loader.php | Runs the theme.json webfonts handler. | | [get\_block\_editor\_theme\_styles()](get_block_editor_theme_styles) wp-includes/block-editor.php | Creates an array of theme styles to load into the block editor. | | [register\_block\_script\_handle()](register_block_script_handle) wp-includes/blocks.php | Finds a script handle for the selected block metadata field. It detects when a path to file was provided and finds a corresponding asset file with details necessary to register the script under automatically generated handle name. It returns unprocessed script handle otherwise. | | [register\_block\_style\_handle()](register_block_style_handle) wp-includes/blocks.php | Finds a style handle for the block metadata field. It detects when a path to file was provided and registers the style under automatically generated handle name. It returns unprocessed style handle otherwise. | | Version | Description | | --- | --- | | [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. | wordpress get_edit_bookmark_link( int|stdClass $link ): string|void get\_edit\_bookmark\_link( int|stdClass $link ): string|void ============================================================ Displays the edit bookmark link. `$link` int|stdClass Optional Bookmark ID. Default is the ID of the current bookmark. string|void The edit bookmark link URL. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function get_edit_bookmark_link( $link = 0 ) { $link = get_bookmark( $link ); if ( ! current_user_can( 'manage_links' ) ) { return; } $location = admin_url( 'link.php?action=edit&amp;link_id=' ) . $link->link_id; /** * Filters the bookmark edit link. * * @since 2.7.0 * * @param string $location The edit link. * @param int $link_id Bookmark ID. */ return apply_filters( 'get_edit_bookmark_link', $location, $link->link_id ); } ``` [apply\_filters( 'get\_edit\_bookmark\_link', string $location, int $link\_id )](../hooks/get_edit_bookmark_link) Filters the bookmark edit link. | Uses | Description | | --- | --- | | [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. | | [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\_Links\_List\_Table::handle\_row\_actions()](../classes/wp_links_list_table/handle_row_actions) wp-admin/includes/class-wp-links-list-table.php | Generates and displays row action links. | | [WP\_Links\_List\_Table::column\_name()](../classes/wp_links_list_table/column_name) wp-admin/includes/class-wp-links-list-table.php | Handles the link name column output. | | [edit\_bookmark\_link()](edit_bookmark_link) wp-includes/link-template.php | Displays the edit bookmark link anchor content. | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
programming_docs
wordpress wp_enqueue_editor() wp\_enqueue\_editor() ===================== Outputs the editor scripts, stylesheets, and default settings. The editor can be initialized when needed after page load. See wp.editor.initialize() in wp-admin/js/editor.js for initialization options. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function wp_enqueue_editor() { if ( ! class_exists( '_WP_Editors', false ) ) { require ABSPATH . WPINC . '/class-wp-editor.php'; } _WP_Editors::enqueue_default_editor(); } ``` | Uses | Description | | --- | --- | | [\_WP\_Editors::enqueue\_default\_editor()](../classes/_wp_editors/enqueue_default_editor) wp-includes/class-wp-editor.php | Enqueue all editor scripts. | | 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. | | Version | Description | | --- | --- | | [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Introduced. | wordpress feed_content_type( string $type = '' ) feed\_content\_type( string $type = '' ) ======================================== Returns the content type for specified feed type. `$type` string Optional Type of feed. Possible values include `'rss'`, rss2', `'atom'`, and `'rdf'`. Default: `''` File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/) ``` function feed_content_type( $type = '' ) { if ( empty( $type ) ) { $type = get_default_feed(); } $types = array( 'rss' => 'application/rss+xml', 'rss2' => 'application/rss+xml', 'rss-http' => 'text/xml', 'atom' => 'application/atom+xml', 'rdf' => 'application/rdf+xml', ); $content_type = ( ! empty( $types[ $type ] ) ) ? $types[ $type ] : 'application/octet-stream'; /** * Filters the content type for a specific feed type. * * @since 2.8.0 * * @param string $content_type Content type indicating the type of data that a feed contains. * @param string $type Type of feed. Possible values include 'rss', rss2', 'atom', and 'rdf'. */ return apply_filters( 'feed_content_type', $content_type, $type ); } ``` [apply\_filters( 'feed\_content\_type', string $content\_type, string $type )](../hooks/feed_content_type) Filters the content type for a specific feed type. | Uses | Description | | --- | --- | | [get\_default\_feed()](get_default_feed) wp-includes/feed.php | Retrieves the default feed. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [feed\_links()](feed_links) wp-includes/general-template.php | Displays the links to the general feeds. | | [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. | | [WP::send\_headers()](../classes/wp/send_headers) wp-includes/class-wp.php | Sends additional HTTP headers for caching, content type, etc. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress media_upload_tabs(): string[] media\_upload\_tabs(): string[] =============================== Defines the default media upload tabs. string[] Default tabs. File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/) ``` function media_upload_tabs() { $_default_tabs = array( 'type' => __( 'From Computer' ), // Handler action suffix => tab text. 'type_url' => __( 'From URL' ), 'gallery' => __( 'Gallery' ), 'library' => __( 'Media Library' ), ); /** * Filters the available tabs in the legacy (pre-3.5.0) media popup. * * @since 2.5.0 * * @param string[] $_default_tabs An array of media tabs. */ return apply_filters( 'media_upload_tabs', $_default_tabs ); } ``` [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. | 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 | | --- | --- | | [the\_media\_upload\_tabs()](the_media_upload_tabs) wp-admin/includes/media.php | Outputs the legacy media upload tabs UI. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress signup_user( string $user_name = '', string $user_email = '', WP_Error|string $errors = '' ) signup\_user( string $user\_name = '', string $user\_email = '', WP\_Error|string $errors = '' ) ================================================================================================ Shows a form for a visitor to sign up for a new user account. `$user_name` string Optional The username. Default: `''` `$user_email` string Optional The user's email. Default: `''` `$errors` [WP\_Error](../classes/wp_error)|string Optional A [WP\_Error](../classes/wp_error) object containing existing errors. Defaults to empty string. Default: `''` File: `wp-signup.php`. [View all references](https://developer.wordpress.org/reference/files/wp-signup.php/) ``` function signup_user( $user_name = '', $user_email = '', $errors = '' ) { global $active_signup; if ( ! is_wp_error( $errors ) ) { $errors = new WP_Error(); } $signup_for = isset( $_POST['signup_for'] ) ? esc_html( $_POST['signup_for'] ) : 'blog'; $signup_user_defaults = array( 'user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors, ); /** * Filters the default user variables used on the user sign-up form. * * @since 3.0.0 * * @param array $signup_user_defaults { * An array of default user variables. * * @type string $user_name The user username. * @type string $user_email The user email address. * @type WP_Error $errors A WP_Error object with possible errors relevant to the sign-up user. * } */ $filtered_results = apply_filters( 'signup_user_init', $signup_user_defaults ); $user_name = $filtered_results['user_name']; $user_email = $filtered_results['user_email']; $errors = $filtered_results['errors']; ?> <h2> <?php /* translators: %s: Name of the network. */ printf( __( 'Get your own %s account in seconds' ), get_network()->site_name ); ?> </h2> <form id="setupform" method="post" action="wp-signup.php" novalidate="novalidate"> <input type="hidden" name="stage" value="validate-user-signup" /> <?php /** This action is documented in wp-signup.php */ do_action( 'signup_hidden_fields', 'validate-user' ); ?> <?php show_user_form( $user_name, $user_email, $errors ); ?> <?php if ( 'blog' === $active_signup ) : ?> <input id="signupblog" type="hidden" name="signup_for" value="blog" /> <?php elseif ( 'user' === $active_signup ) : ?> <input id="signupblog" type="hidden" name="signup_for" value="user" /> <?php else : ?> <fieldset class="signup-options"> <legend><?php _e( 'Create a site or only a username:' ); ?></legend> <p class="wp-signup-radio-buttons"> <span class="wp-signup-radio-button"> <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> /> <label class="checkbox" for="signupblog"><?php _e( 'Gimme a site!' ); ?></label> </span> <span class="wp-signup-radio-button"> <input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> /> <label class="checkbox" for="signupuser"><?php _e( 'Just a username, please.' ); ?></label> </span> </p> </fieldset> <?php endif; ?> <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Next' ); ?>" /></p> </form> <?php } ``` [do\_action( 'signup\_hidden\_fields', string $context )](../hooks/signup_hidden_fields) Hidden sign-up form fields output when creating another site or user. [apply\_filters( 'signup\_user\_init', array $signup\_user\_defaults )](../hooks/signup_user_init) Filters the default user variables used on the user sign-up form. | Uses | Description | | --- | --- | | [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. | | [show\_user\_form()](show_user_form) wp-signup.php | Displays the fields for the new user account registration form. | | [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. | | [checked()](checked) wp-includes/general-template.php | Outputs the HTML checked attribute. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. | | Used By | Description | | --- | --- | | [validate\_user\_signup()](validate_user_signup) wp-signup.php | Validates the new user sign-up. | | [validate\_blog\_signup()](validate_blog_signup) wp-signup.php | Validates new site signup. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress get_registered_metadata( string $object_type, int $object_id, string $meta_key = '' ): mixed get\_registered\_metadata( string $object\_type, int $object\_id, string $meta\_key = '' ): mixed ================================================================================================= Retrieves registered metadata for a specified object. The results include both meta that is registered specifically for the object’s subtype and meta that is registered for the entire object type. `$object_type` string Required Type of object metadata is for. Accepts `'post'`, `'comment'`, `'term'`, `'user'`, or any other object type with an associated meta table. `$object_id` int Required ID of the object the metadata is for. `$meta_key` string Optional Registered metadata key. If not specified, retrieve all registered metadata for the specified object. Default: `''` mixed A single value or array of values for a key if specified. An array of all registered keys and values for an object ID if not. False if a given $meta\_key is not registered. File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/) ``` function get_registered_metadata( $object_type, $object_id, $meta_key = '' ) { $object_subtype = get_object_subtype( $object_type, $object_id ); if ( ! empty( $meta_key ) ) { if ( ! empty( $object_subtype ) && ! registered_meta_key_exists( $object_type, $meta_key, $object_subtype ) ) { $object_subtype = ''; } if ( ! registered_meta_key_exists( $object_type, $meta_key, $object_subtype ) ) { return false; } $meta_keys = get_registered_meta_keys( $object_type, $object_subtype ); $meta_key_data = $meta_keys[ $meta_key ]; $data = get_metadata( $object_type, $object_id, $meta_key, $meta_key_data['single'] ); return $data; } $data = get_metadata( $object_type, $object_id ); if ( ! $data ) { return array(); } $meta_keys = get_registered_meta_keys( $object_type ); if ( ! empty( $object_subtype ) ) { $meta_keys = array_merge( $meta_keys, get_registered_meta_keys( $object_type, $object_subtype ) ); } return array_intersect_key( $data, $meta_keys ); } ``` | Uses | Description | | --- | --- | | [get\_object\_subtype()](get_object_subtype) wp-includes/meta.php | Returns the object subtype for a given object ID of a specific type. | | [registered\_meta\_key\_exists()](registered_meta_key_exists) wp-includes/meta.php | Checks if a meta key is registered. | | [get\_registered\_meta\_keys()](get_registered_meta_keys) wp-includes/meta.php | Retrieves a list of registered metadata args for an object type, keyed by their meta keys. | | [get\_metadata()](get_metadata) wp-includes/meta.php | Retrieves the value of a metadata field for the specified object type and ID. | | Version | Description | | --- | --- | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. | wordpress get_site_allowed_themes() get\_site\_allowed\_themes() ============================ This function has been deprecated. Use [WP\_Theme::get\_allowed\_on\_network()](../classes/wp_theme/get_allowed_on_network) instead. Deprecated functionality for getting themes network-enabled themes. * [WP\_Theme::get\_allowed\_on\_network()](../classes/wp_theme/get_allowed_on_network) File: `wp-admin/includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms-deprecated.php/) ``` function get_site_allowed_themes() { _deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_network()' ); return array_map( 'intval', WP_Theme::get_allowed_on_network() ); } ``` | Uses | Description | | --- | --- | | [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. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. | wordpress _wp_get_post_revision_version( WP_Post $revision ): int|false \_wp\_get\_post\_revision\_version( WP\_Post $revision ): int|false =================================================================== This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Gets the post revision version. `$revision` [WP\_Post](../classes/wp_post) Required int|false File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/) ``` function _wp_get_post_revision_version( $revision ) { if ( is_object( $revision ) ) { $revision = get_object_vars( $revision ); } elseif ( ! is_array( $revision ) ) { return false; } if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) ) { return (int) $matches[1]; } return 0; } ``` | Used By | Description | | --- | --- | | [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. | | [\_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. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress rest_is_field_included( string $field, array $fields ): bool rest\_is\_field\_included( string $field, array $fields ): bool =============================================================== Given an array of fields to include in a response, some of which may be `nested.fields`, determine whether the provided field should be included in the response body. If a parent field is passed in, the presence of any nested field within that parent will cause the method to return `true`. For example "title" will return true if any of `title`, `title.raw` or `title.rendered` is provided. `$field` string Required A field to test for inclusion in the response body. `$fields` array Required An array of string fields supported by the endpoint. bool Whether to include the field or not. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/) ``` function rest_is_field_included( $field, $fields ) { if ( in_array( $field, $fields, true ) ) { return true; } foreach ( $fields as $accepted_field ) { // Check to see if $field is the parent of any item in $fields. // A field "parent" should be accepted if "parent.child" is accepted. if ( strpos( $accepted_field, "$field." ) === 0 ) { return true; } // Conversely, if "parent" is accepted, all "parent.child" fields // should also be accepted. if ( strpos( $field, "$accepted_field." ) === 0 ) { return true; } } return false; } ``` | Used By | Description | | --- | --- | | [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\_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\_Global\_Styles\_Controller::get\_theme\_item()](../classes/wp_rest_global_styles_controller/get_theme_item) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Returns the given theme global styles config. | | [WP\_REST\_Global\_Styles\_Controller::prepare\_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\_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\_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\_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\_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\_Block\_Directory\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_block_directory_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php | Parse block metadata for a block, and prepare it for an API response. | | [WP\_REST\_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\_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::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\_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\_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\_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\_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\_Controller::add\_additional\_fields\_to\_object()](../classes/wp_rest_controller/add_additional_fields_to_object) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Adds the values from additional fields to a data object. | | [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 | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
programming_docs
wordpress wp_print_head_scripts(): array wp\_print\_head\_scripts(): array ================================= Prints the script queue in the HTML head on the front end. Postpones the scripts that were queued for the footer. [wp\_print\_footer\_scripts()](wp_print_footer_scripts) is called in the footer to print these scripts. array File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/) ``` function wp_print_head_scripts() { global $wp_scripts; if ( ! did_action( 'wp_print_scripts' ) ) { /** This action is documented in wp-includes/functions.wp-scripts.php */ do_action( 'wp_print_scripts' ); } if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { return array(); // No need to run if nothing is queued. } return print_head_scripts(); } ``` [do\_action( 'wp\_print\_scripts' )](../hooks/wp_print_scripts) Fires before scripts in the $handles queue are printed. | Uses | Description | | --- | --- | | [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. | | [print\_head\_scripts()](print_head_scripts) wp-includes/script-loader.php | Prints the script queue in the HTML head on admin pages. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress settings_errors( string $setting = '', bool $sanitize = false, bool $hide_on_update = false ) settings\_errors( string $setting = '', bool $sanitize = false, bool $hide\_on\_update = false ) ================================================================================================ Displays settings errors registered by [add\_settings\_error()](add_settings_error) . Part of the Settings API. Outputs a div for each error retrieved by [get\_settings\_errors()](get_settings_errors) . This is called automatically after a settings page based on the Settings API is submitted. Errors should be added during the validation callback function for a setting defined in [register\_setting()](register_setting) . The $sanitize option is passed into [get\_settings\_errors()](get_settings_errors) and will re-run the setting sanitization on its current value. The $hide\_on\_update option will cause errors to only show when the settings page is first loaded. if the user has already saved new values it will be hidden to avoid repeating messages already shown in the default error reporting after submission. This is useful to show general errors like missing settings when the user arrives at the settings page. `$setting` string Optional slug title of a specific setting whose errors you want. Default: `''` `$sanitize` bool Optional Whether to re-sanitize the setting value before returning errors. Default: `false` `$hide_on_update` bool Optional If set to true errors will not be shown if the settings page has already been submitted. Default: `false` File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/) ``` function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) { if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) ) { return; } $settings_errors = get_settings_errors( $setting, $sanitize ); if ( empty( $settings_errors ) ) { return; } $output = ''; foreach ( $settings_errors as $key => $details ) { if ( 'updated' === $details['type'] ) { $details['type'] = 'success'; } if ( in_array( $details['type'], array( 'error', 'success', 'warning', 'info' ), true ) ) { $details['type'] = 'notice-' . $details['type']; } $css_id = sprintf( 'setting-error-%s', esc_attr( $details['code'] ) ); $css_class = sprintf( 'notice %s settings-error is-dismissible', esc_attr( $details['type'] ) ); $output .= "<div id='$css_id' class='$css_class'> \n"; $output .= "<p><strong>{$details['message']}</strong></p>"; $output .= "</div> \n"; } echo $output; } ``` | Uses | Description | | --- | --- | | [get\_settings\_errors()](get_settings_errors) wp-admin/includes/template.php | Fetches settings errors registered by [add\_settings\_error()](add_settings_error) . | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Legacy `error` and `updated` CSS classes are mapped to `notice-error` and `notice-success`. | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress wp_get_canonical_url( int|WP_Post $post = null ): string|false wp\_get\_canonical\_url( int|WP\_Post $post = null ): string|false ================================================================== Returns the canonical URL for a post. When the post is the same as the current requested page the function will handle the pagination arguments too. `$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or object. Default is global `$post`. Default: `null` string|false The canonical URL. False if the post does not exist or has not been published yet. File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/) ``` function wp_get_canonical_url( $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } if ( 'publish' !== $post->post_status ) { return false; } $canonical_url = get_permalink( $post ); // If a canonical is being generated for the current page, make sure it has pagination if needed. if ( get_queried_object_id() === $post->ID ) { $page = get_query_var( 'page', 0 ); if ( $page >= 2 ) { if ( ! get_option( 'permalink_structure' ) ) { $canonical_url = add_query_arg( 'page', $page, $canonical_url ); } else { $canonical_url = trailingslashit( $canonical_url ) . user_trailingslashit( $page, 'single_paged' ); } } $cpage = get_query_var( 'cpage', 0 ); if ( $cpage ) { $canonical_url = get_comments_pagenum_link( $cpage ); } } /** * Filters the canonical URL for a post. * * @since 4.6.0 * * @param string $canonical_url The post's canonical URL. * @param WP_Post $post Post object. */ return apply_filters( 'get_canonical_url', $canonical_url, $post ); } ``` [apply\_filters( 'get\_canonical\_url', string $canonical\_url, WP\_Post $post )](../hooks/get_canonical_url) Filters the canonical URL for a post. | Uses | Description | | --- | --- | | [get\_queried\_object\_id()](get_queried_object_id) wp-includes/query.php | Retrieves the ID of the currently queried object. | | [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. | | [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. | | [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. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Used By | Description | | --- | --- | | [rel\_canonical()](rel_canonical) wp-includes/link-template.php | Outputs rel=canonical for singular queries. | | Version | Description | | --- | --- | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. | wordpress wp_remote_head( string $url, array $args = array() ): array|WP_Error wp\_remote\_head( string $url, array $args = array() ): array|WP\_Error ======================================================================= Performs an HTTP request using the HEAD method and returns its response. * [wp\_remote\_request()](wp_remote_request) : For more information on the response array format. * [WP\_Http::request()](../classes/wp_http/request): For default arguments information. `$url` string Required URL to retrieve. `$args` array Optional Request arguments. Default: `array()` array|[WP\_Error](../classes/wp_error) The response or [WP\_Error](../classes/wp_error) on failure. File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/) ``` function wp_remote_head( $url, $args = array() ) { $http = _wp_http_get_object(); return $http->head( $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 | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress wp_heartbeat_settings( array $settings ): array wp\_heartbeat\_settings( array $settings ): array ================================================= Default settings for heartbeat. Outputs the nonce used in the heartbeat XHR. `$settings` array Required array Heartbeat settings. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function wp_heartbeat_settings( $settings ) { if ( ! is_admin() ) { $settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' ); } if ( is_user_logged_in() ) { $settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' ); } return $settings; } ``` | Uses | Description | | --- | --- | | [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. | | [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. | | [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. | | [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress comment_ID() comment\_ID() ============= Displays the comment ID of the current comment. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/) ``` function comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid echo get_comment_ID(); } ``` | Uses | Description | | --- | --- | | [get\_comment\_ID()](get_comment_id) wp-includes/comment-template.php | Retrieves the comment ID of the current comment. | | Used By | Description | | --- | --- | | [Walker\_Comment::comment()](../classes/walker_comment/comment) wp-includes/class-walker-comment.php | Outputs a single comment. | | [Walker\_Comment::html5\_comment()](../classes/walker_comment/html5_comment) wp-includes/class-walker-comment.php | Outputs a comment in the HTML5 format. | | [Walker\_Comment::ping()](../classes/walker_comment/ping) wp-includes/class-walker-comment.php | Outputs a pingback comment. | | Version | Description | | --- | --- | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress wp_kses_hair_parse( string $attr ): array|false wp\_kses\_hair\_parse( string $attr ): array|false ================================================== Builds an attribute list from string containing attributes. Does not modify input. May return "evil" output. In case of unexpected input, returns false instead of stripping things. Based on `wp_kses_hair()` but does not return a multi-dimensional array. `$attr` string Required Attribute list from HTML element to closing HTML element tag. array|false List of attributes found in $attr. Returns false on failure. File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/) ``` function wp_kses_hair_parse( $attr ) { if ( '' === $attr ) { return array(); } // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation $regex = '(?:' . '[_a-zA-Z][-_a-zA-Z0-9:.]*' // Attribute name. . '|' . '\[\[?[^\[\]]+\]\]?' // Shortcode in the name position implies unfiltered_html. . ')' . '(?:' // Attribute value. . '\s*=\s*' // All values begin with '='. . '(?:' . '"[^"]*"' // Double-quoted. . '|' . "'[^']*'" // Single-quoted. . '|' . '[^\s"\']+' // Non-quoted. . '(?:\s|$)' // Must have a space. . ')' . '|' . '(?:\s|$)' // If attribute has no value, space is required. . ')' . '\s*'; // Trailing space is optional except as mentioned above. // phpcs:enable // Although it is possible to reduce this procedure to a single regexp, // we must run that regexp twice to get exactly the expected result. $validation = "%^($regex)+$%"; $extraction = "%$regex%"; if ( 1 === preg_match( $validation, $attr ) ) { preg_match_all( $extraction, $attr, $attrarr ); return $attrarr[0]; } else { return false; } } ``` | Used By | Description | | --- | --- | | [wp\_kses\_attr\_parse()](wp_kses_attr_parse) wp-includes/kses.php | Finds all attributes of an HTML element. | | Version | Description | | --- | --- | | [4.2.3](https://developer.wordpress.org/reference/since/4.2.3/) | Introduced. | wordpress the_terms( int $post_id, string $taxonomy, string $before = '', string $sep = ', ', string $after = '' ): void|false the\_terms( int $post\_id, string $taxonomy, string $before = '', string $sep = ', ', string $after = '' ): void|false ====================================================================================================================== Displays the terms for a post in a list. `$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: `''` void|false Void on success, false on failure. File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/) ``` function the_terms( $post_id, $taxonomy, $before = '', $sep = ', ', $after = '' ) { $term_list = get_the_term_list( $post_id, $taxonomy, $before, $sep, $after ); if ( is_wp_error( $term_list ) ) { return false; } /** * Filters the list of terms to display. * * @since 2.9.0 * * @param string $term_list List of terms to display. * @param string $taxonomy The taxonomy name. * @param string $before String to use before the terms. * @param string $sep String to use between the terms. * @param string $after String to use after the terms. */ echo apply_filters( 'the_terms', $term_list, $taxonomy, $before, $sep, $after ); } ``` [apply\_filters( 'the\_terms', string $term\_list, string $taxonomy, string $before, string $sep, string $after )](../hooks/the_terms) Filters the list of terms to display. | 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. | | [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress get_plugin_page_hook( string $plugin_page, string $parent_page ): string|null get\_plugin\_page\_hook( string $plugin\_page, string $parent\_page ): string|null ================================================================================== Gets the hook attached to the administrative page of a plugin. `$plugin_page` string Required The slug name of the plugin page. `$parent_page` string Required The slug name for the parent menu (or the file name of a standard WordPress admin page). string|null Hook attached to the plugin page, null otherwise. File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/) ``` function get_plugin_page_hook( $plugin_page, $parent_page ) { $hook = get_plugin_page_hookname( $plugin_page, $parent_page ); if ( has_action( $hook ) ) { return $hook; } else { return null; } } ``` | Uses | Description | | --- | --- | | [get\_plugin\_page\_hookname()](get_plugin_page_hookname) wp-admin/includes/plugin.php | Gets the hook name for the administrative page of a plugin. | | [has\_action()](has_action) wp-includes/plugin.php | Checks if any action has been registered for a hook. | | Used By | Description | | --- | --- | | [get\_admin\_page\_title()](get_admin_page_title) wp-admin/includes/plugin.php | Gets the title of the current admin page. | | [\_wp\_menu\_output()](_wp_menu_output) wp-admin/menu-header.php | Display menu. | | Version | Description | | --- | --- | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress _wp_cron(): int|false \_wp\_cron(): int|false ======================= This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Run scheduled callbacks or spawn cron for all scheduled events. 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. int|false 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. File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/) ``` function _wp_cron() { // Prevent infinite loops caused by lack of wp-cron.php. if ( strpos( $_SERVER['REQUEST_URI'], '/wp-cron.php' ) !== false || ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) ) { return 0; } $crons = wp_get_ready_cron_jobs(); if ( empty( $crons ) ) { return 0; } $gmt_time = microtime( true ); $keys = array_keys( $crons ); if ( isset( $keys[0] ) && $keys[0] > $gmt_time ) { return 0; } $schedules = wp_get_schedules(); $results = array(); foreach ( $crons as $timestamp => $cronhooks ) { if ( $timestamp > $gmt_time ) { break; } foreach ( (array) $cronhooks as $hook => $args ) { if ( isset( $schedules[ $hook ]['callback'] ) && ! call_user_func( $schedules[ $hook ]['callback'] ) ) { continue; } $results[] = spawn_cron( $gmt_time ); break 2; } } if ( in_array( false, $results, true ) ) { return false; } return count( $results ); } ``` | Uses | Description | | --- | --- | | [wp\_get\_ready\_cron\_jobs()](wp_get_ready_cron_jobs) wp-includes/cron.php | Retrieve cron jobs ready to be run. | | [wp\_get\_schedules()](wp_get_schedules) wp-includes/cron.php | Retrieve supported event recurrence schedules. | | [spawn\_cron()](spawn_cron) wp-includes/cron.php | Sends a request to run cron through HTTP request that doesn’t halt page loading. | | Used By | Description | | --- | --- | | [wp\_cron()](wp_cron) wp-includes/cron.php | Register [\_wp\_cron()](_wp_cron) to run on the {@see ‘wp\_loaded’} action. | | Version | Description | | --- | --- | | [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
programming_docs
wordpress wp_media_upload_handler(): null|string wp\_media\_upload\_handler(): null|string ========================================= Handles the process of uploading media. null|string File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/) ``` function wp_media_upload_handler() { $errors = array(); $id = 0; if ( isset( $_POST['html-upload'] ) && ! empty( $_FILES ) ) { check_admin_referer( 'media-form' ); // Upload File button was clicked. $id = media_handle_upload( 'async-upload', $_REQUEST['post_id'] ); unset( $_FILES ); if ( is_wp_error( $id ) ) { $errors['upload_error'] = $id; $id = false; } } if ( ! empty( $_POST['insertonlybutton'] ) ) { $src = $_POST['src']; if ( ! empty( $src ) && ! strpos( $src, '://' ) ) { $src = "http://$src"; } if ( isset( $_POST['media_type'] ) && 'image' !== $_POST['media_type'] ) { $title = esc_html( wp_unslash( $_POST['title'] ) ); if ( empty( $title ) ) { $title = esc_html( wp_basename( $src ) ); } if ( $title && $src ) { $html = "<a href='" . esc_url( $src ) . "'>$title</a>"; } $type = 'file'; $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ); if ( $ext ) { $ext_type = wp_ext2type( $ext ); if ( 'audio' === $ext_type || 'video' === $ext_type ) { $type = $ext_type; } } /** * Filters the URL sent to the editor for a specific media type. * * The dynamic portion of the hook name, `$type`, refers to the type * of media being sent. * * Possible hook names include: * * - `audio_send_to_editor_url` * - `file_send_to_editor_url` * - `video_send_to_editor_url` * * @since 3.3.0 * * @param string $html HTML markup sent to the editor. * @param string $src Media source URL. * @param string $title Media title. */ $html = apply_filters( "{$type}_send_to_editor_url", $html, sanitize_url( $src ), $title ); } else { $align = ''; $alt = esc_attr( wp_unslash( $_POST['alt'] ) ); if ( isset( $_POST['align'] ) ) { $align = esc_attr( wp_unslash( $_POST['align'] ) ); $class = " class='align$align'"; } if ( ! empty( $src ) ) { $html = "<img src='" . esc_url( $src ) . "' alt='$alt'$class />"; } /** * Filters the image URL sent to the editor. * * @since 2.8.0 * * @param string $html HTML markup sent to the editor for an image. * @param string $src Image source URL. * @param string $alt Image alternate, or alt, text. * @param string $align The image alignment. Default 'alignnone'. Possible values include * 'alignleft', 'aligncenter', 'alignright', 'alignnone'. */ $html = apply_filters( 'image_send_to_editor_url', $html, sanitize_url( $src ), $alt, $align ); } return media_send_to_editor( $html ); } if ( isset( $_POST['save'] ) ) { $errors['upload_notice'] = __( 'Saved.' ); wp_enqueue_script( 'admin-gallery' ); return wp_iframe( 'media_upload_gallery_form', $errors ); } elseif ( ! empty( $_POST ) ) { $return = media_upload_form_handler(); if ( is_string( $return ) ) { return $return; } if ( is_array( $return ) ) { $errors = $return; } } if ( isset( $_GET['tab'] ) && 'type_url' === $_GET['tab'] ) { $type = 'image'; if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ), true ) ) { $type = $_GET['type']; } return wp_iframe( 'media_upload_type_url_form', $type, $errors, $id ); } return wp_iframe( 'media_upload_type_form', 'image', $errors, $id ); } ``` [apply\_filters( 'image\_send\_to\_editor\_url', string $html, string $src, string $alt, string $align )](../hooks/image_send_to_editor_url) Filters the image URL sent to the editor. [apply\_filters( "{$type}\_send\_to\_editor\_url", string $html, string $src, string $title )](../hooks/type_send_to_editor_url) Filters the URL sent to the editor for a specific media type. | Uses | Description | | --- | --- | | [media\_upload\_form\_handler()](media_upload_form_handler) wp-admin/includes/media.php | Handles form submissions for the legacy media uploader. | | [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\_send\_to\_editor()](media_send_to_editor) wp-admin/includes/media.php | Adds image HTML to editor. | | [wp\_iframe()](wp_iframe) wp-admin/includes/media.php | Outputs the iframe to display the media upload page. | | [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. | | [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. | | [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. | | [wp\_ext2type()](wp_ext2type) wp-includes/functions.php | Retrieves the file type based on the extension name. | | [\_\_()](__) 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\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). | | [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [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 | | --- | --- | | [media\_upload\_image()](media_upload_image) wp-admin/includes/deprecated.php | Handles uploading an image. | | [media\_upload\_audio()](media_upload_audio) wp-admin/includes/deprecated.php | Handles uploading an audio file. | | [media\_upload\_video()](media_upload_video) wp-admin/includes/deprecated.php | Handles uploading a video file. | | [media\_upload\_file()](media_upload_file) wp-admin/includes/deprecated.php | Handles uploading a generic file. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress get_object_taxonomies( string|string[]|WP_Post $object, string $output = 'names' ): string[]|WP_Taxonomy[] get\_object\_taxonomies( string|string[]|WP\_Post $object, string $output = 'names' ): string[]|WP\_Taxonomy[] ============================================================================================================== 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. Example: ``` $taxonomies = get_object_taxonomies( 'post' ); ``` This results in: ``` Array( 'category', 'post_tag' ) ``` `$object` string|string[]|[WP\_Post](../classes/wp_post) Required Name of the type of taxonomy object, or an object (row from posts) `$output` string Optional The type of output to return in the array. Accepts either `'names'` or `'objects'`. Default `'names'`. Default: `'names'` string[]|[WP\_Taxonomy](../classes/wp_taxonomy)[] The names or objects of all taxonomies of `$object_type`. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/) ``` function get_object_taxonomies( $object, $output = 'names' ) { global $wp_taxonomies; if ( is_object( $object ) ) { if ( 'attachment' === $object->post_type ) { return get_attachment_taxonomies( $object, $output ); } $object = $object->post_type; } $object = (array) $object; $taxonomies = array(); foreach ( (array) $wp_taxonomies as $tax_name => $tax_obj ) { if ( array_intersect( $object, (array) $tax_obj->object_type ) ) { if ( 'names' === $output ) { $taxonomies[] = $tax_name; } else { $taxonomies[ $tax_name ] = $tax_obj; } } } return $taxonomies; } ``` | Uses | Description | | --- | --- | | [get\_attachment\_taxonomies()](get_attachment_taxonomies) wp-includes/media.php | Retrieves taxonomies attached to given the attachment. | | Used By | Description | | --- | --- | | [WP\_REST\_Menu\_Items\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_menu_items_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares a single post output for response. | | [WP\_REST\_Menu\_Items\_Controller::get\_item\_schema()](../classes/wp_rest_menu_items_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Retrieves the term’s schema, conforming to JSON Schema. | | [WP\_REST\_Posts\_Controller::prepare\_tax\_query()](../classes/wp_rest_posts_controller/prepare_tax_query) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares the ‘tax\_query’ for a collection of posts. | | [WP\_REST\_Posts\_Controller::prepare\_taxonomy\_limit\_schema()](../classes/wp_rest_posts_controller/prepare_taxonomy_limit_schema) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares the collection schema for including and excluding items by terms. | | [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\_Posts\_Controller::get\_schema\_links()](../classes/wp_rest_posts_controller/get_schema_links) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves Link Description Objects that should be added to the Schema for the posts collection. | | [WP\_REST\_Posts\_Controller::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\_item\_schema()](../classes/wp_rest_posts_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves the post’s schema, conforming to JSON Schema. | | [WP\_REST\_Posts\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_posts_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares a single post output for response. | | [WP\_REST\_Posts\_Controller::handle\_terms()](../classes/wp_rest_posts_controller/handle_terms) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Updates the post’s terms from a REST request. | | [WP\_REST\_Posts\_Controller::check\_assign\_terms\_permission()](../classes/wp_rest_posts_controller/check_assign_terms_permission) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks whether current user can assign all terms sent with the current request. | | [WP\_REST\_Taxonomies\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_taxonomies_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Checks whether a given request has permission to read taxonomies. | | [WP\_REST\_Taxonomies\_Controller::get\_items()](../classes/wp_rest_taxonomies_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Retrieves all public taxonomies. | | [WP\_REST\_Post\_Types\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_post_types_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Prepares a post type object for serialization. | | [WP\_Post\_Type::unregister\_taxonomies()](../classes/wp_post_type/unregister_taxonomies) wp-includes/class-wp-post-type.php | Removes the post type from all taxonomies. | | [wp\_queue\_posts\_for\_term\_meta\_lazyload()](wp_queue_posts_for_term_meta_lazyload) wp-includes/post.php | Queues posts for lazy-loading of term meta. | | [wxr\_post\_taxonomy()](wxr_post_taxonomy) wp-admin/includes/export.php | Outputs list of taxonomy terms, in XML tag format, associated with a post. | | [get\_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. | | [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. | | [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\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. | | [update\_object\_term\_cache()](update_object_term_cache) wp-includes/taxonomy.php | Updates the cache for the given term object ID(s). | | [get\_the\_taxonomies()](get_the_taxonomies) wp-includes/taxonomy.php | Retrieves all taxonomies associated with a post. | | [get\_post\_taxonomies()](get_post_taxonomies) wp-includes/taxonomy.php | Retrieves all taxonomy names for the given post. | | [is\_object\_in\_taxonomy()](is_object_in_taxonomy) wp-includes/taxonomy.php | Determines if the given object type is associated with the given taxonomy. | | [clean\_object\_term\_cache()](clean_object_term_cache) wp-includes/taxonomy.php | Removes the taxonomy relationship to terms from the cache. | | [\_wp\_menu\_item\_classes\_by\_context()](_wp_menu_item_classes_by_context) wp-includes/nav-menu-template.php | Adds the class property classes for the current context, if applicable. | | [get\_attachment\_taxonomies()](get_attachment_taxonomies) wp-includes/media.php | Retrieves taxonomies attached to given the attachment. | | [\_update\_term\_count\_on\_transition\_post\_status()](_update_term_count_on_transition_post_status) wp-includes/post.php | Updates the custom taxonomies’ term counts when a post’s status is changed. | | [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. | | [wp\_publish\_post()](wp_publish_post) wp-includes/post.php | Publishes a post by transitioning the post status. | | [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. | | [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. | | [wp\_xmlrpc\_server::\_insert\_post()](../classes/wp_xmlrpc_server/_insert_post) wp-includes/class-wp-xmlrpc-server.php | Helper method for wp\_newPost() and wp\_editPost(), containing shared logic. | | [wp\_xmlrpc\_server::\_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. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress wp_get_attachment_image_sizes( int $attachment_id, string|int[] $size = 'medium', array $image_meta = null ): string|false wp\_get\_attachment\_image\_sizes( int $attachment\_id, string|int[] $size = 'medium', array $image\_meta = null ): string|false ================================================================================================================================ Retrieves the value for an image attachment’s ‘sizes’ attribute. * [wp\_calculate\_image\_sizes()](wp_calculate_image_sizes) `$attachment_id` int Required Image attachment ID. `$size` string|int[] Optional Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default `'medium'`. Default: `'medium'` `$image_meta` array Optional The image meta data as returned by '[wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) '. Default: `null` string|false A valid source size value for use in a `'sizes'` attribute or false. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/) ``` function wp_get_attachment_image_sizes( $attachment_id, $size = 'medium', $image_meta = null ) { $image = wp_get_attachment_image_src( $attachment_id, $size ); if ( ! $image ) { return false; } if ( ! is_array( $image_meta ) ) { $image_meta = wp_get_attachment_metadata( $attachment_id ); } $image_src = $image[0]; $size_array = array( absint( $image[1] ), absint( $image[2] ), ); return wp_calculate_image_sizes( $size_array, $image_src, $image_meta, $attachment_id ); } ``` | Uses | Description | | --- | --- | | [wp\_calculate\_image\_sizes()](wp_calculate_image_sizes) wp-includes/media.php | Creates a ‘sizes’ attribute value for an image. | | [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) wp-includes/media.php | Retrieves an image to represent an attachment. | | [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. | | [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. | | Version | Description | | --- | --- | | [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. | wordpress _get_random_header_data(): object \_get\_random\_header\_data(): 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. Gets random header image data from registered images in theme. object File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/) ``` function _get_random_header_data() { global $_wp_default_headers; static $_wp_random_header = null; if ( empty( $_wp_random_header ) ) { $header_image_mod = get_theme_mod( 'header_image', '' ); $headers = array(); if ( 'random-uploaded-image' === $header_image_mod ) { $headers = get_uploaded_header_images(); } elseif ( ! empty( $_wp_default_headers ) ) { if ( 'random-default-image' === $header_image_mod ) { $headers = $_wp_default_headers; } else { if ( current_theme_supports( 'custom-header', 'random-default' ) ) { $headers = $_wp_default_headers; } } } if ( empty( $headers ) ) { return new stdClass; } $_wp_random_header = (object) $headers[ array_rand( $headers ) ]; $_wp_random_header->url = sprintf( $_wp_random_header->url, get_template_directory_uri(), get_stylesheet_directory_uri() ); $_wp_random_header->thumbnail_url = sprintf( $_wp_random_header->thumbnail_url, get_template_directory_uri(), get_stylesheet_directory_uri() ); } return $_wp_random_header; } ``` | Uses | Description | | --- | --- | | [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. | | [get\_uploaded\_header\_images()](get_uploaded_header_images) wp-includes/theme.php | Gets the header images uploaded for the active theme. | | [get\_template\_directory\_uri()](get_template_directory_uri) wp-includes/theme.php | Retrieves template directory URI for the active theme. | | [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) wp-includes/theme.php | Retrieves stylesheet directory URI for the active theme. | | [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. | | Used By | Description | | --- | --- | | [get\_random\_header\_image()](get_random_header_image) wp-includes/theme.php | Gets random header image URL from registered images in theme. | | [get\_custom\_header()](get_custom_header) wp-includes/theme.php | Gets the header image data. | | Version | Description | | --- | --- | | [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
programming_docs
wordpress wp_list_cats( string|array $args = '' ): null|string|false wp\_list\_cats( string|array $args = '' ): null|string|false ============================================================ This function has been deprecated. Use [wp\_list\_categories()](wp_list_categories) instead. Lists categories. * [wp\_list\_categories()](wp_list_categories) `$args` string|array Optional Default: `''` null|string|false File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function wp_list_cats($args = '') { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); $parsed_args = wp_parse_args( $args ); // Map to new names. if ( isset($parsed_args['optionall']) && isset($parsed_args['all'])) $parsed_args['show_option_all'] = $parsed_args['all']; if ( isset($parsed_args['sort_column']) ) $parsed_args['orderby'] = $parsed_args['sort_column']; if ( isset($parsed_args['sort_order']) ) $parsed_args['order'] = $parsed_args['sort_order']; if ( isset($parsed_args['optiondates']) ) $parsed_args['show_last_update'] = $parsed_args['optiondates']; if ( isset($parsed_args['optioncount']) ) $parsed_args['show_count'] = $parsed_args['optioncount']; if ( isset($parsed_args['list']) ) $parsed_args['style'] = $parsed_args['list'] ? 'list' : 'break'; $parsed_args['title_li'] = ''; return wp_list_categories($parsed_args); } ``` | Uses | Description | | --- | --- | | [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | Used By | Description | | --- | --- | | [list\_cats()](list_cats) wp-includes/deprecated.php | Lists categories. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [wp\_list\_categories()](wp_list_categories) | | [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. | wordpress ms_allowed_http_request_hosts( bool $is_external, string $host ): bool ms\_allowed\_http\_request\_hosts( bool $is\_external, string $host ): bool =========================================================================== Adds any domain in a multisite installation for safe HTTP requests to the allowed list. Attached to the [‘http\_request\_host\_is\_external’](../hooks/http_request_host_is_external) filter. `$is_external` bool Required `$host` string Required bool File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/) ``` function ms_allowed_http_request_hosts( $is_external, $host ) { global $wpdb; static $queried = array(); if ( $is_external ) { return $is_external; } if ( get_network()->domain === $host ) { return true; } if ( isset( $queried[ $host ] ) ) { return $queried[ $host ]; } $queried[ $host ] = (bool) $wpdb->get_var( $wpdb->prepare( "SELECT domain FROM $wpdb->blogs WHERE domain = %s LIMIT 1", $host ) ); return $queried[ $host ]; } ``` | Uses | Description | | --- | --- | | [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network 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. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress wp_count_sites( int $network_id = null ): int[] wp\_count\_sites( int $network\_id = null ): int[] ================================================== Count number of sites grouped by site status. `$network_id` int Optional The network to get counts for. Default is the current network ID. Default: `null` int[] Numbers of sites grouped by site status. * `all`intThe total number of sites. * `public`intThe number of public sites. * `archived`intThe number of archived sites. * `mature`intThe number of mature sites. * `spam`intThe number of spam sites. * `deleted`intThe number of deleted sites. File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/) ``` function wp_count_sites( $network_id = null ) { if ( empty( $network_id ) ) { $network_id = get_current_network_id(); } $counts = array(); $args = array( 'network_id' => $network_id, 'number' => 1, 'fields' => 'ids', 'no_found_rows' => false, ); $q = new WP_Site_Query( $args ); $counts['all'] = $q->found_sites; $_args = $args; $statuses = array( 'public', 'archived', 'mature', 'spam', 'deleted' ); foreach ( $statuses as $status ) { $_args = $args; $_args[ $status ] = 1; $q = new WP_Site_Query( $_args ); $counts[ $status ] = $q->found_sites; } return $counts; } ``` | Uses | Description | | --- | --- | | [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. | | [WP\_Site\_Query::\_\_construct()](../classes/wp_site_query/__construct) wp-includes/class-wp-site-query.php | Sets up the site query, based on the query vars passed. | | 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. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. | wordpress post_exists( string $title, string $content = '', string $date = '', string $type = '', string $status = '' ): int post\_exists( string $title, string $content = '', string $date = '', string $type = '', string $status = '' ): int =================================================================================================================== Determines if a post exists based on title, content, date and type. `$title` string Required Post title. `$content` string Optional Post content. Default: `''` `$date` string Optional Post date. Default: `''` `$type` string Optional Post type. Default: `''` `$status` string Optional Post status. Default: `''` int Post ID if post exists, 0 otherwise. File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/) ``` function post_exists( $title, $content = '', $date = '', $type = '', $status = '' ) { global $wpdb; $post_title = wp_unslash( sanitize_post_field( 'post_title', $title, 0, 'db' ) ); $post_content = wp_unslash( sanitize_post_field( 'post_content', $content, 0, 'db' ) ); $post_date = wp_unslash( sanitize_post_field( 'post_date', $date, 0, 'db' ) ); $post_type = wp_unslash( sanitize_post_field( 'post_type', $type, 0, 'db' ) ); $post_status = wp_unslash( sanitize_post_field( 'post_status', $status, 0, 'db' ) ); $query = "SELECT ID FROM $wpdb->posts WHERE 1=1"; $args = array(); if ( ! empty( $date ) ) { $query .= ' AND post_date = %s'; $args[] = $post_date; } if ( ! empty( $title ) ) { $query .= ' AND post_title = %s'; $args[] = $post_title; } if ( ! empty( $content ) ) { $query .= ' AND post_content = %s'; $args[] = $post_content; } if ( ! empty( $type ) ) { $query .= ' AND post_type = %s'; $args[] = $post_type; } if ( ! empty( $status ) ) { $query .= ' AND post_status = %s'; $args[] = $post_status; } if ( ! empty( $args ) ) { return (int) $wpdb->get_var( $wpdb->prepare( $query, $args ) ); } return 0; } ``` | Uses | Description | | --- | --- | | [sanitize\_post\_field()](sanitize_post_field) wp-includes/post.php | Sanitizes a post field based on context. | | [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. | | [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. | | [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. | | Version | Description | | --- | --- | | [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Added the `$status` parameter. | | [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Added the `$type` parameter. | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress get_comment_meta( int $comment_id, string $key = '', bool $single = false ): mixed get\_comment\_meta( int $comment\_id, string $key = '', bool $single = false ): mixed ===================================================================================== Retrieves comment meta field for a comment. `$comment_id` int Required Comment ID. `$key` string Optional The meta key to retrieve. By default, returns data for all keys. Default: `''` `$single` bool Optional Whether to return a single value. This parameter has no effect if `$key` is not specified. Default: `false` mixed An array of values if `$single` is false. The value of meta data field if `$single` is true. False for an invalid `$comment_id` (non-numeric, zero, or negative value). An empty string if a valid but non-existing comment ID is passed. File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/) ``` function get_comment_meta( $comment_id, $key = '', $single = false ) { return get_metadata( 'comment', $comment_id, $key, $single ); } ``` | Uses | Description | | --- | --- | | [get\_metadata()](get_metadata) wp-includes/meta.php | Retrieves the value of a metadata field for the specified object type and ID. | | Used By | Description | | --- | --- | | [WP\_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\_unspam\_comment()](wp_unspam_comment) wp-includes/comment.php | Removes a comment from the Spam. | | [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 block_header_area() block\_header\_area() ===================== Prints the header block template part. File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/) ``` function block_header_area() { block_template_part( 'header' ); } ``` | Uses | Description | | --- | --- | | [block\_template\_part()](block_template_part) wp-includes/block-template-utils.php | Prints a block template part. | | Version | Description | | --- | --- | | [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. | wordpress delete_get_calendar_cache() delete\_get\_calendar\_cache() ============================== Purges the cached results of get\_calendar. * [get\_calendar()](get_calendar) File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function delete_get_calendar_cache() { wp_cache_delete( 'get_calendar', 'calendar' ); } ``` | Uses | Description | | --- | --- | | [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress _wp_privacy_account_request_confirmed( int $request_id ) \_wp\_privacy\_account\_request\_confirmed( int $request\_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. Updates log when privacy request is confirmed. `$request_id` int Required ID of the request. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function _wp_privacy_account_request_confirmed( $request_id ) { $request = wp_get_user_request( $request_id ); if ( ! $request ) { return; } if ( ! in_array( $request->status, array( 'request-pending', 'request-failed' ), true ) ) { return; } update_post_meta( $request_id, '_wp_user_request_confirmed_timestamp', time() ); wp_update_post( array( 'ID' => $request_id, 'post_status' => 'request-confirmed', ) ); } ``` | Uses | Description | | --- | --- | | [wp\_get\_user\_request()](wp_get_user_request) wp-includes/user.php | Returns the user request object for the specified request ID. | | [wp\_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. | | Version | Description | | --- | --- | | [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. | wordpress wp_kses_one_attr( string $string, string $element ): string wp\_kses\_one\_attr( string $string, string $element ): string ============================================================== Filters one HTML attribute and ensures its value is allowed. This function can escape data in some situations where `wp_kses()` must strip the whole attribute. `$string` string Required The `'whole'` attribute, including name and value. `$element` string Required The HTML element name to which the attribute belongs. string Filtered attribute. File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/) ``` function wp_kses_one_attr( $string, $element ) { $uris = wp_kses_uri_attributes(); $allowed_html = wp_kses_allowed_html( 'post' ); $allowed_protocols = wp_allowed_protocols(); $string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) ); // Preserve leading and trailing whitespace. $matches = array(); preg_match( '/^\s*/', $string, $matches ); $lead = $matches[0]; preg_match( '/\s*$/', $string, $matches ); $trail = $matches[0]; if ( empty( $trail ) ) { $string = substr( $string, strlen( $lead ) ); } else { $string = substr( $string, strlen( $lead ), -strlen( $trail ) ); } // Parse attribute name and value from input. $split = preg_split( '/\s*=\s*/', $string, 2 ); $name = $split[0]; if ( count( $split ) == 2 ) { $value = $split[1]; // Remove quotes surrounding $value. // Also guarantee correct quoting in $string for this one attribute. if ( '' === $value ) { $quote = ''; } else { $quote = $value[0]; } if ( '"' === $quote || "'" === $quote ) { if ( substr( $value, -1 ) != $quote ) { return ''; } $value = substr( $value, 1, -1 ); } else { $quote = '"'; } // Sanitize quotes, angle braces, and entities. $value = esc_attr( $value ); // Sanitize URI values. if ( in_array( strtolower( $name ), $uris, true ) ) { $value = wp_kses_bad_protocol( $value, $allowed_protocols ); } $string = "$name=$quote$value$quote"; $vless = 'n'; } else { $value = ''; $vless = 'y'; } // Sanitize attribute by name. wp_kses_attr_check( $name, $value, $string, $vless, $element, $allowed_html ); // Restore whitespace. return $lead . $string . $trail; } ``` | Uses | Description | | --- | --- | | [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\_kses\_attr\_check()](wp_kses_attr_check) wp-includes/kses.php | Determines whether an attribute is allowed. | | [wp\_kses\_no\_null()](wp_kses_no_null) wp-includes/kses.php | Removes any invalid control characters in a text string. | | [wp\_kses\_bad\_protocol()](wp_kses_bad_protocol) wp-includes/kses.php | Sanitizes a string and removed disallowed URL protocols. | | [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\_allowed\_protocols()](wp_allowed_protocols) wp-includes/functions.php | Retrieves a list of protocols to allow in HTML attributes. | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | Used By | Description | | --- | --- | | [do\_shortcodes\_in\_html\_tags()](do_shortcodes_in_html_tags) wp-includes/shortcodes.php | Searches only inside HTML elements for shortcodes and process them. | | Version | Description | | --- | --- | | [4.2.3](https://developer.wordpress.org/reference/since/4.2.3/) | Introduced. | wordpress is_main_network( int $network_id = null ): bool is\_main\_network( int $network\_id = null ): bool ================================================== Determines whether a network is the main network of the Multisite installation. `$network_id` int Optional Network ID to test. Defaults to current network. Default: `null` bool True if $network\_id is the main network, or if not running Multisite. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function is_main_network( $network_id = null ) { if ( ! is_multisite() ) { return true; } if ( null === $network_id ) { $network_id = get_current_network_id(); } $network_id = (int) $network_id; return ( get_main_network_id() === $network_id ); } ``` | Uses | Description | | --- | --- | | [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. | | [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. | | Used By | Description | | --- | --- | | [delete\_expired\_transients()](delete_expired_transients) wp-includes/option.php | Deletes all expired transients. | | [\_wp\_upload\_dir()](_wp_upload_dir) wp-includes/functions.php | A non-filtered, non-cached version of [wp\_upload\_dir()](wp_upload_dir) that doesn’t check the path. | | [wp\_should\_upgrade\_global\_tables()](wp_should_upgrade_global_tables) wp-admin/includes/upgrade.php | Determine if global tables should be upgraded. | | [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. | | Version | Description | | --- | --- | | [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. | wordpress get_posts_by_author_sql( string|string[] $post_type, bool $full = true, int $post_author = null, bool $public_only = false ): string get\_posts\_by\_author\_sql( string|string[] $post\_type, bool $full = true, int $post\_author = null, bool $public\_only = false ): string =========================================================================================================================================== Retrieves the post SQL based on capability, author, and type. * [get\_private\_posts\_cap\_sql()](get_private_posts_cap_sql) `$post_type` string|string[] Required Single post type or an array of post types. `$full` bool Optional Returns a full WHERE statement instead of just an `'andalso'` term. Default: `true` `$post_author` int Optional Query posts having a single author ID. Default: `null` `$public_only` bool Optional Only return public posts. Skips cap checks for $current\_user. Default: `false` string SQL WHERE code that can be added to a query. This function provides a standardized way to appropriately select on the post\_status of a post type. The function will return a piece of SQL code that can be added to a WHERE clause; this SQL is constructed to allow all published posts, and all private posts to which the user has access. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function get_posts_by_author_sql( $post_type, $full = true, $post_author = null, $public_only = false ) { global $wpdb; if ( is_array( $post_type ) ) { $post_types = $post_type; } else { $post_types = array( $post_type ); } $post_type_clauses = array(); foreach ( $post_types as $post_type ) { $post_type_obj = get_post_type_object( $post_type ); if ( ! $post_type_obj ) { continue; } /** * Filters the capability to read private posts for a custom post type * when generating SQL for getting posts by author. * * @since 2.2.0 * @deprecated 3.2.0 The hook transitioned from "somewhat useless" to "totally useless". * * @param string $cap Capability. */ $cap = apply_filters_deprecated( 'pub_priv_sql_capability', array( '' ), '3.2.0' ); if ( ! $cap ) { $cap = current_user_can( $post_type_obj->cap->read_private_posts ); } // Only need to check the cap if $public_only is false. $post_status_sql = "post_status = 'publish'"; if ( false === $public_only ) { if ( $cap ) { // Does the user have the capability to view private posts? Guess so. $post_status_sql .= " OR post_status = 'private'"; } elseif ( is_user_logged_in() ) { // Users can view their own private posts. $id = get_current_user_id(); if ( null === $post_author || ! $full ) { $post_status_sql .= " OR post_status = 'private' AND post_author = $id"; } elseif ( $id == (int) $post_author ) { $post_status_sql .= " OR post_status = 'private'"; } // Else none. } // Else none. } $post_type_clauses[] = "( post_type = '" . $post_type . "' AND ( $post_status_sql ) )"; } if ( empty( $post_type_clauses ) ) { return $full ? 'WHERE 1 = 0' : '1 = 0'; } $sql = '( ' . implode( ' OR ', $post_type_clauses ) . ' )'; if ( null !== $post_author ) { $sql .= $wpdb->prepare( ' AND post_author = %d', $post_author ); } if ( $full ) { $sql = 'WHERE ' . $sql; } return $sql; } ``` [apply\_filters\_deprecated( 'pub\_priv\_sql\_capability', string $cap )](../hooks/pub_priv_sql_capability) Filters the capability to read private posts for a custom post type when generating SQL for getting posts by author. | Uses | Description | | --- | --- | | [apply\_filters\_deprecated()](apply_filters_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated filter hook. | | [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. | | [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. | | [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. | | [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. | | [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. | | 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. | | [count\_user\_posts()](count_user_posts) wp-includes/user.php | Gets the number of posts a user has written. | | [count\_many\_users\_posts()](count_many_users_posts) wp-includes/user.php | Gets the number of posts written by a list of users. | | [get\_private\_posts\_cap\_sql()](get_private_posts_cap_sql) wp-includes/post.php | Retrieves the private post SQL based on capability. | | Version | Description | | --- | --- | | [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced the ability to pass an array of post types to `$post_type`. | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
programming_docs
wordpress seems_utf8( string $str ): bool seems\_utf8( string $str ): bool ================================ Checks to see if a string is utf8 encoded. NOTE: This function checks for 5-Byte sequences, UTF8 has Bytes Sequences with a maximum length of 4. `$str` string Required The string to be checked bool True if $str fits a UTF-8 model, false otherwise. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function seems_utf8( $str ) { mbstring_binary_safe_encoding(); $length = strlen( $str ); reset_mbstring_encoding(); for ( $i = 0; $i < $length; $i++ ) { $c = ord( $str[ $i ] ); if ( $c < 0x80 ) { $n = 0; // 0bbbbbbb } elseif ( ( $c & 0xE0 ) == 0xC0 ) { $n = 1; // 110bbbbb } elseif ( ( $c & 0xF0 ) == 0xE0 ) { $n = 2; // 1110bbbb } elseif ( ( $c & 0xF8 ) == 0xF0 ) { $n = 3; // 11110bbb } elseif ( ( $c & 0xFC ) == 0xF8 ) { $n = 4; // 111110bb } elseif ( ( $c & 0xFE ) == 0xFC ) { $n = 5; // 1111110b } else { return false; // Does not match any model. } for ( $j = 0; $j < $n; $j++ ) { // n bytes matching 10bbbbbb follow ? if ( ( ++$i == $length ) || ( ( ord( $str[ $i ] ) & 0xC0 ) != 0x80 ) ) { return false; } } } return true; } ``` | Uses | Description | | --- | --- | | [mbstring\_binary\_safe\_encoding()](mbstring_binary_safe_encoding) wp-includes/functions.php | Sets the mbstring internal encoding to a binary safe encoding when func\_overload is enabled. | | [reset\_mbstring\_encoding()](reset_mbstring_encoding) wp-includes/functions.php | Resets the mbstring internal encoding to a users previously set encoding. | | Used By | Description | | --- | --- | | [wxr\_cdata()](wxr_cdata) wp-admin/includes/export.php | Wraps given string in XML CDATA tag. | | [wp\_read\_image\_metadata()](wp_read_image_metadata) wp-admin/includes/image.php | Gets extended image metadata, exif or iptc as available. | | [sanitize\_file\_name()](sanitize_file_name) wp-includes/formatting.php | Sanitizes a filename, replacing whitespace with dashes. | | [sanitize\_title\_with\_dashes()](sanitize_title_with_dashes) wp-includes/formatting.php | Sanitizes a title, replacing whitespace and a few other characters with dashes. | | [remove\_accents()](remove_accents) wp-includes/formatting.php | Converts all accent characters to ASCII characters. | | Version | Description | | --- | --- | | [1.2.1](https://developer.wordpress.org/reference/since/1.2.1/) | Introduced. | wordpress _wp_nav_menu_meta_box_object( object $data_object = null ): object \_wp\_nav\_menu\_meta\_box\_object( object $data\_object = null ): 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. Adds custom arguments to some of the meta box object types. `$data_object` object Optional The post type or taxonomy meta-object. Default: `null` object The post type or taxonomy object. 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_meta_box_object( $data_object = null ) { if ( isset( $data_object->name ) ) { if ( 'page' === $data_object->name ) { $data_object->_default_query = array( 'orderby' => 'menu_order title', 'post_status' => 'publish', ); // Posts should show only published items. } elseif ( 'post' === $data_object->name ) { $data_object->_default_query = array( 'post_status' => 'publish', ); // Categories should be in reverse chronological order. } elseif ( 'category' === $data_object->name ) { $data_object->_default_query = array( 'orderby' => 'id', 'order' => 'DESC', ); // Custom post types should show only published items. } else { $data_object->_default_query = array( 'post_status' => 'publish', ); } } return $data_object; } ``` | Used By | Description | | --- | --- | | [\_wp\_ajax\_menu\_quick\_search()](_wp_ajax_menu_quick_search) wp-admin/includes/nav-menu.php | Prints the appropriate response to a menu quick search. | | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress get_dirsize( string $directory, int $max_execution_time = null ): int|false|null get\_dirsize( string $directory, int $max\_execution\_time = null ): int|false|null =================================================================================== Gets the size of a directory. A helper function that is used primarily to check whether a blog has exceeded its allowed upload space. `$directory` string Required Full path of a directory. `$max_execution_time` int Optional Maximum time to run before giving up. In seconds. The timeout is global and is measured from the moment WordPress started to load. Default: `null` int|false|null Size in bytes if a valid directory. False if not. Null if timeout. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function get_dirsize( $directory, $max_execution_time = null ) { // Exclude individual site directories from the total when checking the main site of a network, // as they are subdirectories and should not be counted. if ( is_multisite() && is_main_site() ) { $size = recurse_dirsize( $directory, $directory . '/sites', $max_execution_time ); } else { $size = recurse_dirsize( $directory, null, $max_execution_time ); } return $size; } ``` | Uses | Description | | --- | --- | | [recurse\_dirsize()](recurse_dirsize) wp-includes/functions.php | Gets the size of a directory recursively. | | [is\_main\_site()](is_main_site) wp-includes/functions.php | Determines whether a site is the main site of the current network. | | [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. | | Used By | Description | | --- | --- | | [get\_space\_used()](get_space_used) wp-includes/ms-functions.php | Returns the space used by the current site. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | MU (3.0.0) | | [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. | wordpress wp_admin_bar_sidebar_toggle( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_sidebar\_toggle( WP\_Admin\_Bar $wp\_admin\_bar ) ================================================================= Adds the sidebar toggle button. `$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_sidebar_toggle( $wp_admin_bar ) { if ( is_admin() ) { $wp_admin_bar->add_node( array( 'id' => 'menu-toggle', 'title' => '<span class="ab-icon" aria-hidden="true"></span><span class="screen-reader-text">' . __( 'Menu' ) . '</span>', 'href' => '#', ) ); } } ``` | Uses | Description | | --- | --- | | [WP\_Admin\_Bar::add\_node()](../classes/wp_admin_bar/add_node) wp-includes/class-wp-admin-bar.php | Adds a node to the menu. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. | | Version | Description | | --- | --- | | [3.8.0](https://developer.wordpress.org/reference/since/3.8.0/) | Introduced. | wordpress term_is_ancestor_of( int|object $term1, int|object $term2, string $taxonomy ): bool term\_is\_ancestor\_of( int|object $term1, int|object $term2, string $taxonomy ): bool ====================================================================================== Checks if a term is an ancestor of another term. You can use either an ID or the term object for both parameters. `$term1` int|object Required ID or object to check if this is the parent term. `$term2` int|object Required The child term. `$taxonomy` string Required Taxonomy name that $term1 and `$term2` belong to. bool Whether `$term2` is a child of `$term1`. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/) ``` function term_is_ancestor_of( $term1, $term2, $taxonomy ) { if ( ! isset( $term1->term_id ) ) { $term1 = get_term( $term1, $taxonomy ); } if ( ! isset( $term2->parent ) ) { $term2 = get_term( $term2, $taxonomy ); } if ( empty( $term1->term_id ) || empty( $term2->parent ) ) { return false; } if ( $term2->parent === $term1->term_id ) { return true; } return term_is_ancestor_of( $term1, get_term( $term2->parent, $taxonomy ), $taxonomy ); } ``` | Uses | Description | | --- | --- | | [term\_is\_ancestor\_of()](term_is_ancestor_of) wp-includes/taxonomy.php | Checks if a term is an ancestor of another term. | | [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. | | Used By | Description | | --- | --- | | [wp\_insert\_category()](wp_insert_category) wp-admin/includes/taxonomy.php | Updates an existing Category or creates a new Category. | | [cat\_is\_ancestor\_of()](cat_is_ancestor_of) wp-includes/category.php | Checks if a category is an ancestor of another category. | | [term\_is\_ancestor\_of()](term_is_ancestor_of) wp-includes/taxonomy.php | Checks if a term is an ancestor of another term. | | Version | Description | | --- | --- | | [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. | wordpress register_deactivation_hook( string $file, callable $callback ) register\_deactivation\_hook( string $file, callable $callback ) ================================================================ Sets the deactivation hook for a plugin. When a plugin is deactivated, the action ‘deactivate\_PLUGINNAME’ hook is called. In the name of this hook, PLUGINNAME is replaced with the name of the plugin, including the optional subdirectory. For example, when the plugin is located in wp-content/plugins/sampleplugin/sample.php, then the name of this hook will become ‘deactivate\_sampleplugin/sample.php’. When the plugin consists of only one file and is (as by default) located at wp-content/plugins/sample.php the name of this hook will be ‘deactivate\_sample.php’. `$file` string Required The filename of the plugin including the path. `$callback` callable Required The function hooked to the `'deactivate_PLUGIN'` action. File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/) ``` function register_deactivation_hook( $file, $callback ) { $file = plugin_basename( $file ); add_action( 'deactivate_' . $file, $callback ); } ``` | Uses | Description | | --- | --- | | [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. | | [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress get_the_author_description(): string get\_the\_author\_description(): string ======================================= This function has been deprecated. Use [get\_the\_author\_meta()](get_the_author_meta) instead. Retrieve the description of the author of the current post. * [get\_the\_author\_meta()](get_the_author_meta) string The author's description. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_the_author_description() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'description\')' ); return get_the_author_meta('description'); } ``` | Uses | Description | | --- | --- | | [get\_the\_author\_meta()](get_the_author_meta) wp-includes/author-template.php | Retrieves the requested data of the author of the current post. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use [get\_the\_author\_meta()](get_the_author_meta) | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress get_language_attributes( string $doctype = 'html' ): string get\_language\_attributes( string $doctype = 'html' ): string ============================================================= Gets the language attributes for the ‘html’ tag. Builds up a set of HTML attributes containing the text direction and language information for the page. `$doctype` string Optional The type of HTML document. Accepts `'xhtml'` or `'html'`. Default `'html'`. Default: `'html'` string A space-separated list of language attributes. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function get_language_attributes( $doctype = 'html' ) { $attributes = array(); if ( function_exists( 'is_rtl' ) && is_rtl() ) { $attributes[] = 'dir="rtl"'; } $lang = get_bloginfo( 'language' ); if ( $lang ) { if ( 'text/html' === get_option( 'html_type' ) || 'html' === $doctype ) { $attributes[] = 'lang="' . esc_attr( $lang ) . '"'; } if ( 'text/html' !== get_option( 'html_type' ) || 'xhtml' === $doctype ) { $attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"'; } } $output = implode( ' ', $attributes ); /** * Filters the language attributes for display in the 'html' tag. * * @since 2.5.0 * @since 4.3.0 Added the `$doctype` parameter. * * @param string $output A space-separated list of language attributes. * @param string $doctype The type of HTML document (xhtml|html). */ return apply_filters( 'language_attributes', $output, $doctype ); } ``` [apply\_filters( 'language\_attributes', string $output, string $doctype )](../hooks/language_attributes) Filters the language attributes for display in the ‘html’ tag. | Uses | Description | | --- | --- | | [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). | | [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. | | [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. | | Used By | Description | | --- | --- | | [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. | | [language\_attributes()](language_attributes) wp-includes/general-template.php | Displays the language attributes for the ‘html’ tag. | | [\_default\_wp\_die\_handler()](_default_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. | | Version | Description | | --- | --- | | [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. | wordpress get_header( string $name = null, array $args = array() ): void|false get\_header( string $name = null, array $args = array() ): void|false ===================================================================== Loads header template. Includes the header template for a theme or if a name is specified then a specialised header will be included. For the parameter, if the file is called "header-special.php" then specify "special". `$name` string Optional The name of the specialised header. Default: `null` `$args` array Optional Additional arguments passed to the header template. Default: `array()` void|false Void on success, false if the template does not exist. If the theme contains no header.php file then the header from the default theme `wp-includes/theme-compat/header.php` will be included. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function get_header( $name = null, $args = array() ) { /** * Fires before the header template file is loaded. * * @since 2.1.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 header file to use. Null for the default header. * @param array $args Additional arguments passed to the header template. */ do_action( 'get_header', $name, $args ); $templates = array(); $name = (string) $name; if ( '' !== $name ) { $templates[] = "header-{$name}.php"; } $templates[] = 'header.php'; if ( ! locate_template( $templates, true, true, $args ) ) { return false; } } ``` [do\_action( 'get\_header', string|null $name, array $args )](../hooks/get_header) Fires before the header 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 wp_should_upgrade_global_tables(): bool wp\_should\_upgrade\_global\_tables(): bool =========================================== Determine if global tables should be upgraded. This function performs a series of checks to ensure the environment allows for the safe upgrading of global WordPress database tables. It is necessary because global tables will commonly grow to millions of rows on large installations, and the ability to control their upgrade routines can be critical to the operation of large networks. In a future iteration, this function may use `wp_is_large_network()` to more- intelligently prevent global table upgrades. Until then, we make sure WordPress is on the main site of the main network, to avoid running queries more than once in multi-site or multi-network environments. bool Whether to run the upgrade routines on global tables. File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/) ``` function wp_should_upgrade_global_tables() { // Return false early if explicitly not upgrading. if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { return false; } // Assume global tables should be upgraded. $should_upgrade = true; // Set to false if not on main network (does not matter if not multi-network). if ( ! is_main_network() ) { $should_upgrade = false; } // Set to false if not on main site of current network (does not matter if not multi-site). if ( ! is_main_site() ) { $should_upgrade = false; } /** * Filters if upgrade routines should be run on global tables. * * @since 4.3.0 * * @param bool $should_upgrade Whether to run the upgrade routines on global tables. */ return apply_filters( 'wp_should_upgrade_global_tables', $should_upgrade ); } ``` [apply\_filters( 'wp\_should\_upgrade\_global\_tables', bool $should\_upgrade )](../hooks/wp_should_upgrade_global_tables) Filters if upgrade routines should be run on global tables. | Uses | Description | | --- | --- | | [is\_main\_network()](is_main_network) wp-includes/functions.php | Determines whether a network is the main network of the Multisite installation. | | [is\_main\_site()](is_main_site) wp-includes/functions.php | Determines whether a site is the main site of the current network. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [pre\_schema\_upgrade()](pre_schema_upgrade) wp-admin/includes/upgrade.php | Runs before the schema is upgraded. | | [upgrade\_network()](upgrade_network) wp-admin/includes/upgrade.php | Executes network-level upgrade routines. | | [dbDelta()](dbdelta) wp-admin/includes/upgrade.php | Modifies the database based on specified SQL statements. | | Version | Description | | --- | --- | | [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
programming_docs
wordpress download_url( string $url, int $timeout = 300, bool $signature_verification = false ): string|WP_Error download\_url( string $url, int $timeout = 300, bool $signature\_verification = false ): string|WP\_Error ========================================================================================================= Downloads a URL to a local temporary file using the WordPress HTTP API. Please note that the calling function must unlink() the file. `$url` string Required The URL of the file to download. `$timeout` int Optional The timeout for the request to download the file. Default 300 seconds. Default: `300` `$signature_verification` bool Optional Whether to perform Signature Verification. Default: `false` string|[WP\_Error](../classes/wp_error) Filename on success, [WP\_Error](../classes/wp_error) on failure. File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/) ``` function download_url( $url, $timeout = 300, $signature_verification = false ) { // WARNING: The file is not automatically deleted, the script must unlink() the file. if ( ! $url ) { return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.' ) ); } $url_path = parse_url( $url, PHP_URL_PATH ); $url_filename = ''; if ( is_string( $url_path ) && '' !== $url_path ) { $url_filename = basename( $url_path ); } $tmpfname = wp_tempnam( $url_filename ); if ( ! $tmpfname ) { return new WP_Error( 'http_no_file', __( 'Could not create temporary file.' ) ); } $response = wp_safe_remote_get( $url, array( 'timeout' => $timeout, 'stream' => true, 'filename' => $tmpfname, ) ); if ( is_wp_error( $response ) ) { unlink( $tmpfname ); return $response; } $response_code = wp_remote_retrieve_response_code( $response ); if ( 200 !== $response_code ) { $data = array( 'code' => $response_code, ); // Retrieve a sample of the response body for debugging purposes. $tmpf = fopen( $tmpfname, 'rb' ); if ( $tmpf ) { /** * Filters the maximum error response body size in `download_url()`. * * @since 5.1.0 * * @see download_url() * * @param int $size The maximum error response body size. Default 1 KB. */ $response_size = apply_filters( 'download_url_error_max_body_size', KB_IN_BYTES ); $data['body'] = fread( $tmpf, $response_size ); fclose( $tmpf ); } unlink( $tmpfname ); return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ), $data ); } $content_disposition = wp_remote_retrieve_header( $response, 'content-disposition' ); if ( $content_disposition ) { $content_disposition = strtolower( $content_disposition ); if ( 0 === strpos( $content_disposition, 'attachment; filename=' ) ) { $tmpfname_disposition = sanitize_file_name( substr( $content_disposition, 21 ) ); } else { $tmpfname_disposition = ''; } // Potential file name must be valid string. if ( $tmpfname_disposition && is_string( $tmpfname_disposition ) && ( 0 === validate_file( $tmpfname_disposition ) ) ) { $tmpfname_disposition = dirname( $tmpfname ) . '/' . $tmpfname_disposition; if ( rename( $tmpfname, $tmpfname_disposition ) ) { $tmpfname = $tmpfname_disposition; } if ( ( $tmpfname !== $tmpfname_disposition ) && file_exists( $tmpfname_disposition ) ) { unlink( $tmpfname_disposition ); } } } $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' ); if ( $content_md5 ) { $md5_check = verify_file_md5( $tmpfname, $content_md5 ); if ( is_wp_error( $md5_check ) ) { unlink( $tmpfname ); return $md5_check; } } // If the caller expects signature verification to occur, check to see if this URL supports it. if ( $signature_verification ) { /** * Filters the list of hosts which should have Signature Verification attempted on. * * @since 5.2.0 * * @param string[] $hostnames List of hostnames. */ $signed_hostnames = apply_filters( 'wp_signature_hosts', array( 'wordpress.org', 'downloads.wordpress.org', 's.w.org' ) ); $signature_verification = in_array( parse_url( $url, PHP_URL_HOST ), $signed_hostnames, true ); } // Perform signature valiation if supported. if ( $signature_verification ) { $signature = wp_remote_retrieve_header( $response, 'x-content-signature' ); if ( ! $signature ) { // Retrieve signatures from a file if the header wasn't included. // WordPress.org stores signatures at $package_url.sig. $signature_url = false; if ( is_string( $url_path ) && ( '.zip' === substr( $url_path, -4 ) || '.tar.gz' === substr( $url_path, -7 ) ) ) { $signature_url = str_replace( $url_path, $url_path . '.sig', $url ); } /** * Filters the URL where the signature for a file is located. * * @since 5.2.0 * * @param false|string $signature_url The URL where signatures can be found for a file, or false if none are known. * @param string $url The URL being verified. */ $signature_url = apply_filters( 'wp_signature_url', $signature_url, $url ); if ( $signature_url ) { $signature_request = wp_safe_remote_get( $signature_url, array( 'limit_response_size' => 10 * KB_IN_BYTES, // 10KB should be large enough for quite a few signatures. ) ); if ( ! is_wp_error( $signature_request ) && 200 === wp_remote_retrieve_response_code( $signature_request ) ) { $signature = explode( "\n", wp_remote_retrieve_body( $signature_request ) ); } } } // Perform the checks. $signature_verification = verify_file_signature( $tmpfname, $signature, $url_filename ); } if ( is_wp_error( $signature_verification ) ) { if ( /** * Filters whether Signature Verification failures should be allowed to soft fail. * * WARNING: This may be removed from a future release. * * @since 5.2.0 * * @param bool $signature_softfail If a softfail is allowed. * @param string $url The url being accessed. */ apply_filters( 'wp_signature_softfail', true, $url ) ) { $signature_verification->add_data( $tmpfname, 'softfail-filename' ); } else { // Hard-fail. unlink( $tmpfname ); } return $signature_verification; } return $tmpfname; } ``` [apply\_filters( 'download\_url\_error\_max\_body\_size', int $size )](../hooks/download_url_error_max_body_size) Filters the maximum error response body size in `download_url()`. [apply\_filters( 'wp\_signature\_hosts', string[] $hostnames )](../hooks/wp_signature_hosts) Filters the list of hosts which should have Signature Verification attempted on. [apply\_filters( 'wp\_signature\_softfail', bool $signature\_softfail, string $url )](../hooks/wp_signature_softfail) Filters whether Signature Verification failures should be allowed to soft fail. [apply\_filters( 'wp\_signature\_url', false|string $signature\_url, string $url )](../hooks/wp_signature_url) Filters the URL where the signature for a file is located. | Uses | Description | | --- | --- | | [verify\_file\_signature()](verify_file_signature) wp-admin/includes/file.php | Verifies the contents of a file against its ED25519 signature. | | [wp\_tempnam()](wp_tempnam) wp-admin/includes/file.php | Returns a filename of a temporary unique file. | | [verify\_file\_md5()](verify_file_md5) wp-admin/includes/file.php | Calculates and compares the MD5 of a file to its expected value. | | [sanitize\_file\_name()](sanitize_file_name) wp-includes/formatting.php | Sanitizes a filename, replacing whitespace with dashes. | | [validate\_file()](validate_file) wp-includes/functions.php | Validates a file name and path against an allowed set of rules. | | [wp\_safe\_remote\_get()](wp_safe_remote_get) wp-includes/http.php | Retrieve the raw response from a safe HTTP request using the GET method. | | [wp\_remote\_retrieve\_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\_header()](wp_remote_retrieve_header) wp-includes/http.php | Retrieve a single header by name 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. | | [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\_Upgrader::download\_package()](../classes/wp_upgrader/download_package) wp-admin/includes/class-wp-upgrader.php | Download a package. | | [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.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Support for Content-Disposition filename was added. | | [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Signature Verification with SoftFail was added. | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress __return_true(): true \_\_return\_true(): true ======================== Returns true. Useful for returning true to filters easily. * [\_\_return\_false()](__return_false) true True. ##### Usage: ``` <?php // This will add a filter on `example_filter` that returns true add_filter( 'example_filter', '__return_true' ); ?> ``` File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/) ``` function __return_true() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore return true; } ``` | Version | Description | | --- | --- | | [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. | wordpress install_dashboard() install\_dashboard() ==================== Displays the Featured tab of Add Plugins screen. File: `wp-admin/includes/plugin-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin-install.php/) ``` function install_dashboard() { display_plugins_table(); ?> <div class="plugins-popular-tags-wrapper"> <h2><?php _e( 'Popular tags' ); ?></h2> <p><?php _e( 'You may also browse based on the most popular tags in the Plugin Directory:' ); ?></p> <?php $api_tags = install_popular_tags(); echo '<p class="popular-tags">'; if ( is_wp_error( $api_tags ) ) { echo $api_tags->get_error_message(); } else { // Set up the tags in a way which can be interpreted by wp_generate_tag_cloud(). $tags = array(); foreach ( (array) $api_tags as $tag ) { $url = self_admin_url( 'plugin-install.php?tab=search&type=tag&s=' . urlencode( $tag['name'] ) ); $data = array( 'link' => esc_url( $url ), 'name' => $tag['name'], 'slug' => $tag['slug'], 'id' => sanitize_title_with_dashes( $tag['name'] ), 'count' => $tag['count'], ); $tags[ $tag['name'] ] = (object) $data; } echo wp_generate_tag_cloud( $tags, array( /* translators: %s: Number of plugins. */ 'single_text' => __( '%s plugin' ), /* translators: %s: Number of plugins. */ 'multiple_text' => __( '%s plugins' ), ) ); } echo '</p><br class="clear" /></div>'; } ``` | Uses | Description | | --- | --- | | [display\_plugins\_table()](display_plugins_table) wp-admin/includes/plugin-install.php | Displays plugin content based on plugin list. | | [install\_popular\_tags()](install_popular_tags) wp-admin/includes/plugin-install.php | Retrieves popular WordPress plugin tags. | | [wp\_generate\_tag\_cloud()](wp_generate_tag_cloud) wp-includes/category-template.php | Generates a tag cloud (heatmap) from provided data. | | [sanitize\_title\_with\_dashes()](sanitize_title_with_dashes) wp-includes/formatting.php | Sanitizes a title, replacing whitespace and a few other characters with dashes. | | [self\_admin\_url()](self_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for either the current site or the network depending on context. | | [\_e()](_e) wp-includes/l10n.php | Displays translated text. | | [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | [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 switch_to_blog( int $new_blog_id, bool $deprecated = null ): true switch\_to\_blog( int $new\_blog\_id, bool $deprecated = null ): true ===================================================================== Switch the current blog. This function is useful if you need to pull posts, or other information, from other blogs. You can switch back afterwards using [restore\_current\_blog()](restore_current_blog) . Things that aren’t switched: * plugins. See #14941 * [restore\_current\_blog()](restore_current_blog) `$new_blog_id` int Required The ID of the blog to switch to. Default: current blog. `$deprecated` bool Optional Not used. Default: `null` true Always returns true. File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/) ``` function switch_to_blog( $new_blog_id, $deprecated = null ) { global $wpdb; $prev_blog_id = get_current_blog_id(); if ( empty( $new_blog_id ) ) { $new_blog_id = $prev_blog_id; } $GLOBALS['_wp_switched_stack'][] = $prev_blog_id; /* * If we're switching to the same blog id that we're on, * set the right vars, do the associated actions, but skip * the extra unnecessary work */ if ( $new_blog_id == $prev_blog_id ) { /** * Fires when the blog is switched. * * @since MU (3.0.0) * @since 5.4.0 The `$context` parameter was added. * * @param int $new_blog_id New blog ID. * @param int $prev_blog_id Previous blog ID. * @param string $context Additional context. Accepts 'switch' when called from switch_to_blog() * or 'restore' when called from restore_current_blog(). */ do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'switch' ); $GLOBALS['switched'] = true; return true; } $wpdb->set_blog_id( $new_blog_id ); $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix(); $GLOBALS['blog_id'] = $new_blog_id; if ( function_exists( 'wp_cache_switch_to_blog' ) ) { wp_cache_switch_to_blog( $new_blog_id ); } else { global $wp_object_cache; if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) { $global_groups = $wp_object_cache->global_groups; } else { $global_groups = false; } wp_cache_init(); if ( function_exists( 'wp_cache_add_global_groups' ) ) { if ( is_array( $global_groups ) ) { wp_cache_add_global_groups( $global_groups ); } else { wp_cache_add_global_groups( array( 'blog-details', 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', 'networks', 'sites', 'site-details', 'site-options', 'site-transient', 'rss', 'users', 'useremail', 'userlogins', 'usermeta', 'user_meta', 'userslugs', ) ); } wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) ); } } /** This filter is documented in wp-includes/ms-blogs.php */ do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'switch' ); $GLOBALS['switched'] = true; return true; } ``` [do\_action( 'switch\_blog', int $new\_blog\_id, int $prev\_blog\_id, string $context )](../hooks/switch_blog) Fires when the blog is switched. | Uses | Description | | --- | --- | | [wp\_cache\_switch\_to\_blog()](wp_cache_switch_to_blog) wp-includes/cache.php | Switches the internal blog ID. | | [wp\_cache\_init()](wp_cache_init) wp-includes/cache.php | Sets up Object Cache Global and assigns it. | | [wp\_cache\_add\_global\_groups()](wp_cache_add_global_groups) wp-includes/cache.php | Adds a group or set of groups to the list of global groups. | | [wp\_cache\_add\_non\_persistent\_groups()](wp_cache_add_non_persistent_groups) wp-includes/cache.php | Adds a group or set of groups to the list of non-persistent groups. | | [wpdb::set\_blog\_id()](../classes/wpdb/set_blog_id) wp-includes/class-wpdb.php | Sets blog ID. | | [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. | | [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. | | Used By | Description | | --- | --- | | [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. | | [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\_Site::get\_details()](../classes/wp_site/get_details) wp-includes/class-wp-site.php | Retrieves the details for this site. | | [has\_custom\_logo()](has_custom_logo) wp-includes/general-template.php | Determines whether the site has a custom logo. | | [get\_custom\_logo()](get_custom_logo) wp-includes/general-template.php | Returns a custom logo, linked to home unless the theme supports removing the link on the home page. | | [wp\_get\_users\_with\_no\_role()](wp_get_users_with_no_role) wp-includes/user.php | Gets the user IDs of all users with no role on this site. | | [get\_site\_icon\_url()](get_site_icon_url) wp-includes/general-template.php | Returns the Site Icon URL. | | [WP\_MS\_Sites\_List\_Table::column\_blogname()](../classes/wp_ms_sites_list_table/column_blogname) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the site name column output. | | [confirm\_another\_blog\_signup()](confirm_another_blog_signup) wp-signup.php | Shows a message confirming that the new site has been created. | | [wpmu\_delete\_user()](wpmu_delete_user) wp-admin/includes/ms.php | Delete a user from the network and remove from all sites. | | [upload\_space\_setting()](upload_space_setting) wp-admin/includes/ms.php | Displays the site upload space quota setting form on the Edit Site Settings screen. | | [wpmu\_delete\_blog()](wpmu_delete_blog) wp-admin/includes/ms.php | Delete a site. | | [WP\_Users\_List\_Table::get\_views()](../classes/wp_users_list_table/get_views) wp-admin/includes/class-wp-users-list-table.php | Return an associative array listing all the views that can be used with this table. | | [WP\_Importer::set\_blog()](../classes/wp_importer/set_blog) wp-admin/includes/class-wp-importer.php | | | [WP\_User::get\_role\_caps()](../classes/wp_user/get_role_caps) wp-includes/class-wp-user.php | Retrieves all of the capabilities of the user’s roles, and merges them with individual user capabilities. | | [current\_user\_can\_for\_blog()](current_user_can_for_blog) wp-includes/capabilities.php | Returns whether the current user has the specified capability for a given site. | | [WP\_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\_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\_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. | | [count\_users()](count_users) wp-includes/user.php | Counts number of users who have each of the user roles. | | [newblog\_notify\_siteadmin()](newblog_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new site has been activated. | | [create\_empty\_blog()](create_empty_blog) wp-includes/ms-deprecated.php | Create an empty blog. | | [get\_blog\_post()](get_blog_post) wp-includes/ms-functions.php | Gets a blog post from any site on the network. | | [add\_user\_to\_blog()](add_user_to_blog) wp-includes/ms-functions.php | Adds a user to a blog, along with specifying the user’s role. | | [remove\_user\_from\_blog()](remove_user_from_blog) wp-includes/ms-functions.php | Removes a user from a blog. | | [get\_blog\_permalink()](get_blog_permalink) wp-includes/ms-functions.php | Gets the permalink for a post on another blog. | | [get\_blog\_option()](get_blog_option) wp-includes/ms-blogs.php | Retrieve option value for a given blog id based on name of option. | | [add\_blog\_option()](add_blog_option) wp-includes/ms-blogs.php | Add a new option for a given blog ID. | | [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. | | [update\_blog\_option()](update_blog_option) wp-includes/ms-blogs.php | Update an option for a particular blog. | | [get\_blog\_details()](get_blog_details) wp-includes/ms-blogs.php | Retrieve the details for a blog from the blogs table and blog options. | | [wp\_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 | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
programming_docs
wordpress wp_admin_css( string $file = 'wp-admin', bool $force_echo = false ) wp\_admin\_css( string $file = 'wp-admin', bool $force\_echo = false ) ====================================================================== Enqueues or directly prints a stylesheet link to the specified CSS file. "Intelligently" decides to enqueue or to print the CSS file. If the [‘wp\_print\_styles’](../hooks/wp_print_styles) action has *not* yet been called, the CSS file will be enqueued. If the [‘wp\_print\_styles’](../hooks/wp_print_styles) action has been called, the CSS link will be printed. Printing may be forced by passing true as the $force\_echo (second) parameter. For backward compatibility with WordPress 2.3 calling method: If the $file (first) parameter does not correspond to a registered CSS file, we assume $file is a file relative to wp-admin/ without its ".css" extension. A stylesheet link to that generated URL is printed. `$file` string Optional Style handle name or file name (without ".css" extension) relative to wp-admin/. Defaults to `'wp-admin'`. Default: `'wp-admin'` `$force_echo` bool Optional Force the stylesheet link to be printed rather than enqueued. Default: `false` File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function wp_admin_css( $file = 'wp-admin', $force_echo = false ) { // For backward compatibility. $handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file; if ( wp_styles()->query( $handle ) ) { if ( $force_echo || did_action( 'wp_print_styles' ) ) { // We already printed the style queue. Print this one immediately. wp_print_styles( $handle ); } else { // Add to style queue. wp_enqueue_style( $handle ); } return; } $stylesheet_link = sprintf( "<link rel='stylesheet' href='%s' type='text/css' />\n", esc_url( wp_admin_css_uri( $file ) ) ); /** * Filters the stylesheet link to the specified CSS file. * * If the site is set to display right-to-left, the RTL stylesheet link * will be used instead. * * @since 2.3.0 * @param string $stylesheet_link HTML link element for the stylesheet. * @param string $file Style handle name or filename (without ".css" extension) * relative to wp-admin/. Defaults to 'wp-admin'. */ echo apply_filters( 'wp_admin_css', $stylesheet_link, $file ); if ( function_exists( 'is_rtl' ) && is_rtl() ) { $rtl_stylesheet_link = sprintf( "<link rel='stylesheet' href='%s' type='text/css' />\n", esc_url( wp_admin_css_uri( "$file-rtl" ) ) ); /** This filter is documented in wp-includes/general-template.php */ echo apply_filters( 'wp_admin_css', $rtl_stylesheet_link, "$file-rtl" ); } } ``` [apply\_filters( 'wp\_admin\_css', string $stylesheet\_link, string $file )](../hooks/wp_admin_css) Filters the stylesheet link to the specified CSS file. | Uses | Description | | --- | --- | | [wp\_styles()](wp_styles) wp-includes/functions.wp-styles.php | Initialize $wp\_styles if it has not been set. | | [wp\_admin\_css\_uri()](wp_admin_css_uri) wp-includes/general-template.php | Displays the URL of a WordPress admin CSS file. | | [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). | | [wp\_print\_styles()](wp_print_styles) wp-includes/functions.wp-styles.php | Display styles that are in the $handles queue. | | [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. | | [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. | | [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 | | --- | --- | | [display\_header()](display_header) wp-admin/install.php | Display installation header. | | Version | Description | | --- | --- | | [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. | wordpress the_generator( string $type ) the\_generator( string $type ) ============================== Displays the generator XML or Comment for RSS, ATOM, etc. Returns the correct generator type for the requested output format. Allows for a plugin to filter generators overall the [‘the\_generator’](../hooks/the_generator) filter. `$type` string Required The type of generator to output - (`html|xhtml|atom|rss2|rdf|comment|export`). File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function the_generator( $type ) { /** * Filters the output of the XHTML generator tag for display. * * @since 2.5.0 * * @param string $generator_type The generator output. * @param string $type The type of generator to output. Accepts 'html', * 'xhtml', 'atom', 'rss2', 'rdf', 'comment', 'export'. */ echo apply_filters( 'the_generator', get_the_generator( $type ), $type ) . "\n"; } ``` [apply\_filters( 'the\_generator', string $generator\_type, string $type )](../hooks/the_generator) Filters the output of the XHTML generator tag for display. | Uses | Description | | --- | --- | | [get\_the\_generator()](get_the_generator) wp-includes/general-template.php | Creates the generator XML or Comment for RSS, ATOM, etc. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | Used By | Description | | --- | --- | | [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. | | [wp\_generator()](wp_generator) wp-includes/general-template.php | Displays the XHTML generator that is generated on the wp\_head hook. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress get_sample_permalink( int|WP_Post $post, string|null $title = null, string|null $name = null ): array get\_sample\_permalink( int|WP\_Post $post, string|null $title = null, string|null $name = null ): array ======================================================================================================== Returns a sample permalink based on the post name. `$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object. `$title` string|null Optional Title to override the post's current title when generating the post name. Default: `null` `$name` string|null Optional Name to override the post name. Default: `null` array Array containing the sample permalink with placeholder for the post name, and the post name. * stringThe permalink with placeholder for the post name. * `1`stringThe post name. File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/) ``` function get_sample_permalink( $post, $title = null, $name = null ) { $post = get_post( $post ); if ( ! $post ) { return array( '', '' ); } $ptype = get_post_type_object( $post->post_type ); $original_status = $post->post_status; $original_date = $post->post_date; $original_name = $post->post_name; $original_filter = $post->filter; // Hack: get_permalink() would return plain permalink for drafts, so we will fake that our post is published. if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ), true ) ) { $post->post_status = 'publish'; $post->post_name = sanitize_title( $post->post_name ? $post->post_name : $post->post_title, $post->ID ); } // If the user wants to set a new name -- override the current one. // Note: if empty name is supplied -- use the title instead, see #6072. if ( ! is_null( $name ) ) { $post->post_name = sanitize_title( $name ? $name : $title, $post->ID ); } $post->post_name = wp_unique_post_slug( $post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent ); $post->filter = 'sample'; $permalink = get_permalink( $post, true ); // Replace custom post_type token with generic pagename token for ease of use. $permalink = str_replace( "%$post->post_type%", '%pagename%', $permalink ); // Handle page hierarchy. if ( $ptype->hierarchical ) { $uri = get_page_uri( $post ); if ( $uri ) { $uri = untrailingslashit( $uri ); $uri = strrev( stristr( strrev( $uri ), '/' ) ); $uri = untrailingslashit( $uri ); } /** This filter is documented in wp-admin/edit-tag-form.php */ $uri = apply_filters( 'editable_slug', $uri, $post ); if ( ! empty( $uri ) ) { $uri .= '/'; } $permalink = str_replace( '%pagename%', "{$uri}%pagename%", $permalink ); } /** This filter is documented in wp-admin/edit-tag-form.php */ $permalink = array( $permalink, apply_filters( 'editable_slug', $post->post_name, $post ) ); $post->post_status = $original_status; $post->post_date = $original_date; $post->post_name = $original_name; $post->filter = $original_filter; /** * Filters the sample permalink. * * @since 4.4.0 * * @param array $permalink { * Array containing the sample permalink with placeholder for the post name, and the post name. * * @type string $0 The permalink with placeholder for the post name. * @type string $1 The post name. * } * @param int $post_id Post ID. * @param string $title Post title. * @param string $name Post name (slug). * @param WP_Post $post Post object. */ return apply_filters( 'get_sample_permalink', $permalink, $post->ID, $title, $name, $post ); } ``` [apply\_filters( 'editable\_slug', string $slug, WP\_Term|WP\_Post $tag )](../hooks/editable_slug) Filters the editable slug for a post or term. [apply\_filters( 'get\_sample\_permalink', array $permalink, int $post\_id, string $title, string $name, WP\_Post $post )](../hooks/get_sample_permalink) Filters the sample permalink. | Uses | Description | | --- | --- | | [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. | | [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. | | [get\_page\_uri()](get_page_uri) wp-includes/post.php | Builds the URI path for a page. | | [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. | | [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. | | [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. | | Used By | Description | | --- | --- | | [WP\_REST\_Posts\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_posts_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares a single post output for response. | | [get\_sample\_permalink\_html()](get_sample_permalink_html) wp-admin/includes/post.php | Returns the HTML of the sample permalink slug editor. | | Version | Description | | --- | --- | | [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. | wordpress wp_cache_set_comments_last_changed() wp\_cache\_set\_comments\_last\_changed() ========================================= Sets the last changed time for the ‘comment’ cache group. File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/) ``` function wp_cache_set_comments_last_changed() { wp_cache_set( 'last_changed', microtime(), 'comment' ); } ``` | Uses | Description | | --- | --- | | [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. | | Version | Description | | --- | --- | | [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. | wordpress the_category_head( string $before = '', string $after = '' ) the\_category\_head( string $before = '', string $after = '' ) ============================================================== This function has been deprecated. Use [get\_the\_category\_by\_ID()](get_the_category_by_id) instead. Prints a category with optional text before and after. * [get\_the\_category\_by\_ID()](get_the_category_by_id) `$before` string Optional Text to display before the category. Default: `''` `$after` string Optional Text to display after the category. Default: `''` File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function the_category_head( $before = '', $after = '' ) { global $currentcat, $previouscat; _deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' ); // Grab the first cat in the list. $categories = get_the_category(); $currentcat = $categories[0]->category_id; if ( $currentcat != $previouscat ) { echo $before; echo get_the_category_by_ID($currentcat); echo $after; $previouscat = $currentcat; } } ``` | Uses | Description | | --- | --- | | [get\_the\_category()](get_the_category) wp-includes/category-template.php | Retrieves post categories. | | [get\_the\_category\_by\_ID()](get_the_category_by_id) wp-includes/category-template.php | Retrieves category name based on category ID. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. | wordpress rsd_link() rsd\_link() =========== Displays the link to the Really Simple Discovery service endpoint. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function rsd_link() { printf( '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="%s" />' . "\n", esc_url( site_url( 'xmlrpc.php?rsd', 'rpc' ) ) ); } ``` | 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. | | [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. | wordpress filter_block_kses( WP_Block_Parser_Block $block, array[]|string $allowed_html, string[] $allowed_protocols = array() ): array filter\_block\_kses( WP\_Block\_Parser\_Block $block, array[]|string $allowed\_html, string[] $allowed\_protocols = array() ): array ==================================================================================================================================== Filters and sanitizes a parsed block to remove non-allowable HTML from block attribute values. `$block` WP\_Block\_Parser\_Block Required The parsed block object. `$allowed_html` array[]|string Required An array of allowed HTML elements and attributes, or a context name such as `'post'`. See [wp\_kses\_allowed\_html()](wp_kses_allowed_html) for the list of accepted context names. `$allowed_protocols` string[] Optional Array of allowed URL protocols. Defaults to the result of [wp\_allowed\_protocols()](wp_allowed_protocols) . Default: `array()` array The filtered and sanitized block object result. File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/) ``` function filter_block_kses( $block, $allowed_html, $allowed_protocols = array() ) { $block['attrs'] = filter_block_kses_value( $block['attrs'], $allowed_html, $allowed_protocols ); if ( is_array( $block['innerBlocks'] ) ) { foreach ( $block['innerBlocks'] as $i => $inner_block ) { $block['innerBlocks'][ $i ] = filter_block_kses( $inner_block, $allowed_html, $allowed_protocols ); } } return $block; } ``` | Uses | Description | | --- | --- | | [filter\_block\_kses\_value()](filter_block_kses_value) wp-includes/blocks.php | Filters and sanitizes a parsed block attribute value to remove non-allowable HTML. | | [filter\_block\_kses()](filter_block_kses) wp-includes/blocks.php | Filters and sanitizes a parsed block to remove non-allowable HTML from block attribute values. | | Used By | Description | | --- | --- | | [filter\_block\_content()](filter_block_content) wp-includes/blocks.php | Filters and sanitizes block content to remove non-allowable HTML from parsed block attribute values. | | [filter\_block\_kses()](filter_block_kses) wp-includes/blocks.php | Filters and sanitizes a parsed block to remove non-allowable HTML from block attribute values. | | Version | Description | | --- | --- | | [5.3.1](https://developer.wordpress.org/reference/since/5.3.1/) | Introduced. | wordpress signup_nonce_fields() signup\_nonce\_fields() ======================= Adds a nonce field to the signup page. File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/) ``` function signup_nonce_fields() { $id = mt_rand(); echo "<input type='hidden' name='signup_form_id' value='{$id}' />"; wp_nonce_field( 'signup_form_' . $id, '_signup_form', false ); } ``` | Uses | Description | | --- | --- | | [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress get_theme( string $theme ): array|null get\_theme( string $theme ): array|null ======================================= This function has been deprecated. Use [wp\_get\_theme()](wp_get_theme) instead. Retrieve theme data. * [wp\_get\_theme()](wp_get_theme) `$theme` string Required Theme name. array|null Null, if theme name does not exist. Theme data, if exists. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function get_theme( $theme ) { _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' ); $themes = get_themes(); if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) return $themes[ $theme ]; return null; } ``` | Uses | Description | | --- | --- | | [get\_themes()](get_themes) wp-includes/deprecated.php | Retrieve list of themes with theme data in theme directory. | | [\_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\_theme()](wp_get_theme) | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress wp_is_home_url_using_https(): bool wp\_is\_home\_url\_using\_https(): bool ======================================= Checks whether the current site URL is using HTTPS. * [home\_url()](home_url) bool True if using HTTPS, false otherwise. File: `wp-includes/https-detection.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/https-detection.php/) ``` function wp_is_home_url_using_https() { return 'https' === wp_parse_url( home_url(), PHP_URL_SCHEME ); } ``` | 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. | | [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 | | --- | --- | | [wp\_is\_using\_https()](wp_is_using_https) wp-includes/https-detection.php | Checks whether the website is using HTTPS. | | Version | Description | | --- | --- | | [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
programming_docs
wordpress wp_get_script_polyfill( WP_Scripts $scripts, string[] $tests ): string wp\_get\_script\_polyfill( WP\_Scripts $scripts, string[] $tests ): string ========================================================================== 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. `$scripts` [WP\_Scripts](../classes/wp_scripts) Required [WP\_Scripts](../classes/wp_scripts) object. `$tests` string[] Required Features to detect. string Conditional polyfill inline script. File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/) ``` function wp_get_script_polyfill( $scripts, $tests ) { $polyfill = ''; foreach ( $tests as $test => $handle ) { if ( ! array_key_exists( $handle, $scripts->registered ) ) { continue; } $src = $scripts->registered[ $handle ]->src; $ver = $scripts->registered[ $handle ]->ver; if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $scripts->content_url && 0 === strpos( $src, $scripts->content_url ) ) ) { $src = $scripts->base_url . $src; } if ( ! empty( $ver ) ) { $src = add_query_arg( 'ver', $ver, $src ); } /** This filter is documented in wp-includes/class-wp-scripts.php */ $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) ); if ( ! $src ) { continue; } $polyfill .= ( // Test presence of feature... '( ' . $test . ' ) || ' . /* * ...appending polyfill on any failures. Cautious viewers may balk * at the `document.write`. Its caveat of synchronous mid-stream * blocking write is exactly the behavior we need though. */ 'document.write( \'<script src="' . $src . '"></scr\' + \'ipt>\' );' ); } return $polyfill; } ``` [apply\_filters( 'script\_loader\_src', string $src, string $handle )](../hooks/script_loader_src) Filters the script loader source. | Uses | Description | | --- | --- | | [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 | | --- | --- | | [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. | wordpress wp_image_editor_supports( string|array $args = array() ): bool wp\_image\_editor\_supports( string|array $args = array() ): bool ================================================================= Tests whether there is an editor that supports a given mime type or methods. `$args` string|array Optional Array of arguments to retrieve the image editor supports. Default: `array()` bool True if an eligible editor is found; false otherwise. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/) ``` function wp_image_editor_supports( $args = array() ) { return (bool) _wp_image_editor_choose( $args ); } ``` | Used By | Description | | --- | --- | | [wp\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. | | [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor | | [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. | | [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. | | [wp\_plupload\_default\_settings()](wp_plupload_default_settings) wp-includes/media.php | Prints default Plupload arguments. | | Version | Description | | --- | --- | | [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. | wordpress wxr_cdata( string $str ): string wxr\_cdata( string $str ): string ================================= Wraps given string in XML CDATA tag. `$str` string Required String to wrap in XML CDATA tag. string File: `wp-admin/includes/export.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/export.php/) ``` function wxr_cdata( $str ) { if ( ! seems_utf8( $str ) ) { $str = utf8_encode( $str ); } // $str = ent2ncr(esc_html($str)); $str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>'; return $str; } ``` | Uses | Description | | --- | --- | | [seems\_utf8()](seems_utf8) wp-includes/formatting.php | Checks to see if a string is utf8 encoded. | | Used By | Description | | --- | --- | | [wxr\_term\_meta()](wxr_term_meta) wp-admin/includes/export.php | Outputs term meta XML tags for a given term object. | | [wxr\_post\_taxonomy()](wxr_post_taxonomy) wp-admin/includes/export.php | Outputs list of taxonomy terms, in XML tag format, associated with a post. | | [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. | | [wxr\_cat\_name()](wxr_cat_name) wp-admin/includes/export.php | Outputs a cat\_name XML tag from a given category object. | | [wxr\_category\_description()](wxr_category_description) wp-admin/includes/export.php | Outputs a category\_description XML tag from a given category object. | | [wxr\_tag\_name()](wxr_tag_name) wp-admin/includes/export.php | Outputs a tag\_name XML tag from a given tag object. | | [wxr\_tag\_description()](wxr_tag_description) wp-admin/includes/export.php | Outputs a tag\_description XML tag from a given tag object. | | [wxr\_term\_name()](wxr_term_name) wp-admin/includes/export.php | Outputs a term\_name XML tag from a given term object. | | [wxr\_term\_description()](wxr_term_description) wp-admin/includes/export.php | Outputs a term\_description XML tag from a given term object. | | [wxr\_authors\_list()](wxr_authors_list) wp-admin/includes/export.php | Outputs list of authors with posts. | | [wxr\_nav\_menu\_terms()](wxr_nav_menu_terms) wp-admin/includes/export.php | Outputs all navigation menu terms. | | Version | Description | | --- | --- | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress theme_update_available( WP_Theme $theme ) theme\_update\_available( WP\_Theme $theme ) ============================================ Check if there is an update for a theme available. Will display link, if there is an update available. * [get\_theme\_update\_available()](get_theme_update_available) `$theme` [WP\_Theme](../classes/wp_theme) Required Theme data object. File: `wp-admin/includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme.php/) ``` function theme_update_available( $theme ) { echo get_theme_update_available( $theme ); } ``` | Uses | Description | | --- | --- | | [get\_theme\_update\_available()](get_theme_update_available) wp-admin/includes/theme.php | Retrieves the update link if there is a theme update available. | | Used By | Description | | --- | --- | | [WP\_Themes\_List\_Table::display\_rows()](../classes/wp_themes_list_table/display_rows) wp-admin/includes/class-wp-themes-list-table.php | | | Version | Description | | --- | --- | | [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. | wordpress _ajax_wp_die_handler( string $message, string $title = '', string|array $args = array() ) \_ajax\_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 Ajax response with an error message. This is the handler for [wp\_die()](wp_die) when processing Ajax requests. `$message` string Required Error message. `$title` string Optional Error title (unused). 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 _ajax_wp_die_handler( $message, $title = '', $args = array() ) { // Set default 'response' to 200 for Ajax requests. $args = wp_parse_args( $args, array( 'response' => 200 ) ); list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); if ( ! headers_sent() ) { // This is intentional. For backward-compatibility, support passing null here. if ( null !== $args['response'] ) { status_header( $parsed_args['response'] ); } nocache_headers(); } if ( is_scalar( $message ) ) { $message = (string) $message; } else { $message = '0'; } if ( $parsed_args['exit'] ) { die( $message ); } echo $message; } ``` | Uses | Description | | --- | --- | | [\_wp\_die\_process\_input()](_wp_die_process_input) wp-includes/functions.php | Processes arguments passed to [wp\_die()](wp_die) consistently for its handlers. | | [status\_header()](status_header) wp-includes/functions.php | Sets HTTP status header. | | [nocache\_headers()](nocache_headers) wp-includes/functions.php | Sets the headers to prevent caching for the different browsers. | | [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. | | Version | Description | | --- | --- | | [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. | wordpress wp_is_ini_value_changeable( string $setting ): bool wp\_is\_ini\_value\_changeable( string $setting ): bool ======================================================= Determines whether a PHP ini value is changeable at runtime. `$setting` string Required The name of the ini setting to check. bool True if the value is changeable at runtime. False otherwise. File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/) ``` function wp_is_ini_value_changeable( $setting ) { static $ini_all; if ( ! isset( $ini_all ) ) { $ini_all = false; // Sometimes `ini_get_all()` is disabled via the `disable_functions` option for "security purposes". if ( function_exists( 'ini_get_all' ) ) { $ini_all = ini_get_all(); } } // Bit operator to workaround https://bugs.php.net/bug.php?id=44936 which changes access level to 63 in PHP 5.2.6 - 5.2.17. if ( isset( $ini_all[ $setting ]['access'] ) && ( INI_ALL === ( $ini_all[ $setting ]['access'] & 7 ) || INI_USER === ( $ini_all[ $setting ]['access'] & 7 ) ) ) { return true; } // If we were unable to retrieve the details, fail gracefully to assume it's changeable. if ( ! is_array( $ini_all ) ) { return true; } return false; } ``` | Used By | Description | | --- | --- | | [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. | | Version | Description | | --- | --- | | [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. | wordpress the_author_meta( string $field = '', int|false $user_id = false ) the\_author\_meta( string $field = '', int|false $user\_id = false ) ==================================================================== Outputs the field from the user’s DB object. Defaults to current post’s author. * [get\_the\_author\_meta()](get_the_author_meta) `$field` string Optional Selects the field of the users record. See [get\_the\_author\_meta()](get_the_author_meta) for the list of possible fields. More Arguments from get\_the\_author\_meta( ... $field ) The user field to retrieve. Default: `''` `$user_id` int|false Optional User ID. Default: `false` This template tag displays a desired meta data field for a user. Only one field is returned at a time, you need to specify which you want. If this tag is used within The Loop, the user ID value need not be specified, and the displayed data is that of the current post author. A user ID can be specified if this tag is used outside The Loop. If the meta field does not exist, nothing is printed. **NOTE:** Use `get_the_author_meta()` if you need to return (and do something with) the field, rather than just display it. For parameter $userID, if the user ID fields is used, then this function display the specific field for this user ID. File: `wp-includes/author-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/author-template.php/) ``` function the_author_meta( $field = '', $user_id = false ) { $author_meta = get_the_author_meta( $field, $user_id ); /** * Filters the value of the requested user metadata. * * The filter name is dynamic and depends on the $field parameter of the function. * * @since 2.8.0 * * @param string $author_meta The value of the metadata. * @param int|false $user_id The user ID. */ echo apply_filters( "the_author_{$field}", $author_meta, $user_id ); } ``` [apply\_filters( "the\_author\_{$field}", string $author\_meta, int|false $user\_id )](../hooks/the_author_field) Filters the value of the requested user metadata. | 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. | | [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\_icq()](the_author_icq) wp-includes/deprecated.php | Display the ICQ number of the author of the current post. | | [the\_author\_yim()](the_author_yim) wp-includes/deprecated.php | Display the Yahoo! IM name of the author of the current post. | | [the\_author\_msn()](the_author_msn) wp-includes/deprecated.php | Display the MSN address of the author of the current post. | | [the\_author\_aim()](the_author_aim) wp-includes/deprecated.php | Display the AIM address of the author of the current post. | | [the\_author\_url()](the_author_url) wp-includes/deprecated.php | Display the URL to the home page of the author of the current post. | | [the\_author\_ID()](the_author_id) wp-includes/deprecated.php | Display the ID of the author of the current post. | | [the\_author\_description()](the_author_description) wp-includes/deprecated.php | Display the description of the author of the current post. | | [the\_author\_login()](the_author_login) wp-includes/deprecated.php | Display the login name of the author of the current post. | | [the\_author\_firstname()](the_author_firstname) wp-includes/deprecated.php | Display the first name of the author of the current post. | | [the\_author\_lastname()](the_author_lastname) wp-includes/deprecated.php | Display the last name of the author of the current post. | | [the\_author\_nickname()](the_author_nickname) wp-includes/deprecated.php | Display the nickname of the author of the current post. | | [the\_author\_email()](the_author_email) wp-includes/deprecated.php | Display the email of the author of the current post. | | Version | Description | | --- | --- | | [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. | wordpress walk_category_dropdown_tree( mixed $args ): string walk\_category\_dropdown\_tree( mixed $args ): string ===================================================== Retrieves HTML dropdown (select) content for category list. * [Walker::walk()](../classes/walker/walk): for parameters and return description. `$args` mixed Required Elements array, maximum hierarchical depth and optional additional arguments. string File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/) ``` function walk_category_dropdown_tree( ...$args ) { // The user's options are the third parameter. if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) { $walker = new Walker_CategoryDropdown; } else { /** * @var Walker $walker */ $walker = $args[2]['walker']; } return $walker->walk( ...$args ); } ``` | Uses | Description | | --- | --- | | [Walker::walk()](../classes/walker/walk) wp-includes/class-wp-walker.php | Displays array of elements hierarchically. | | Used By | Description | | --- | --- | | [wp\_dropdown\_categories()](wp_dropdown_categories) wp-includes/category-template.php | Displays or retrieves the HTML dropdown list of categories. | | Version | Description | | --- | --- | | [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Formalized the existing `...$args` parameter by adding it to the function signature. | | [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. | wordpress make_site_theme_from_default( string $theme_name, string $template ): void|false make\_site\_theme\_from\_default( string $theme\_name, string $template ): void|false ===================================================================================== Creates a site theme from the default theme. `$theme_name` string Required The name of the theme. `$template` string Required The directory name of the theme. void|false File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/) ``` function make_site_theme_from_default( $theme_name, $template ) { $site_dir = WP_CONTENT_DIR . "/themes/$template"; $default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME; // Copy files from the default theme to the site theme. // $files = array( 'index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css' ); $theme_dir = @opendir( $default_dir ); if ( $theme_dir ) { while ( ( $theme_file = readdir( $theme_dir ) ) !== false ) { if ( is_dir( "$default_dir/$theme_file" ) ) { continue; } if ( ! copy( "$default_dir/$theme_file", "$site_dir/$theme_file" ) ) { return; } chmod( "$site_dir/$theme_file", 0777 ); } closedir( $theme_dir ); } // Rewrite the theme header. $stylelines = explode( "\n", implode( '', file( "$site_dir/style.css" ) ) ); if ( $stylelines ) { $f = fopen( "$site_dir/style.css", 'w' ); foreach ( $stylelines as $line ) { if ( strpos( $line, 'Theme Name:' ) !== false ) { $line = 'Theme Name: ' . $theme_name; } elseif ( strpos( $line, 'Theme URI:' ) !== false ) { $line = 'Theme URI: ' . __get_option( 'url' ); } elseif ( strpos( $line, 'Description:' ) !== false ) { $line = 'Description: Your theme.'; } elseif ( strpos( $line, 'Version:' ) !== false ) { $line = 'Version: 1'; } elseif ( strpos( $line, 'Author:' ) !== false ) { $line = 'Author: You'; } fwrite( $f, $line . "\n" ); } fclose( $f ); } // Copy the images. umask( 0 ); if ( ! mkdir( "$site_dir/images", 0777 ) ) { return false; } $images_dir = @opendir( "$default_dir/images" ); if ( $images_dir ) { while ( ( $image = readdir( $images_dir ) ) !== false ) { if ( is_dir( "$default_dir/images/$image" ) ) { continue; } if ( ! copy( "$default_dir/images/$image", "$site_dir/images/$image" ) ) { return; } chmod( "$site_dir/images/$image", 0777 ); } closedir( $images_dir ); } } ``` | 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. |
programming_docs
wordpress the_custom_logo( int $blog_id ) the\_custom\_logo( int $blog\_id ) ================================== Displays a custom logo, linked to home unless the theme supports removing the link on the home page. `$blog_id` int Optional ID of the blog in question. Default is the ID of the current blog. File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/) ``` function the_custom_logo( $blog_id = 0 ) { echo get_custom_logo( $blog_id ); } ``` | Uses | Description | | --- | --- | | [get\_custom\_logo()](get_custom_logo) wp-includes/general-template.php | Returns a custom logo, linked to home unless the theme supports removing the link on the home page. | | Version | Description | | --- | --- | | [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. | wordpress wp_delete_signup_on_user_delete( int $id, int|null $reassign, WP_User $user ) wp\_delete\_signup\_on\_user\_delete( int $id, int|null $reassign, WP\_User $user ) =================================================================================== Deletes an associated signup entry when a user is deleted from the database. `$id` int Required ID of the user to delete. `$reassign` int|null Required ID of the user to reassign posts and links to. `$user` [WP\_User](../classes/wp_user) Required User object. File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/) ``` function wp_delete_signup_on_user_delete( $id, $reassign, $user ) { global $wpdb; $wpdb->delete( $wpdb->signups, array( 'user_login' => $user->user_login ) ); } ``` | Uses | Description | | --- | --- | | [wpdb::delete()](../classes/wpdb/delete) wp-includes/class-wpdb.php | Deletes a row in the table. | | Version | Description | | --- | --- | | [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. | wordpress user_can_delete_post_comments( int $user_id, int $post_id, int $blog_id = 1 ): bool user\_can\_delete\_post\_comments( int $user\_id, int $post\_id, int $blog\_id = 1 ): bool ========================================================================================== This function has been deprecated. Use [current\_user\_can()](current_user_can) instead. Whether user can delete a post. * [current\_user\_can()](current_user_can) `$user_id` int Required `$post_id` int Required `$blog_id` int Optional Not Used Default: `1` bool returns true if $user\_id can delete $post\_id's comments File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/) ``` function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); // Right now if one can edit comments, one can delete comments. return user_can_edit_post_comments($user_id, $post_id, $blog_id); } ``` | Uses | Description | | --- | --- | | [user\_can\_edit\_post\_comments()](user_can_edit_post_comments) wp-includes/deprecated.php | Whether user can delete a post. | | [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. | | Version | Description | | --- | --- | | [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Use [current\_user\_can()](current_user_can) | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress is_post_publicly_viewable( int|WP_Post|null $post = null ): bool is\_post\_publicly\_viewable( int|WP\_Post|null $post = null ): bool ==================================================================== Determines whether a post is publicly viewable. Posts are considered publicly viewable if both the post status and post type are viewable. `$post` int|[WP\_Post](../classes/wp_post)|null Optional Post ID or post object. Defaults to global $post. Default: `null` bool Whether the post is publicly viewable. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/) ``` function is_post_publicly_viewable( $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $post_type = get_post_type( $post ); $post_status = get_post_status( $post ); return is_post_type_viewable( $post_type ) && is_post_status_viewable( $post_status ); } ``` | Uses | Description | | --- | --- | | [is\_post\_status\_viewable()](is_post_status_viewable) wp-includes/post.php | Determines whether a post status is considered “viewable”. | | [is\_post\_type\_viewable()](is_post_type_viewable) wp-includes/post.php | Determines whether a post type is considered “viewable”. | | [get\_post\_type()](get_post_type) wp-includes/post.php | Retrieves the post type of the current post or of a given post. | | [get\_post\_status()](get_post_status) wp-includes/post.php | Retrieves the post status based on the post ID. | | [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Used By | Description | | --- | --- | | [WP\_REST\_Terms\_Controller::check\_read\_terms\_permission\_for\_post()](../classes/wp_rest_terms_controller/check_read_terms_permission_for_post) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Checks if the terms for a post can be read. | | [get\_oembed\_response\_data()](get_oembed_response_data) wp-includes/embed.php | Retrieves the oEmbed response data for a given post. | | [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. | | Version | Description | | --- | --- | | [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. | wordpress wp_get_current_commenter(): array wp\_get\_current\_commenter(): array ==================================== Gets current commenter’s name, email, and URL. Expects cookies content to already be sanitized. User of this function might wish to recheck the returned array for validity. * [sanitize\_comment\_cookies()](sanitize_comment_cookies) : Use to sanitize cookies array An array of current commenter variables. * `comment_author`stringThe name of the current commenter, or an empty string. * `comment_author_email`stringThe email address of the current commenter, or an empty string. * `comment_author_url`stringThe URL address of the current commenter, or an empty string. File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/) ``` function wp_get_current_commenter() { // Cookies should already be sanitized. $comment_author = ''; if ( isset( $_COOKIE[ 'comment_author_' . COOKIEHASH ] ) ) { $comment_author = $_COOKIE[ 'comment_author_' . COOKIEHASH ]; } $comment_author_email = ''; if ( isset( $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] ) ) { $comment_author_email = $_COOKIE[ 'comment_author_email_' . COOKIEHASH ]; } $comment_author_url = ''; if ( isset( $_COOKIE[ 'comment_author_url_' . COOKIEHASH ] ) ) { $comment_author_url = $_COOKIE[ 'comment_author_url_' . COOKIEHASH ]; } /** * Filters the current commenter's name, email, and URL. * * @since 3.1.0 * * @param array $comment_author_data { * An array of current commenter variables. * * @type string $comment_author The name of the current commenter, or an empty string. * @type string $comment_author_email The email address of the current commenter, or an empty string. * @type string $comment_author_url The URL address of the current commenter, or an empty string. * } */ return apply_filters( 'wp_get_current_commenter', compact( 'comment_author', 'comment_author_email', 'comment_author_url' ) ); } ``` [apply\_filters( 'wp\_get\_current\_commenter', array $comment\_author\_data )](../hooks/wp_get_current_commenter) Filters the current commenter’s name, email, and URL. | 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 | | --- | --- | | [Walker\_Comment::filter\_comment\_text()](../classes/walker_comment/filter_comment_text) wp-includes/class-walker-comment.php | Filters the comment text. | | [wp\_get\_unapproved\_comment\_author\_email()](wp_get_unapproved_comment_author_email) wp-includes/comment.php | Gets unapproved comment author’s email. | | [Walker\_Comment::comment()](../classes/walker_comment/comment) wp-includes/class-walker-comment.php | Outputs a single comment. | | [Walker\_Comment::html5\_comment()](../classes/walker_comment/html5_comment) wp-includes/class-walker-comment.php | Outputs a comment in the HTML5 format. | | [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. | | [comments\_template()](comments_template) wp-includes/comment-template.php | Loads the comment template specified in $file. | | Version | Description | | --- | --- | | [2.0.4](https://developer.wordpress.org/reference/since/2.0.4/) | Introduced. | wordpress get_blog_post( int $blog_id, int $post_id ): WP_Post|null get\_blog\_post( int $blog\_id, int $post\_id ): WP\_Post|null ============================================================== Gets a blog post from any site on the network. This function is similar to [get\_post()](get_post) , except that it can retrieve a post from any site on the network, not just the current site. `$blog_id` int Required ID of the blog. `$post_id` int Required ID of the post being looked for. [WP\_Post](../classes/wp_post)|null [WP\_Post](../classes/wp_post) object on success, null on failure File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/) ``` function get_blog_post( $blog_id, $post_id ) { switch_to_blog( $blog_id ); $post = get_post( $post_id ); restore_current_blog(); return $post; } ``` | 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\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. | | Version | Description | | --- | --- | | [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. | wordpress allowed_http_request_hosts( bool $is_external, string $host ): bool allowed\_http\_request\_hosts( bool $is\_external, string $host ): bool ======================================================================= Mark allowed redirect hosts safe for HTTP requests as well. Attached to the [‘http\_request\_host\_is\_external’](../hooks/http_request_host_is_external) filter. `$is_external` bool Required `$host` string Required bool File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/) ``` function allowed_http_request_hosts( $is_external, $host ) { if ( ! $is_external && wp_validate_redirect( 'http://' . $host ) ) { $is_external = true; } return $is_external; } ``` | Uses | Description | | --- | --- | | [wp\_validate\_redirect()](wp_validate_redirect) wp-includes/pluggable.php | Validates a URL for use in a redirect. | | Version | Description | | --- | --- | | [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. | wordpress iso8601_to_datetime( string $date_string, string $timezone = 'user' ): string|false iso8601\_to\_datetime( string $date\_string, string $timezone = 'user' ): string|false ====================================================================================== Given an ISO 8601 (Ymd\TH:i:sO) date, returns a MySQL DateTime (Y-m-d H:i:s) format used by post\_date[\_gmt]. `$date_string` string Required Date and time in ISO 8601 format <https://en.wikipedia.org/wiki/ISO_8601>. `$timezone` string Optional If set to `'gmt'` returns the result in UTC. Default `'user'`. Default: `'user'` string|false The date and time in MySQL DateTime format - Y-m-d H:i:s, or false on failure. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/) ``` function iso8601_to_datetime( $date_string, $timezone = 'user' ) { $timezone = strtolower( $timezone ); $wp_timezone = wp_timezone(); $datetime = date_create( $date_string, $wp_timezone ); // Timezone is ignored if input has one. if ( false === $datetime ) { return false; } if ( 'gmt' === $timezone ) { return $datetime->setTimezone( new DateTimeZone( 'UTC' ) )->format( 'Y-m-d H:i:s' ); } if ( 'user' === $timezone ) { return $datetime->setTimezone( $wp_timezone )->format( 'Y-m-d H:i:s' ); } return false; } ``` | Uses | Description | | --- | --- | | [wp\_timezone()](wp_timezone) wp-includes/functions.php | Retrieves the timezone of the site as a `DateTimeZone` object. | | Used By | Description | | --- | --- | | [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\_editComment()](../classes/wp_xmlrpc_server/wp_editcomment) wp-includes/class-wp-xmlrpc-server.php | Edit comment. | | [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 | | --- | --- | | [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. | wordpress wp_authenticate_application_password( WP_User|WP_Error|null $input_user, string $username, string $password ): WP_User|WP_Error|null wp\_authenticate\_application\_password( WP\_User|WP\_Error|null $input\_user, string $username, string $password ): WP\_User|WP\_Error|null ============================================================================================================================================ Authenticates the user using an application password. `$input_user` [WP\_User](../classes/wp_user)|[WP\_Error](../classes/wp_error)|null Required [WP\_User](../classes/wp_user) or [WP\_Error](../classes/wp_error) object if a previous callback failed authentication. `$username` string Required Username for authentication. `$password` string Required Password for authentication. [WP\_User](../classes/wp_user)|[WP\_Error](../classes/wp_error)|null [WP\_User](../classes/wp_user) on success, [WP\_Error](../classes/wp_error) on failure, null if null is passed in and this isn't an API request. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/) ``` function wp_authenticate_application_password( $input_user, $username, $password ) { if ( $input_user instanceof WP_User ) { return $input_user; } if ( ! WP_Application_Passwords::is_in_use() ) { return $input_user; } $is_api_request = ( ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ); /** * Filters whether this is an API request that Application Passwords can be used on. * * By default, Application Passwords is available for the REST API and XML-RPC. * * @since 5.6.0 * * @param bool $is_api_request If this is an acceptable API request. */ $is_api_request = apply_filters( 'application_password_is_api_request', $is_api_request ); if ( ! $is_api_request ) { return $input_user; } $error = null; $user = get_user_by( 'login', $username ); if ( ! $user && is_email( $username ) ) { $user = get_user_by( 'email', $username ); } // If the login name is invalid, short circuit. if ( ! $user ) { if ( is_email( $username ) ) { $error = new WP_Error( 'invalid_email', __( '<strong>Error:</strong> Unknown email address. Check again or try your username.' ) ); } else { $error = new WP_Error( 'invalid_username', __( '<strong>Error:</strong> Unknown username. Check again or try your email address.' ) ); } } elseif ( ! wp_is_application_passwords_available() ) { $error = new WP_Error( 'application_passwords_disabled', __( 'Application passwords are not available.' ) ); } elseif ( ! wp_is_application_passwords_available_for_user( $user ) ) { $error = new WP_Error( 'application_passwords_disabled_for_user', __( 'Application passwords are not available for your account. Please contact the site administrator for assistance.' ) ); } if ( $error ) { /** * Fires when an application password failed to authenticate the user. * * @since 5.6.0 * * @param WP_Error $error The authentication error. */ do_action( 'application_password_failed_authentication', $error ); return $error; } /* * Strips out anything non-alphanumeric. This is so passwords can be used with * or without spaces to indicate the groupings for readability. * * Generated application passwords are exclusively alphanumeric. */ $password = preg_replace( '/[^a-z\d]/i', '', $password ); $hashed_passwords = WP_Application_Passwords::get_user_application_passwords( $user->ID ); foreach ( $hashed_passwords as $key => $item ) { if ( ! wp_check_password( $password, $item['password'], $user->ID ) ) { continue; } $error = new WP_Error(); /** * Fires when an application password has been successfully checked as valid. * * This allows for plugins to add additional constraints to prevent an application password from being used. * * @since 5.6.0 * * @param WP_Error $error The error object. * @param WP_User $user The user authenticating. * @param array $item The details about the application password. * @param string $password The raw supplied password. */ do_action( 'wp_authenticate_application_password_errors', $error, $user, $item, $password ); if ( is_wp_error( $error ) && $error->has_errors() ) { /** This action is documented in wp-includes/user.php */ do_action( 'application_password_failed_authentication', $error ); return $error; } WP_Application_Passwords::record_application_password_usage( $user->ID, $item['uuid'] ); /** * Fires after an application password was used for authentication. * * @since 5.6.0 * * @param WP_User $user The user who was authenticated. * @param array $item The application password used. */ do_action( 'application_password_did_authenticate', $user, $item ); return $user; } $error = new WP_Error( 'incorrect_password', __( 'The provided password is an invalid application password.' ) ); /** This action is documented in wp-includes/user.php */ do_action( 'application_password_failed_authentication', $error ); return $error; } ``` [do\_action( 'application\_password\_did\_authenticate', WP\_User $user, array $item )](../hooks/application_password_did_authenticate) Fires after an application password was used for authentication. [do\_action( 'application\_password\_failed\_authentication', WP\_Error $error )](../hooks/application_password_failed_authentication) Fires when an application password failed to authenticate the user. [apply\_filters( 'application\_password\_is\_api\_request', bool $is\_api\_request )](../hooks/application_password_is_api_request) Filters whether this is an API request that Application Passwords can be used on. [do\_action( 'wp\_authenticate\_application\_password\_errors', WP\_Error $error, WP\_User $user, array $item, string $password )](../hooks/wp_authenticate_application_password_errors) Fires when an application password has been successfully checked as valid. | Uses | Description | | --- | --- | | [WP\_Application\_Passwords::is\_in\_use()](../classes/wp_application_passwords/is_in_use) wp-includes/class-wp-application-passwords.php | Checks if application passwords are being used by the site. | | [WP\_Application\_Passwords::get\_user\_application\_passwords()](../classes/wp_application_passwords/get_user_application_passwords) wp-includes/class-wp-application-passwords.php | Gets a user’s application passwords. | | [WP\_Application\_Passwords::record\_application\_password\_usage()](../classes/wp_application_passwords/record_application_password_usage) wp-includes/class-wp-application-passwords.php | Records that an application password has been used. | | [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. | | [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. | | [wp\_check\_password()](wp_check_password) wp-includes/pluggable.php | Checks the plaintext password against the encrypted Password. | | [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. | | [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\_validate\_application\_password()](wp_validate_application_password) wp-includes/user.php | Validates the application password credentials passed via Basic Authentication. | | Version | Description | | --- | --- | | [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
programming_docs