-
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
bugSomething isn't workingSomething isn't working
Description
When I add a hook to a class method;
- If I have a namspace,
__NAMESPACE__is prefixed the callback name:
<?php
declare( strict_types = 1 );
namespace Soderlind\Test;
class Test {
public function __construct() {
add_filter('the_content',__NAMESPACE__ . '\\filter_the_content' );
add_action('init',__NAMESPACE__ . '\\action_init' );
}
.
.
.
}- If I don't have a namespace:
public function __construct() {
add_filter('the_content','filter_the_content' );
add_action('init','action_init' );
}In both cases, the correct is
public function __construct() {
add_filter('the_content', [ $this, 'filter_the_content' ] );
add_action('init', [ $this,'action_init' ] );
}Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working