/wp-includes/functions.php

Description

Main WordPress API

Includes
require (ABSPATH.WPINC.'/option.php') (line 8)
Functions
absint (line 2795)

Converts value to nonnegative integer.

  • return: An nonnegative integer
  • since: 2.5.0
int absint (mixed $maybeint)
  • mixed $maybeint: Data you wish to have converted to a nonnegative integer
add_magic_quotes (line 733)

Walks the array while sanitizing the contents.

  • return: Sanitized $array.
  • since: 0.71
array add_magic_quotes (array $array)
  • array $array: Array to walk while sanitizing contents.
add_query_arg (line 638)

Retrieve a modified URL query string.

You can rebuild the URL and append a new query variable to the URL query by using this function. You can also retrieve the full URL with query data.

Adding a single key & value or an associative array. Setting a key value to an empty string removes the key. Omitting oldquery_or_uri uses the $_SERVER value. Additional values provided are expected to be encoded appropriately with urlencode() or rawurlencode().

string add_query_arg (mixed $param1, mixed $param2, mixed $param3)
  • mixed $param1: Either newkey or an associative_array
  • mixed $param2: Either newvalue or oldquery or uri
  • mixed $param3: Optional. Old query or uri
apache_mod_loaded (line 3012)

Does the specified module exist in the Apache config?

  • since: 2.5.0
bool apache_mod_loaded (string $mod, [bool $default = false])
  • string $mod: e.g. mod_rewrite
  • bool $default: The default return value if the module is not found
bool_from_yn (line 980)

Whether input is yes or no. Must be 'y' to be true.

  • return: True if yes, false on anything else
  • since: 1.0.0
bool bool_from_yn (string $yn)
  • string $yn: Character string containing either 'y' or 'n'
build_query (line 586)

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.

string build_query (array $data)
  • array $data: URL-encode key/value pairs.
cache_javascript_headers (line 953)

Set the headers for caching for 10 days with JavaScript content type.

  • since: 2.1.0
void cache_javascript_headers ()
current_time (line 59)

Retrieve the current time based on specified type.

The 'mysql' type will return the time in the format for MySQL DATETIME field. The 'timestamp' type will return the current timestamp.

If $gmt is set to either '1' or 'true', then both types will use GMT time. if $gmt is false, the output is adjusted with the GMT offset in the WordPress option.

  • return: String if $type is 'gmt', int if $type is 'timestamp'.
  • since: 1.0.0
int|string current_time (string $type, [int|bool $gmt = 0])
  • string $type: Either 'mysql' or 'timestamp'.
  • int|bool $gmt: Optional. Whether to use GMT timezone. Default is false.
date_i18n (line 84)

Retrieve the date in localized format, based on timestamp.

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.

string date_i18n (string $dateformatstring, [int $unixtimestamp = false], [bool $gmt = false])
  • string $dateformatstring: Format to display the date.
  • int $unixtimestamp: Optional. Unix timestamp.
  • bool $gmt: Optional, default is false. Whether to convert to GMT for time.
dead_db (line 2752)

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
  • uses: $wpdb
void dead_db ()
do_enclose (line 410)

Check content for video and audio links to add as enclosures.

Will not add enclosures that have already been added and will remove enclosures that are no longer in the post. This is called as pingbacks and trackbacks.

  • since: 1.5.0
  • uses: $wpdb
void do_enclose (string $content, int $post_ID)
  • string $content: Post Content
  • int $post_ID: Post ID
do_feed (line 996)

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.

  • since: 2.1.0
  • uses: do_action() - Calls 'do_feed_$feed' hook, if a hook exists for the feed.
  • uses: $wp_query - Used to tell if the use a comment feed.
void do_feed ()
do_feed_atom (line 1055)

Load either Atom comment feed or Atom posts feed.

  • since: 2.1.0
void do_feed_atom (bool $for_comments)
  • bool $for_comments: True for the comment feed, false for normal feed.
do_feed_rdf (line 1021)

Load the RDF RSS 0.91 Feed template.

  • since: 2.1.0
