Other Functions (category)

get_oembed_response_data_for_url()

Retrieves the oEmbed response data for a given URL.

wp_get_development_mode()

Retrieves the current development mode.

wp_is_development_mode()

Checks whether the site is in the given development mode.

Helper Functions

__return_empty_array()

Simply returns an empty array: array(). Helper function of WordPress.

__return_empty_string()

Simply returns an empty string:". Helper function of WordPress.

__return_false()

Simply returns false. Helper function of WordPress.

__return_null()

Simply returns null. Auxiliary function of WordPress.

__return_true()

Simply returns true. Helper function of WordPress.

__return_zero()

Simply returns 0. Helper function of WordPress. Useful for use in filters.

array_key_first()

Get the first key of the given array without affecting the internal array pointer.

array_key_last()

Get the last key of the given array without affecting the internal array pointer.

block_core_social_link_services()

Returns the SVG for social link.

build_query()

Build URL query based on an associative and, or indexed array.

get_page_hierarchy()

Order the pages with children under parents in a flat list.

get_self_link()

Returns the link for the currently displayed feed.

human_readable_duration()

Convert a duration in format HH:ii:ss or ii:ss to human readable format.

map_deep()

Applies the specified function to the values of the passed array/object/string/number. It's a recursive function.

maybe_serialize()

Serialize data, if needed.

maybe_unserialize()

Unserialize data only if it was serialized or returns the original value.

path_join()

Join two filesystem paths together. If the second parameter is an absolute path (starts with a slash), then only it will be returned.

str_contains()

Performs a case-sensitive check indicating if needle is contained in haystack.

str_ends_with()

Performs a case-sensitive check indicating if the haystack ends with needle.

str_starts_with()

Performs a case-sensitive check indicating if the haystack begins with needle.

stripslashes_deep()

Navigates through an array, object, or scalar, and removes slashes from the values.

timer_float()

Get the time elapsed so far during this PHP script.

timer_stop()

Retrieve or display the time from the page start to when function is called.

urlencode_deep()

Navigates through an array, object, or scalar, and encodes the values to be used in a URL.

wp_array_slice_assoc()

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

wp_basename()

i18n friendly version of basename()

wp_debug_backtrace_summary()

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

wp_extract_urls()

Use RegEx to extract URLs from arbitrary content.

wp_filter_object_list()

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

wp_get_list_item_separator()

Retrieves the list item separator based on the locale.

wp_html_split()

Separate HTML elements and comments from the text.

wp_is_jsonp_request()

Checks whether current request is a JSONP request, or is expecting a JSONP response.

wp_json_encode()

Encode a variable into JSON, with some sanity checks. Checks strings and translates them to UTF-8.

wp_json_file_decode()

Reads and decodes a JSON file.

wp_kses_array_lc()

Translates all keys of the specified array to lowercase (ABC to abc). Keys of nested arrays are also processed.

wp_kses_hair()

Builds an attribute list from string containing attributes.

wp_kses_uri_attributes()

Helper function listing HTML attributes containing a URL.

wp_list_filter()

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

wp_list_pluck()

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

wp_list_sort()

Sorts a list of objects, based on one or more orderby arguments.

wp_make_link_relative()

Convert full URL paths to absolute paths.

wp_normalize_path()

Normalize a filesystem path.

wp_parse_args()

Merge user defined arguments into defaults array.

wp_parse_id_list()

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

wp_parse_list()

Cleans up an array, comma- or space-separated list of scalar values.

wp_parse_slug_list()

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

wp_parse_str()

Parses a string into variables to be stored in an array.

wp_parse_url()

Parses a URL and returns its components. A wrapper for PHP's parse_url() function that handles consistency in the return values across PHP versions.

wp_rand()

Generates a random number between the specified min and max.

wp_recursive_ksort()

Sorts the keys of an array alphabetically. The array is passed by reference so it doesn't get returned which mimics the behaviour of ksort.

wp_reset_vars()

Resets global variables based on $_GET and $_POST

wp_send_json()

Encodes the passed variable into JSON, prints the result to the screen and terminates the script (die). Used to return data for AJAX requests.

wp_send_json_error()

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

wp_send_json_success()

Returns JSON data. Is used to return a success response to AJAX request. The response object always contains the element success=true. die() php execution.

wp_slash()

Add slashes (\) to a string or array of strings.

wp_spaces_regexp()

Returns the regexp for common whitespace characters.

wp_sprintf()

WordPress implementation of PHP sprintf() with filters.

wp_tempnam()

Returns a filename of a Temporary unique file. Please note that the calling function must unlink() this itself.

wp_unslash()

