Other Functions (category)

get_oembed_response_data_for_url()

Gets oEmbed data for the current site's URL.

send_origin_headers()

Sends CORS headers if the request came from an allowed source (URL).

wp_get_development_mode()

Gets the current development mode: core, plugin, theme, all.

wp_is_development_mode()

Checks if the site is in the specified development mode: core, plugin, theme, all.

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

Gets the first key of the passed array. Does not touch the internal pointer of the array.

array_key_last()

Gets the last key of the given array. Does not touch the internal pointer of the array.

block_core_social_link_services()

Gets the SVG code of the social service: Twitter, Facebook, etc.

build_query()

Collects a query string from the provided simple/associative array.

get_page_hierarchy()

Sorts an array of hierarchical posts based on parent relationships (post_parent).

get_self_link()

Gets the URL (link) of the current page (request) that triggered the currently running code.

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

Serializes (turns into a string) the passed 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()

Checks if the specified string (substring) is in another string. Case sensitive.

str_ends_with()

Checks if the string ends with the specified substring. Case sensitive.

str_starts_with()

Checks if the string starts with the specified substring. Case sensitive.

stripslashes_deep()

Iterates through an array, object, scalar and removes escaping slashes (\) from string values.

timer_float()

Gets the time (in seconds) that has passed since the start of the PHP script execution.

timer_stop()

Gets the execution time of the PHP script from the moment the page generation starts until this function is called.

urlencode_deep()

Iterates over all elements of the array and processes all values with the function urlencode(). A string can also be passed.

wp_array_slice_assoc()

Leaves elements from the first array whose keys (indexes) match the values of the second array.

wp_basename()

Gets the last component from the specified path or URL, retrieving everything after the last /.

wp_debug_backtrace_summary()

Gets a trace with function names — a list of all functions/methods that were called to reach the current place in the code (from where this function was called).

wp_extract_urls()

Uses a regular expression to "extract" all links (URLs) from the provided text.

wp_filter_object_list()

Filters the given array of objects by the specified key=>value parameters.

wp_get_list_item_separator()

Gets the separator for list items. What the separator will be depends on the current site locale.

wp_html_split()

Parses the given text (in the form of HTML code) into HTML tags and comments, returning an array of values: tags and their text.

wp_is_jsonp_request()

Checks if the current request is a JSONP request or expects 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 (parses) the specified 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()

Gets a list of HTML tag attributes (as an array) from the provided string with attributes.

wp_kses_uri_attributes()

Gets a list of HTML attributes that (according to the specification) should specify a URL.

wp_list_filter()

Filters an array of objects (or an array of arrays) and retrieves from the array those objects that have the specified parameter.

wp_list_pluck()

Collects a specified field from nested arrays of a multidimensional array.

wp_list_sort()

Sorts an array of objects or an array of arrays by one or more fields.

wp_make_link_relative()

Converts an absolute URL to a relative path. Removes the protocol (http/https) and domain, leaving / at the beginning.

wp_normalize_path()

Normalizes the path for a file or folder by replacing backslashes and double slashes with a single one.

wp_parse_args()

Combines two arrays so that the parameters of the first array (passed) replace the parameters of the second array (default) when they match. Parameters can be specified as a string.

wp_parse_id_list()

Processes/cleans an array of numbers (IDs) or a string where numbers are separated by commas or spaces. Will return an array of numbers.

wp_parse_list()

Breaks a string into an array of values separated by the characters ,   \t \n: comma, space, tab, newline.

wp_parse_slug_list()

Creates an array of tags from a string of words separated by commas, spaces. The values of the array are cleaned using sanitize_title().

wp_parse_str()

Parses the query string, for example, foo=1&foo2=2 and creates an array of data from it.

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 an array and all nested arrays by key in ascending order (a-z).

wp_reset_vars()

Sets the specified variables as global if they are specified in the $_GET / $_POST request.

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 a regular expression that matches all kinds of spaces (line breaks, invisible characters, etc.).

wp_sprintf()

Variant of the PHP function sprintf() from WordPress. Supports %l (list) in the passed format.

wp_tempnam()

Creates an empty temporary writable file with a unique name in the temporary directory. After use, the file must be deleted using unlink();

wp_unique_id()

Gets a unique identifier.

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 "done incorrectly". For example, the function is called incorrectly, the parameter is specified incorrectly, etc.

cache_javascript_headers()

Sets headers for the Javascript file and caches it for 10 days.