void do_feed_rdf ()
do_feed_rss (line 1030)

Load the RSS 1.0 Feed Template.

  • since: 2.1.0
void do_feed_rss ()
do_feed_rss2 (line 1041)

Load either the RSS2 comment feed or the RSS2 posts feed.

  • since: 2.1.0
void do_feed_rss2 (bool $for_comments)
  • bool $for_comments: True for the comment feed, false for normal feed.
do_robots (line 1071)

Display the robots.txt file content.

The echo content should be with usage of the permalinks or for creating the robots.txt file.

  • since: 2.1.0
  • uses: do_action() - Calls 'do_robotstxt' hook for displaying robots.txt rules.
void do_robots ()
force_ssl_admin (line 3137)

Whether to force SSL used for the Administration Screens.

  • return: True if forced, false if not forced.
  • since: 2.6.0
bool force_ssl_admin ([string|bool $force = null])
  • string|bool $force
force_ssl_login (line 3117)

Whether SSL login should be forced.

  • return: True if forced, false if not forced.
  • since: 2.6.0
bool force_ssl_login ([string|bool $force = null])
  • string|bool $force: Optional.
get_allowed_mime_types (line 2007)

Retrieve list of allowed mime types and file extensions.

  • return: Array of mime types keyed by the file extension regex corresponding to those types.
  • since: 2.8.6
  • uses: wp_get_upload_mime_types() - to fetch the list of mime types
  • uses: apply_filters() - Calls 'upload_mimes' on returned array
array get_allowed_mime_types ()
get_file_data (line 3533)

Retrieve metadata from a file.

Searches for metadata in the first 8kiB 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 8kiB, then the author should correct their plugin file and move the data headers to the top.

void get_file_data (string $file, array $default_headers, [string $context = ''])
  • string $file: Path to the file
  • array $default_headers: List of headers, in the format array('HeaderKey' => 'Header Name')
  • string $context: If specified adds filter hook "extra_{$context}_headers"
get_num_queries (line 967)

Retrieve the number of database queries during the WordPress execution.

  • return: Number of database queries
  • since: 2.0.0
int get_num_queries ()
get_status_header_desc (line 793)

Retrieve the description for the HTTP status.

  • return: Empty string if not found, or description if found.
  • since: 2.3.0
string get_status_header_desc (int $code)
  • int $code: HTTP status code.
get_tag_regex (line 3988)

Return RegEx body to liberally match 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

  • since: 3.6.0
string get_tag_regex (string $tag)
  • string $tag: An HTML tag name. Example: 'video'
get_temp_dir (line 1412)

Determines a writable directory for temporary files.

Function's preference is the return value of

, 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

  1. WP_TEMP_DIR
constant in your
  1. wp-config.php
file.

  • return: Writable temporary directory
  • since: 2.5.0
string get_temp_dir ()
get_weekstartend (line 205)

Get the week start and end from the datetime or date string from mysql.

  • return: Keys are 'start' and 'end'.
  • since: 0.71
array get_weekstartend (string $mysqlstring, [int $start_of_week = ''])
  • string $mysqlstring: Date or datetime field type from mysql.
  • int $start_of_week: Optional. Start of the week as an integer.
global_terms_enabled (line 3245)

Whether global terms are enabled.

  • return: True if multisite and global terms enabled
  • since: 3.0.0
bool global_terms_enabled ()
iis7_supports_permalinks (line 3039)

Check if IIS 7 supports pretty permalinks.

  • since: 2.8.0
bool iis7_supports_permalinks ()
is_blog_installed (line 1104)

Test whether blog 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 option siteurl for whether WordPress is installed.

  • return: Whether blog is already installed.
  • since: 2.1.0
  • uses: $wpdb
bool is_blog_installed ()
is_lighttpd_before_150 (line 2997)

Is the server running earlier than 1.5.0 version of lighttpd?

  • return: Whether the server is running lighttpd < 1.5.0
  • since: 2.5.0
bool is_lighttpd_before_150 ()
is_main_site (line 3224)

Is main site?

  • return: True if not multisite or $blog_id is main site
  • since: 3.0.0
