Hot answers tagged

2

This is just a typo Wrong //wvdh-startpoint add_submenu_page( 'wvdh-startpoint', 'page-from-plugin', 'menu-from-plugin', 'manage_options', 'plugin-slug', 'wvdh_settings_page' ); Correct //wdvh-startpoint add_submenu_page( 'wdvh-startpoint', 'page-from-plugin', 'menu-from-plugin', 'manage_options', 'plugin-slug', 'wvdh_settings_page' );


2

get_template_directory_uri works in a plugin, in that it returns the active theme directory URI, which is what the template directory is. If you're trying to get the URI for your plugin assets, then you want plugin_dir_url. wp_enqueue_script( 'jquery-repeater-form', plugin_dir_url( __FILE__ ) . 'js/sample.js' );


2

Your code seems correct, but it will load the script only in admin area beacuse you are enqueuing the script in admin_enqueue_scripts action. To load the script in frontend, use wp_enqueue_scripts action (which is not the same that wp_enqueue_script() function): function Zumper_widget_enqueue_script() { wp_enqueue_script( 'my_custom_script', ...


1

WPINC is defined by WP before plugins are loaded; so, the fact that it is already defined indicates the plugin is being loaded by WP rather than a direct request.



Only top voted, non community-wiki answers of a minimum length are eligible