do_robots()

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

download_url()

Uploads a file (URL) to a temporary PHP directory. Works based on the WordPress HTTP API.

get_privacy_policy_url()

Returns the URL of the privacy policy page.

maybe_convert_table_to_utf8mb4()

Converts table fields to the encoding utf8mb4_unicode_ci, if there are fields in the table with encoding utf8_* or utf8mb4_*.

nocache_headers()

Sets headers that prevent caching in all 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()

Checks if the user's browser needs to be updated.

wp_die()

Kills WordPress execution and displays the specified HTML message.

wp_editor()

Displays the text editor - Quicktags (textarea with buttons) and TinyMCE (visual editor). Can be used in templates, on pages like: post, static page, etc.

wp_font_dir()

Gets the path and URL of the current fonts folder.

wp_get_raw_referer()

Gets the referer (referer) URL. A wrapper for $_SERVER['HTTP_REFERER'].

wp_get_referer()

Gets the referer link (referer URL) only if it is an internal URL - the URL of the current site.

wp_install_defaults()

Creates default content for a newly installed site: basic categories, posts, pages, etc.

wp_magic_quotes()

Changes global variables $_GET, $_POST, $_REQUEST, $_COOKIE, $_SERVER - adds magic quotes to their values.

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 the specified URL, you can specify the redirect status (301, 302...).

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

Outputs HTML rating (stars) for the specified rating.

wp_timezone_choice()

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

wp_validate_redirect()

Checks the specified URL for the possibility of using it for redirection.

Scripts and Styles

add_editor_style()

Connects a custom CSS file for the TinyMCE visual editor.

wp_add_inline_script()

Adds additional JavaScript code to the registered script.

wp_add_inline_style()

Adds an additional block of CSS styles. CSS is added directly to the HTML document, after the main (specified) styles.

wp_dequeue_script()

Cancels the connection of a script that was previously added to the queue.

wp_dequeue_style()

Removes a CSS stylesheet from the output queue. A file is added to the queue using wp_enqueue_style().

wp_deregister_script()

Deletes a previously registered script.

wp_deregister_style()

Cancels the registration of a CSS stylesheet.

wp_enqueue_code_editor()

Connects all necessary (scripts, styles, settings, languages) for using the built-in code editor in WordPress.

wp_enqueue_editor()

Outputs scripts, styles, and default settings for the WordPress TinyMCE editor. Which can then be initialized on any textarea field after the page loads.

wp_enqueue_media()

Connects all files necessary for using the WordPress media API (file upload and selection window). The function connects scripts, styles, settings, and templates.

wp_enqueue_script()

Correctly connects the script (JavaScript file) to the page.

wp_enqueue_style()

Correctly adds a CSS style file. Registers the style file if it has not been registered yet.

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 (translates) the jQuery date picker script: jQuery UI datepicker.

wp_localize_script()

Adds additional data before the specified script that is queued for output.

wp_register_script()

Registers a script file to later enqueue it using the function wp_enqueue_script().

wp_register_style()

Registers a CSS file in WordPress. After registration, the file can be added to the HTML document using the wp_enqueue_style() function.

wp_resource_hints()

Outputs <link> tags for dns-prefetch, preconnect, prefetch, prerender.

wp_script_add_data()

Adds data to scripts enqueued with wp_enqueue_script(). For example, when you need to output a script only for "IE 6" or "lt IE 9" (less than IE 9).

wp_script_is()

Determines whether the script file has been registered / added to the output queue / output to the screen.

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

Determines whether the stylesheet has been registered / enqueued for output / output to the screen.

Admin Menu

add_menu_page()

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

add_meta_box()

Adds additional blocks (meta box) on the edit/create post, page, or custom post type screens in the admin panel.

add_options_page()

Adds a child page (submenu) to the admin panel menu "Settings".

add_submenu_page()

Adds a child page (subsection) of the specified main menu in the admin panel.

add_theme_page()

Adds a submenu to the "Appearance" menu in the admin panel.

do_meta_boxes()

Outputs any meta boxes registered for the admin panel page and a specific context, using the function add_meta_box().

get_admin_page_title()

Gets the title of the admin page.

get_admin_url()

Retrieves the URL to the site admin area.

get_current_screen()

Gets the data object of the current admin panel page.

includes_url()

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

is_admin()

Checks if the user is in the admin panel of the site (console or any other admin page). Conditional tag.