bool is_main_site ([int $blog_id = ''])
  • int $blog_id: optional blog id to test (default current blog)
is_new_day (line 563)

Whether today is a new day.

  • return: 1 when new day, 0 if not a new day.
  • since: 0.71
  • uses: $previousday - Previous day
  • uses: $day - Today
int is_new_day ()
is_serialized (line 247)

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.

  • return: False if not serialized and true if it was.
  • since: 2.0.5
bool is_serialized (mixed $data)
  • mixed $data: Value to check to see if was serialized.
is_serialized_string (line 286)

Check whether serialized data is of string type.

  • return: False if not a serialized string, true if it is.
  • since: 2.0.5
bool is_serialized_string (mixed $data)
  • mixed $data: Serialized data
is_ssl (line 3097)

Determine if SSL is used.

  • return: True if SSL, false if not used.
  • since: 2.6.0
bool is_ssl ()
maybe_serialize (line 314)

Serialize data, if needed.

  • return: A scalar data
  • since: 2.0.5
mixed maybe_serialize (mixed $data)
  • mixed $data: Data that might be serialized.
maybe_unserialize (line 230)

Unserialize value only if it was serialized.

  • return: Unserialized data can be any type.
  • since: 2.0.0
mixed maybe_unserialize (string $original)
  • string $original: Maybe unserialized original, if is needed.
mysql2date (line 26)

Converts given date string into a different format.

$format should be either a PHP date format string, e.g. 'U' for a Unix timestamp, or 'G' for a Unix timestamp assuming that $date is GMT.

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

  • return: Formatted date string, or Unix timestamp.
  • since: 0.71
string|int mysql2date (string $format, string $date, [bool $translate = true])
  • string $format: Format of the date to return.
  • string $date: Date string to convert.
  • bool $translate: Whether the return date should be translated. Default is true.
nocache_headers (line 925)

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

void nocache_headers ()
number_format_i18n (line 153)

Convert integer number to format based on the locale.

  • return: Converted number in string format.
  • since: 2.3.0
string number_format_i18n (int $number, [int $decimals = 0])
  • int $number: The number to convert based on locale.
  • int $decimals: Precision of the number of decimal places.
path_is_absolute (line 1364)

Test if a give filesystem path is absolute ('/foo/bar', 'c:\windows').

  • return: True if path is absolute, false is not absolute.
  • since: 2.5.0
bool path_is_absolute (string $path)
  • string $path: File path
path_join (line 1391)

Join two filesystem paths together (e.g. 'give me $path relative to $base').

If the $path is absolute, then it the full path is returned.

  • return: The path with the base or absolute path.
  • since: 2.5.0
string path_join (string $base, string $path)
  • string $base
  • string $path
remove_query_arg (line 716)

Removes an item or list from the query string.

  • return: New URL query string.
  • since: 1.5.0
string remove_query_arg (string|array $key, [bool $query = false])
  • string|array $key: Query key or keys to remove.
  • bool $query: When false uses the $_SERVER value.
send_frame_options_header (line 3751)

Send a HTTP header to limit rendering of pages to same origin iframes.

none send_frame_options_header ()
send_nosniff_header (line 3649)

Send a HTTP header to disable content type sniffing in browsers which support it.

none send_nosniff_header ()
size_format (line 180)

Convert number of bytes largest unit bytes will fit into.

It is easier to read 1kB than 1024 bytes and 1MB 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 TB 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.

bool|string size_format (int|string $bytes, [int $decimals = 0])
  • int|string $bytes: Number of bytes. Note max integer size for integers.
  • int $decimals: Precision of number of decimal places. Deprecated.
smilies_init (line 2453)

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
void smilies_init ()
status_header (line 875)

Set HTTP status header.

  • since: 2.0.0
  • uses: apply_filters() - Calls 'status_header' on status header string, HTTP HTTP code, HTTP code description, and protocol string as separate parameters.
unknown status_header (int $header)
  • int $header: HTTP status code
url_is_accessable_via_ssl (line 2810)

