How can I pass a variable to wp_ajax action?

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

Extension preview disapeared since WP 4.5.2

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

How to enable Admins to see Plugins

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

how to customize hello dolly plugin?

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’ ); }

Disable text tab on WordPress text-editor

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’);

Set active theme via URL

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

Can a plugin cause permanent damage?

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