remove_menu_page()

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

remove_meta_box()

Deletes meta-boxes (additional blocks in the admin panel) on the post, page, and custom post type editing screens.

remove_submenu_page()

Deletes a submenu item from the WordPress admin panel. For example, Settings > Permalinks.

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

Forms and displays the HTML code of a note (message, error) at the top of the admin panel page.

wp_get_admin_notice()

Forms and returns the HTML code of a notice (message, error) that we usually see at the top of the admin panel.

wp_maintenance()

Stops the site from functioning and displays a message about maintenance (the site is in development mode).

Metadata

add_metadata()

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

delete_metadata()

Deletes the metadata of the specified object (post, user, comment).

delete_metadata_by_mid()

Deletes a row of metadata from the Database by the primary field meta_id.

get_metadata()

Gets the metadata of the specified object (post, comment, user). Caches the result.

is_protected_meta()

Determines whether a meta key is protected (internal).

register_meta()

Registers a meta key (key of custom field).

sanitize_meta()

Clears the value of meta data. The function itself does nothing, but applies the filter "sanitize_{$meta_type}_meta_{$meta_key}", through which different meta data can be sanitized differently.

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

Deletes settings (post from the wp_options table in the DB).

get_bloginfo()

Gets information about the site from the settings.

get_home_path()

Gets the absolute path to the root folder of the site (where wp-config.php is located). The result may differ from the constant ABSPATH. It has a trailing slash at the end.

get_home_url()

Gets the URL of the site's main page (without / at the end). You can specify the site ID of the network. Considers the protocol (http, https).

get_option()

Gets the value of the specified setting (option).

get_site_url()

Gets the site URL.

home_url()

Gets the URL of the site's main page (without the trailing slash /). Considers the protocol (http, https).

is_ssl()

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

site_url()

Gets the site URL (where the WordPress core is installed) with the corresponding protocol (https, if the is_ssl condition is triggered).

update_option()

Updates the value of an option (setting) in the database. Expects an unescaped string.

wp_get_environment_type()

Gets the current environment type: local, development, staging, production (default).

wp_load_alloptions()

Loads into cache all auto-loaded options of WordPress. Retrieves all options of the site.

Main Query

add_query_arg()

Adds the specified GET parameters to the current or specified URL.

get_queried_object()

Sets and Gets the current queried object (complete information about the post, tags, categories, etc.).

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

Gets query variables (query parameters) from WP_Query, which is set in the global variable $wp_query.

get_search_query()

Retrieves the contents of the search WordPress query variable.

get_status_header_desc()

Gets the text (message) of the HTTP response status code. For example, "Not Found".

is_embed()

Checks whether the request is a request for an embed post page.

is_robots()

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

redirect_canonical()

Defines whether the current request should be redirected to another URL. It performs the redirection if necessary.

remove_query_arg()

Removes the specified GET request parameters from the URL: ?parametr=value&param2=val2.

wp()

Sets the main query (WordPress environment).

Checks

array_is_list()

Checks if an array is a list.

is_admin_bar_showing()

Checks whether the "Admin bar" (toolbar) will be shown (or has already been shown). That is, whether the admin panel will be displayed for the current user. Conditional tag.

is_blog_installed()

Checks if the site is installed. It checks for the presence of the siteurl option and tables in the database. The result is cached.

is_countable()

Checks if the content of the variable is a countable value (array or an instance of Countable|SimpleXMLElement|ResourceBundle).

is_email()

Checks if the given string is an e-mail address.

is_iterable()

Checks whether the contents of the variable match the pseudo-type iterable, that is, whether it is an array or an object implementing Traversable.

is_php_version_compatible()

Compares the provided PHP version with the PHP version installed on the server.

is_serialized()

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

is_serialized_string()

Checks if a string is serialized in the specified serialized string. That is, whether the string (and not an array or number) was serialized.

is_wp_error()

Checks whether the passed variable is a WordPress Error.

is_wp_version_compatible()

Compares the provided version of WordPress with the installed version of WordPress.

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 if the domain and server support the HTTPS protocol.

wp_is_json_request()

Checks if the current request is a JSON request or expects a JSON response.

wp_is_numeric_array()

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

wp_is_using_https()

Checks if the site is using HTTPS.

wp_validate_boolean()

Converts the value of the specified variable to boolean true or false.

Date/Time

calendar_week_mod()

Translates the entered integer to the number of days since the beginning of the week: 8=1 (8-7), 15=1 (15-7*2).

