WordPress at a glance
Home Functions Other Functions

Other Functions (category)

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.

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

Determine a writable directory for temporary files.

human_readable_duration()

Convert a duration to human readable format.

is_email()

Verifies that an email is valid.

is_php_version_compatible()

Checks compatibility with the current PHP version.

is_serialized()

Check value to find if it was serialized.

is_serialized_string()

Check whether serialized data is of string type.

is_wp_version_compatible()

Checks compatibility with the current WordPress version.

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 value only if it was serialized.

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.

seems_utf8()

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

stripslashes_deep()

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

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

Determines whether the current request is a WordPress Ajax request.

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

Generate a random UUID (version 4).

wp_html_split()

Separate HTML elements and comments from the text.

wp_is_numeric_array()

Determines if the variable is a numeric-indexed array.

wp_is_uuid()

Validates that a UUID is valid.

wp_json_encode()

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

wp_kses_array_lc()

Goes through an array and changes the keys to all lower case.

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

Recursive directory creation based on full path.

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

Resets global variables based on $_GET and $_POST

wp_send_json()

Send a JSON response back to an Ajax request.

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

Remove slashes from a string or array of strings.

wp_validate_boolean()

Filter/validate a variable as a boolean.

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

Fetch the saved Custom CSS content for rendering.

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

Add metadata to a CSS stylesheet.

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

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

sanitize_meta()

Sanitize meta value.

update_metadata()

Update metadata for the specified object. If no value already exists for the specified object ID and metadata key, the metadata will be added.

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

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

get_option()

Retrieves an option value based on an 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_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()

Retrieve ID of the current queried object.

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.

Uncategorized

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.

is_blog_installed()

Test whether WordPress is already installed.

is_wp_error()

Check whether variable is a WordPress Error.

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.

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.

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

Determines if the date should be declined.

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'].

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

Sanitize content for allowed HTML tags for post content.

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

Print option value after sanitizing for forms.

readonly()

Outputs the html readonly attribute.

selected()

Outputs the html selected attribute.

File system (WP_Filesystem)

copy_dir()

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

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

wp_delete_file_from_directory()

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

SQL

dbDelta()

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

esc_sql()

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

Retrieve the post SQL based on capability, author, and type.

sanitize_sql_orderby()

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

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

Emoji

wp_encode_emoji()

Convert emoji characters to their equivalent HTML entity.

wp_staticize_emoji()

Convert emoji to a static img element.