Main WordPress API
Converts value to nonnegative integer.
Walks the array while sanitizing the contents.
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().
Does the specified module exist in the Apache config?
Whether input is yes or no. Must be 'y' to be true.
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.
Set the headers for caching for 10 days with JavaScript content type.
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.
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.
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.
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.
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.
Load either Atom comment feed or Atom posts feed.
Load the RDF RSS 0.91 Feed template.
Load the RSS 1.0 Feed Template.
Load either the RSS2 comment feed or the RSS2 posts feed.
Display the robots.txt file content.
The echo content should be with usage of the permalinks or for creating the robots.txt file.
Whether to force SSL used for the Administration Screens.
Whether SSL login should be forced.
Retrieve list of allowed mime types and file extensions.
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.
Retrieve the number of database queries during the WordPress execution.
Retrieve the description for the HTTP status.
Return RegEx body to liberally match an opening HTML tag that:
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
Get the week start and end from the datetime or date string from mysql.
Whether global terms are enabled.
Check if IIS 7 supports pretty permalinks.
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.
Is the server running earlier than 1.5.0 version of lighttpd?
Is main site?
Whether today is a new day.
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.
Check whether serialized data is of string type.
Determine if SSL is used.
Serialize data, if needed.
Unserialize value only if it was serialized.
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.
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.
Convert integer number to format based on the locale.
Test if a give filesystem path is absolute ('/foo/bar', 'c:\windows').
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.
Removes an item or list from the query string.
Send a HTTP header to limit rendering of pages to same origin iframes.
Send a HTTP header to disable content type sniffing in browsers which support it.
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.
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.
Set HTTP status header.
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.
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.
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.
Set up the WordPress query.
Retrieve a list of protocols to allow in HTML attributes.
Extract a slice of an array, given a list of keys.
Check whether a user is still logged in, and act accordingly if not.
Output the HTML that shows the wp-login dialog when the user is no longer logged in
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' );
Test if the supplied date is valid for the Gregorian calendar
Retrieve the file type from the file name.
You can optionally define the mime array, if needed.
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().
Return a comma separated string of functions that have been called to get to the current point in code.
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.
Retrieve the file type based on the extension name.
Filters a list of objects, based on a set of key => value arguments.
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.
Retrieve HTTP Headers from URL.
Retrieve list of mime types and file extensions.
Gets the header information to prevent caching.
The several different headers cover the different ways cache prevention is handled by different browsers
Retrieve original referer that was posted, if it exists.
Retrieve referer from '_wp_http_referer' or HTTP referer. If it's the same as the current request URL, will return false.
Guess the URL for the site.
Will remove wp-admin links to retrieve only return URLs not in the wp-admin directory.
Test if a given path is a stream URL
Determine if a directory is writable.
This function is used to work around certain ACL issues in PHP primarily affecting Windows Servers.
Filters a list of objects, based on a set of key => value arguments.
Pluck a certain field out of each object in a list.
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.
Recursive directory creation based on full path.
Will attempt to set permissions on folders.
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.
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.
Retrieve URL with nonce added to URL query.
Flush all output buffers for PHP 5.2.
Make sure all output buffers are flushed before our singletons our destroyed.
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.
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.
Clean up an array, comma- or space-separated list of IDs.
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.
HTTP request for URI to retrieve content.
Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS.
Send a JSON response back to an Ajax request.
Send a JSON response back to an Ajax request, indicating failure.
Send a JSON response back to an Ajax request, indicating success.
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.
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.
Gives a nicely formatted list of timezone strings.
gmt_offset modification for smart timezone handling.
Overrides the gmt_offset option if we have a timezone_string available.
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.
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.
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.
Append the Widgets menu to the themes main menu.
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.
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.
XMLRPC XML content without title and category elements.
Strip close comment and close php tags from file headers used by WP.
See http://core.trac.wordpress.org/ticket/8497
Retrieve ids that are not already present in the cache
Returns a MySQL expression for selecting the week number based on the start_of_week option.
Returns an empty array.
Useful for returning an empty array to filters easily.
Returns false.
Useful for returning false to filters easily.
Returns null.
Useful for returning null to filters easily.
Returns true.
Useful for returning true to filters easily.
Returns 0.
Useful for returning 0 to filters easily.
Documentation generated on Tue, 18 Jun 2013 23:18:32 +0000 by phpDocumentor 1.4.1