WordPress Common Functions Chinese Translation

WordPress provides us with a wealth of functions to facilitate our customization of WordPress, the development of WordPress themes or plug-ins, we will be here to often use the function of the document translated into Chinese, coupled with the use of summaries and code examples, easy to follow up access.

WordPress admin_post_{$action} hooks and instructions for use

In the development of WordPress themes or plug-ins, we often need to add some custom actions, such as we created a form, need to submit data to the back-end, WordPress provides us with admin_post_{$action} hook to facilitate the implementation of this back-end. Plugin Description The dynamic part of the hook name $action refers to...

wp_safe_remote_post uses the POST method to get the raw response from a safe HTTP request

This function is ideal when making HTTP requests to arbitrary URLs. The URL is validated to avoid redirection and request forgery attacks. Function Parameters Parameter Data Type Required or Not Required Description Default $url string yes request URL no $args array no request parameter array() Function return value Array of responses, in case of error...

get_transient Get transient data

This function is used to get the value of the transient data, if the transient data does not exist, has no value or has expired, the return value will be false. Function Parameters Parameter Data Type Required or Not Required Description Default Value $transient string is a transient data name and is not expected to be escaped by SQL None Function Return Value If the fetch is successful, return...

set_transient Set or update the value of transient data

Setting or updating transient data values in WordPress is often used to save data that doesn't need to be there all the time. Function Parameters Parameters Data Type Required or Not Required Description Default $transient string is the name of the transient data, which must not exceed 172 characters in length. None $value multiple is the value of the transient data, if non-scalar...

sanitize_file_name sanitize_file_name, replace spaces with dashes

Removes illegal special characters from filenames and special characters that need to be escaped to be displayed on the command line, replaces spaces and consecutive dashes with English dashes, and removes periods, dashes, and underscores from the beginning and end of filenames. This function is not guaranteed to return file names that are allowed to be uploaded. Function Parameters Is the parameter data type required to describe...

remove_menu_page Remove background menu

function function Remove WordPress backend top level menu. Function Parameters Parameter Data Type Required or Not Required Description Default Value $menu_slug String Yes Menu Slug No Function return value Returns the removed menu data if it succeeds, or false if it fails. Example of use The function needs to be mounted to admin_init ...

register_block_pattern Register a customized Pattern

function function Registers a custom Pattern to the WordPress Gutenberg editor. Function Parameters Parameter Data Type Required or Not Required Description Default Value $pattern_name string is the name of the Pattern that contains the namespace None $pattern_properties array is an array that contains the properties of the Pattern. None $pattern_proper...

wp_remote_get sends a GET request to a URL and returns data

function function Performs an HTTP request using the GET method and returns its response. Function Parameters Parameter Data Type Required or Not Required Description Default $url string yes request URL no $args array no request parameter array() Function return value In case of success, an array is returned, in case of failure, a WP_Error object is returned. ...

wp_remote_post sends an HTTP POST request and returns the corresponding

function function Performs an HTTP request using the POST method and returns its response data. Parameters Parameter Data Type Required or Not Required Description Default $url string yes request URL no $args array no request parameter array() Return Value Array of responses, if an error occurs, return WP_Error object Usage Example Sent...