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

Using add_filter inside another class

The reason you see the default value is that you are adding the filter after the filter has been applied, which results in the default value being used. The filter is applied when the object is constructed, which I’m assuming is before admin_init. If it’s after admin_init it won’t work either, but that’s because the … Read more

Add Archive Page Template via Plugin

WordPress has a template_include filter which you can use. // Add a filter to ‘template_include’ hook add_filter( ‘template_include’, ‘wpse_force_template’ ); function wpse_force_template( $template ) { // If the current url is an archive of any kind if( is_archive() ) { // Set this to the template file inside your plugin folder $template = WP_PLUGIN_DIR .”https://wordpress.stackexchange.com/”. … Read more

How exactly does Bad Behavior plugin work?

Bad Behavior does two things: It checks the HTTP request and sees if it is as per the standard or not. Usually spammers don’t write their scripts so well as to be fully compliant with the HTTP standard. Bad Behavior can make out poorly scripted HTTP requests from properly scripted ones (which would be sent … Read more