Declare a function before plugin does on the theme functions.php file
You cannot do that in a theme, because themes are loaded after plugins. Use a custom plugin, maybe a mu-plugin to be sure, because they are loaded earlier than normal plugins.
You cannot do that in a theme, because themes are loaded after plugins. Use a custom plugin, maybe a mu-plugin to be sure, because they are loaded earlier than normal plugins.
You’d need to put the variable’s value onto the page so that javascript can pass it back to PHP using ajax. Ajax functions are a completely separate “page load” so even if you made it global it won’t work. The best way to do this is using “wp_localize_script” (https://codex.wordpress.org/Function_Reference/wp_localize_script) Here’s an full example of how … Read more
I hate OOP mixed in the functional structure of wordpress (here come the downvotes…..). If you use OOP just for name spacing then just use the name spacing feature of PHP, putting function in a class is just a very small part of what OOP should be. Anyway, your problems is that a there are … Read more
register_post_type needs to be called on every page load– init seems to be fine and is the hook used in the Codex sample. The post data itself is kept in the database, but the registration tells the PHP what to do with it. Most of the post type information– the $labels, the $args— are not … Read more
Your error log does tell you the reason, it’s the part about: Refused to display … in a frame because it set to ‘X-Frame-Origin’ to ‘SAMEORIGIN,DENY’ And the reason for that is the one about “conflicting values” before it. WordPress core only sends SAMEORIGIN value in admin screens, via send_frame_options_header(). So DENY is coming from … Read more
Have a look at the Network Admin Settings screen (in my installation, it’s at example.com/wp-admin/network/settings.php). Tucked away down near the bottom is this: Menu Settings Enable administration menus [] Plugins Checking that box should allow your users to see the Plugins menu in their sites’ back end. (I don’t think it’ll allow them to install … Read more
In your theme, add a custom action in a template where you want to show the output: do_action( ‘show_lyrics’ ); This does nothing for itself. Now you can add the function hello_dolly as a callback for that action in your functions.php: if ( function_exists( ‘hello_dolly’ ) ) { add_action( ‘show_lyrics’, ‘hello_dolly’ ); }
For disabling the text tab for all users except administrators, you can add the following: function my_editor_settings($settings) { if ( ! current_user_can(‘administrator’) ) { $settings[‘quicktags’] = false; return $settings; } else { $settings[‘quicktags’] = true; return $settings; } } add_filter(‘wp_editor_settings’, ‘my_editor_settings’);
I created simple class which will do exactly what you want. To switch theme you must add theme GET parameter to your site url with name of the theme. http://example.com/?theme=twentyfifteen Selected theme will also be stored in cookie so next time the user enters the site he will have earlier selected theme. class WPSE_287356_Theme_Switcher { … Read more
Yes, it’s absolutely possible for a plugin to make permanent changes to a site. The plugin could add to or modify the contents of the database and it could remove files (typically this would apply to media). It’s not uncommon for plugins to leave behind orphaned data such as options in the database. This is … Read more