Determines if the blog can be accessed over SSL.

Determines if blog can be accessed over SSL by using cURL to access the site using the https in the siteurl. Requires cURL extension to work correctly.

  • return: Whether SSL access is available
  • since: 2.5.0
bool url_is_accessable_via_ssl (string $url)
  • string $url
validate_file (line 3074)

File validates against allowed set of defined rules.

A return value of '1' means that the $file contains either '..' or './'. A return value of '2' means that the $file contains ':' after the first character. A return value of '3' means that the file is not in the allowed files list.

  • return: 0 means nothing is wrong, greater than 0 means something was wrong.
  • since: 1.2.0
  • usedby: validate_file_to_edit()
int validate_file (string $file, [array $allowed_files = ''])
  • string $file: File path.
  • array $allowed_files: List of allowed files.
win_is_writable (line 1474)

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.

bool win_is_writable (string $path)
  • string $path
wp (line 777)

Set up the WordPress query.

  • since: 2.0.0
void wp ([string $query_vars = ''])
  • string $query_vars: Default WP_Query arguments.
wp_allowed_protocols (line 3764)

Retrieve a list of protocols to allow in HTML attributes.

array wp_allowed_protocols ()
wp_array_slice_assoc (line 2593)

Extract a slice of an array, given a list of keys.

  • return: The array slice
  • since: 3.1.0
array wp_array_slice_assoc (array $array, array $keys)
  • array $array: The original array
  • array $keys: The list of keys
wp_auth_check (line 3964)

Check whether a user is still logged in, and act accordingly if not.

  • since: 3.6.0
void wp_auth_check ( $response,  $data)
  • $response
  • $data
wp_auth_check_html (line 3923)

Output the HTML that shows the wp-login dialog when the user is no longer logged in

void wp_auth_check_html ()
wp_auth_check_load (line 3897)

Load the auth check for monitoring whether the user is still logged in.

Can be disabled with remove_action( 'admin_init', 'wp_auth_check_load' );

  • since: 3.6.0
void wp_auth_check_load ()
wp_checkdate (line 3885)

Test if the supplied date is valid for the Gregorian calendar

  • return: true|false
  • since: 3.5.0
bool wp_checkdate ( $month,  $day,  $year,  $source_date)
  • $month
  • $day
  • $year
  • $source_date
wp_check_filetype (line 1809)

Retrieve the file type from the file name.

You can optionally define the mime array, if needed.

  • return: Values with extension first and mime type.
  • since: 2.0.4
array wp_check_filetype (string $filename, [array $mimes = null])
  • string $filename: File name or path.
  • array $mimes: Optional. Key is the file extension with value as the mime type.
wp_check_filetype_and_ext (line 1843)

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 validating images known to getimagesize().

array wp_check_filetype_and_ext (string $file, string $filename, [array $mimes = null])
  • string $file: Full path to the image.
  • string $filename: The filename of the image (may differ from $file due to $file being in a tmp directory)
  • array $mimes: Optional. Key is the file extension with value as the mime type.
wp_debug_backtrace_summary (line 3786)

Return a comma separated string of functions that have been called to get to the current point in code.

string|array wp_debug_backtrace_summary ([string $ignore_class = null], [int $skip_frames = 0], [bool $pretty = true])
  • string $ignore_class: A class to ignore all function calls within - useful when you want to just give info about the callee
  • int $skip_frames: A number of stack frames to skip - useful for unwinding back to the source of the issue
  • bool $pretty: Whether or not you want a comma separated string or raw array returned
wp_die (line 2052)

Kill WordPress execution and display HTML message with 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.

void wp_die ([string $message = ''], [string $title = ''], [string|array $args = array()])
  • string $message: Error message.
  • string $title: Error title.
  • string|array $args: Optional arguments to control behavior.
wp_ext2type (line 1782)

Retrieve the file type based on the extension name.

  • return: The file type, example: audio, video, document, spreadsheet, etc. Null if not found.
  • since: 2.5.0
  • uses: apply_filters() - Calls 'ext2type' hook on default supported types.
