[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> functions.php (summary)

Main WordPress API

File Size: 9087 lines (283 kb)
Included or required: 4 times
Referenced: 0 times
Includes or requires: 5 files
 wp-includes/default-widgets.php
 wp-admin/includes/file.php
 wp-includes/option.php
 wp-includes/version.php
 wp-includes/class-IXR.php

Defines 210 functions

  mysql2date()
  current_time()
  current_datetime()
  wp_timezone_string()
  wp_timezone()
  date_i18n()
  wp_date()
  wp_maybe_decline_date()
  number_format_i18n()
  size_format()
  human_readable_duration()
  get_weekstartend()
  maybe_serialize()
  maybe_unserialize()
  is_serialized()
  is_serialized_string()
  xmlrpc_getposttitle()
  xmlrpc_getpostcategory()
  xmlrpc_removepostdata()
  wp_extract_urls()
  do_enclose()
  wp_get_http_headers()
  is_new_day()
  build_query()
  _http_build_query()
  add_query_arg()
  remove_query_arg()
  wp_removable_query_args()
  add_magic_quotes()
  wp_remote_fopen()
  wp()
  get_status_header_desc()
  status_header()
  wp_get_nocache_headers()
  nocache_headers()
  cache_javascript_headers()
  get_num_queries()
  bool_from_yn()
  do_feed()
  do_feed_rdf()
  do_feed_rss()
  do_feed_rss2()
  do_feed_atom()
  do_robots()
  do_favicon()
  is_blog_installed()
  wp_nonce_url()
  wp_nonce_field()
  wp_referer_field()
  wp_original_referer_field()
  wp_get_referer()
  wp_get_raw_referer()
  wp_get_original_referer()
  wp_mkdir_p()
  path_is_absolute()
  path_join()
  wp_normalize_path()
  get_temp_dir()
  wp_is_writable()
  win_is_writable()
  wp_get_upload_dir()
  wp_upload_dir()
  _wp_upload_dir()
  wp_unique_filename()
  _wp_check_alternate_file_names()
  _wp_check_existing_file_names()
  wp_upload_bits()
  wp_ext2type()
  wp_get_default_extension_for_mime_type()
  wp_check_filetype()
  wp_check_filetype_and_ext()
  wp_get_image_mime()
  wp_get_mime_types()
  wp_get_ext_types()
  wp_filesize()
  get_allowed_mime_types()
  wp_nonce_ays()
  wp_die()
  _default_wp_die_handler()
  _ajax_wp_die_handler()
  _json_wp_die_handler()
  _jsonp_wp_die_handler()
  _xmlrpc_wp_die_handler()
  _xml_wp_die_handler()
  _scalar_wp_die_handler()
  _wp_die_process_input()
  wp_json_encode()
  _wp_json_sanity_check()
  _wp_json_convert_string()
  _wp_json_prepare_data()
  wp_send_json()
  wp_send_json_success()
  wp_send_json_error()
  wp_check_jsonp_callback()
  wp_json_file_decode()
  _config_wp_home()
  _config_wp_siteurl()
  _delete_option_fresh_site()
  _mce_set_direction()
  wp_is_serving_rest_request()
  smilies_init()
  wp_parse_args()
  wp_parse_list()
  wp_parse_id_list()
  wp_parse_slug_list()
  wp_array_slice_assoc()
  wp_recursive_ksort()
  _wp_array_get()
  _wp_array_set()
  _wp_to_kebab_case()
  wp_is_numeric_array()
  wp_filter_object_list()
  wp_list_filter()
  wp_list_pluck()
  wp_list_sort()
  wp_maybe_load_widgets()
  wp_widgets_add_menu()
  wp_ob_end_flush_all()
  dead_db()
  _deprecated_function()
  _deprecated_constructor()
  _deprecated_class()
  _deprecated_file()
  _deprecated_argument()
  _deprecated_hook()
  _doing_it_wrong()
  wp_trigger_error()
  is_lighttpd_before_150()
  apache_mod_loaded()
  iis7_supports_permalinks()
  validate_file()
  force_ssl_admin()
  wp_guess_url()
  wp_suspend_cache_addition()
  wp_suspend_cache_invalidation()
  is_main_site()
  get_main_site_id()
  is_main_network()
  get_main_network_id()
  is_site_meta_supported()
  wp_timezone_override_offset()
  _wp_timezone_choice_usort_callback()
  wp_timezone_choice()
  _cleanup_header_comment()
  wp_scheduled_delete()
  get_file_data()
  __return_true()
  __return_false()
  __return_zero()
  __return_empty_array()
  __return_null()
  __return_empty_string()
  send_nosniff_header()
  _wp_mysql_week()
  wp_find_hierarchy_loop()
  wp_find_hierarchy_loop_tortoise_hare()
  send_frame_options_header()
  wp_allowed_protocols()
  wp_debug_backtrace_summary()
  _get_non_cached_ids()
  _validate_cache_id()
  _device_can_upload()
  wp_is_stream()
  wp_checkdate()
  wp_auth_check_load()
  wp_auth_check_html()
  wp_auth_check()
  get_tag_regex()
  is_utf8_charset()
  _canonical_charset()
  mbstring_binary_safe_encoding()
  reset_mbstring_encoding()
  wp_validate_boolean()
  wp_delete_file()
  wp_delete_file_from_directory()
  wp_post_preview_js()
  mysql_to_rfc3339()
  wp_raise_memory_limit()
  wp_generate_uuid4()
  wp_is_uuid()
  wp_unique_id()
  wp_unique_prefixed_id()
  wp_cache_get_last_changed()
  wp_cache_set_last_changed()
  wp_site_admin_email_change_notification()
  wp_privacy_anonymize_ip()
  wp_privacy_anonymize_data()
  wp_privacy_exports_dir()
  wp_privacy_exports_url()
  wp_schedule_delete_old_privacy_export_files()
  wp_privacy_delete_old_export_files()
  wp_get_update_php_url()
  wp_get_default_update_php_url()
  wp_update_php_annotation()
  wp_get_update_php_annotation()
  wp_get_direct_php_update_url()
  wp_direct_php_update_button()
  wp_get_update_https_url()
  wp_get_default_update_https_url()
  wp_get_direct_update_https_url()
  get_dirsize()
  recurse_dirsize()
  clean_dirsize_cache()
  wp_get_wp_version()
  is_wp_version_compatible()
  is_php_version_compatible()
  wp_fuzzy_number_match()
  wp_get_admin_notice()
  wp_admin_notice()
  wp_is_heic_image_mime_type()

Functions
Functions that are not part of a class:

mysql2date( $format, $date, $translate = true )   X-Ref
Converts given MySQL date string into a different format.

- `$format` should be a PHP date format string.
- 'U' and 'G' formats will return an integer sum of timestamp with timezone offset.
- `$date` is expected to be local time in MySQL format (`Y-m-d H:i:s`).

Historically UTC time could be passed to the function to produce Unix timestamp.

If `$translate` is true then the given date and format string will
be passed to `wp_date()` for translation.

return: string|int|false Integer if `$format` is 'U' or 'G', string otherwise.
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.

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.

return: int|string Integer if `$type` is 'timestamp' or 'U', string otherwise.
param: string   $type Type of time to retrieve. Accepts 'mysql', 'timestamp', 'U',
param: int|bool $gmt  Optional. Whether to use GMT timezone. Default false.

current_datetime()   X-Ref
Retrieves the current time as an object using the site's timezone.

return: DateTimeImmutable Date and time object.

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.

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.

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.

return: string The date, translated if locale specifies it.
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

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.

return: string|false The date, translated if locale specifies it. False on invalid timestamp input.
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

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.

return: string The date, declined if locale specifies it.
param: string $date   Formatted date string.
param: string $format Optional. Date format to check. Default empty string.

number_format_i18n( $number, $decimals = 0 )   X-Ref
Converts float number to format based on the locale.

return: string Converted number in string format.
param: float $number   The number to convert based on locale.
param: int   $decimals Optional. Precision of the number of decimal places. Default 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.

return: string|false Number string on success, false on failure.
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.

human_readable_duration( $duration = '' )   X-Ref
Converts a duration to human readable format.

return: string|false A human readable duration string, false on failure.
param: string $duration Duration will be in string format (HH:ii:ss) OR (ii:ss),

get_weekstartend( $mysqlstring, $start_of_week = '' )   X-Ref
Gets the week start and end from the datetime or date string from MySQL.

return: int[] {
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.

maybe_serialize( $data )   X-Ref
Serializes data, if needed.

return: mixed A scalar data.
param: string|array|object $data Data that might be serialized.

maybe_unserialize( $data )   X-Ref
Unserializes data only if it was serialized.

return: mixed Unserialized data can be any type.
param: string $data Data that might be unserialized.

is_serialized( $data, $strict = true )   X-Ref
Checks value to find if it was serialized.

If $data is not a string, then returned value will always be false.
Serialized data is always a string.

return: bool False if not serialized and true if it was.
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.

is_serialized_string( $data )   X-Ref
Checks whether serialized data is of string type.

return: bool False if not a serialized string, true if it is.
param: string $data Serialized data.

xmlrpc_getposttitle( $content )   X-Ref
Retrieves post title from XMLRPC XML.

If the title element is not part of the XML, then the default post title from
the $post_default_title will be used instead.

return: string Post title
param: string $content XMLRPC XML Request content

xmlrpc_getpostcategory( $content )   X-Ref
Retrieves 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.

return: string|array List of categories or category name.
param: string $content XMLRPC XML Request content

xmlrpc_removepostdata( $content )   X-Ref
XMLRPC XML content without title and category elements.

return: string XMLRPC XML Request content without title and category elements.
param: string $content XML-RPC XML Request content.

wp_extract_urls( $content )   X-Ref
Uses RegEx to extract URLs from arbitrary content.

return: string[] Array of URLs found in passed string.
param: string $content Content to extract URLs from.

do_enclose( $content, $post )   X-Ref
No description

wp_get_http_headers( $url, $deprecated = false )   X-Ref
Retrieves HTTP Headers from URL.

return: \WpOrg\Requests\Utility\CaseInsensitiveDictionary|false Headers on success, false on failure.
param: string $url        URL to retrieve HTTP headers from.
param: bool   $deprecated Not Used.

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.

build_query( $data )   X-Ref
Builds URL query based on an associative and, or indexed array.

This is a convenient function for easily building url queries. It sets the
separator to '&' and uses _http_build_query() function.

return: string URL-encoded string.
param: array $data URL-encode key/value pairs.

_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).

return: string The query string.
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 string.
param: bool         $urlencode Optional. Whether to use urlencode() in the result. Default true.

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.

return: string New URL query string (unescaped).
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.

remove_query_arg( $key, $query = false )   X-Ref
Removes an item or items from a query string.

Important: The return value of remove_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.

return: string New URL 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.

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.

add_magic_quotes( $input_array )   X-Ref
Walks the array while sanitizing the contents.

return: array Sanitized $input_array.
param: array $input_array Array to walk while sanitizing contents.

wp_remote_fopen( $uri )   X-Ref
HTTP request for URI to retrieve content.

return: string|false HTTP content. False on failure.
param: string $uri URI/URL of web page to retrieve.

wp( $query_vars = '' )   X-Ref
Sets up the WordPress query.

param: string|array $query_vars Default WP_Query arguments.

get_status_header_desc( $code )   X-Ref
Retrieves the description for the HTTP status.

return: string Status description if found, an empty string otherwise.
param: int $code HTTP status code.

status_header( $code, $description = '' )   X-Ref
Sets HTTP status header.

param: int    $code        HTTP status code.
param: string $description Optional. A custom description for the HTTP status.

wp_get_nocache_headers()   X-Ref
Gets the HTTP 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.

nocache_headers()   X-Ref
Sets the HTTP 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.


cache_javascript_headers()   X-Ref
Sets the HTTP headers for caching for 10 days with JavaScript content type.


get_num_queries()   X-Ref
Retrieves the number of database queries during the WordPress execution.

return: int Number of database queries.

bool_from_yn( $yn )   X-Ref
Determines whether input is yes or no.

Must be 'y' to be true.

return: bool True if 'y', false on anything else.
param: string $yn Character string containing either 'y' (yes) or 'n' (no).

do_feed()   X-Ref
Loads the feed template from the use of an action hook.

If the feed action does not have a hook, then the function will die with a
message telling the visitor that the feed is not valid.

It is better to only have one hook for each feed.


do_feed_rdf()   X-Ref
Loads the RDF RSS 0.91 Feed template.


do_feed_rss()   X-Ref
Loads the RSS 1.0 Feed Template.


do_feed_rss2( $for_comments )   X-Ref
Loads either the RSS2 comment feed or the RSS2 posts feed.

param: bool $for_comments True for the comment feed, false for normal feed.

do_feed_atom( $for_comments )   X-Ref
Loads either Atom comment feed or Atom posts feed.

param: bool $for_comments True for the comment feed, false for normal feed.

do_robots()   X-Ref
Displays the default robots.txt file content.


do_favicon()   X-Ref
Displays the favicon.ico file content.


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.

wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' )   X-Ref
Retrieves URL with nonce added to URL query.

return: string Escaped URL with nonce action added.
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'.

wp_nonce_field( $action = -1, $name = '_wpnonce', $referer = true, $display = true )   X-Ref
Retrieves or display nonce hidden field for forms.

The nonce field is used to validate that the contents of the form came from
the location on the current site and not somewhere else. The nonce does not
offer absolute protection, but should protect against most cases. It is very
important to use nonce field in forms.

The $action and $name are optional, but if you want to have better security,
it is strongly suggested to set those two parameters. It is easier to just
call the function without any parameters, because validation of the nonce
doesn't require any parameters, but since crackers know what the default is
it won't be difficult for them to find a way around your nonce and cause
damage.

The input name will be whatever $name value you gave. The input value will be
the nonce creation value.

return: string Nonce field HTML markup.
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       $display Optional. Whether to display or return hidden form field. Default true.

wp_referer_field( $display = true )   X-Ref
Retrieves or displays referer hidden field for forms.

The referer link is the current Request URI from the server super global. The
input name is '_wp_http_referer', in case you wanted to check manually.

return: string Referer field HTML markup.
param: bool $display Optional. Whether to echo or return the referer field. Default true.

wp_original_referer_field( $display = true, $jump_back_to = 'current' )   X-Ref
Retrieves or displays original referer hidden field for forms.

The input name is '_wp_original_http_referer' and will be either the same
value of wp_referer_field(), if that was posted already or it will be the
current page, if it doesn't exist.

return: string Original referer field.
param: bool   $display      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.

wp_get_referer()   X-Ref
Retrieves 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.

wp_get_raw_referer()   X-Ref
Retrieves unvalidated referer from the '_wp_http_referer' URL query variable or the HTTP referer.

If the value of the '_wp_http_referer' URL query variable is not a string then it will be ignored.

Do not use for redirects, use wp_get_referer() instead.

return: string|false Referer URL on success, false on failure.

wp_get_original_referer()   X-Ref
Retrieves original referer that was posted, if it exists.

return: string|false Original referer URL on success, false on failure.

wp_mkdir_p( $target )   X-Ref
Recursive directory creation based on full path.

Will attempt to set permissions on folders.

return: bool Whether the path was created. True if path already exists.
param: string $target Full path to attempt to create.

path_is_absolute( $path )   X-Ref
Tests if a given filesystem path is absolute.

For example, '/foo/bar', or 'c:\windows'.

return: bool True if path is absolute, false is not absolute.
param: string $path File path.

path_join( $base, $path )   X-Ref
Joins two filesystem paths together.

For example, 'give me $path relative to $base'. If the $path is absolute,
then it the full path is returned.

return: string The path with the base or absolute path.
param: string $base Base path.
param: string $path Path relative to $base.

wp_normalize_path( $path )   X-Ref
Normalizes a filesystem path.

On windows systems, replaces backslashes with forward slashes
and forces upper-case drive letters.
Allows for two leading slashes for Windows network shares, but
ensures that all other duplicate slashes are reduced to a single.

return: string Normalized path.
param: string $path Path to normalize.

get_temp_dir()   X-Ref
Determines 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.

wp_is_writable( $path )   X-Ref
Determines if a directory is writable.

This function is used to work around certain ACL issues in PHP primarily
affecting Windows Servers.

return: bool Whether the path is writable.
param: string $path Path to check for write-ability.

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 interpret the OS ACL.

return: bool Whether the path is writable.
param: string $path Windows path to check for write-ability.

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.

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.

return: array {
param: string|null $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.

_wp_upload_dir( $time = null )   X-Ref
A non-filtered, non-cached version of wp_upload_dir() that doesn't check the path.

return: array See wp_upload_dir()
param: string|null $time Optional. Time formatted in 'yyyy/mm'. Default null.

wp_unique_filename( $dir, $filename, $unique_filename_callback = null )   X-Ref
Gets a filename that is sanitized and unique for the given directory.

If the filename is not unique, then a number will be added to the filename
before the extension, and will continue adding numbers until the filename
is unique.

The callback function allows the caller to use their own method to create
unique file names. If defined, the callback should take three arguments:
- directory, base filename, and extension - and return a unique filename.

return: string New filename, if given wasn't unique.
param: string   $dir                      Directory.
param: string   $filename                 File name.
param: callable $unique_filename_callback Callback. Default null.

_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.

return: bool True if the tested file name could match an existing file, false otherwise.
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.

_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.

return: bool True if the tested file name could match an existing file, false otherwise.
param: string $filename The file name to check.
param: array  $files    An array of existing files in the directory.

wp_upload_bits( $name, $deprecated, $bits, $time = null )   X-Ref
Creates a file in the upload folder with given content.

If there is an error, then the key 'error' will exist with the error message.
If success, then the key 'file' will have the unique file path, the 'url' key
will have the link to the new file. and the 'error' key will be set to false.

This function will not move an uploaded file to the upload folder. It will
create a new file with the content in $bits parameter. If you move the upload
file, read the content of the uploaded file, and then you can give the
filename and content to this function, which will add it to the upload
folder.

The permissions will be set on the new file automatically by this function.

return: array {
param: string      $name       Filename.
param: null|string $deprecated Never used. Set to null.
param: string      $bits       File content
param: string|null $time       Optional. Time formatted in 'yyyy/mm'. Default null.

wp_ext2type( $ext )   X-Ref
Retrieves the file type based on the extension name.

return: string|void The file type, example: audio, video, document, spreadsheet, etc.
param: string $ext The extension to search.

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().

return: string|false
param: string $mime_type

wp_check_filetype( $filename, $mimes = null )   X-Ref
Retrieves the file type from the file name.

You can optionally define the mime array, if needed.

return: array {
param: string        $filename File name or path.
param: string[]|null $mimes    Optional. Array of allowed mime types keyed by their file extension regex.

wp_check_filetype_and_ext( $file, $filename, $mimes = null )   X-Ref
Attempts to determine the real file type of a file.

If unable to, the file name extension will be used to determine type.

If it's determined that the extension does not match the file's real type,
then the "proper_filename" value will be set with a proper filename and extension.

Currently this function only supports renaming images validated via wp_get_image_mime().

return: array {
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[]|null $mimes    Optional. Array of allowed mime types keyed by their file extension regex.

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.

return: string|false The actual mime type or false if the type cannot be determined.
param: string $file Full path to the file.

wp_get_mime_types()   X-Ref
Retrieves the list of mime types and file extensions.

return: string[] Array of mime types keyed by the file extension regex corresponding to those types.

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.

wp_filesize( $path )   X-Ref
Wrapper for PHP filesize with filters and casting the result as an integer.

return: int The size of the file in bytes, or 0 in the event of an error.
param: string $path Path to the file.

get_allowed_mime_types( $user = null )   X-Ref
Retrieves the list of allowed mime types and file extensions.

return: string[] Array of mime types keyed by the file extension regex corresponding
param: int|WP_User $user Optional. User to check. Defaults to current user.

wp_nonce_ays( $action )   X-Ref
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.

param: string $action The nonce action.

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 {

_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 string.
param: string|array    $args    Optional. Arguments to control behavior. Default empty array.

_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 string.
param: string|array $args    Optional. Arguments to control behavior. Default empty array.

_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 string.
param: string|array $args    Optional. Arguments to control behavior. Default empty array.

_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 string.
param: string|array $args    Optional. Arguments to control behavior. Default empty array.

_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 string.
param: string|array $args    Optional. Arguments to control behavior. Default empty array.

_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 string.
param: string|array $args    Optional. Arguments to control behavior. Default empty array.

_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 string.
param: string       $title   Optional. Error title (unused). Default empty string.
param: string|array $args    Optional. Arguments to control behavior. Default empty array.

_wp_die_process_input( $message, $title = '', $args = array()   X-Ref
Processes arguments passed to wp_die() consistently for its handlers.

return: array {
param: string|WP_Error $message Error message or WP_Error object.
param: string          $title   Optional. Error title. Default empty string.
param: string|array    $args    Optional. Arguments to control behavior. Default empty array.

wp_json_encode( $value, $flags = 0, $depth = 512 )   X-Ref
Encodes a variable into JSON, with some confidence checks.

return: string|false The JSON encoded string, or false if it cannot be encoded.
param: mixed $value Variable (usually an array or object) to encode as JSON.
param: int   $flags Optional. Options to be passed to json_encode(). Default 0.
param: int   $depth Optional. Maximum depth to walk through $value. Must be

_wp_json_sanity_check( $value, $depth )   X-Ref
Performs confidence checks on data that shall be encoded to JSON.

return: mixed The sanitized data that shall be encoded to JSON.
param: mixed $value Variable (usually an array or object) to encode as JSON.
param: int   $depth Maximum depth to walk through $value. Must be greater than 0.

_wp_json_convert_string( $input_string )   X-Ref
Converts a string to UTF-8, so that it can be safely encoded to JSON.

return: string The checked string.
param: string $input_string The string which is to be converted.

_wp_json_prepare_data( $value )   X-Ref
Prepares response data to be serialized to JSON.

This supports the JsonSerializable interface for PHP 5.2-5.3 as well.

return: bool|int|float|null|string|array Data ready for `json_encode()`.
param: mixed $value Native representation.

wp_send_json( $response, $status_code = null, $flags = 0 )   X-Ref
Sends 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   $flags       Optional. Options to be passed to json_encode(). Default 0.

wp_send_json_success( $value = null, $status_code = null, $flags = 0 )   X-Ref
Sends a JSON response back to an Ajax request, indicating success.

param: mixed $value       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   $flags       Optional. Options to be passed to json_encode(). Default 0.

wp_send_json_error( $value = null, $status_code = null, $flags = 0 )   X-Ref
Sends a JSON response back to an Ajax request, indicating failure.

If the `$value` 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 $value       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   $flags       Optional. Options to be passed to json_encode(). Default 0.

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.

return: bool Whether the callback function name is valid.
param: string $callback Supplied JSONP callback function name.

wp_json_file_decode( $filename, $options = array()   X-Ref
Reads and decodes a JSON file.

return: mixed Returns the value encoded in JSON in appropriate PHP type.
param: string $filename Path to the JSON file.
param: array  $options  {

_config_wp_home( $url = '' )   X-Ref
Retrieves the WordPress home page URL.

If the constant named 'WP_HOME' exists, then it will be used and returned
by the function. This can be used to counter the redirection on your local
development environment.

return: string Homepage location.
param: string $url URL for the home location.

_config_wp_siteurl( $url = '' )   X-Ref
Retrieves 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.

return: string The WordPress site URL.
param: string $url URL to set the WordPress site location.

_delete_option_fresh_site()   X-Ref
Deletes the fresh site option.


_mce_set_direction( $mce_init )   X-Ref
Sets the localized direction for MCE plugin.

Will only set the direction to 'rtl', if the WordPress locale has
the text direction set to 'rtl'.

Fills in the 'directionality' setting, enables the 'directionality'
plugin, and adds the 'ltr' button to 'toolbar1', formerly
'theme_advanced_buttons1' array keys. These keys are then returned
in the $mce_init (TinyMCE settings) array.

return: array Direction set for 'rtl', if needed by locale.
param: array $mce_init MCE settings array.

wp_is_serving_rest_request()   X-Ref
Determines whether WordPress is currently serving a REST API request.

The function relies on the 'REST_REQUEST' global. As such, it only returns true when an actual REST _request_ is
being made. It does not return true when a REST endpoint is hit as part of another request, e.g. for preloading a
REST response. See {@see wp_is_rest_endpoint()} for that purpose.

This function should not be called until the {@see 'parse_request'} action, as the constant is only defined then,
even for an actual REST request.

return: bool True if it's a WordPress REST API request, false otherwise.

smilies_init()   X-Ref
Converts 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.


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.

return: array Merged user defined values with defaults.
param: string|array|object $args     Value to merge with $defaults.
param: array               $defaults Optional. Array that serves as the defaults.

wp_parse_list( $input_list )   X-Ref
Converts a comma- or space-separated list of scalar values to an array.

return: array Array of values.
param: array|string $input_list List of values.

wp_parse_id_list( $input_list )   X-Ref
Cleans up an array, comma- or space-separated list of IDs.

return: int[] Sanitized array of IDs.
param: array|string $input_list List of IDs.

wp_parse_slug_list( $input_list )   X-Ref
Cleans up an array, comma- or space-separated list of slugs.

return: string[] Sanitized array of slugs.
param: array|string $input_list List of slugs.

wp_array_slice_assoc( $input_array, $keys )   X-Ref
Extracts a slice of an array, given a list of keys.

return: array The array slice.
param: array $input_array The original array.
param: array $keys        The list of keys.

wp_recursive_ksort( &$input_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 behavior of `ksort()`.

param: array $input_array The array to sort, passed by reference.

_wp_array_get( $input_array, $path, $default_value = 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:

$input_array = array(
'a' => array(
'b' => array(
'c' => 1,
),
),
);
_wp_array_get( $input_array, array( 'a', 'b', 'c' ) );

return: mixed The value from the path specified.
param: array $input_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_value Optional. The return value if the path does not exist within the array,

_wp_array_set( &$input_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:

$input_array = array();
_wp_array_set( $input_array, array( 'a', 'b', 'c', 1 ) );

$input_array becomes:
array(
'a' => array(
'b' => array(
'c' => 1,
),
),
);

param: array $input_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.

_wp_to_kebab_case( $input_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.

return: string kebab-cased-string.
param: string $input_string The string to kebab-case.

wp_is_numeric_array( $data )   X-Ref
Determines if the variable is a numeric-indexed array.

return: bool Whether the variable is a list.
param: mixed $data Variable to check.

wp_filter_object_list( $input_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.

return: array A list of objects or object fields.
param: array       $input_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

wp_list_filter( $input_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.

return: array Array of found values.
param: array  $input_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

wp_list_pluck( $input_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.

return: array Array of found values. If `$index_key` is set, an array of found values with keys
param: array      $input_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.

wp_list_sort( $input_list, $orderby = array()   X-Ref
Sorts an array of objects or arrays based on one or more orderby arguments.

return: array The sorted array.
param: array        $input_list    An array of objects or arrays 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.

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.


wp_widgets_add_menu()   X-Ref
Appends the Widgets menu to the themes main menu.


wp_ob_end_flush_all()   X-Ref
Flushes all output buffers for PHP 5.2.

Make sure all output buffers are flushed before our singletons are destroyed.


dead_db()   X-Ref
Loads custom DB error or display WordPress DB error.

If a file exists in the wp-content directory named db-error.php, then it will
be loaded instead of displaying the WordPress DB error. If it is not found,
then the WordPress DB error will be displayed instead.

The WordPress DB error sets the HTTP status header to 500 to try to prevent
search engines from caching the message. Custom DB messages should do the
same.

This function was backported to WordPress 2.3.2, but originally was added
in WordPress 2.5.0.


_deprecated_function( $function_name, $version, $replacement = '' )   X-Ref
Marks a function as deprecated and inform when it has been used.

There is a {@see 'deprecated_function_run'} hook 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_name 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 string.

_deprecated_constructor( $class_name, $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_name   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.

_deprecated_class( $class_name, $version, $replacement = '' )   X-Ref
Marks a class as deprecated and informs when it has been used.

There is a {@see 'deprecated_class_run'} hook that will be called that can be used
to get the backtrace up to what file and function called the deprecated class.

The current behavior is to trigger a user error if `WP_DEBUG` is true.

This function is to be used in the class constructor for every deprecated class.
See {@see _deprecated_constructor()} for deprecating PHP4-style constructors.

param: string $class_name  The name of the class being instantiated.
param: string $version     The version of WordPress that deprecated the class.
param: string $replacement Optional. The class or function that should have been called.

_deprecated_file( $file, $version, $replacement = '', $message = '' )   X-Ref
Marks a file as deprecated and inform when it has been used.

There is a {@see 'deprecated_file_included'} hook 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 string.

_deprecated_argument( $function_name, $version, $message = '' )   X-Ref
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 {@see 'deprecated_argument_run'} hook 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_name 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 string.

_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 string.
param: string $message     Optional. A message regarding the change. Default empty.

_doing_it_wrong( $function_name, $message, $version )   X-Ref
Marks something as being incorrectly called.

There is a {@see 'doing_it_wrong_run'} hook 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_name 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.

wp_trigger_error( $function_name, $message, $error_level = E_USER_NOTICE )   X-Ref
Generates a user-level error/warning/notice/deprecation message.

Generates the message when `WP_DEBUG` is true.

param: string $function_name The function that triggered the error.
param: string $message       The message explaining the error.
param: int    $error_level   Optional. The designated error type for this error.

is_lighttpd_before_150()   X-Ref
Determines whether the server is running an earlier than 1.5.0 version of lighttpd.

return: bool Whether the server is running lighttpd < 1.5.0.

apache_mod_loaded( $mod, $default_value = false )   X-Ref
Determines whether the specified module exist in the Apache config.

return: bool Whether the specified module is loaded.
param: string $mod           The module, e.g. mod_rewrite.
param: bool   $default_value Optional. The default return value if the module is not found. Default false.

iis7_supports_permalinks()   X-Ref
Checks if IIS 7+ supports pretty permalinks.

return: bool Whether IIS7 supports permalinks.

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.

return: int 0 means nothing is wrong, greater than 0 means something was wrong.
param: string   $file          File path.
param: string[] $allowed_files Optional. Array of allowed files. Default empty array.

force_ssl_admin( $force = null )   X-Ref
Determines whether to force SSL used for the Administration Screens.

return: bool True if forced, false if not forced.
param: string|bool $force Optional. Whether to force SSL in admin screens. Default null.

wp_guess_url()   X-Ref
Guesses 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.

wp_suspend_cache_addition( $suspend = null )   X-Ref
Temporarily suspends cache additions.

Stops more data being added to the cache, but still allows cache retrieval.
This is useful for actions, such as imports, when a lot of data would otherwise
be almost uselessly added to the cache.

Suspension lasts for a single page load at most. Remember to call this
function again if you wish to re-enable cache adds earlier.

return: bool The current suspend setting.
param: bool $suspend Optional. Suspends additions if true, re-enables them if false.

wp_suspend_cache_invalidation( $suspend = true )   X-Ref
Suspends 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.

return: bool The current suspend setting.
param: bool $suspend Optional. Whether to suspend or enable cache invalidation. Default true.

is_main_site( $site_id = null, $network_id = null )   X-Ref
Determines whether a site is the main site of the current network.

return: bool True if $site_id is the main site of the network, or if not
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.

get_main_site_id( $network_id = null )   X-Ref
Gets the main site ID.

return: int The ID of the main site.
param: int $network_id Optional. The ID of the network for which to get the main site.

is_main_network( $network_id = null )   X-Ref
Determines whether a network is the main network of the Multisite installation.

return: bool True if $network_id is the main network, or if not running Multisite.
param: int $network_id Optional. Network ID to test. Defaults to current network.

get_main_network_id()   X-Ref
Gets the main network ID.

return: int The ID of the main network.

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.

wp_timezone_override_offset()   X-Ref
Modifies gmt_offset for smart timezone handling.

Overrides the gmt_offset option if we have a timezone_string available.

return: float|false Timezone GMT offset, false otherwise.

_wp_timezone_choice_usort_callback( $a, $b )   X-Ref
Sort-helper for timezones.

return: int
param: array $a
param: array $b

wp_timezone_choice( $selected_zone, $locale = null )   X-Ref
Gives a nicely-formatted list of timezone strings.

return: string
param: string $selected_zone Selected timezone.
param: string $locale        Optional. Locale to load the timezones in. Default current site locale.

_cleanup_header_comment( $str )   X-Ref
Strips close comment and close php tags from file headers used by WP.

return: string
param: string $str Header comment to clean up.

wp_scheduled_delete()   X-Ref
Permanently deletes comments or posts of any type that have held a status
of 'trash' for the number of days defined in EMPTY_TRASH_DAYS.

The default value of `EMPTY_TRASH_DAYS` is 30 (days).


get_file_data( $file, $default_headers, $context = '' )   X-Ref
Retrieves metadata from a file.

Searches for metadata in the first 8 KB of a file, such as a plugin or theme.
Each piece of metadata must be on its own line. Fields can not span multiple
lines, the value will get cut at the end of the first line.

If the file data is not within that first 8 KB, then the author should correct
their plugin file and move the data headers to the top.

return: string[] Array of file header values keyed by header name.
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_true()   X-Ref
Returns true.

Useful for returning true to filters easily.

return: true True.

__return_false()   X-Ref
Returns false.

Useful for returning false to filters easily.

return: false False.

__return_zero()   X-Ref
Returns 0.

Useful for returning 0 to filters easily.

return: int 0.

__return_empty_array()   X-Ref
Returns an empty array.

Useful for returning an empty array to filters easily.

return: array Empty array.

__return_null()   X-Ref
Returns null.

Useful for returning null to filters easily.

return: null Null value.

__return_empty_string()   X-Ref
Returns an empty string.

Useful for returning an empty string to filters easily.

return: string Empty string.

send_nosniff_header()   X-Ref
Sends a HTTP header to disable content type sniffing in browsers which support it.


_wp_mysql_week( $column )   X-Ref
Returns a MySQL expression for selecting the week number based on the start_of_week option.

return: string SQL clause.
param: string $column Database column.

wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array()   X-Ref
Finds hierarchy loops using a callback function that maps object IDs to parent IDs.

return: array IDs of all members of loop.
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. Default empty array.

wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array()   X-Ref
Uses 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.

return: mixed Scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if
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

send_frame_options_header()   X-Ref
Sends a HTTP header to limit rendering of pages to same origin iframes.


wp_allowed_protocols()   X-Ref
Retrieves a list of protocols to allow in HTML attributes.

return: string[] Array of allowed protocols. Defaults to an array containing 'http', 'https',

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.

return: string|array Either a string containing a reversed comma separated trace or an array
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

_get_non_cached_ids( $object_ids, $cache_group )   X-Ref
Retrieves IDs that are not already present in the cache.

return: int[] Array of IDs not present in the cache.
param: int[]  $object_ids  Array of IDs.
param: string $cache_group The cache group to check against.

_validate_cache_id( $object_id )   X-Ref
Checks whether the given cache ID is either an integer or an integer-like string.

Both `16` and `"16"` are considered valid, other numeric types and numeric strings
(`16.3` and `"16.3"`) are considered invalid.

return: bool Whether the given $object_id is a valid cache ID.
param: mixed $object_id The cache ID to validate.

_device_can_upload()   X-Ref
Tests if the current device has the capability to upload files.

return: bool Whether the device is able to upload files.

wp_is_stream( $path )   X-Ref
Tests if a given path is a stream URL

return: bool True if the path is a stream URL.
param: string $path The resource path or URL.

wp_checkdate( $month, $day, $year, $source_date )   X-Ref
Tests if the supplied date is valid for the Gregorian calendar.

return: bool True if valid date, false if not valid date.
param: int    $month       Month number.
param: int    $day         Day number.
param: int    $year        Year number.
param: string $source_date The date to filter.

wp_auth_check_load()   X-Ref
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 {@see 'wp_auth_check_load'} can be used
for fine-grained control.


wp_auth_check_html()   X-Ref
Outputs the HTML that shows the wp-login dialog when the user is no longer logged in.


wp_auth_check( $response )   X-Ref
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.

return: array The Heartbeat response with 'wp-auth-check' value set.
param: array $response  The Heartbeat response.

get_tag_regex( $tag )   X-Ref
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

return: string Tag RegEx.
param: string $tag An HTML tag name. Example: 'video'.

is_utf8_charset( $blog_charset = null )   X-Ref
Indicates if a given slug for a character set represents the UTF-8
text encoding. If not provided, examines the current blog's charset.

A charset is considered to represent UTF-8 if it is a case-insensitive
match of "UTF-8" with or without the hyphen.

Example:

true  === is_utf8_charset( 'UTF-8' );
true  === is_utf8_charset( 'utf8' );
false === is_utf8_charset( 'latin1' );
false === is_utf8_charset( 'UTF 8' );

// Only strings match.
false === is_utf8_charset( [ 'charset' => 'utf-8' ] );

// Without a given charset, it depends on the site option "blog_charset".
$is_utf8 = is_utf8_charset();

return: bool Whether the slug represents the UTF-8 encoding.
param: string|null $blog_charset Optional. Slug representing a text character encoding, or "charset".

_canonical_charset( $charset )   X-Ref
Retrieves a canonical form of the provided charset appropriate for passing to PHP
functions such as htmlspecialchars() and charset HTML attributes.

return: string The canonical form of the charset.
param: string $charset A charset name, e.g. "UTF-8", "Windows-1252", "SJIS".

mbstring_binary_safe_encoding( $reset = false )   X-Ref
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.

param: bool $reset Optional. Whether to reset the encoding back to a previously-set encoding.

reset_mbstring_encoding()   X-Ref
Resets the mbstring internal encoding to a users previously set encoding.


wp_validate_boolean( $value )   X-Ref
Filters/validates a variable as a boolean.

Alternative to `filter_var( $value, FILTER_VALIDATE_BOOLEAN )`.

return: bool Whether the value is validated.
param: mixed $value Boolean value to validate.

wp_delete_file( $file )   X-Ref
Deletes a file.

return: bool True on success, false on failure.
param: string $file The path to the file to delete.

wp_delete_file_from_directory( $file, $directory )   X-Ref
Deletes a file if its path is within the given directory.

return: bool True on success, false on failure.
param: string $file      Absolute path to the file to delete.
param: string $directory Absolute path to a directory.

wp_post_preview_js()   X-Ref
Outputs a small JS snippet on preview tabs/windows to remove `window.name` when a user is navigating to another page.

This prevents reusing the same tab for a preview when the user has navigated away.


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.

return: string Date formatted for ISO8601 without time zone.
param: string $date_string Date string to parse and format.

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.

return: int|string|false The limit that was set or false on failure.
param: string $context Optional. Context in which the function is called. Accepts either 'admin',

wp_generate_uuid4()   X-Ref
Generates a random UUID (version 4).

return: string UUID.

wp_is_uuid( $uuid, $version = null )   X-Ref
Validates that a UUID is valid.

return: bool The string is a valid UUID or false on failure.
param: mixed $uuid    UUID to check.
param: int   $version Specify which version of UUID to check against. Default is none,

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.

return: string Unique ID.
param: string $prefix Prefix for the returned ID.

wp_unique_prefixed_id( $prefix = '' )   X-Ref
Generates an incremental ID that is independent per each different prefix.

It is similar to `wp_unique_id`, but each prefix has its own internal ID
counter to make each prefix independent from each other. The ID starts at 1
and increments on each call. The returned value is not universally unique,
but it is unique across the life of the PHP process and it's stable per
prefix.

return: string Incremental ID per prefix.
param: string $prefix Optional. Prefix for the returned ID. Default empty string.

wp_cache_get_last_changed( $group )   X-Ref
Gets last changed date for the specified cache group.

return: string UNIX timestamp with microseconds representing when the group was last changed.
param: string $group Where the cache contents are grouped.

wp_cache_set_last_changed( $group )   X-Ref
Sets last changed date for the specified cache group to now.

return: string UNIX timestamp when the group was last changed.
param: string $group Where the cache contents are grouped.

wp_site_admin_email_change_notification( $old_email, $new_email, $option_name )   X-Ref
Sends 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.

wp_privacy_anonymize_ip( $ip_addr, $ipv6_fallback = false )   X-Ref
Returns an anonymized IPv4 or IPv6 address.

return: string  The anonymized IP 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

wp_privacy_anonymize_data( $type, $data = '' )   X-Ref
Returns uniform "anonymous" data by type.

return: string The anonymous data for the requested type.
param: string $type The type of data to be anonymized.
param: string $data Optional. The data to be anonymized. Default empty string.

wp_privacy_exports_dir()   X-Ref
Returns the directory used to store personal data export files.

return: string Exports directory.

wp_privacy_exports_url()   X-Ref
Returns the URL of the directory used to store personal data export files.

return: string Exports directory URL.

wp_schedule_delete_old_privacy_export_files()   X-Ref
Schedules a `WP_Cron` job to delete expired export files.


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.


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.

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.

wp_update_php_annotation( $before = '<p class="description">', $after = '</p>', $display = true )   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.

return: string|void
param: string $before  Markup to output before the annotation. Default `<p class="description">`.
param: string $after   Markup to output after the annotation. Default `</p>`.
param: bool   $display Whether to echo or return the markup. Default `true` for echo.

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.

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.

wp_direct_php_update_button()   X-Ref
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()`.


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.

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.

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.

get_dirsize( $directory, $max_execution_time = null )   X-Ref
Gets the size of a directory.

A helper function that is used primarily to check whether
a blog has exceeded its allowed upload space.

return: int|false|null Size in bytes if a valid directory. False if not. Null if timeout.
param: string $directory Full path of a directory.
param: int    $max_execution_time Maximum time to run before giving up. In seconds.

recurse_dirsize( $directory, $exclude = null, $max_execution_time = null, &$directory_cache = null )   X-Ref
Gets the size of a directory recursively.

Used by get_dirsize() to get a directory size when it contains other directories.

return: int|false|null Size in bytes if a valid directory. False if not. Null if timeout.
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.

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.

wp_get_wp_version()   X-Ref
Returns the current WordPress version.

Returns an unmodified value of `$wp_version`. Some plugins modify the global
in an attempt to improve security through obscurity. This practice can cause
errors in WordPress, so the ability to get an unmodified version is needed.

return: string The current WordPress version.

is_wp_version_compatible( $required )   X-Ref
Checks compatibility with the current WordPress version.

return: bool True if required version is compatible or empty, false if not.
param: string $required Minimum required WordPress version.

is_php_version_compatible( $required )   X-Ref
Checks compatibility with the current PHP version.

return: bool True if required version is compatible or empty, false if not.
param: string $required Minimum required PHP version.

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.

return: bool Whether the numbers match within the specified precision.
param: int|float $expected  The expected value.
param: int|float $actual    The actual number.
param: int|float $precision Optional. The allowed variation. Default 1.

wp_get_admin_notice( $message, $args = array()   X-Ref
Creates and returns the markup for an admin notice.

return: string The markup for an admin notice.
param: string $message The message.
param: array  $args {

wp_admin_notice( $message, $args = array()   X-Ref
Outputs an admin notice.

param: string $message The message to output.
param: array  $args {

wp_is_heic_image_mime_type( $mime_type )   X-Ref
Checks if a mime type is for a HEIC/HEIF image.

return: bool Whether the mime type is for a HEIC/HEIF image.
param: string $mime_type The mime type to check.



Generated : Sun Dec 22 08:20:01 2024 Cross-referenced by PHPXref