Let me look at what this code means.

Source: Internet
Author: User
Php experts help me to see what this code means: function & nbsp; apply_filters ($ tag, & nbsp; $ value) & nbsp; {global & nbsp; $ wp_filter, & nbsp; $ merged_filters, & nbsp; $ php experts help me see what this code means


function apply_filters($tag, $value) {
global $wp_filter, $merged_filters, $wp_current_filter;

$args = array();

if ( isset($wp_filter['all']) ) {
$wp_current_filter[] = $tag;
$args = func_get_args();
_wp_call_all_hook($args);
}

if ( !isset($wp_filter[$tag]) ) {
if ( isset($wp_filter['all']) )
array_pop($wp_current_filter);
return $value;
}

if ( !isset($wp_filter['all']) )
$wp_current_filter[] = $tag;

if ( !isset( $merged_filters[ $tag ] ) ) {
ksort($wp_filter[$tag]);
$merged_filters[ $tag ] = true;
}

reset( $wp_filter[ $tag ] );

if ( empty($args) )
$args = func_get_args();

do {
foreach( (array) current($wp_filter[$tag]) as $the_ )
if ( !is_null($the_['function']) ){
$args[1] = $value;
$value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
}

} while ( next($wp_filter[$tag]) !== false );

array_pop( $wp_current_filter );

return $value;
}



function the_permalink() {
echo apply_filters('the_permalink', get_permalink());
}
Share:
------ Solution --------------------
Common functions-apply_filters ()
Description
Call the function added to the filter hook. View the filter hook list on the Plugin API.
By calling this function, you can call the callback function attached to the filter hook $ tag. You can call this function by using the name of the new hook specified by the $ tag parameter to create a new filter hook.
Usage
 
Parameters
$ Tag
(String) (required) name of the filter hook
Default value: None
$ Value
(Mixed) (required) values that may be modified by connecting to the filter on $ tag
Default value: None
Returned value
(Mixed) after all connected functions are applied to this function, the $ value result is returned.
Note: the type of the returned value should be the same as that of $ value, such as a string or array.
Usage:

$ Tag: any value can be customized.
$ Value: any value can be customized.

------ Solution --------------------
Reference:
Quote: reference:

Common functions-apply_filters ()
Description
Call the function added to the filter hook. View the filter hook list on the Plugin API.
By calling this function, you can call the callback function attached to the filter hook $ tag. You can call this function by using the name of the new hook specified by the $ tag parameter to create a new filter hook.
Usage
 
Parameters
$ Tag
(String) (required) name of the filter hook
Default value: None
$ Value
(Mixed) (required) values that may be modified by connecting to the filter on $ tag
Default value: None
Returned value
(Mixed) after all connected functions are applied to this function, the $ value result is returned.
Note: the type of the returned value should be the same as that of $ value, such as a string or array.
Usage:

$ Tag: any value can be customized.
$ Value: any value can be customized.


Filter hook? What is it?
I chose wordpress as a blog. I first displayed all the blog posts (pagination) on the blog. php page, and then clicked the title to enter the full blog content.
Why did I jump to index when I click the blog title. php page, if it is a template written by someone else, in index. all blog posts are displayed in php. click the title and click index. why can't I change a page if the full blog is displayed in php? The code is roughly as follows:

// Check for logs
// Loop when a blog post has logs
"Title =" ">

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.