current_time()

Returns the current site time, taking into account the site's timezone setting (timezone). The format in which to return the result can be specified arbitrarily. mysql: YYYY-MM-DD HH:MM:SS, unix: 1335820033, arbitrary format: d. M. Y.

get_calendar()

Displays the calendar on the screen (by default, the current month).

get_date_from_gmt()

Converts the date from GMT/UTC timezone to the site's timezone. Accepts the date in the format Y-m-d H:i:s.

get_gmt_from_date()

Converts the specified date to the site's timezone, to GMT/UTC zone. Accepts date in the format Y-m-d H:i:s.

get_weekstartend()

Gets the timestamp of the start and end of the week to which the specified date belongs.

human_time_diff()

Defines the difference between two given timestamps and returns the result in a human-readable format: 1 minute, 5 hours, 10 days, 3 months, 1 year (1 min, 5 hours, 10 days). Relative dates.

mysql2date()

Translates the specified date (as a string) into another format.

wp_date()

Gets the localized date (translated into the current language) from the given Unix timestamp.

wp_maybe_decline_date()

Declines or modifies the month in the provided date string. For example for Russian: 15 Май > 15 мая.

wp_timezone()

Gets the site's timezone as a DateTimeZone object.

wp_timezone_string()

Gets the time zone from the 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()

Cleans the specified URL so that it can be safely used for redirects or stored in the database.

wp_create_nonce()

Creates a unique security key for a short period 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()

Checks if the specified URL can be used in an HTTP request, for example 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()

Gets the secret key (salt), which is added to the hash.

wp_sanitize_redirect()

Cleans the specified URL so that it can be safely used in redirects.

wp_verify_nonce()

Verify nonce token.

Form Helpers

checked()

Used in checkbox and radio fields of the form. Made for convenience, checks two values and if they match, outputs the attribute checked='checked' for the current form field.

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

Compares 2 values, if they match, outputs the string readonly='readonly'. Used for the tag <input>.

selected()

Outputs the string selected='selected' if the first two parameters of the function match.

wp_readonly()

Outputs readonly='readonly', if the first two parameters of the function match.

File system (WP_Filesystem)

copy_dir()

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

get_temp_dir()

Gets the path to the folder where temporary files can be written. With a slash at the end.

list_files()

Get a list of files from the specified directory and from all nested directories (up to 100 levels of nesting).

unzip_file()

Unzips the specified ZIP archive to a folder on the server using the WordPress filesystem API.

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 the specified file from the specified folder, only if the file is located in that folder.

wp_filesize()

Gets the size of the specified file.

WP_Filesystem()

Creates an object for working with files in WordPress. The created object is saved in the variable global $wp_filesystem.

WP_Filesystem_Direct{}

WordPress file system class for direct (non-FTP) file and directory (folder) operations through PHP.

wp_mkdir_p()

Recursively creates a directory (folder) at the specified path. Does nothing if the folder already exists. Grants parent permissions to new folders.

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

Creates the JOIN and WHERE parts of the SQL query for metadata based on the provided parameters, which can be used in the main query.

get_num_queries()

Gets the number of queries that have been made to the WordPress database before this function is called.

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

Use instead of wpdb::esc_like(). Prepares a string for use in a SQL query LIKE expression. Since version 4.0, it is considered deprecated!

sanitize_sql_orderby()

Checks if the provided string can be used in the ORDER BY part of an SQL query.

wpdb::get_var()

Gets the value of a single cell from the query result. By default, the first cell is taken — this is the first column and the first row.

Transient Options

delete_expired_transients()

Deletes all expired transient options.

delete_transient()

Deletes a transient option.

get_transient()

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

set_site_transient()

Sets or updates temporary data for a multisite network.

set_transient()

Sets or updates a transient option.

Bookmarks

edit_bookmark_link()

Outputs a link to edit the current bookmark (link) if the user is authorized and has permission to edit.

get_bookmark()

Gets the link data from the blogroll, in the form of an array. You need to specify the link ID.

get_bookmarks()

Gets an array of data about blogroll links (Admin -> Links -> Links).

wp_list_bookmarks()

Displays a list of links specified on the "Administration > Links" page.

Emoji

wp_encode_emoji()

Converts emoji symbols in the provided string to their HTML code (&#x1f31b).

wp_staticize_emoji()

Converts emoji characters in the provided text to HTML elements <img>.