string|null wp_ext2type (string $ext)
  • string $ext: The extension to search.
wp_filter_object_list (line 2614)

Filters a list of objects, based on a set of key => value arguments.

  • return: A list of objects or object fields
  • since: 3.0.0
array wp_filter_object_list (array $list, [array $args = array()], [string $operator = 'and'], [bool|string $field = false])
  • array $list: An array of objects to filter
  • array $args: An array of key => value arguments to match against each object
  • string $operator: The logical operation to perform. 'or' means only one element from the array needs to match; 'and' means all elements must match. The default is 'and'.
  • bool|string $field: A field from the object to place instead of the entire object
wp_get_http (line 491)

Perform a HTTP HEAD or GET request.

If $file_path is a writable filename, this will do a GET request and write the file to that path.

  • return: False on failure and string of headers if HEAD request.
  • since: 2.5.0
bool|string wp_get_http (string $url, [string|bool $file_path = false], [int $red = 1])
  • string $url: URL to fetch.
  • string|bool $file_path: Optional. File path to write request to.
  • int $red: (private) The number of Redirects followed, Upon 5 being hit, returns false.
wp_get_http_headers (line 542)

Retrieve HTTP Headers from URL.

  • return: False on failure, headers on success.
  • since: 1.5.1
bool|string wp_get_http_headers (string $url, [bool $deprecated = false])
  • string $url
  • bool $deprecated: Not Used.
wp_get_mime_types (line 1905)

Retrieve list of mime types and file extensions.

  • return: Array of mime types keyed by the file extension regex corresponding to those types.
  • since: 3.5.0
  • uses: apply_filters() - Calls 'mime_types' on returned array. This filter should be used to add types, not remove them. To remove types use the upload_mimes filter.
array wp_get_mime_types ()
wp_get_nocache_headers (line 902)

Gets the header information to prevent caching.

The several different headers cover the different ways cache prevention is handled by different browsers

array wp_get_nocache_headers ()
wp_get_original_referer (line 1299)

Retrieve original referer that was posted, if it exists.

  • return: False if no original referer or original referer if set.
  • since: 2.0.4
string|bool wp_get_original_referer ()
wp_get_referer (line 1278)

Retrieve referer from '_wp_http_referer' or HTTP referer. If it's the same as the current request URL, will return false.

  • return: False on failure. Referer URL on success.
  • since: 2.0.4
string|bool wp_get_referer ()
wp_guess_url (line 3159)

Guess the URL for the site.

Will remove wp-admin links to retrieve only return URLs not in the wp-admin directory.

  • since: 2.6.0
string wp_guess_url ()
wp_is_stream (line 3871)

Test if a given path is a stream URL

  • return: True if the path is a stream URL
bool wp_is_stream (string $path)
  • string $path: The resource path or URL
wp_is_writable (line 1451)

Determine if a directory is writable.

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

bool wp_is_writable (string $path)
  • string $path
wp_list_filter (line 2640)

Filters a list of objects, based on a set of key => value arguments.

  • since: 3.1.0
array wp_list_filter (array $list, [array $args = array()], [string $operator = 'AND'])
  • array $list: An array of objects to filter
  • array $args: An array of key => value arguments to match against each object
  • string $operator: The logical operation to perform: 'AND' means all elements from the array must match; 'OR' means only one element needs to match; 'NOT' means no elements may match. The default is 'AND'.
wp_list_pluck (line 2679)

Pluck a certain field out of each object in a list.

  • since: 3.1.0
array wp_list_pluck (array $list, int|string $field)
  • array $list: A list of objects or arrays
  • int|string $field: A field from the object to place instead of the entire object
wp_maybe_load_widgets (line 2699)

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
  • uses: add_action() - Calls '_admin_menu' hook with 'wp_widgets_add_menu' value.
void wp_maybe_load_widgets ()
wp_mkdir_p (line 1315)

Recursive directory creation based on full path.

Will attempt to set permissions on folders.

  • return: Whether the path was created. True if path already exists.
  • since: 2.0.1
