_get_cron_array
_get_term_children
_get_term_hierarchy
_pad_term_counts
_set_cron_array
_upgrade_cron_array
_wp_http_get_object
add_shortcode
check_server_timer
clean_object_term_cache
clean_term_cache
do_shortcode
do_shortcode_tag
get_object_taxonomies
get_object_term_cache
get_objects_in_term
get_shortcode_regex
get_taxonomy
get_term
get_term_by
get_term_children
get_term_field
get_term_to_edit
get_terms
is_object_in_term
is_taxonomy
is_taxonomy_hierarchical
is_term
register_taxonomy
register_uninstall_hook
remove_all_actions
remove_all_filters
remove_all_shortcodes
remove_shortcode
sanitize_term
sanitize_term_field
shortcode_atts
shortcode_parse_atts
spawn_cron
strip_shortcodes
update_object_term_cache
update_term_cache
wp_cache_add
wp_cache_add_global_groups
wp_cache_add_non_persistent_groups
wp_cache_close
wp_cache_delete
wp_cache_flush
wp_cache_get
wp_cache_init
wp_cache_replace
wp_cache_set
wp_clear_scheduled_hook
wp_count_terms
wp_cron
wp_defer_term_counting
wp_delete_object_term_relationships
wp_delete_term
wp_get_object_terms
wp_get_schedule
wp_get_schedules
wp_insert_term
wp_next_scheduled
wp_remote_get
wp_remote_head
wp_remote_post
wp_remote_request
wp_remote_retrieve_body
wp_remote_retrieve_header
wp_remote_retrieve_headers
wp_remote_retrieve_response_code
wp_remote_retrieve_response_message
wp_reschedule_event
wp_schedule_event
wp_schedule_single_event
wp_set_object_terms
wp_unique_term_slug
wp_unschedule_event
wp_update_term
wp_update_term_count
wp_update_term_count_now
ABSPATH
AUTH_KEY
AUTH_SALT
DB_CHARSET
DB_COLLATE
DB_HOST
DB_NAME
DB_PASSWORD
DB_USER
LOGGED_IN_KEY
LOGGED_IN_SALT
NONCE_KEY
NONCE_SALT
SECURE_AUTH_KEY
SECURE_AUTH_SALT
WP_DEBUG
WP_PHP_BINARY
WP_TESTS_DOMAIN
WP_TESTS_EMAIL
WP_TESTS_TITLE
_get_cron_array() : array
_get_term_children($term_id, $terms, $taxonomy)
_pad_term_counts($terms, $taxonomy)
_set_cron_array(array $cron)
package | WordPress |
---|---|
since | 2.1.0 |
access | private |
array
Cron info array from {@link _get_cron_array()}.
_upgrade_cron_array(array $cron) : array
This function upgrades the Cron info array to version 2.
package | WordPress |
---|---|
since | 2.1.0 |
access | private |
array
Cron info array from {@link _get_cron_array()}.
array
An upgraded Cron info array._wp_http_get_object() : \WP_Http
add_shortcode(string $tag, callable $func)
There can only be one hook for each shortcode. Which means that if another plugin has a similar shortcode, it will override yours or yours will override theirs depending on which order the plugins are included and/or ran.
Simplest example of a shortcode tag using the API:
// [footag foo="bar"]
function footag_func($atts) {
return "foo = {$atts[foo]}";
}
add_shortcode('footag', 'footag_func');
Example with nice attribute defaults:
// [bartag foo="bar"]
function bartag_func($atts) {
extract(shortcode_atts(array(
'foo' => 'no foo',
'baz' => 'default baz',
), $atts));
return "foo = {$foo}";
} add_shortcode('bartag', 'bartag_func');
Example with enclosed content:
// [baztag]content[/baztag]
function baztag_func($atts, $content='') {
return "content = $content";
}
add_shortcode('baztag', 'baztag_func');
package | WordPress |
---|---|
since | 2.5 |
uses |
string
Shortcode tag to be searched in post content.
callable
Hook to run when shortcode is found.
clean_object_term_cache($object_ids, $object_type)
clean_term_cache($ids, $taxonomy = ''
)
do_shortcode(string $content) : string
If there are no shortcode tags defined, then the content will be returned without any filtering. This might cause issues when plugins are disabled but the shortcode will still show up in the post or content.
package | WordPress |
---|---|
since | 2.5 |
uses | |
uses | Gets the search pattern for searching shortcodes. |
string
Content to search for shortcodes
string
Content with shortcodes filtered out.do_shortcode_tag(array $m) : mixed
package | WordPress |
---|---|
see | for details of the match array contents. |
since | 2.5 |
access | private |
uses |
array
Regular expression match array
mixed
False on failure.get_object_taxonomies($object_type)
get_object_term_cache($id, $taxonomy)
get_objects_in_term($terms, $taxonomies, $args = array()
)
get_shortcode_regex() : string
The regular expression combines the shortcode tags in the regular expression in a regex class.
The regular expresion contains 6 different sub matches to help with parsing.
1/6 - An extra [ or ] to allow for escaping shortcodes with double [[]] 2 - The shortcode name 3 - The shortcode argument list 4 - The self closing / 5 - The content of a shortcode when it wraps some content.
package | WordPress |
---|---|
since | 2.5 |
uses |
string
The shortcode search regular expressionget_term($term, $taxonomy, $output= OBJECT
, $filter= 'raw'
)
get_term_by($field, $value, $taxonomy, $output= OBJECT
, $filter= 'raw'
)
get_term_children($term, $taxonomy)
get_term_field($field, $term, $taxonomy, $context = 'display'
)
is_object_in_term($object_id, $taxonomy, $terms = null
)
is_taxonomy_hierarchical($taxonomy)
register_taxonomy($taxonomy, $object_type, $args = array()
)
register_uninstall_hook(string $file, callback $callback)
Registers the uninstall hook that will be called when the user clicks on the uninstall link that calls for the plugin to uninstall itself. The link won't be active unless the plugin hooks into the action.
The plugin should not run arbitrary code outside of functions, when registering the uninstall hook. In order to run using the hook, the plugin will have to be included, which means that any code laying outside of a function will be run during the uninstall process. The plugin should not hinder the uninstall process.
If the plugin can not be written without running code within the plugin, then the plugin should create a file named 'uninstall.php' in the base plugin folder. This file will be called, if it exists, during the uninstall process bypassing the uninstall hook. The plugin, when using the 'uninstall.php' should always check for the 'WP_UNINSTALL_PLUGIN' constant, before executing.
package | WordPress |
---|---|
since | 2.7 |
string
callback
The callback to run when the hook is called.
remove_all_actions(string $tag, integer $priority = false
) : boolean
package | WordPress |
---|---|
since | 2.7 |
string
The action to remove hooks from.
integer
The priority number to remove them from.
boolean
True when finished.remove_all_filters(string $tag, integer $priority = false
) : boolean
package | WordPress |
---|---|
since | 2.7 |
string
The filter to remove hooks from.
integer
The priority number to remove.
boolean
True when finished.remove_all_shortcodes()
This function is simple, it clears all of the shortcode tags by replacing the shortcodes global by a empty array. This is actually a very efficient method for removing all shortcodes.
package | WordPress |
---|---|
since | 2.5 |
uses |
remove_shortcode(string $tag)
sanitize_term($term, $taxonomy, $context = 'display'
)
sanitize_term_field($field, $value, $term_id, $taxonomy, $context)
shortcode_atts(array $pairs, array $atts) : array
The pairs should be considered to be all of the attributes which are supported by the caller and given as a list. The returned attributes will only contain the attributes in the $pairs list.
If the $atts list has unsupported attributes, then they will be ignored and removed from the final returned list.
package | WordPress |
---|---|
since | 2.5 |
array
Entire list of supported attributes and their defaults.
array
User defined attributes in shortcode tag.
array
Combined and filtered attribute list.shortcode_parse_atts(string $text) : array
The attributes list has the attribute name as the key and the value of the attribute as the value in the key/value pair. This allows for easier retrieval of the attributes, since all attributes have to be known.
package | WordPress |
---|---|
since | 2.5 |
string
array
List of attributes and their value.spawn_cron($local_time = 0
) : null
package | WordPress |
---|---|
since | 2.1.0 |
null
Cron could not be spawned, because it is not needed to run.strip_shortcodes(string $content) : string
package | WordPress |
---|---|
since | 2.5 |
uses |
string
Content to remove shortcode tags.
string
Content without shortcode tags.update_object_term_cache($object_ids, $object_type)
update_term_cache($terms, $taxonomy = ''
)
wp_cache_add(integer|string $key, mixed $data, string $flag= ''
, integer $expire= 0
) : \unknown
package | WordPress |
---|---|
since | 2.0.0 |
uses | Object Cache Class |
see |
integer
string
The cache ID to use for retrieval later
mixed
The data to add to the cache store
string
The group to add the cache to
integer
When the cache data should be expired
\unknown
wp_cache_add_global_groups(string|array $groups)
wp_cache_add_non_persistent_groups(string|array $groups)
wp_cache_close() : boolean
This function has ceased to do anything since WordPress 2.5. The functionality was removed along with the rest of the persistent cache. This does not mean that plugins can't implement this function when they need to make sure that the cache is cleaned up after WordPress no longer needs it.
package | WordPress |
---|---|
since | 2.0.0 |
boolean
Always returns Truewp_cache_delete(integer|string $id, string $flag = ''
) : boolean
package | WordPress |
---|---|
since | 2.0.0 |
uses | Object Cache Class |
see |
integer
string
What the contents in the cache are called
string
Where the cache contents are grouped
boolean
True on successful removal, false on failurewp_cache_flush($group = null
) : boolean
package | WordPress |
---|---|
since | 2.0.0 |
uses | Object Cache Class |
see |
boolean
Always returns truewp_cache_get(integer|string $id, string $flag = ''
) : boolean | mixed
package | WordPress |
---|---|
since | 2.0.0 |
uses | Object Cache Class |
see |
integer
string
What the contents in the cache are called
string
Where the cache contents are grouped
boolean
mixed
False on failure to retrieve contents or the cache
contents on successwp_cache_init()
package | WordPress |
---|---|
since | 2.0.0 |
global | WP_Object_Cache $wp_object_cache WordPress Object Cache |
wp_cache_replace($key, mixed $data, string $flag= ''
, integer $expire= 0
) : boolean
package | WordPress |
---|---|
since | 2.0.0 |
uses | Object Cache Class |
see |
mixed
The contents to store in the cache
string
Where to group the cache contents
integer
When to expire the cache contents
boolean
False if cache ID and group already exists, true on successwp_cache_set($key, mixed $data, string $flag= ''
, integer $expire= 0
) : boolean
package | WordPress |
---|---|
since | 2.0 |
uses | Object Cache Class |
see |
mixed
The contents to store in the cache
string
Where to group the cache contents
integer
When to expire the cache contents
boolean
False if cache ID and group already exists, true on successwp_clear_scheduled_hook(string $hook, array $args = array()
)
package | WordPress |
---|---|
since | 2.1.0 |
string
Action hook, the execution of which will be unscheduled.
array
Optional. Arguments that were to be pass to the hook's callback function.
wp_count_terms($taxonomy, $args = array()
)
wp_cron() : null
wp_delete_object_term_relationships($object_id, $taxonomies)
wp_delete_term($term, $taxonomy, $args = array()
)
wp_get_object_terms($object_ids, $taxonomies, $args = array()
)
wp_get_schedule(string $hook, array $args = array()
) : string | boolean
package | WordPress |
---|---|
since | 2.1.0 |
string
Action hook to execute when cron is run.
array
Optional. Arguments to pass to the hook's callback function.
string
boolean
False, if no schedule. Schedule on success.wp_get_schedules() : array
The supported recurrences are 'hourly' and 'daily'. A plugin may add more by hooking into the 'cron_schedules' filter. The filter accepts an array of arrays. The outer array has a key that is the name of the schedule or for example 'weekly'. The value is an array with two keys, one is 'interval' and the other is 'display'.
The 'interval' is a number in seconds of when the cron job should run. So for 'hourly', the time is 3600 or 6060. For weekly, the value would be 6060247 or 604800. The value of 'interval' would then be 604800.
The 'display' is the description. For the 'weekly' key, the 'display' would
be __('Once Weekly')
.
For your plugin, you will be passed an array. you can easily add your
schedule by doing the following.
// filter parameter variable name is 'array'
$array['weekly'] = array(
'interval' => 604800,
'display' => __('Once Weekly')
);
package | WordPress |
---|---|
since | 2.1.0 |
array
wp_insert_term($term, $taxonomy, $args = array()
)
wp_next_scheduled(string $hook, array $args = array()
) : boolean | integer
package | WordPress |
---|---|
since | 2.1.0 |
string
Action hook to execute when cron is run.
array
Optional. Arguments to pass to the hook's callback function.
boolean
integer
The UNIX timestamp of the next time the scheduled event will occur.wp_remote_get(string $url, array $args = array()
) : \WP_Error | array
package | WordPress |
---|---|
see | For more information on the response array format. |
since | 2.7.0 |
string
Site URL to retrieve.
array
Optional. Override the defaults.
\WP_Error
array
The response or WP_Error on failure.wp_remote_head(string $url, array $args = array()
) : \WP_Error | array
package | WordPress |
---|---|
see | For more information on the response array format. |
since | 2.7.0 |
string
Site URL to retrieve.
array
Optional. Override the defaults.
\WP_Error
array
The response or WP_Error on failure.wp_remote_post(string $url, array $args = array()
) : \WP_Error | array
package | WordPress |
---|---|
see | For more information on the response array format. |
since | 2.7.0 |
string
Site URL to retrieve.
array
Optional. Override the defaults.
\WP_Error
array
The response or WP_Error on failure.wp_remote_request(string $url, array $args = array()
) : \WP_Error | array
The array structure is a little complex.
$res = array( 'headers' => array(), 'response' => array('code' => int, 'message' => string) );
All of the headers in $res['headers'] are with the name as the key and the value as the value. So to get the User-Agent, you would do the following.
$user_agent = $res['headers']['user-agent'];
The body is the raw response content and can be retrieved from $res['body'].
This function is called first to make the request and there are other API functions to abstract out the above convoluted setup.
package | WordPress |
---|---|
since | 2.7.0 |
string
Site URL to retrieve.
array
Optional. Override the defaults.
\WP_Error
array
The response or WP_Error on failure.wp_remote_retrieve_body(array $response) : string
package | WordPress |
---|---|
since | 2.7.0 |
array
HTTP response.
string
The body of the response. Empty string if no body or incorrect parameter given.wp_remote_retrieve_header(array $response, string $header) : string
package | WordPress |
---|---|
since | 2.7.0 |
array
string
Header name to retrieve value from.
string
The header value. Empty string on if incorrect parameter given, or if the header doesnt exist.wp_remote_retrieve_headers(array $response) : array
package | WordPress |
---|---|
since | 2.7.0 |
array
HTTP response.
array
The headers of the response. Empty array if incorrect parameter given.wp_remote_retrieve_response_code(array $response) : string
Will return an empty array if incorrect parameter value is given.
package | WordPress |
---|---|
since | 2.7.0 |
array
HTTP response.
string
the response code. Empty string on incorrect parameter given.wp_reschedule_event(integer $timestamp, string $recurrence, string $hook, array $args = array()
) : boolean | null
package | WordPress |
---|---|
since | 2.1.0 |
integer
Timestamp for when to run the event.
string
How often the event should recur.
string
Action hook to execute when cron is run.
array
Optional. Arguments to pass to the hook's callback function.
boolean
null
False on failure. Null when event is rescheduled.wp_schedule_event(integer $timestamp, string $recurrence, string $hook, array $args = array()
) : boolean | null
Schedules a hook which will be executed by the WordPress actions core on a specific interval, specified by you. The action will trigger when someone visits your WordPress site, if the scheduled time has passed.
Valid values for the recurrence are hourly, daily and twicedaily. These can be extended using the cron_schedules filter in wp_get_schedules().
package | WordPress |
---|---|
since | 2.1.0 |
integer
Timestamp for when to run the event.
string
How often the event should recur.
string
Action hook to execute when cron is run.
array
Optional. Arguments to pass to the hook's callback function.
boolean
null
False on failure, null when complete with scheduling event.wp_schedule_single_event(integer $timestamp, string $hook, array $args = array()
)
Schedules a hook which will be executed once by the WordPress actions core at a time which you specify. The action will fire off when someone visits your WordPress site, if the schedule time has passed.
package | WordPress |
---|---|
since | 2.1.0 |
link | http://codex.wordpress.org/Function_Reference/wp_schedule_single_event |
integer
Timestamp for when to run the event.
string
Action hook to execute when cron is run.
array
Optional. Arguments to pass to the hook's callback function.
wp_set_object_terms($object_id, $terms, $taxonomy, $append = false
)
wp_unschedule_event(integer $timestamp, string $hook, array $args = array()
)
The $timestamp and $hook parameters are required, so that the event can be identified.
package | WordPress |
---|---|
since | 2.1.0 |
integer
Timestamp for when to run the event.
string
Action hook, the execution of which will be unscheduled.
array
Arguments to pass to the hook's callback function. Although not passed to a callback function, these arguments are used to uniquely identify the scheduled event, so they should be the same as those used when originally scheduling the event.
wp_update_term($term, $taxonomy, $args = array()
)
wp_update_term_count($terms, $taxonomy, $do_deferred = false
)
wp_update_term_count_now($terms, $taxonomy)
_wp_call_all_hook(array $args)
The 'all' hook passes all of the arguments or parameters that were used for the hook, which this function was called for.
This function is used internally for apply_filters(), do_action(), and do_action_ref_array() and is not meant to be used from outside those functions. This function does not check for the existence of the all hook, so it will fail unless the all hook exists prior to this function call.
package | WordPress |
---|---|
package | WordPress |
subpackage | Plugin |
since | 2.5 |
access | private |
uses | Used to process all of the functions in the 'all' hook |
array
The collected parameters from the hook that was called.
_wp_filter_build_unique_id(string $tag, callback $function, integer|boolean $priority) : string | boolean
The old way to serialize the callback caused issues and this function is the solution. It works by checking for objects and creating an a new property in the class to keep track of the object and new objects of the same class that need to be added.
It also allows for the removal of actions and filters for objects after they change class properties. It is possible to include the property $wp_filter_id in your class and set it to "null" or a number to bypass the workaround. However this will prevent you from adding new classes and any new classes will overwrite the previous hook by the same class.
Functions and static method callbacks are just returned as strings and shouldn't have any speed penalty.
package | WordPress |
---|---|
package | WordPress |
subpackage | Plugin |
access | private |
since | 2.2.3 |
link | http://trac.wordpress.org/ticket/3875 |
global | array $wp_filter Storage for all of the filters and actions |
string
Used in counting how many hooks were applied
callback
Used for creating unique id
integer
boolean
Used in counting how many hooks were applied. If === false and $function is an object reference, we return the unique id only if it already has one, false otherwise.
string
boolean
Unique ID for usage as array key or false if $priority === false and $function is an object reference, and it does not already have a uniqe id.add_action(string $tag, callback $function_to_add, integer $priority= 10
, integer $accepted_args= 1
)
Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Plugins can specify that one or more of its PHP functions are executed at these points, using the Action API.
package | WordPress |
---|---|
package | WordPress |
uses | Adds an action. Parameter list and functionality are the same. |
subpackage | Plugin |
since | 1.2 |
string
The name of the action to which the $function_to_add is hooked.
callback
The name of the function you wish to be called.
integer
optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
integer
optional. The number of arguments the function accept (default 1).
add_filter(string $tag, callback $function_to_add, integer $priority= 10
, integer $accepted_args= 1
) : boolean
Filters are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen. Plugins can specify that one or more of its PHP functions is executed to modify specific types of text at these times, using the Filter API.
To use the API, the following code should be used to bind a callback to the filter.
function example_hook($example) { echo $example; }
add_filter('example_filter', 'example_hook');
In WordPress 1.5.1+, hooked functions can take extra arguments that are set when the matching do_action() or apply_filters() call is run. The $accepted_args allow for calling functions only when the number of args match. Hooked functions can take extra arguments that are set when the matching do_action() or apply_filters() call is run. For example, the action comment_id_not_found will pass any functions that hook onto it the ID of the requested comment.
Note: the function will return true no matter if the function was hooked fails or not. There are no checks for whether the function exists beforehand and no checks to whether the $function_to_add is even a string. It is up to you to take care and this is done for optimization purposes, so everything is as quick as possible.
package | WordPress |
---|---|
package | WordPress |
subpackage | Plugin |
since | 0.71 |
global | array $wp_filter Stores all of the filters added in the form of wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)']'] |
global | array $merged_filters Tracks the tags that need to be merged for later. If the hook is added, it doesn't need to run through that process. |
string
The name of the filter to hook the $function_to_add to.
callback
The name of the function to be called when the filter is applied.
integer
optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
integer
optional. The number of arguments the function accept (default 1).
boolean
trueapply_filters(string $tag, mixed $value) : mixed
The callback functions attached to filter hook $tag are invoked by calling this function. This function can be used to create a new filter hook by simply calling this function with the name of the new hook specified using the $tag parameter.
The function allows for additional arguments to be added and passed to hooks.
function example_hook($string, $arg1, $arg2)
{
//Do stuff
return $string;
}
$value = apply_filters('example_filter', 'filter me', 'arg1', 'arg2');
package | WordPress |
---|---|
package | WordPress |
subpackage | Plugin |
since | 0.71 |
global | array $wp_filter Stores all of the filters |
global | array $merged_filters Merges the filter hooks using this function. |
global | array $wp_current_filter stores the list of current filters with the current one last |
string
The name of the filter hook.
mixed
The value on which the filters hooked to $tag are applied on.
mixed
The filtered value after all hooked functions are applied to it.apply_filters_ref_array(string $tag, array $args) : mixed
package | WordPress |
---|---|
package | WordPress |
see | This function is identical, but the arguments passed to the functions hooked to $tag are supplied using an array. |
subpackage | Plugin |
since | 3.0.0 |
global | array $wp_filter Stores all of the filters |
global | array $merged_filters Merges the filter hooks using this function. |
global | array $wp_current_filter stores the list of current filters with the current one last |
string
The name of the filter hook.
array
The arguments supplied to the functions hooked to $tag
mixed
The filtered value after all hooked functions are applied to it.current_filter() : string
did_action(string $tag) : integer
do_action(string $tag, $arg = ''
) : null
This function invokes all functions attached to action hook $tag. It is possible to create new action hooks by simply calling this function, specifying the name of the new hook using the $tag parameter.
You can pass extra arguments to the hooks, much like you can with apply_filters().
package | WordPress |
---|---|
package | WordPress |
see | This function works similar with the exception that nothing is returned and only the functions or methods are called. |
subpackage | Plugin |
since | 1.2 |
global | array $wp_filter Stores all of the filters |
global | array $wp_actions Increments the amount of times action was triggered. |
string
The name of the action to be executed.
null
Will return null if $tag does not exist in $wp_filter arraydo_action_ref_array(string $tag, array $args) : null
package | WordPress |
---|---|
package | WordPress |
see | This function is identical, but the arguments passed to the functions hooked to $tag are supplied using an array. |
subpackage | Plugin |
since | 2.1 |
global | array $wp_filter Stores all of the filters |
global | array $wp_actions Increments the amount of times action was triggered. |
string
The name of the action to be executed.
array
The arguments supplied to the functions hooked to $tag
null
Will return null if $tag does not exist in $wp_filter arrayhas_action(string $tag, callback $function_to_check = false
) : integer | boolean
package | WordPress |
---|---|
package | WordPress |
subpackage | Plugin |
since | 2.5 |
see | has_action() is an alias of has_filter(). |
string
The name of the action hook.
callback
optional. If specified, return the priority of that function on this hook or false if not attached.
integer
boolean
Optionally returns the priority on that hook for the specified function.has_filter(string $tag, callback $function_to_check = false
) : integer | boolean
package | WordPress |
---|---|
package | WordPress |
subpackage | Plugin |
since | 2.5 |
global | array $wp_filter Stores all of the filters |
string
The name of the filter hook.
callback
optional. If specified, return the priority of that function on this hook or false if not attached.
integer
boolean
Optionally returns the priority on that hook for the specified function.plugin_basename(string $file) : string
plugin_dir_path(string $file) : string
plugin_dir_url(string $file) : string
register_activation_hook(string $file, callback $function)
When a plugin is activated, the action 'activate_PLUGINNAME' hook is activated. In the name of this hook, PLUGINNAME is replaced with the name of the plugin, including the optional subdirectory. For example, when the plugin is located in wp-content/plugin/sampleplugin/sample.php, then the name of this hook will become 'activate_sampleplugin/sample.php'. When the plugin consists of only one file and is (as by default) located at wp-content/plugin/sample.php the name of this hook will be 'activate_sample.php'.
package | WordPress |
---|---|
package | WordPress |
subpackage | Plugin |
since | 2.0 |
string
The filename of the plugin including the path.
callback
the function hooked to the 'activate_PLUGIN' action.
register_deactivation_hook(string $file, callback $function)
When a plugin is deactivated, the action 'deactivate_PLUGINNAME' hook is deactivated. In the name of this hook, PLUGINNAME is replaced with the name of the plugin, including the optional subdirectory. For example, when the plugin is located in wp-content/plugin/sampleplugin/sample.php, then the name of this hook will become 'activate_sampleplugin/sample.php'.
When the plugin consists of only one file and is (as by default) located at wp-content/plugin/sample.php the name of this hook will be 'activate_sample.php'.
package | WordPress |
---|---|
package | WordPress |
subpackage | Plugin |
since | 2.0 |
string
The filename of the plugin including the path.
callback
the function hooked to the 'activate_PLUGIN' action.
remove_action(string $tag, callback $function_to_remove, integer $priority= 10
, integer $accepted_args= 1
) : boolean
This function removes a function attached to a specified action hook. This method can be used to remove default functions attached to a specific filter hook and possibly replace them with a substitute.
package | WordPress |
---|---|
package | WordPress |
subpackage | Plugin |
since | 1.2 |
string
The action hook to which the function to be removed is hooked.
callback
The name of the function which should be removed.
integer
optional The priority of the function (default: 10).
integer
optional. The number of arguments the function accpets (default: 1).
boolean
Whether the function is removed.remove_filter(string $tag, callback $function_to_remove, integer $priority= 10
, integer $accepted_args= 1
) : boolean
This function removes a function attached to a specified filter hook. This method can be used to remove default functions attached to a specific filter hook and possibly replace them with a substitute.
To remove a hook, the $function_to_remove and $priority arguments must match when the hook was added. This goes for both filters and actions. No warning will be given on removal failure.
package | WordPress |
---|---|
package | WordPress |
subpackage | Plugin |
since | 1.2 |
string
The filter hook to which the function to be removed is hooked.
callback
The name of the function which should be removed.
integer
optional. The priority of the function (default: 10).
integer
optional. The number of arguments the function accpets (default: 1).
boolean
Whether the function existed before it was removed.wp_get_original_referer() : string | boolean
wp_get_referer() : string | boolean
wp_original_referer_field(boolean $echo= true
, string $jump_back_to= 'current'
) : string
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.
package | WordPress |
---|---|
package | WordPress |
subpackage | Security |
since | 2.0.4 |
boolean
Whether to echo the original http referer
string
Optional, default is 'current'. Can be 'previous' or page you want to jump back to.
string
Original referer field.wp_referer_field(boolean $echo = true
) : string
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.
package | WordPress |
---|---|
package | WordPress |
subpackage | Security |
since | 2.0.4 |
boolean
Whether to echo or return the referer field.
string
Referer field.