Removes slashes from a string or from strings of an array, or properties of an object. The array can be of any nesting level.

Uncategorized

_doing_it_wrong()

Mark something as being incorrectly called.

cache_javascript_headers()

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

do_robots()

Displays the robots.txt file content. Sets appropriate HTTP headers. Used for creation of dynamic robots.txt file.

download_url()

Downloads a URL to a local temporary file using the WordPress HTTP Class. Please note, That the calling function must unlink() the file.

get_privacy_policy_url()

Retrieves the URL to the privacy policy page.

maybe_convert_table_to_utf8mb4()

If a table only contains utf8 or utf8mb4 columns, convert it to utf8mb4.

nocache_headers()

Set the headers to prevent caching for the different browsers.

show_admin_bar()

Allows you to disable the "Toolbar" (Admin Bar). Technically, the function enables/disables "Admin Bar" for the front-end. You cannot turn it off in Admin-panel.

wp_check_browser_version()

Check if the user needs a browser update

wp_die()

Kills WordPress execution and displays the specified HTML message.

wp_editor()

Renders an editor. Using this function is the proper way to output all needed components for both TinyMCE and Quicktags. _WP_Editors should not be used directly. See https://core.trac.wordpress.org/ticket/17144.

wp_get_raw_referer()

Retrieves unvalidated referer from '_wp_http_referer' or HTTP referer.

wp_get_referer()

Retrieve referer from '_wp_http_referer' or HTTP referer.

wp_install_defaults()

Creates the initial content for a newly-installed site: categories, posts, pages etc.

wp_magic_quotes()

Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER.

wp_mail()

Send mail, similar to PHP's mail

wp_oembed_get()

Embeds the object by specified URL. Tries to get the HTML code from the passed URL by using supported WordPress oEmbed providers.

wp_redirect()

Redirects to another page.

wp_safe_redirect()

Performs a safe redirect, using wp_redirect(). Before redirections check whether the host is in whitelist (in list of allowed hosts).

wp_star_rating()

Output a HTML element with a star rating for a given rating.

wp_timezone_choice()

Gives a nicely-formatted list of timezone strings in <option> format for use in <select>.

wp_validate_redirect()

Validates a URL for use in a redirect.

Scripts and Styles

add_editor_style()

Links (connect) specified stylesheets CSS file to the TinyMCE visual editor.

wp_add_inline_script()

Adds extra code to a registered script.

wp_add_inline_style()

Add extra CSS styles to a registered stylesheet.

wp_dequeue_script()

Remove a previously enqueued script.

wp_dequeue_style()

Remove a previously enqueued CSS stylesheet.

wp_deregister_script()

Remove a registered script.

wp_deregister_style()

Remove a registered stylesheet.

wp_enqueue_code_editor()

Enqueue assets needed by the code editor for the given settings.

wp_enqueue_editor()

Outputs the editor scripts, stylesheets, and default settings.

wp_enqueue_media()

Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs.

wp_enqueue_script()

Adds a script (JavaScript file) to the page.

wp_enqueue_style()

Adds a CSS stylesheet file to the page. Also registers the stylesheet file if it wasn't registered.

wp_get_custom_css()

Fetches the CSS code from the Theme Customizer settings. The CSS will be retrieved as it is: without a <style> pane.

wp_localize_jquery_ui_datepicker()

Localizes the jQuery UI datepicker.

wp_localize_script()

Localize a script. Works only if the script has already been added.

wp_register_script()

Register a new script.

wp_register_style()

Register a CSS stylesheet.

wp_resource_hints()

Prints resource hints to browsers for pre-fetching, pre-rendering and pre-connecting to web sites.

wp_script_add_data()

Add metadata to a script.

wp_script_is()

Check whether a script has been added to the queue.

wp_style_add_data()

Adds metadata to a CSS stylesheet file that has been added with wp_enqueue_style() function. Use it, for example, to make a stylesheet file work only with certain versions of IE browsers.

wp_style_is()

Check whether a CSS stylesheet has been added to the queue.

Admin Menu

add_menu_page()

Add a top-level menu page to the Dashboard (next to Posts, Pages, Users etc).

add_meta_box()

Adds a meta box to one or more screens.

add_options_page()

Add submenu page to the Settings main menu.

add_submenu_page()

Add a submenu page. This function takes a capability which will be used to determine whether or not a page is included in the menu.

add_theme_page()

Add submenu page to the Appearance main menu.

do_meta_boxes()

Meta-Box template function

get_admin_page_title()

Gets the title of the current admin page.

get_admin_url()

Retrieves the URL to the site admin area.

get_current_screen()

