Hello I have problem with my custom plugin :/

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wp_slider_info_page' not found or invalid function name in C:\xampp\htdocs\wordpress\wp-includes\plugin.php on line 496

I found many topics about this warning but I still don't know what is wrong.. :/

if ( !class_exists( 'wp_slider' ) ) {

    class wp_slider{

        function __construct() {

            add_action( 'admin_menu', array( $this, 'wp_slider_info' ) );
            add_action( 'slider-style', array( $this, 'slider_styles') );
            add_action( 'slider-script', array( $this, 'slider_scripts') );

            add_filter( 'the_content', array( $this, 'wp_slider_info_page') );

            register_activation_hook( __FILE__, array( $this, 'wp_install' ) );
            register_deactivation_hook(__FILE__, array( $this, 'wp_uninstall' ) );

        function wp_slider_info(){

            add_menu_page('wp Slider', 'wp Slider', 'administrator', 'slider-info', 'wp_slider_info_page', 'dashicons-format-video');

        function wp_install(){
            global $wpdb;
            $sql="CREATE TABLE $table_name (
            id int(11) NOT NULL AUTO_INCREMENT,
            image varchar(255) NOT NULL,
            link varchar(255) NOT NULL,
            title varchar(255) NOT NULL,
            content text NULL,
            UNIQUE KEY id (id)

            require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
            dbDelta( $sql );

        function wp_uninstall(){
            global $wpdb;
            $sql='DROP TABLE '.$table_name;

        public function slider_scripts() {

            if (!is_admin()) {
                wp_register_style('slider-script', plugins_url('slider-script.js', __FILE__), array( 'jquery' ));

        public function slider_styles( $page ) {

            wp_register_style('slider-style', plugins_url('slider-style.css', __FILE__));

        function wp_slider_info_page( $content ){

            return $content . '<p>Test</p>';


    new wp_slider();

  • Welcome to WPSE. Your question is unfortunately off topic due to it being asking for debug help. The error you are getting is quite explicit and tells you exactly what is wrong. Reread your error Commented Mar 31, 2015 at 11:25
  • try changing function wp_slider_info_page to public function wp_slider_info_page. See if that helps.
    – Sisir
    Commented Apr 1, 2015 at 7:30

1 Answer 1


wp_slider_info_page is method of a class.

Function in class has to be set like this:

array( $this, 'wp_slider_info_page' )

only then WP knows that it is part of current class.


add_menu_page('wp Slider', 'wp Slider', 'administrator', 'slider-info', 'wp_slider_info_page', 'dashicons-format-video');


add_menu_page('wp Slider', 'wp Slider', 'administrator', 'slider-info', array( $this, 'wp_slider_info_page' ), 'dashicons-format-video');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.