bool wp_mkdir_p (string $target)
  • string $target: Full path to attempt to create.
wp_nonce_ays (line 2023)

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.

  • since: 2.0.4
void wp_nonce_ays (string $action)
  • string $action: The nonce action.
wp_nonce_field (line 1209)

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.

string wp_nonce_field ([string $action = -1], [string $name = &quot;_wpnonce&quot;], [bool $referer = true], [bool $echo = true])
  • string $action: Optional. Action name.
  • string $name: Optional. Nonce name.
  • bool $referer: Optional, default true. Whether to set the referer field for validation.
  • bool $echo: Optional, default true. Whether to display or return hidden form field.
wp_nonce_url (line 1176)

Retrieve URL with nonce added to URL query.

  • return: URL with nonce action added.
  • since: 2.0.4
  • usedby: wp_logout_url() - To protect against CSRF.
string wp_nonce_url (string $actionurl, [string $action = -1], [string $name = '_wpnonce'])
  • string $actionurl: URL to add nonce action.
  • string $action: Optional. Nonce action name.
  • string $name: Optional. Nonce name.
wp_ob_end_flush_all (line 2729)

Flush all output buffers for PHP 5.2.

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

  • since: 2.2.0
void wp_ob_end_flush_all ()
wp_original_referer_field (line 1258)

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.

  • return: Original referer field.
  • since: 2.0.4
string wp_original_referer_field ([bool $echo = true], [string $jump_back_to = 'current'])
  • bool $echo: Whether to echo the original http referer
  • string $jump_back_to: Optional, default is 'current'. Can be 'previous' or page you want to jump back to.
wp_parse_args (line 2556)

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

array wp_parse_args (string|array $args, [array $defaults = ''])
  • string|array $args: Value to merge with $defaults
  • array $defaults: Array that serves as the defaults.
wp_parse_id_list (line 2577)

Clean up an array, comma- or space-separated list of IDs.

  • return: Sanitized array of IDs
  • since: 3.0.0
array wp_parse_id_list (array|string $list)
  • array|string $list
wp_referer_field (line 1235)

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.

  • return: Referer field.
  • since: 2.0.4
string wp_referer_field ([bool $echo = true])
  • bool $echo: Whether to echo or return the referer field.
wp_remote_fopen (line 753)

HTTP request for URI to retrieve content.

  • return: HTTP content. False on failure.
  • since: 1.5.1
  • uses: wp_remote_get()
bool|string wp_remote_fopen (string $uri)
  • string $uri: URI/URL of web page to retrieve.
wp_scheduled_delete (line 3476)

Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS.

  • since: 2.9.0
void wp_scheduled_delete ()
wp_send_json (line 2324)

Send a JSON response back to an Ajax request.

  • since: 3.5.0
void wp_send_json (mixed $response)
  • mixed $response: Variable (usually an array or object) to encode as JSON, then print and die.
wp_send_json_error (line 2356)

Send a JSON response back to an Ajax request, indicating failure.

  • since: 3.5.0
void wp_send_json_error ([mixed $data = null])
  • mixed $data: Data to encode as JSON, then print and die.
wp_send_json_success (line 2340)

Send a JSON response back to an Ajax request, indicating success.

  • since: 3.5.0
void wp_send_json_success ([mixed $data = null])
  • mixed $data: Data to encode as JSON, then print and die.
wp_suspend_cache_addition (line 3185)

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.

  • return: The current suspend setting
  • since: 3.3.0
bool wp_suspend_cache_addition ([bool $suspend = null])
  • bool $suspend: Optional. Suspends additions if true, re-enables them if false.
wp_suspend_cache_invalidation (line 3206)

Suspend cache invalidation.

Turns cache invalidation on and off. Useful during imports where you don't wont 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: The current suspend setting
  • since: 2.7.0
bool wp_suspend_cache_invalidation ([bool $suspend = true])
  • bool $suspend: Whether to suspend or enable cache invalidation
wp_timezone_choice (line 3337)

Gives a nicely formatted list of timezone strings.

  • since: 2.9.0