Get the current screen object

includes_url()

Retrieves the URL to the wp-includes directory with the appropriate protocol: 'https' or 'http'.

is_admin()

Whether the current request is for an administrative interface page.

remove_menu_page()

Remove a top-level admin menu item, ex: "Posts", "Media", "Pages".

remove_meta_box()

Removes a meta box from one or more screens.

remove_submenu_page()

Remove an admin submenu.

wp_add_dashboard_widget()

Adds (register) a new widget (a meta box) to the administration dashboard (the main page of the admin panel).

wp_admin_notice()

Outputs an admin notice.

wp_get_admin_notice()

Creates and returns the markup for an admin notice.

wp_maintenance()

Die with a maintenance message when conditions are met.

Metadata

add_metadata()

Add metadata (an additional data) for the specified object (a post, a comment, a user etc).

delete_metadata()

Delete metadata for the specified object.

delete_metadata_by_mid()

Delete meta data by meta ID

get_metadata()

Retrieve metadata for the specified object.

is_protected_meta()

Determines whether a meta key is protected (internal).

register_meta()

Registers a meta key (key of custom field).

sanitize_meta()

Sanitize meta value.

update_metadata()

Update metadata for the specified object. If no value already exists, the metadata will be added as new metadata.

Site Options (settings)

add_option()

Adds a new option. Does nothing if this option already exists.

admin_url()

Retrieves the URL to the admin area for the current site. Takes into account protocols (http and https).

delete_option()

Removes option by name. Prevents removal of protected WordPress options.

get_bloginfo()

Retrieves information about the current site.

get_home_path()

Gets the absolute filesystem path to the root of the WordPress installation.

get_home_url()

Retrieves the URL for a given site where the front end is accessible.

get_option()

Gets the value of the specified option by option name.

get_site_url()

Retrieves the URL for a given site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible.

home_url()

Retrieves the URL for the current site where the front end is accessible.

is_ssl()

Checks whether secure HTTPS (SSL) connection is used. A conditional tag.

site_url()

Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible.

update_option()

Update the value of an option that was already added.

wp_get_environment_type()

Retrieves the current environment type.

wp_load_alloptions()

Loads and caches all autoloaded options, if available or all options.

Main Query

add_query_arg()

Retrieves a modified URL query string.

get_queried_object()

Retrieve the currently-queried object.

get_queried_object_id()

Gets the ID of the current query object. It can be: any post, category, tag, other taxonomy element, author's archive.

get_query_var()

Retrieve variable in the WP_Query class.

get_search_query()

Retrieves the contents of the search WordPress query variable.

get_status_header_desc()

Retrieve the description for the HTTP status.

is_embed()

Is the query for an embedded post?

is_robots()

Checks if this is a request to robots.txt file. A conditional tag.

redirect_canonical()

Redirects incoming links to the proper URL based on the site url.

remove_query_arg()

Removes an item or items from a query string.

wp()

Set up the WordPress query.

Date/Time

calendar_week_mod()

Get number of days since the start of the week.

current_time()

Retrieve the current time based on specified type.

get_calendar()

Display calendar with days that have posts as links.

get_date_from_gmt()

Converts a GMT date into the correct format for the blog.

get_gmt_from_date()

Returns a date in the GMT equivalent.

get_weekstartend()

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

human_time_diff()

Determines the difference between two timestamps.

mysql2date()

Convert given date string into a different format.

wp_date()

Retrieves the date, in localized format.

wp_maybe_decline_date()

Determines if the date should be declined.

wp_timezone()

Retrieves the timezone from site settings as a DateTimeZone object.

wp_timezone_string()

Retrieves the timezone from site settings as a string.

Security

check_admin_referer()

Makes sure that a user was referred from another admin page. Сhecks a nonce token. Stops php with die() in case of error.

check_ajax_referer()

Verifies nonce token of an Ajax request. Kills PHP if the verification failed. By default searches for a nonce token in $_REQUEST['_ajax_nonce'] and $_REQUEST['_wpnonce'].

sanitize_url()

Sanitizes a URL for database or redirect usage.

wp_create_nonce()

Creates a cryptographic token for a short amount of time (from 12 to 24 hours).

wp_generate_password()

Generates a random password. You can specify the length and what characters to use.

wp_hash()

Gets hash of a given string.

wp_hash_password()

Encrypts the specified text to make a password hash from it.

wp_http_validate_url()

Validate a URL for safe use in the HTTP API.

wp_kses_post()

Sanitizes the passed string (content), leaving in it only allowed post content HTML tags for the current user.

wp_nonce_ays()

