Created
October 8, 2011 13:55
-
-
Save cori/1272309 to your computer and use it in GitHub Desktop.
Wordpress Custom hook problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class hook_client { | |
static function start() { | |
//logging here shows that this function is being called | |
add_filter('custom_filter', array(__CLASS__, 'filter_handler'), 1, 2 ); | |
//logging here shows that the custom_filter hook is being hooked to | |
} | |
static function filter_handler($content, $postdata) { | |
//logging here shows that this method is never entered | |
//do stuff with $content | |
return $content | |
} | |
} | |
hook_client::start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class plugin { | |
function do_stuff() { | |
// do some stuff with $content | |
$postdata['content'] = apply_filters('custom_filter', $content, &$postdata); | |
// logging $postdata['content'] returns null here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment