Certain functions are undefined when called form mu-plugins

Thanks to diggy from StackOverflow I’ve foudn that in the WordPress cycle, the file vars.php (containing my needed functions) is included after muplugins_loaded executes. Including wp_is_mobile() and current_user_can() in wrapper functions fixed my problem. CORRECT function my_epic_function() { if(current_user_can( ‘edit_posts’ )) { if(!wp_is_mobile()) { //code to be executed } } } add_action(‘init’, ‘my_epic_function’); INCORRECT function … Read more

Create Table on Plugin Activation

You are getting this error because ‘wpmyfirstplugin_createTable’ is called on register_activation_hook. This hook is called when a plugin is activated from dashboard and before declaring any variable. So when this function runs it does not get the table name parameter.

Add sub menu page in your plugin

The add_submenu_page first parameter should be the top menu page handle which in you case is a-qoute so: function a_qoute_admin_action(){ add_menu_page( __(‘Reservations Pages’),// the page title __(‘Donation’),//menu title ‘edit_themes’,//capability ‘a-qoute’,//menu slug/handle this is what you need!!! ‘qoute_settings’,//callback function ”,//icon_url, ”//position ); add_submenu_page( ‘a-qoute’, ‘Donations Log’, //page title ‘Donations Log’, //menu title ‘edit_themes’, //capability, ‘DonationsLog’,//menu slug … Read more

Inserting custom PHP script on homepage

As you have already understated, running executable PHP inside a text box is not a good idea. It isn’t only just not a good idea, but a terrible idea. This creates a loop hole in your security which can be very easily exploited by a hacker. I would suggest writing your own custom widget for … Read more

call_user_func_array() expects parameter 1 to be a valid callback

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. Replace add_menu_page(‘wp Slider’, ‘wp Slider’, ‘administrator’, ‘slider-info’, ‘wp_slider_info_page’, ‘dashicons-format-video’); with add_menu_page(‘wp Slider’, ‘wp Slider’, ‘administrator’, ‘slider-info’, array( $this, ‘wp_slider_info_page’ ), ‘dashicons-format-video’);

Where are theme codes located for WordPress?

They’re probably referring to the functions file in your theme, functions.php. This file is loaded by WordPress during setup, and gives you an opportunity to do things or register hooks and filters. Note that this file is optional, and not every theme has a functions.php, if that’s the case just create one yourself Keep in … Read more