Display "The link you followed has expired" message with a link to the previous page - wp_get_referer().

wp_nonce_field()

Retrieve or display hidden nonce field for a form.

wp_nonce_url()

Adds a nonce token to the URL: ?_wpnonce=9d6bd884a1.

wp_referer_field()

Display or retrieve a hidden input field for form with the current page URI value (referer).

wp_salt()

Get salt to add to hashes.

wp_sanitize_redirect()

Sanitizes a URL for use in a redirect.

wp_verify_nonce()

Verify nonce token.

Form Helpers

checked()

Outputs the html checked attribute.

disabled()

Compares two given values, and if they are the same, displays disabled = 'disabled' – an attribute for a form input field.

form_option()

Displays the sanitized option value. Used when displaying the wp option value for the value attribute of the <input> tag.

readonly()

Outputs the html readonly attribute.

selected()

Outputs the html selected attribute.

wp_readonly()

Outputs the HTML readonly attribute.

File system (WP_Filesystem)

copy_dir()

Copies a directory from one location to another via the WordPress Filesystem Abstraction.

get_temp_dir()

Determine a writable directory for temporary files.

list_files()

Returns a listing of all files in the specified folder and all subdirectories up to 100 levels deep. The depth of the recursiveness can be controlled by the $levels param.

unzip_file()

Unzips a specified ZIP file to a location on the Filesystem via the WordPress Filesystem Abstraction. Assumes that WP_Filesystem() has already been called and set up. Does not extract a root-level __MACOSX directory, if present.

wp_delete_file()

Delete a file. This function is a wrapper for PHP's unlink() function — it uses wp_delete_file filter before deleting a file.

wp_delete_file_from_directory()

Deletes a file if its path is within the given directory.

wp_filesize()

Wrapper for PHP filesize with filters and casting the result as an integer.

WP_Filesystem()

Initializes and connects the WordPress Filesystem Abstraction classes.

WP_Filesystem_Direct{}

WordPress Filesystem Class for direct PHP file and folder manipulation.

wp_mkdir_p()

Recursive directory creation based on full path.

SQL

dbDelta()

Creates or modifies database tables based on the specified SQL query to create table.

esc_sql()

Prepares data for use in a MySQL query. Protects against SQL injections. May accept an array of strings for processing.

get_meta_sql()

Given a meta query, generates SQL clauses to be appended to a main query.

get_num_queries()

Retrieve the number of database queries during the WordPress execution.

get_posts_by_author_sql()

Retrieves WHERE part of the SQL query where posts with 'private' post status for authenticated users will be taken into account.

like_escape()

Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described.

sanitize_sql_orderby()

Ensures a string is a valid SQL 'order by' clause.

wpdb::get_var()

Retrieves one variable from the database.

Transient Options

delete_expired_transients()

Deletes all expired transients.

delete_transient()

Delete a transient.

get_transient()

Get the value of a transient (a temporary option).

set_site_transient()

Sets/updates the value of a site transient.

set_transient()

Set/update the value of a transient.

Bookmarks

edit_bookmark_link()

Displays the edit bookmark link anchor content.

get_bookmark()

Retrieve Bookmark data

get_bookmarks()

Retrieves the list of bookmarks

wp_list_bookmarks()

Retrieve or echo all of the bookmarks.

Checks

is_admin_bar_showing()

Determine whether the admin bar should be showing.

is_blog_installed()

Test whether WordPress is already installed.

is_countable()

Polyfill for is_countable() function added in PHP 7.3.

is_email()

Verifies that an email is valid.

is_iterable()

Polyfill for is_iterable() function added in PHP 7.1.

is_php_version_compatible()

Checks compatibility with the current PHP version.

is_serialized()

Check the given value if it's a serialized string.

is_serialized_string()

Check whether serialized data is of string type.

is_wp_error()

Checks whether the passed variable is a WordPress Error.

is_wp_version_compatible()

Checks compatibility with the current WordPress version.

seems_utf8()

Checks to see if a string is UTF-8 encoded.

wp_doing_ajax()

Determines whether the current request is a WordPress Ajax request.

wp_is_https_supported()

Checks whether HTTPS is supported for the server and domain.

wp_is_json_request()

Checks whether current request is a JSON request, or is expecting a JSON response.

wp_is_numeric_array()

Checks if the specified variable is an numeric-indexed array.

wp_is_using_https()

Checks whether the website is using HTTPS.

wp_validate_boolean()

Turns the value of the specified variable into a logical true or false.

Emoji

wp_encode_emoji()

Convert emoji characters to their equivalent HTML entity.

wp_staticize_emoji()

Convert emoji to a static img element.