-1
I am developing a wordpress plugin and when I use object orientation to add a button in the post section it displays me the following error:
"Warning: call_user_func_array() expects Parameter 1 to be a Valid callback, Function 'add_media_button' not found or invalid Function name in /var/www/jovempan/wp-includes/class-wp-hook.php on line 286"
Note: This error only appears when using POO
My code:
class PostagensRelacionadas{
public function __construct(){
add_action('media_buttons', 'add_media_button');
}
public function add_media_button() {
$dados = printf( ' <a href="#TB_inline?&width=600&height=550&inlineId=my-content-id" class="button my-button my-custom-button" id="my-custom-button">' . '<span class="wp-media-buttons-icon dashicons dashicons-art"></span> %s' . '</a>', 'Notícias Relacionadas', __( 'Notícias relacionadas', 'textdomain' ) );
}
}
$class = new PostagensRelacionadas();
$class->add_media_button();