[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
Main WordPress API
File Size: | 8460 lines (260 kb) |
Included or required: | 4 times |
Referenced: | 0 times |
Includes or requires: | 3 files wp-includes/class-IXR.php wp-includes/default-widgets.php wp-includes/option.php |
mysql2date( $format, $date, $translate = true ) X-Ref |
Convert given MySQL date string into a different format. - `$format` should be a PHP date format string. - 'U' and 'G' formats will return an integer sum of timestamp with timezone offset. - `$date` is expected to be local time in MySQL format (`Y-m-d H:i:s`). Historically UTC time could be passed to the function to produce Unix timestamp. If `$translate` is true then the given date and format string will be passed to `wp_date()` for translation. param: string $format Format of the date to return. param: string $date Date string to convert. param: bool $translate Whether the return date should be translated. Default true. return: string|int|false Integer if `$format` is 'U' or 'G', string otherwise. since: 0.71 |
current_time( $type, $gmt = 0 ) X-Ref |
Retrieves the current time based on specified type. - The 'mysql' type will return the time in the format for MySQL DATETIME field. - The 'timestamp' or 'U' types will return the current timestamp or a sum of timestamp and timezone offset, depending on `$gmt`. - Other strings will be interpreted as PHP date formats (e.g. 'Y-m-d'). If `$gmt` is a truthy value then both types will use GMT time, otherwise the output is adjusted with the GMT offset for the site. param: string $type Type of time to retrieve. Accepts 'mysql', 'timestamp', 'U', param: int|bool $gmt Optional. Whether to use GMT timezone. Default false. return: int|string Integer if `$type` is 'timestamp' or 'U', string otherwise. since: 1.0.0 since: 5.3.0 Now returns an integer if `$type` is 'U'. Previously a string was returned. |
current_datetime() X-Ref |
Retrieves the current time as an object using the site's timezone. return: DateTimeImmutable Date and time object. since: 5.3.0 |
wp_timezone_string() X-Ref |
Retrieves the timezone of the site as a string. Uses the `timezone_string` option to get a proper timezone name if available, otherwise falls back to a manual UTC ± offset. Example return values: - 'Europe/Rome' - 'America/North_Dakota/New_Salem' - 'UTC' - '-06:30' - '+00:00' - '+08:45' return: string PHP timezone name or a ±HH:MM offset. since: 5.3.0 |
wp_timezone() X-Ref |
Retrieves the timezone of the site as a `DateTimeZone` object. Timezone can be based on a PHP timezone string or a ±HH:MM offset. return: DateTimeZone Timezone object. since: 5.3.0 |
date_i18n( $format, $timestamp_with_offset = false, $gmt = false ) X-Ref |
Retrieves the date in localized format, based on a sum of Unix timestamp and timezone offset in seconds. If the locale specifies the locale month and weekday, then the locale will take over the format for the date. If it isn't, then the date format string will be used instead. Note that due to the way WP typically generates a sum of timestamp and offset with `strtotime()`, it implies offset added at a _current_ time, not at the time the timestamp represents. Storing such timestamps or calculating them differently will lead to invalid output. param: string $format Format to display the date. param: int|bool $timestamp_with_offset Optional. A sum of Unix timestamp and timezone offset param: bool $gmt Optional. Whether to use GMT timezone. Only applies return: string The date, translated if locale specifies it. since: 0.71 since: 5.3.0 Converted into a wrapper for wp_date(). |
wp_date( $format, $timestamp = null, $timezone = null ) X-Ref |
Retrieves the date, in localized format. This is a newer function, intended to replace `date_i18n()` without legacy quirks in it. Note that, unlike `date_i18n()`, this function accepts a true Unix timestamp, not summed with timezone offset. param: string $format PHP date format. param: int $timestamp Optional. Unix timestamp. Defaults to current time. param: DateTimeZone $timezone Optional. Timezone to output result in. Defaults to timezone return: string|false The date, translated if locale specifies it. False on invalid timestamp input. since: 5.3.0 |
wp_maybe_decline_date( $date, $format = '' ) X-Ref |
Determines if the date should be declined. If the locale specifies that month names require a genitive case in certain formats (like 'j F Y'), the month name will be replaced with a correct form. param: string $date Formatted date string. param: string $format Optional. Date format to check. Default empty string. return: string The date, declined if locale specifies it. since: 4.4.0 since: 5.4.0 The `$format` parameter was added. |
number_format_i18n( $number, $decimals = 0 ) X-Ref |
Convert float number to format based on the locale. param: float $number The number to convert based on locale. param: int $decimals Optional. Precision of the number of decimal places. Default 0. return: string Converted number in string format. since: 2.3.0 |
size_format( $bytes, $decimals = 0 ) X-Ref |
Converts a number of bytes to the largest unit the bytes will fit into. It is easier to read 1 KB than 1024 bytes and 1 MB than 1048576 bytes. Converts number of bytes to human readable number by taking the number of that unit that the bytes will go into it. Supports YB value. Please note that integers in PHP are limited to 32 bits, unless they are on 64 bit architecture, then they have 64 bit size. If you need to place the larger size then what PHP integer type will hold, then use a string. It will be converted to a double, which should always have 64 bit length. Technically the correct unit names for powers of 1024 are KiB, MiB etc. param: int|string $bytes Number of bytes. Note max integer size for integers. param: int $decimals Optional. Precision of number of decimal places. Default 0. return: string|false Number string on success, false on failure. since: 2.3.0 since: 6.0.0 Support for PB, EB, ZB, and YB was added. |
human_readable_duration( $duration = '' ) X-Ref |
Convert a duration to human readable format. param: string $duration Duration will be in string format (HH:ii:ss) OR (ii:ss), return: string|false A human readable duration string, false on failure. since: 5.1.0 |
get_weekstartend( $mysqlstring, $start_of_week = '' ) X-Ref |
Get the week start and end from the datetime or date string from MySQL. param: string $mysqlstring Date or datetime field type from MySQL. param: int|string $start_of_week Optional. Start of the week as an integer. Default empty string. return: int[] { since: 0.71 |
maybe_serialize( $data ) X-Ref |
Serialize data, if needed. param: string|array|object $data Data that might be serialized. return: mixed A scalar data. since: 2.0.5 |
maybe_unserialize( $data ) X-Ref |
Unserialize data only if it was serialized. param: string $data Data that might be unserialized. return: mixed Unserialized data can be any type. since: 2.0.0 |
is_serialized( $data, $strict = true ) X-Ref |
Check value to find if it was serialized. If $data is not an string, then returned value will always be false. Serialized data is always a string. param: string $data Value to check to see if was serialized. param: bool $strict Optional. Whether to be strict about the end of the string. Default true. return: bool False if not serialized and true if it was. since: 2.0.5 |
is_serialized_string( $data ) X-Ref |
Check whether serialized data is of string type. param: string $data Serialized data. return: bool False if not a serialized string, true if it is. since: 2.0.5 |
xmlrpc_getposttitle( $content ) X-Ref |
Retrieve post title from XMLRPC XML. If the title element is not part of the XML, then the default post title from the $post_default_title will be used instead. param: string $content XMLRPC XML Request content return: string Post title since: 0.71 |
xmlrpc_getpostcategory( $content ) X-Ref |
Retrieve the post category or categories from XMLRPC XML. If the category element is not found, then the default post category will be used. The return type then would be what $post_default_category. If the category is found, then it will always be an array. param: string $content XMLRPC XML Request content return: string|array List of categories or category name. since: 0.71 |
xmlrpc_removepostdata( $content ) X-Ref |
XMLRPC XML content without title and category elements. param: string $content XML-RPC XML Request content. return: string XMLRPC XML Request content without title and category elements. since: 0.71 |
wp_extract_urls( $content ) X-Ref |
Use RegEx to extract URLs from arbitrary content. param: string $content Content to extract URLs from. return: string[] Array of URLs found in passed string. since: 3.7.0 since: 6.0.0 Fixes support for HTML entities (Trac 30580). |
do_enclose( $content, $post ) X-Ref |
No description |
wp_get_http_headers( $url, $deprecated = false ) X-Ref |
Retrieve HTTP Headers from URL. param: string $url URL to retrieve HTTP headers from. param: bool $deprecated Not Used. return: string|false Headers on success, false on failure. since: 1.5.1 |
is_new_day() X-Ref |
Determines whether the publish date of the current post in the loop is different from the publish date of the previous post in the loop. For more information on this and similar theme functions, check out the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ Conditional Tags} article in the Theme Developer Handbook. return: int 1 when new day, 0 if not a new day. since: 0.71 |
build_query( $data ) X-Ref |
Build URL query based on an associative and, or indexed array. This is a convenient function for easily building url queries. It sets the separator to '&' and uses _http_build_query() function. param: array $data URL-encode key/value pairs. return: string URL-encoded string. since: 2.3.0 |
_http_build_query( $data, $prefix = null, $sep = null, $key = '', $urlencode = true ) X-Ref |
From php.net (modified by Mark Jaquith to behave like the native PHP5 function). param: array|object $data An array or object of data. Converted to array. param: string $prefix Optional. Numeric index. If set, start parameter numbering with it. param: string $sep Optional. Argument separator; defaults to 'arg_separator.output'. param: string $key Optional. Used to prefix key name. Default empty. param: bool $urlencode Optional. Whether to use urlencode() in the result. Default true. return: string The query string. since: 3.2.0 |
add_query_arg( ...$args ) X-Ref |
Retrieves a modified URL query string. You can rebuild the URL and append query variables to the URL query by using this function. There are two ways to use this function; either a single key and value, or an associative array. Using a single key and value: add_query_arg( 'key', 'value', 'http://example.com' ); Using an associative array: add_query_arg( array( 'key1' => 'value1', 'key2' => 'value2', ), 'http://example.com' ); Omitting the URL from either use results in the current URL being used (the value of `$_SERVER['REQUEST_URI']`). Values are expected to be encoded appropriately with urlencode() or rawurlencode(). Setting any query variable's value to boolean false removes the key (see remove_query_arg()). Important: The return value of add_query_arg() is not escaped by default. Output should be late-escaped with esc_url() or similar to help prevent vulnerability to cross-site scripting (XSS) attacks. param: string|array $key Either a query variable key, or an associative array of query variables. param: string $value Optional. Either a query variable value, or a URL to act upon. param: string $url Optional. A URL to act upon. return: string New URL query string (unescaped). since: 1.5.0 since: 5.3.0 Formalized the existing and already documented parameters |
remove_query_arg( $key, $query = false ) X-Ref |
Removes an item or items from a query string. param: string|string[] $key Query key or keys to remove. param: false|string $query Optional. When false uses the current URL. Default false. return: string New URL query string. since: 1.5.0 |
wp_removable_query_args() X-Ref |
Returns an array of single-use query variable names that can be removed from a URL. return: string[] An array of query variable names to remove from the URL. since: 4.4.0 |
add_magic_quotes( $array ) X-Ref |
Walks the array while sanitizing the contents. param: array $array Array to walk while sanitizing contents. return: array Sanitized $array. since: 0.71 since: 5.5.0 Non-string values are left untouched. |
wp_remote_fopen( $uri ) X-Ref |
HTTP request for URI to retrieve content. param: string $uri URI/URL of web page to retrieve. return: string|false HTTP content. False on failure. since: 1.5.1 |
wp( $query_vars = '' ) X-Ref |
Set up the WordPress query. param: string|array $query_vars Default WP_Query arguments. since: 2.0.0 |
get_status_header_desc( $code ) X-Ref |
Retrieve the description for the HTTP status. param: int $code HTTP status code. return: string Status description if found, an empty string otherwise. since: 2.3.0 since: 3.9.0 Added status codes 418, 428, 429, 431, and 511. since: 4.5.0 Added status codes 308, 421, and 451. since: 5.1.0 Added status code 103. |
status_header( $code, $description = '' ) X-Ref |
Set HTTP status header. param: int $code HTTP status code. param: string $description Optional. A custom description for the HTTP status. since: 2.0.0 since: 4.4.0 Added the `$description` parameter. |
wp_get_nocache_headers() X-Ref |
Get the header information to prevent caching. The several different headers cover the different ways cache prevention is handled by different browsers return: array The associative array of header names and field values. since: 2.8.0 |
nocache_headers() X-Ref |
Set the headers to prevent caching for the different browsers. Different browsers support different nocache headers, so several headers must be sent so that all of them get the point that no caching should occur. since: 2.0.0 |
cache_javascript_headers() X-Ref |
Set the headers for caching for 10 days with JavaScript content type. since: 2.1.0 |
get_num_queries() X-Ref |
Retrieve the number of database queries during the WordPress execution. return: int Number of database queries. since: 2.0.0 |
bool_from_yn( $yn ) X-Ref |
Whether input is yes or no. Must be 'y' to be true. param: string $yn Character string containing either 'y' (yes) or 'n' (no). return: bool True if 'y', false on anything else. since: 1.0.0 |
do_feed() X-Ref |
Load the feed template from the use of an action hook. If the feed action does not have a hook, then the function will die with a message telling the visitor that the feed is not valid. It is better to only have one hook for each feed. since: 2.1.0 |
do_feed_rdf() X-Ref |
Load the RDF RSS 0.91 Feed template. since: 2.1.0 |
do_feed_rss() X-Ref |
Load the RSS 1.0 Feed Template. since: 2.1.0 |
do_feed_rss2( $for_comments ) X-Ref |
Load either the RSS2 comment feed or the RSS2 posts feed. param: bool $for_comments True for the comment feed, false for normal feed. since: 2.1.0 |
do_feed_atom( $for_comments ) X-Ref |
Load either Atom comment feed or Atom posts feed. param: bool $for_comments True for the comment feed, false for normal feed. since: 2.1.0 |
do_robots() X-Ref |
Displays the default robots.txt file content. since: 2.1.0 since: 5.3.0 Remove the "Disallow: /" output if search engine visiblity is |
do_favicon() X-Ref |
Display the favicon.ico file content. since: 5.4.0 |
is_blog_installed() X-Ref |
Determines whether WordPress is already installed. The cache will be checked first. If you have a cache plugin, which saves the cache values, then this will work. If you use the default WordPress cache, and the database goes away, then you might have problems. Checks for the 'siteurl' option for whether WordPress is installed. For more information on this and similar theme functions, check out the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ Conditional Tags} article in the Theme Developer Handbook. return: bool Whether the site is already installed. since: 2.1.0 |
wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) X-Ref |
Retrieve URL with nonce added to URL query. param: string $actionurl URL to add nonce action. param: int|string $action Optional. Nonce action name. Default -1. param: string $name Optional. Nonce name. Default '_wpnonce'. return: string Escaped URL with nonce action added. since: 2.0.4 |
wp_nonce_field( $action = -1, $name = '_wpnonce', $referer = true, $echo = true ) X-Ref |
Retrieve or display nonce hidden field for forms. The nonce field is used to validate that the contents of the form came from the location on the current site and not somewhere else. The nonce does not offer absolute protection, but should protect against most cases. It is very important to use nonce field in forms. The $action and $name are optional, but if you want to have better security, it is strongly suggested to set those two parameters. It is easier to just call the function without any parameters, because validation of the nonce doesn't require any parameters, but since crackers know what the default is it won't be difficult for them to find a way around your nonce and cause damage. The input name will be whatever $name value you gave. The input value will be the nonce creation value. param: int|string $action Optional. Action name. Default -1. param: string $name Optional. Nonce name. Default '_wpnonce'. param: bool $referer Optional. Whether to set the referer field for validation. Default true. param: bool $echo Optional. Whether to display or return hidden form field. Default true. return: string Nonce field HTML markup. since: 2.0.4 |
wp_referer_field( $echo = true ) X-Ref |
Retrieve or display referer hidden field for forms. The referer link is the current Request URI from the server super global. The input name is '_wp_http_referer', in case you wanted to check manually. param: bool $echo Optional. Whether to echo or return the referer field. Default true. return: string Referer field HTML markup. since: 2.0.4 |
wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) X-Ref |
Retrieve or display original referer hidden field for forms. The input name is '_wp_original_http_referer' and will be either the same value of wp_referer_field(), if that was posted already or it will be the current page, if it doesn't exist. param: bool $echo Optional. Whether to echo the original http referer. Default true. param: string $jump_back_to Optional. Can be 'previous' or page you want to jump back to. return: string Original referer field. since: 2.0.4 |
wp_get_referer() X-Ref |
Retrieve referer from '_wp_http_referer' or HTTP referer. If it's the same as the current request URL, will return false. return: string|false Referer URL on success, false on failure. since: 2.0.4 |
wp_get_raw_referer() X-Ref |
Retrieves unvalidated referer from '_wp_http_referer' or HTTP referer. Do not use for redirects, use wp_get_referer() instead. return: string|false Referer URL on success, false on failure. since: 4.5.0 |
wp_get_original_referer() X-Ref |
Retrieve original referer that was posted, if it exists. return: string|false Original referer URL on success, false on failure. since: 2.0.4 |
wp_mkdir_p( $target ) X-Ref |
Recursive directory creation based on full path. Will attempt to set permissions on folders. param: string $target Full path to attempt to create. return: bool Whether the path was created. True if path already exists. since: 2.0.1 |
path_is_absolute( $path ) X-Ref |
Test if a given filesystem path is absolute. For example, '/foo/bar', or 'c:\windows'. param: string $path File path. return: bool True if path is absolute, false is not absolute. since: 2.5.0 |
path_join( $base, $path ) X-Ref |
Join two filesystem paths together. For example, 'give me $path relative to $base'. If the $path is absolute, then it the full path is returned. param: string $base Base path. param: string $path Path relative to $base. return: string The path with the base or absolute path. since: 2.5.0 |
wp_normalize_path( $path ) X-Ref |
Normalize a filesystem path. On windows systems, replaces backslashes with forward slashes and forces upper-case drive letters. Allows for two leading slashes for Windows network shares, but ensures that all other duplicate slashes are reduced to a single. param: string $path Path to normalize. return: string Normalized path. since: 3.9.0 since: 4.4.0 Ensures upper-case drive letters on Windows systems. since: 4.5.0 Allows for Windows network shares. since: 4.9.7 Allows for PHP file wrappers. |
get_temp_dir() X-Ref |
Determine a writable directory for temporary files. Function's preference is the return value of sys_get_temp_dir(), followed by your PHP temporary upload directory, followed by WP_CONTENT_DIR, before finally defaulting to /tmp/ In the event that this function does not find a writable location, It may be overridden by the WP_TEMP_DIR constant in your wp-config.php file. return: string Writable temporary directory. since: 2.5.0 |
wp_is_writable( $path ) X-Ref |
Determine if a directory is writable. This function is used to work around certain ACL issues in PHP primarily affecting Windows Servers. param: string $path Path to check for write-ability. return: bool Whether the path is writable. since: 3.6.0 |
win_is_writable( $path ) X-Ref |
Workaround for Windows bug in is_writable() function PHP has issues with Windows ACL's for determine if a directory is writable or not, this works around them by checking the ability to open files rather than relying upon PHP to interprate the OS ACL. param: string $path Windows path to check for write-ability. return: bool Whether the path is writable. since: 2.8.0 |
wp_get_upload_dir() X-Ref |
Retrieves uploads directory information. Same as wp_upload_dir() but "light weight" as it doesn't attempt to create the uploads directory. Intended for use in themes, when only 'basedir' and 'baseurl' are needed, generally in all cases when not uploading files. return: array See wp_upload_dir() for description. since: 4.5.0 |
wp_upload_dir( $time = null, $create_dir = true, $refresh_cache = false ) X-Ref |
Returns an array containing the current upload directory's path and URL. Checks the 'upload_path' option, which should be from the web root folder, and if it isn't empty it will be used. If it is empty, then the path will be 'WP_CONTENT_DIR/uploads'. If the 'UPLOADS' constant is defined, then it will override the 'upload_path' option and 'WP_CONTENT_DIR/uploads' path. The upload URL path is set either by the 'upload_url_path' option or by using the 'WP_CONTENT_URL' constant and appending '/uploads' to the path. If the 'uploads_use_yearmonth_folders' is set to true (checkbox if checked in the administration settings panel), then the time will be used. The format will be year first and then month. If the path couldn't be created, then an error will be returned with the key 'error' containing the error message. The error suggests that the parent directory is not writable by the server. param: string $time Optional. Time formatted in 'yyyy/mm'. Default null. param: bool $create_dir Optional. Whether to check and create the uploads directory. param: bool $refresh_cache Optional. Whether to refresh the cache. Default false. return: array { since: 2.0.0 |
_wp_upload_dir( $time = null ) X-Ref |
A non-filtered, non-cached version of wp_upload_dir() that doesn't check the path. param: string $time Optional. Time formatted in 'yyyy/mm'. Default null. return: array See wp_upload_dir() since: 4.5.0 |
wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) X-Ref |
Get a filename that is sanitized and unique for the given directory. If the filename is not unique, then a number will be added to the filename before the extension, and will continue adding numbers until the filename is unique. The callback function allows the caller to use their own method to create unique file names. If defined, the callback should take three arguments: - directory, base filename, and extension - and return a unique filename. param: string $dir Directory. param: string $filename File name. param: callable $unique_filename_callback Callback. Default null. return: string New filename, if given wasn't unique. since: 2.5.0 |
_wp_check_alternate_file_names( $filenames, $dir, $files ) X-Ref |
Helper function to test if each of an array of file names could conflict with existing files. param: string[] $filenames Array of file names to check. param: string $dir The directory containing the files. param: array $files An array of existing files in the directory. May be empty. return: bool True if the tested file name could match an existing file, false otherwise. since: 5.8.1 |
_wp_check_existing_file_names( $filename, $files ) X-Ref |
Helper function to check if a file name could match an existing image sub-size file name. param: string $filename The file name to check. param: array $files An array of existing files in the directory. return: bool True if the tested file name could match an existing file, false otherwise. since: 5.3.1 |
wp_upload_bits( $name, $deprecated, $bits, $time = null ) X-Ref |
Create a file in the upload folder with given content. If there is an error, then the key 'error' will exist with the error message. If success, then the key 'file' will have the unique file path, the 'url' key will have the link to the new file. and the 'error' key will be set to false. This function will not move an uploaded file to the upload folder. It will create a new file with the content in $bits parameter. If you move the upload file, read the content of the uploaded file, and then you can give the filename and content to this function, which will add it to the upload folder. The permissions will be set on the new file automatically by this function. param: string $name Filename. param: null|string $deprecated Never used. Set to null. param: string $bits File content param: string $time Optional. Time formatted in 'yyyy/mm'. Default null. return: array { since: 2.0.0 |
wp_ext2type( $ext ) X-Ref |
Retrieve the file type based on the extension name. param: string $ext The extension to search. return: string|void The file type, example: audio, video, document, spreadsheet, etc. since: 2.5.0 |
wp_get_default_extension_for_mime_type( $mime_type ) X-Ref |
Returns first matched extension for the mime-type, as mapped from wp_get_mime_types(). param: string $mime_type return: string|false since: 5.8.1 |
wp_check_filetype( $filename, $mimes = null ) X-Ref |
Retrieve the file type from the file name. You can optionally define the mime array, if needed. param: string $filename File name or path. param: string[] $mimes Optional. Array of allowed mime types keyed by their file extension regex. return: array { since: 2.0.4 |
wp_check_filetype_and_ext( $file, $filename, $mimes = null ) X-Ref |
Attempt to determine the real file type of a file. If unable to, the file name extension will be used to determine type. If it's determined that the extension does not match the file's real type, then the "proper_filename" value will be set with a proper filename and extension. Currently this function only supports renaming images validated via wp_get_image_mime(). param: string $file Full path to the file. param: string $filename The name of the file (may differ from $file due to $file being param: string[] $mimes Optional. Array of allowed mime types keyed by their file extension regex. return: array { since: 3.0.0 |
wp_get_image_mime( $file ) X-Ref |
Returns the real mime type of an image file. This depends on exif_imagetype() or getimagesize() to determine real mime types. param: string $file Full path to the file. return: string|false The actual mime type or false if the type cannot be determined. since: 4.7.1 since: 5.8.0 Added support for WebP images. |
wp_get_mime_types() X-Ref |
Retrieve list of mime types and file extensions. return: string[] Array of mime types keyed by the file extension regex corresponding to those types. since: 3.5.0 since: 4.2.0 Support was added for GIMP (.xcf) files. since: 4.9.2 Support was added for Flac (.flac) files. since: 4.9.6 Support was added for AAC (.aac) files. |
wp_get_ext_types() X-Ref |
Retrieves the list of common file extensions and their types. return: array[] Multi-dimensional array of file extensions types keyed by the type of file. since: 4.6.0 |
wp_filesize( $path ) X-Ref |
Wrapper for PHP filesize with filters and casting the result as an integer. param: string $path Path to the file. return: int The size of the file in bytes, or 0 in the event of an error. since: 6.0.0 |
get_allowed_mime_types( $user = null ) X-Ref |
Retrieve list of allowed mime types and file extensions. param: int|WP_User $user Optional. User to check. Defaults to current user. return: string[] Array of mime types keyed by the file extension regex corresponding since: 2.8.6 |
wp_nonce_ays( $action ) X-Ref |
Display "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. param: string $action The nonce action. since: 2.0.4 |
wp_die( $message = '', $title = '', $args = array() X-Ref |
Kills WordPress execution and displays HTML page with an error message. This function complements the `die()` PHP function. The difference is that HTML will be displayed to the user. It is recommended to use this function only when the execution should not continue any further. It is not recommended to call this function very often, and try to handle as many errors as possible silently or more gracefully. As a shorthand, the desired HTTP response code may be passed as an integer to the `$title` parameter (the default title would apply) or the `$args` parameter. param: string|WP_Error $message Optional. Error message. If this is a WP_Error object, param: string|int $title Optional. Error title. If `$message` is a `WP_Error` object, param: string|array|int $args { since: 2.0.4 since: 4.1.0 The `$title` and `$args` parameters were changed to optionally accept since: 5.1.0 The `$link_url`, `$link_text`, and `$exit` arguments were added. since: 5.3.0 The `$charset` argument was added. since: 5.5.0 The `$text_direction` argument has a priority over get_language_attributes() |
_default_wp_die_handler( $message, $title = '', $args = array() X-Ref |
Kills WordPress execution and displays HTML page with an error message. This is the default handler for wp_die(). If you want a custom one, you can override this using the {@see 'wp_die_handler'} filter in wp_die(). param: string|WP_Error $message Error message or WP_Error object. param: string $title Optional. Error title. Default empty. param: string|array $args Optional. Arguments to control behavior. Default empty array. since: 3.0.0 |
_ajax_wp_die_handler( $message, $title = '', $args = array() X-Ref |
Kills WordPress execution and displays Ajax response with an error message. This is the handler for wp_die() when processing Ajax requests. param: string $message Error message. param: string $title Optional. Error title (unused). Default empty. param: string|array $args Optional. Arguments to control behavior. Default empty array. since: 3.4.0 |
_json_wp_die_handler( $message, $title = '', $args = array() X-Ref |
Kills WordPress execution and displays JSON response with an error message. This is the handler for wp_die() when processing JSON requests. param: string $message Error message. param: string $title Optional. Error title. Default empty. param: string|array $args Optional. Arguments to control behavior. Default empty array. since: 5.1.0 |
_jsonp_wp_die_handler( $message, $title = '', $args = array() X-Ref |
Kills WordPress execution and displays JSONP response with an error message. This is the handler for wp_die() when processing JSONP requests. param: string $message Error message. param: string $title Optional. Error title. Default empty. param: string|array $args Optional. Arguments to control behavior. Default empty array. since: 5.2.0 |
_xmlrpc_wp_die_handler( $message, $title = '', $args = array() X-Ref |
Kills WordPress execution and displays XML response with an error message. This is the handler for wp_die() when processing XMLRPC requests. param: string $message Error message. param: string $title Optional. Error title. Default empty. param: string|array $args Optional. Arguments to control behavior. Default empty array. since: 3.2.0 |
_xml_wp_die_handler( $message, $title = '', $args = array() X-Ref |
Kills WordPress execution and displays XML response with an error message. This is the handler for wp_die() when processing XML requests. param: string $message Error message. param: string $title Optional. Error title. Default empty. param: string|array $args Optional. Arguments to control behavior. Default empty array. since: 5.2.0 |
_scalar_wp_die_handler( $message = '', $title = '', $args = array() X-Ref |
Kills WordPress execution and displays an error message. This is the handler for wp_die() when processing APP requests. param: string $message Optional. Response to print. Default empty. param: string $title Optional. Error title (unused). Default empty. param: string|array $args Optional. Arguments to control behavior. Default empty array. since: 3.4.0 since: 5.1.0 Added the $title and $args parameters. |
_wp_die_process_input( $message, $title = '', $args = array() X-Ref |
Processes arguments passed to wp_die() consistently for its handlers. param: string|WP_Error $message Error message or WP_Error object. param: string $title Optional. Error title. Default empty. param: string|array $args Optional. Arguments to control behavior. Default empty array. return: array { since: 5.1.0 |
wp_json_encode( $data, $options = 0, $depth = 512 ) X-Ref |
Encode a variable into JSON, with some sanity checks. param: mixed $data Variable (usually an array or object) to encode as JSON. param: int $options Optional. Options to be passed to json_encode(). Default 0. param: int $depth Optional. Maximum depth to walk through $data. Must be return: string|false The JSON encoded string, or false if it cannot be encoded. since: 4.1.0 since: 5.3.0 No longer handles support for PHP < 5.6. |
_wp_json_sanity_check( $data, $depth ) X-Ref |
Perform sanity checks on data that shall be encoded to JSON. param: mixed $data Variable (usually an array or object) to encode as JSON. param: int $depth Maximum depth to walk through $data. Must be greater than 0. return: mixed The sanitized data that shall be encoded to JSON. since: 4.1.0 |
_wp_json_convert_string( $string ) X-Ref |
Convert a string to UTF-8, so that it can be safely encoded to JSON. param: string $string The string which is to be converted. return: string The checked string. since: 4.1.0 |
_wp_json_prepare_data( $data ) X-Ref |
Prepares response data to be serialized to JSON. This supports the JsonSerializable interface for PHP 5.2-5.3 as well. param: mixed $data Native representation. return: bool|int|float|null|string|array Data ready for `json_encode()`. since: 4.4.0 |
wp_send_json( $response, $status_code = null, $options = 0 ) X-Ref |
Send a JSON response back to an Ajax request. param: mixed $response Variable (usually an array or object) to encode as JSON, param: int $status_code Optional. The HTTP status code to output. Default null. param: int $options Optional. Options to be passed to json_encode(). Default 0. since: 3.5.0 since: 4.7.0 The `$status_code` parameter was added. since: 5.6.0 The `$options` parameter was added. |
wp_send_json_success( $data = null, $status_code = null, $options = 0 ) X-Ref |
Send a JSON response back to an Ajax request, indicating success. param: mixed $data Optional. Data to encode as JSON, then print and die. Default null. param: int $status_code Optional. The HTTP status code to output. Default null. param: int $options Optional. Options to be passed to json_encode(). Default 0. since: 3.5.0 since: 4.7.0 The `$status_code` parameter was added. since: 5.6.0 The `$options` parameter was added. |
wp_send_json_error( $data = null, $status_code = null, $options = 0 ) X-Ref |
Send a JSON response back to an Ajax request, indicating failure. If the `$data` parameter is a WP_Error object, the errors within the object are processed and output as an array of error codes and corresponding messages. All other types are output without further processing. param: mixed $data Optional. Data to encode as JSON, then print and die. Default null. param: int $status_code Optional. The HTTP status code to output. Default null. param: int $options Optional. Options to be passed to json_encode(). Default 0. since: 3.5.0 since: 4.1.0 The `$data` parameter is now processed if a WP_Error object is passed in. since: 4.7.0 The `$status_code` parameter was added. since: 5.6.0 The `$options` parameter was added. |
wp_check_jsonp_callback( $callback ) X-Ref |
Checks that a JSONP callback is a valid JavaScript callback name. Only allows alphanumeric characters and the dot character in callback function names. This helps to mitigate XSS attacks caused by directly outputting user input. param: string $callback Supplied JSONP callback function name. return: bool Whether the callback function name is valid. since: 4.6.0 |
wp_json_file_decode( $filename, $options = array() X-Ref |
Reads and decodes a JSON file. param: string $filename Path to the JSON file. param: array $options { return: mixed Returns the value encoded in JSON in appropriate PHP type. since: 5.9.0 |
_config_wp_home( $url = '' ) X-Ref |
Retrieve the WordPress home page URL. If the constant named 'WP_HOME' exists, then it will be used and returned by the function. This can be used to counter the redirection on your local development environment. param: string $url URL for the home location. return: string Homepage location. since: 2.2.0 |
_config_wp_siteurl( $url = '' ) X-Ref |
Retrieve the WordPress site URL. If the constant named 'WP_SITEURL' is defined, then the value in that constant will always be returned. This can be used for debugging a site on your localhost while not having to change the database to your URL. param: string $url URL to set the WordPress site location. return: string The WordPress site URL. since: 2.2.0 |
_delete_option_fresh_site() X-Ref |
Delete the fresh site option. since: 4.7.0 |
_mce_set_direction( $mce_init ) X-Ref |
Set the localized direction for MCE plugin. Will only set the direction to 'rtl', if the WordPress locale has the text direction set to 'rtl'. Fills in the 'directionality' setting, enables the 'directionality' plugin, and adds the 'ltr' button to 'toolbar1', formerly 'theme_advanced_buttons1' array keys. These keys are then returned in the $mce_init (TinyMCE settings) array. param: array $mce_init MCE settings array. return: array Direction set for 'rtl', if needed by locale. since: 2.1.0 |
smilies_init() X-Ref |
Convert smiley code to the icon graphic file equivalent. You can turn off smilies, by going to the write setting screen and unchecking the box, or by setting 'use_smilies' option to false or removing the option. Plugins may override the default smiley list by setting the $wpsmiliestrans to an array, with the key the code the blogger types in and the value the image file. The $wp_smiliessearch global is for the regular expression and is set each time the function is called. The full list of smilies can be found in the function and won't be listed in the description. Probably should create a Codex page for it, so that it is available. since: 2.2.0 |
wp_parse_args( $args, $defaults = array() X-Ref |
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. param: string|array|object $args Value to merge with $defaults. param: array $defaults Optional. Array that serves as the defaults. return: array Merged user defined values with defaults. since: 2.2.0 since: 2.3.0 `$args` can now also be an object. |
wp_parse_list( $list ) X-Ref |
Converts a comma- or space-separated list of scalar values to an array. param: array|string $list List of values. return: array Array of values. since: 5.1.0 |
wp_parse_id_list( $list ) X-Ref |
Cleans up an array, comma- or space-separated list of IDs. param: array|string $list List of IDs. return: int[] Sanitized array of IDs. since: 3.0.0 since: 5.1.0 Refactored to use wp_parse_list(). |
wp_parse_slug_list( $list ) X-Ref |
Cleans up an array, comma- or space-separated list of slugs. param: array|string $list List of slugs. return: string[] Sanitized array of slugs. since: 4.7.0 since: 5.1.0 Refactored to use wp_parse_list(). |
wp_array_slice_assoc( $array, $keys ) X-Ref |
Extract a slice of an array, given a list of keys. param: array $array The original array. param: array $keys The list of keys. return: array The array slice. since: 3.1.0 |
_wp_array_get( $array, $path, $default = null ) X-Ref |
Accesses an array in depth based on a path of keys. It is the PHP equivalent of JavaScript's `lodash.get()` and mirroring it may help other components retain some symmetry between client and server implementations. Example usage: $array = array( 'a' => array( 'b' => array( 'c' => 1, ), ), ); _wp_array_get( $array, array( 'a', 'b', 'c' ) ); param: array $array An array from which we want to retrieve some information. param: array $path An array of keys describing the path with which to retrieve information. param: mixed $default The return value if the path does not exist within the array, return: mixed The value from the path specified. since: 5.6.0 |
_wp_array_set( &$array, $path, $value = null ) X-Ref |
Sets an array in depth based on a path of keys. It is the PHP equivalent of JavaScript's `lodash.set()` and mirroring it may help other components retain some symmetry between client and server implementations. Example usage: $array = array(); _wp_array_set( $array, array( 'a', 'b', 'c', 1 ) ); $array becomes: array( 'a' => array( 'b' => array( 'c' => 1, ), ), ); param: array $array An array that we want to mutate to include a specific value in a path. param: array $path An array of keys describing the path that we want to mutate. param: mixed $value The value that will be set. since: 5.8.0 |
_wp_to_kebab_case( $string ) X-Ref |
This function is trying to replicate what lodash's kebabCase (JS library) does in the client. The reason we need this function is that we do some processing in both the client and the server (e.g.: we generate preset classes from preset slugs) that needs to create the same output. We can't remove or update the client's library due to backward compatibility (some of the output of lodash's kebabCase is saved in the post content). We have to make the server behave like the client. Changes to this function should follow updates in the client with the same logic. param: string $string The string to kebab-case. return: string kebab-cased-string. |
wp_is_numeric_array( $data ) X-Ref |
Determines if the variable is a numeric-indexed array. param: mixed $data Variable to check. return: bool Whether the variable is a list. since: 4.4.0 |
wp_filter_object_list( $list, $args = array() X-Ref |
Filters a list of objects, based on a set of key => value arguments. Retrieves the objects from the list that match the given arguments. Key represents property name, and value represents property value. If an object has more properties than those specified in arguments, that will not disqualify it. When using the 'AND' operator, any missing properties will disqualify it. When using the `$field` argument, this function can also retrieve a particular field from all matching objects, whereas wp_list_filter() only does the filtering. param: array $list An array of objects to filter. param: array $args Optional. An array of key => value arguments to match param: string $operator Optional. The logical operation to perform. 'AND' means param: bool|string $field Optional. A field from the object to place instead return: array A list of objects or object fields. since: 3.0.0 since: 4.7.0 Uses `WP_List_Util` class. |
wp_list_filter( $list, $args = array() X-Ref |
Filters a list of objects, based on a set of key => value arguments. Retrieves the objects from the list that match the given arguments. Key represents property name, and value represents property value. If an object has more properties than those specified in arguments, that will not disqualify it. When using the 'AND' operator, any missing properties will disqualify it. If you want to retrieve a particular field from all matching objects, use wp_filter_object_list() instead. param: array $list An array of objects to filter. param: array $args Optional. An array of key => value arguments to match param: string $operator Optional. The logical operation to perform. 'AND' means return: array Array of found values. since: 3.1.0 since: 4.7.0 Uses `WP_List_Util` class. since: 5.9.0 Converted into a wrapper for `wp_filter_object_list()`. |
wp_list_pluck( $list, $field, $index_key = null ) X-Ref |
Plucks a certain field out of each object or array in an array. This has the same functionality and prototype of array_column() (PHP 5.5) but also supports objects. param: array $list List of objects or arrays. param: int|string $field Field from the object to place instead of the entire object. param: int|string $index_key Optional. Field from the object to use as keys for the new array. return: array Array of found values. If `$index_key` is set, an array of found values with keys since: 3.1.0 since: 4.0.0 $index_key parameter added. since: 4.7.0 Uses `WP_List_Util` class. |
wp_list_sort( $list, $orderby = array() X-Ref |
Sorts an array of objects or arrays based on one or more orderby arguments. param: array $list An array of objects to sort. param: string|array $orderby Optional. Either the field name to order by or an array param: string $order Optional. Either 'ASC' or 'DESC'. Only used if $orderby param: bool $preserve_keys Optional. Whether to preserve keys. Default false. return: array The sorted array. since: 4.7.0 |
wp_maybe_load_widgets() X-Ref |
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. since: 2.2.0 |
wp_widgets_add_menu() X-Ref |
Append the Widgets menu to the themes main menu. since: 2.2.0 since: 5.9.3 Don't specify menu order when the active theme is a block theme. |
wp_ob_end_flush_all() X-Ref |
Flush all output buffers for PHP 5.2. Make sure all output buffers are flushed before our singletons are destroyed. since: 2.2.0 |
dead_db() X-Ref |
Load custom DB error or display WordPress DB error. If a file exists in the wp-content directory named db-error.php, then it will be loaded instead of displaying the WordPress DB error. If it is not found, then the WordPress DB error will be displayed instead. The WordPress DB error sets the HTTP status header to 500 to try to prevent search engines from caching the message. Custom DB messages should do the same. This function was backported to WordPress 2.3.2, but originally was added in WordPress 2.5.0. since: 2.3.2 |
absint( $maybeint ) X-Ref |
Convert a value to non-negative integer. param: mixed $maybeint Data you wish to have converted to a non-negative integer. return: int A non-negative integer. since: 2.5.0 |
_deprecated_function( $function, $version, $replacement = '' ) X-Ref |
Mark a function as deprecated and inform when it has been used. There is a {@see 'hook deprecated_function_run'} that will be called that can be used to get the backtrace up to what file and function called the deprecated function. The current behavior is to trigger a user error if `WP_DEBUG` is true. This function is to be used in every function that is deprecated. param: string $function The function that was called. param: string $version The version of WordPress that deprecated the function. param: string $replacement Optional. The function that should have been called. Default empty. since: 2.5.0 since: 5.4.0 This function is no longer marked as "private". since: 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE). |
_deprecated_constructor( $class, $version, $parent_class = '' ) X-Ref |
Marks a constructor as deprecated and informs when it has been used. Similar to _deprecated_function(), but with different strings. Used to remove PHP4 style constructors. The current behavior is to trigger a user error if `WP_DEBUG` is true. This function is to be used in every PHP4 style constructor method that is deprecated. param: string $class The class containing the deprecated constructor. param: string $version The version of WordPress that deprecated the function. param: string $parent_class Optional. The parent class calling the deprecated constructor. since: 4.3.0 since: 4.5.0 Added the `$parent_class` parameter. since: 5.4.0 This function is no longer marked as "private". since: 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE). |
_deprecated_file( $file, $version, $replacement = '', $message = '' ) X-Ref |
Mark a file as deprecated and inform when it has been used. There is a hook {@see 'deprecated_file_included'} that will be called that can be used to get the backtrace up to what file and function included the deprecated file. The current behavior is to trigger a user error if `WP_DEBUG` is true. This function is to be used in every file that is deprecated. param: string $file The file that was included. param: string $version The version of WordPress that deprecated the file. param: string $replacement Optional. The file that should have been included based on ABSPATH. param: string $message Optional. A message regarding the change. Default empty. since: 2.5.0 since: 5.4.0 This function is no longer marked as "private". since: 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE). |
_deprecated_argument( $function, $version, $message = '' ) X-Ref |
Mark 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. param: string $function The function that was called. param: string $version The version of WordPress that deprecated the argument used. param: string $message Optional. A message regarding the change. Default empty. since: 3.0.0 since: 5.4.0 This function is no longer marked as "private". since: 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE). |
_deprecated_hook( $hook, $version, $replacement = '', $message = '' ) X-Ref |
Marks a deprecated action or filter hook as deprecated and throws a notice. Use the {@see 'deprecated_hook_run'} action to get the backtrace describing where the deprecated hook was called. Default behavior is to trigger a user error if `WP_DEBUG` is true. This function is called by the do_action_deprecated() and apply_filters_deprecated() functions, and so generally does not need to be called directly. param: string $hook The hook that was used. param: string $version The version of WordPress that deprecated the hook. param: string $replacement Optional. The hook that should have been used. Default empty. param: string $message Optional. A message regarding the change. Default empty. since: 4.6.0 since: 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE). |
_doing_it_wrong( $function, $message, $version ) X-Ref |
Mark something as being incorrectly called. There is a hook {@see 'doing_it_wrong_run'} that will be called that can be used to get the backtrace up to what file and function called the deprecated function. The current behavior is to trigger a user error if `WP_DEBUG` is true. param: string $function The function that was called. param: string $message A message explaining what has been done incorrectly. param: string $version The version of WordPress where the message was added. since: 3.1.0 since: 5.4.0 This function is no longer marked as "private". |
is_lighttpd_before_150() X-Ref |
Is the server running earlier than 1.5.0 version of lighttpd? return: bool Whether the server is running lighttpd < 1.5.0. since: 2.5.0 |
apache_mod_loaded( $mod, $default = false ) X-Ref |
Does the specified module exist in the Apache config? param: string $mod The module, e.g. mod_rewrite. param: bool $default Optional. The default return value if the module is not found. Default false. return: bool Whether the specified module is loaded. since: 2.5.0 |
iis7_supports_permalinks() X-Ref |
Check if IIS 7+ supports pretty permalinks. return: bool Whether IIS7 supports permalinks. since: 2.8.0 |
validate_file( $file, $allowed_files = array() X-Ref |
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. param: string $file File path. param: string[] $allowed_files Optional. Array of allowed files. return: int 0 means nothing is wrong, greater than 0 means something was wrong. since: 1.2.0 |
force_ssl_admin( $force = null ) X-Ref |
Whether to force SSL used for the Administration Screens. param: string|bool $force Optional. Whether to force SSL in admin screens. Default null. return: bool True if forced, false if not forced. since: 2.6.0 |
wp_guess_url() X-Ref |
Guess the URL for the site. Will remove wp-admin links to retrieve only return URLs not in the wp-admin directory. return: string The guessed URL. since: 2.6.0 |
wp_suspend_cache_addition( $suspend = null ) X-Ref |
Temporarily suspend cache additions. Stops more data being added to the cache, but still allows cache retrieval. This is useful for actions, such as imports, when a lot of data would otherwise be almost uselessly added to the cache. Suspension lasts for a single page load at most. Remember to call this function again if you wish to re-enable cache adds earlier. param: bool $suspend Optional. Suspends additions if true, re-enables them if false. return: bool The current suspend setting since: 3.3.0 |
wp_suspend_cache_invalidation( $suspend = true ) X-Ref |
Suspend cache invalidation. Turns cache invalidation on and off. Useful during imports where you don't want to do invalidations every time a post is inserted. Callers must be sure that what they are doing won't lead to an inconsistent cache when invalidation is suspended. param: bool $suspend Optional. Whether to suspend or enable cache invalidation. Default true. return: bool The current suspend setting. since: 2.7.0 |
is_main_site( $site_id = null, $network_id = null ) X-Ref |
Determine whether a site is the main site of the current network. param: int $site_id Optional. Site ID to test. Defaults to current site. param: int $network_id Optional. Network ID of the network to check for. return: bool True if $site_id is the main site of the network, or if not since: 3.0.0 since: 4.9.0 The `$network_id` parameter was added. |
get_main_site_id( $network_id = null ) X-Ref |
Gets the main site ID. param: int $network_id Optional. The ID of the network for which to get the main site. return: int The ID of the main site. since: 4.9.0 |
is_main_network( $network_id = null ) X-Ref |
Determine whether a network is the main network of the Multisite installation. param: int $network_id Optional. Network ID to test. Defaults to current network. return: bool True if $network_id is the main network, or if not running Multisite. since: 3.7.0 |
get_main_network_id() X-Ref |
Get the main network ID. return: int The ID of the main network. since: 4.3.0 |
global_terms_enabled() X-Ref |
Determine whether global terms are enabled. return: bool True if multisite and global terms enabled. since: 3.0.0 |
is_site_meta_supported() X-Ref |
Determines whether site meta is enabled. This function checks whether the 'blogmeta' database table exists. The result is saved as a setting for the main network, making it essentially a global setting. Subsequent requests will refer to this setting instead of running the query. return: bool True if site meta is supported, false otherwise. since: 5.1.0 |
wp_timezone_override_offset() X-Ref |
gmt_offset modification for smart timezone handling. Overrides the gmt_offset option if we have a timezone_string available. return: float|false Timezone GMT offset, false otherwise. since: 2.8.0 |
_wp_timezone_choice_usort_callback( $a, $b ) X-Ref |
Sort-helper for timezones. param: array $a param: array $b return: int since: 2.9.0 |
wp_timezone_choice( $selected_zone, $locale = null ) X-Ref |
Gives a nicely-formatted list of timezone strings. param: string $selected_zone Selected timezone. param: string $locale Optional. Locale to load the timezones in. Default current site locale. return: string since: 2.9.0 since: 4.7.0 Added the `$locale` parameter. |
_cleanup_header_comment( $str ) X-Ref |
Strip close comment and close php tags from file headers used by WP. param: string $str Header comment to clean up. return: string since: 2.8.0 |
wp_scheduled_delete() X-Ref |
Permanently delete comments or posts of any type that have held a status of 'trash' for the number of days defined in EMPTY_TRASH_DAYS. The default value of `EMPTY_TRASH_DAYS` is 30 (days). since: 2.9.0 |
get_file_data( $file, $default_headers, $context = '' ) X-Ref |
Retrieve metadata from a file. Searches for metadata in the first 8 KB of a file, such as a plugin or theme. Each piece of metadata must be on its own line. Fields can not span multiple lines, the value will get cut at the end of the first line. If the file data is not within that first 8 KB, then the author should correct their plugin file and move the data headers to the top. param: string $file Absolute path to the file. param: array $default_headers List of headers, in the format `array( 'HeaderKey' => 'Header Name' )`. param: string $context Optional. If specified adds filter hook {@see 'extra_$context_headers'}. return: string[] Array of file header values keyed by header name. since: 2.9.0 |
__return_true() X-Ref |
Returns true. Useful for returning true to filters easily. return: true True. since: 3.0.0 |
__return_false() X-Ref |
Returns false. Useful for returning false to filters easily. return: false False. since: 3.0.0 |
__return_zero() X-Ref |
Returns 0. Useful for returning 0 to filters easily. return: int 0. since: 3.0.0 |
__return_empty_array() X-Ref |
Returns an empty array. Useful for returning an empty array to filters easily. return: array Empty array. since: 3.0.0 |
__return_null() X-Ref |
Returns null. Useful for returning null to filters easily. return: null Null value. since: 3.4.0 |
__return_empty_string() X-Ref |
Returns an empty string. Useful for returning an empty string to filters easily. return: string Empty string. since: 3.7.0 |
send_nosniff_header() X-Ref |
Send a HTTP header to disable content type sniffing in browsers which support it. since: 3.0.0 |
_wp_mysql_week( $column ) X-Ref |
Return a MySQL expression for selecting the week number based on the start_of_week option. param: string $column Database column. return: string SQL clause. since: 3.0.0 |
wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() X-Ref |
Find hierarchy loops using a callback function that maps object IDs to parent IDs. param: callable $callback Function that accepts ( ID, $callback_args ) and outputs parent_ID. param: int $start The ID to start the loop check at. param: int $start_parent The parent_ID of $start to use instead of calling $callback( $start ). param: array $callback_args Optional. Additional arguments to send to $callback. return: array IDs of all members of loop. since: 3.1.0 |
wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array() X-Ref |
Use the "The Tortoise and the Hare" algorithm to detect loops. For every step of the algorithm, the hare takes two steps and the tortoise one. If the hare ever laps the tortoise, there must be a loop. param: callable $callback Function that accepts ( ID, callback_arg, ... ) and outputs parent_ID. param: int $start The ID to start the loop check at. param: array $override Optional. An array of ( ID => parent_ID, ... ) to use instead of $callback. param: array $callback_args Optional. Additional arguments to send to $callback. Default empty array. param: bool $_return_loop Optional. Return loop members or just detect presence of loop? Only set return: mixed Scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if since: 3.1.0 |
send_frame_options_header() X-Ref |
Send a HTTP header to limit rendering of pages to same origin iframes. since: 3.1.3 |
wp_allowed_protocols() X-Ref |
Retrieve a list of protocols to allow in HTML attributes. return: string[] Array of allowed protocols. Defaults to an array containing 'http', 'https', since: 3.3.0 since: 4.3.0 Added 'webcal' to the protocols array. since: 4.7.0 Added 'urn' to the protocols array. since: 5.3.0 Added 'sms' to the protocols array. since: 5.6.0 Added 'irc6' and 'ircs' to the protocols array. |
wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) X-Ref |
Returns a comma-separated string or array of functions that have been called to get to the current point in code. param: string $ignore_class Optional. A class to ignore all function calls within - useful param: int $skip_frames Optional. A number of stack frames to skip - useful for unwinding param: bool $pretty Optional. Whether you want a comma separated string instead of return: string|array Either a string containing a reversed comma separated trace or an array since: 3.4.0 |
_get_non_cached_ids( $object_ids, $cache_key ) X-Ref |
Retrieve IDs that are not already present in the cache. param: int[] $object_ids Array of IDs. param: string $cache_key The cache bucket to check against. return: int[] Array of IDs not present in the cache. since: 3.4.0 |
_device_can_upload() X-Ref |
Test if the current device has the capability to upload files. return: bool Whether the device is able to upload files. since: 3.4.0 |
wp_is_stream( $path ) X-Ref |
Test if a given path is a stream URL param: string $path The resource path or URL. return: bool True if the path is a stream URL. since: 3.5.0 |
wp_checkdate( $month, $day, $year, $source_date ) X-Ref |
Test if the supplied date is valid for the Gregorian calendar. param: int $month Month number. param: int $day Day number. param: int $year Year number. param: string $source_date The date to filter. return: bool True if valid date, false if not valid date. since: 3.5.0 |
wp_auth_check_load() X-Ref |
Load 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 {@see 'wp_auth_check_load'} can be used for fine-grained control. since: 3.6.0 |
wp_auth_check_html() X-Ref |
Output the HTML that shows the wp-login dialog when the user is no longer logged in. since: 3.6.0 |
wp_auth_check( $response ) X-Ref |
Check 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. param: array $response The Heartbeat response. return: array The Heartbeat response with 'wp-auth-check' value set. since: 3.6.0 |
get_tag_regex( $tag ) X-Ref |
Return 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 param: string $tag An HTML tag name. Example: 'video'. return: string Tag RegEx. since: 3.6.0 |
_canonical_charset( $charset ) X-Ref |
Retrieve a canonical form of the provided charset appropriate for passing to PHP functions such as htmlspecialchars() and charset HTML attributes. param: string $charset A charset name. return: string The canonical form of the charset. since: 3.6.0 |
mbstring_binary_safe_encoding( $reset = false ) X-Ref |
Set 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. param: bool $reset Optional. Whether to reset the encoding back to a previously-set encoding. since: 3.7.0 |
reset_mbstring_encoding() X-Ref |
Reset the mbstring internal encoding to a users previously set encoding. since: 3.7.0 |
wp_validate_boolean( $var ) X-Ref |
Filter/validate a variable as a boolean. Alternative to `filter_var( $var, FILTER_VALIDATE_BOOLEAN )`. param: mixed $var Boolean value to validate. return: bool Whether the value is validated. since: 4.0.0 |
wp_delete_file( $file ) X-Ref |
Delete a file param: string $file The path to the file to delete. since: 4.2.0 |
wp_delete_file_from_directory( $file, $directory ) X-Ref |
Deletes a file if its path is within the given directory. param: string $file Absolute path to the file to delete. param: string $directory Absolute path to a directory. return: bool True on success, false on failure. since: 4.9.7 |
wp_post_preview_js() X-Ref |
Outputs a small JS snippet on preview tabs/windows to remove `window.name` on unload. This prevents reusing the same tab for a preview when the user has navigated away. since: 4.3.0 |
mysql_to_rfc3339( $date_string ) X-Ref |
Parses and formats a MySQL datetime (Y-m-d H:i:s) for ISO8601 (Y-m-d\TH:i:s). Explicitly strips timezones, as datetimes are not saved with any timezone information. Including any information on the offset could be misleading. Despite historical function name, the output does not conform to RFC3339 format, which must contain timezone. param: string $date_string Date string to parse and format. return: string Date formatted for ISO8601 without time zone. since: 4.4.0 |
wp_raise_memory_limit( $context = 'admin' ) X-Ref |
Attempts to raise the PHP memory limit for memory intensive processes. Only allows raising the existing limit and prevents lowering it. param: string $context Optional. Context in which the function is called. Accepts either 'admin', return: int|string|false The limit that was set or false on failure. since: 4.6.0 |
wp_generate_uuid4() X-Ref |
Generate a random UUID (version 4). return: string UUID. since: 4.7.0 |
wp_is_uuid( $uuid, $version = null ) X-Ref |
Validates that a UUID is valid. param: mixed $uuid UUID to check. param: int $version Specify which version of UUID to check against. Default is none, return: bool The string is a valid UUID or false on failure. since: 4.9.0 |
wp_unique_id( $prefix = '' ) X-Ref |
Gets unique ID. This is a PHP implementation of Underscore's uniqueId method. A static variable contains an integer that is incremented with each call. This number is returned with the optional prefix. As such the returned value is not universally unique, but it is unique across the life of the PHP process. param: string $prefix Prefix for the returned ID. return: string Unique ID. since: 5.0.3 |
wp_cache_get_last_changed( $group ) X-Ref |
Gets last changed date for the specified cache group. param: string $group Where the cache contents are grouped. return: string UNIX timestamp with microseconds representing when the group was last changed. since: 4.7.0 |
wp_site_admin_email_change_notification( $old_email, $new_email, $option_name ) X-Ref |
Send an email to the old site admin email address when the site admin email address changes. param: string $old_email The old site admin email address. param: string $new_email The new site admin email address. param: string $option_name The relevant database option name. since: 4.9.0 |
wp_privacy_anonymize_ip( $ip_addr, $ipv6_fallback = false ) X-Ref |
Return an anonymized IPv4 or IPv6 address. param: string $ip_addr The IPv4 or IPv6 address to be anonymized. param: bool $ipv6_fallback Optional. Whether to return the original IPv6 address if the needed functions return: string The anonymized IP address. since: 4.9.6 Abstracted from `WP_Community_Events::get_unsafe_client_ip()`. |
wp_privacy_anonymize_data( $type, $data = '' ) X-Ref |
Return uniform "anonymous" data by type. param: string $type The type of data to be anonymized. param: string $data Optional The data to be anonymized. return: string The anonymous data for the requested type. since: 4.9.6 |
wp_privacy_exports_dir() X-Ref |
Returns the directory used to store personal data export files. return: string Exports directory. since: 4.9.6 |
wp_privacy_exports_url() X-Ref |
Returns the URL of the directory used to store personal data export files. return: string Exports directory URL. since: 4.9.6 |
wp_schedule_delete_old_privacy_export_files() X-Ref |
Schedule a `WP_Cron` job to delete expired export files. since: 4.9.6 |
wp_privacy_delete_old_export_files() X-Ref |
Cleans up export files older than three days old. The export files are stored in `wp-content/uploads`, and are therefore publicly accessible. A CSPRN is appended to the filename to mitigate the risk of an unauthorized person downloading the file, but it is still possible. Deleting the file after the data subject has had a chance to delete it adds an additional layer of protection. since: 4.9.6 |
wp_get_update_php_url() X-Ref |
Gets the URL to learn more about updating the PHP version the site is running on. This URL can be overridden by specifying an environment variable `WP_UPDATE_PHP_URL` or by using the {@see 'wp_update_php_url'} filter. Providing an empty string is not allowed and will result in the default URL being used. Furthermore the page the URL links to should preferably be localized in the site language. return: string URL to learn more about updating PHP. since: 5.1.0 |
wp_get_default_update_php_url() X-Ref |
Gets the default URL to learn more about updating the PHP version the site is running on. Do not use this function to retrieve this URL. Instead, use {@see wp_get_update_php_url()} when relying on the URL. This function does not allow modifying the returned URL, and is only used to compare the actually used URL with the default one. return: string Default URL to learn more about updating PHP. since: 5.1.0 |
wp_update_php_annotation( $before = '<p class="description">', $after = '</p>' ) X-Ref |
Prints the default annotation for the web host altering the "Update PHP" page URL. This function is to be used after {@see wp_get_update_php_url()} to display a consistent annotation if the web host has altered the default "Update PHP" page URL. param: string $before Markup to output before the annotation. Default `<p class="description">`. param: string $after Markup to output after the annotation. Default `</p>`. since: 5.1.0 since: 5.2.0 Added the `$before` and `$after` parameters. |
wp_get_update_php_annotation() X-Ref |
Returns the default annotation for the web hosting altering the "Update PHP" page URL. This function is to be used after {@see wp_get_update_php_url()} to return a consistent annotation if the web host has altered the default "Update PHP" page URL. return: string Update PHP page annotation. An empty string if no custom URLs are provided. since: 5.2.0 |
wp_get_direct_php_update_url() X-Ref |
Gets the URL for directly updating the PHP version the site is running on. A URL will only be returned if the `WP_DIRECT_UPDATE_PHP_URL` environment variable is specified or by using the {@see 'wp_direct_php_update_url'} filter. This allows hosts to send users directly to the page where they can update PHP to a newer version. return: string URL for directly updating PHP or empty string. since: 5.1.1 |
wp_direct_php_update_button() X-Ref |
Display 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()`. since: 5.1.1 |
wp_get_update_https_url() X-Ref |
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 {@see '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. return: string URL to learn more about updating to HTTPS. since: 5.7.0 |
wp_get_default_update_https_url() X-Ref |
Gets the default URL to learn more about updating the site to use HTTPS. Do not use this function to retrieve this URL. Instead, use {@see wp_get_update_https_url()} when relying on the URL. This function does not allow modifying the returned URL, and is only used to compare the actually used URL with the default one. return: string Default URL to learn more about updating to HTTPS. since: 5.7.0 |
wp_get_direct_update_https_url() X-Ref |
Gets the URL for directly updating the site to use HTTPS. A URL will only be returned if the `WP_DIRECT_UPDATE_HTTPS_URL` environment variable is specified or by using the {@see 'wp_direct_update_https_url'} filter. This allows hosts to send users directly to the page where they can update their site to use HTTPS. return: string URL for directly updating to HTTPS or empty string. since: 5.7.0 |
get_dirsize( $directory, $max_execution_time = null ) X-Ref |
Get the size of a directory. A helper function that is used primarily to check whether a blog has exceeded its allowed upload space. param: string $directory Full path of a directory. param: int $max_execution_time Maximum time to run before giving up. In seconds. return: int|false|null Size in bytes if a valid directory. False if not. Null if timeout. since: MU (3.0.0) since: 5.2.0 $max_execution_time parameter added. |
recurse_dirsize( $directory, $exclude = null, $max_execution_time = null, &$directory_cache = null ) X-Ref |
Get the size of a directory recursively. Used by get_dirsize() to get a directory size when it contains other directories. param: string $directory Full path of a directory. param: string|string[] $exclude Optional. Full path of a subdirectory to exclude from the total, param: int $max_execution_time Optional. Maximum time to run before giving up. In seconds. param: array $directory_cache Optional. Array of cached directory paths. return: int|false|null Size in bytes if a valid directory. False if not. Null if timeout. since: MU (3.0.0) since: 4.3.0 The `$exclude` parameter was added. since: 5.2.0 The `$max_execution_time` parameter was added. since: 5.6.0 The `$directory_cache` parameter was added. |
clean_dirsize_cache( $path ) X-Ref |
Cleans directory size cache used by recurse_dirsize(). Removes the current directory and all parent directories from the `dirsize_cache` transient. param: string $path Full path of a directory or file. since: 5.6.0 since: 5.9.0 Added input validation with a notice for invalid input. |
is_wp_version_compatible( $required ) X-Ref |
Checks compatibility with the current WordPress version. param: string $required Minimum required WordPress version. return: bool True if required version is compatible or empty, false if not. since: 5.2.0 |
is_php_version_compatible( $required ) X-Ref |
Checks compatibility with the current PHP version. param: string $required Minimum required PHP version. return: bool True if required version is compatible or empty, false if not. since: 5.2.0 |
wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) X-Ref |
Checks if two numbers are nearly the same. This is similar to using `round()` but the precision is more fine-grained. param: int|float $expected The expected value. param: int|float $actual The actual number. param: int|float $precision The allowed variation. return: bool Whether the numbers match within the specified precision. since: 5.3.0 |
wp_recursive_ksort( &$array ) X-Ref |
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. param: array $array The array to sort, passed by reference. since: 6.0.0 |
Generated: Sun Dec 22 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |