Creating a plugin, getting Warning: call_user_func_array() expects parameter 1
-
I’m trying to put together my own little plugin. Everything went fine and I decided I’d try breaking the code up into several different files. Bear with me as I’m fairly new to making plugins, I’ve only made very simple personal ones before.
I started getting this error after dividing it into multiple files, is it something obvious I’ve missed? I looked at what other plugins did to see how it’s done (or how I think it is).
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘create_fvmenu’ not found or invalid function name in /Users/name/Sites/wordpress/wp-includes/plugin.php on line 405
fvshop.php:
<?php /* Plugin Name: FVshop Version: 0.1 */ define( 'FVSHOP_URL', WP_PLUGIN_URL.'/fvshop' ); define( 'FVSHOP_DIR', WP_PLUGIN_URL.'/fvshop' ); if (is_admin()) { require_once( FVSHOP_DIR . '/includes/fvshop-admin-core.php'); } if (is_admin()) { add_action('admin_init', 'create_fvmenu'); }
/includes/fvshop-admin-core.php:
<?php function create_fvmenu() { add_action('admin_menu', 'fvshop_menu'); function fvshop_menu() { $args = array( 'page_title' => 'FV Shop', 'menu_title' => 'FV Shop', 'capability' => 'manage_options', 'menu_slug' => 'fv_shop', 'function' => '', 'icon_url' => '', 'position' => '' ); add_menu_page('FV Shop', 'FV Shop', 'manage_options', 'fv_shop', 'fv_shop_options', '', '3'); add_submenu_page( 'fv_shop', 'Options', 'Options', 'manage_options', 'opt', 'fv_shop_options'); // add_options_page('FV Shop Options', 'FV Shop', 'manage_options', 'fvshopbutik', 'fv_shop_options'); } function fv_shop_options() { if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.') ); } echo '<div class="wrap">'; echo '<p>FVshoppens options.</p>'; echo '</div>'; } }
Doesn’t really matter what kind of function I put in the second file, I still get the same error.
Could someone shine some light on what I’m doing wrong, or what it is that could be happening?
- The topic ‘Creating a plugin, getting Warning: call_user_func_array() expects parameter 1’ is closed to new replies.