string wp_timezone_choice (string $selected_zone)
  • string $selected_zone: Selected Zone
wp_timezone_override_offset (line 3269)

gmt_offset modification for smart timezone handling.

Overrides the gmt_offset option if we have a timezone_string available.

  • since: 2.8.0
float|bool wp_timezone_override_offset ()
wp_unique_filename (line 1648)

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 is passed three parameters, the first one is the directory, the second is the filename, and the third is the extension.

string wp_unique_filename (string $dir, string $filename, [mixed $unique_filename_callback = null])
  • string $dir
  • string $filename
  • mixed $unique_filename_callback: Callback.
wp_upload_bits (line 1716)

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.

  • since: 2.0.0
array wp_upload_bits (string $name, null $deprecated, mixed $bits, [string $time = null])
  • string $name
  • null $deprecated: Never used. Set to null.
  • mixed $bits: File content
  • string $time: Optional. Time formatted in 'yyyy/mm'.
wp_upload_dir (line 1525)

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

On success, the returned array will have many indices: 'path' - base directory and sub directory or full path to upload directory. 'url' - base url and sub directory or absolute URL to upload directory. 'subdir' - sub directory if uploads use year/month folders option is on. 'basedir' - path without subdir. 'baseurl' - URL path without subdir. 'error' - set to false.

array wp_upload_dir ([string $time = null])
  • string $time: Optional. Time formatted in 'yyyy/mm'.
wp_widgets_add_menu (line 2712)

Append the Widgets menu to the themes main menu.

  • since: 2.2.0
  • uses: $submenu - The administration submenu list.
void wp_widgets_add_menu ()
xmlrpc_getpostcategory (line 367)

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.

  • return: List of categories or category name.
  • since: 0.71
string|array xmlrpc_getpostcategory (string $content)
  • string $content: XMLRPC XML Request content
xmlrpc_getposttitle (line 341)

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.

  • return: Post title
  • since: 0.71
string xmlrpc_getposttitle (string $content)
  • string $content: XMLRPC XML Request content
xmlrpc_removepostdata (line 388)

XMLRPC XML content without title and category elements.

  • return: XMLRPC XML Request content without title and category elements.
  • since: 0.71
string xmlrpc_removepostdata (string $content)
  • string $content: XMLRPC XML Request content
_cleanup_header_comment (line 3467)

Strip close comment and close php tags from file headers used by WP.

See http://core.trac.wordpress.org/ticket/8497

string _cleanup_header_comment (string $str)
  • string $str
_get_non_cached_ids (line 3830)

Retrieve ids that are not already present in the cache

  • since: 3.4.0
array _get_non_cached_ids (array $object_ids, string $cache_key)
  • array $object_ids: ID list
  • string $cache_key: The cache bucket to check against
_http_build_query (line 591)
void _http_build_query ( $data, [ $prefix = null], [ $sep = null], [ $key = ''], [ $urlencode = true])
  • $data
  • $prefix
  • $sep
  • $key
  • $urlencode
_wp_mysql_week (line 3661)

Returns a MySQL expression for selecting the week number based on the start_of_week option.

  • since: 3.0.0
string _wp_mysql_week (string $column)
  • string $column
_wp_timezone_choice_usort_callback (line 3291)
  • since: 2.9.0
int _wp_timezone_choice_usort_callback (unknown_type $a, unknown_type $b)
  • unknown_type $a
  • unknown_type $b
__return_empty_array (line 3624)

Returns an empty array.

Useful for returning an empty array to filters easily.

array __return_empty_array ()
__return_false (line 3598)

Returns false.

Useful for returning false to filters easily.

bool __return_false ()
__return_null (line 3636)

Returns null.

Useful for returning null to filters easily.

  • since: 3.4.0
null __return_null ()
__return_true (line 3585)

Returns true.

Useful for returning true to filters easily.

bool __return_true ()
__return_zero (line 3611)

Returns 0.

Useful for returning 0 to filters easily.

int __return_zero ()

Documentation generated on Tue, 18 Jun 2013 23:18:32 +0000 by phpDocumentor 1.4.1