Simple WordPress function / plugin to redirect a site

While the plugin might solve your problem you could try something direct with WordPress API: add_action( ‘template_redirect’, ‘wpse_142191_all_redirect’ ); function wpse_142191_all_redirect() { if ( !is_user_logged_in() ) { wp_redirect( ‘http://other-site.com’, 301); exit; //always die or exit after redirect } } Be careful with it,this will redirect the whole site on the home page of other site. … Read more

How to send email when my plugin is activated?

I offer you an idea that I have already used something like this. I wanted to know the sites that my plugin uses, I created a cron job allow me to send me an email every week : add_action(‘init’, function() { $time = wp_next_scheduled(‘dro_cron_hook’); wp_unschedule_event($time, ‘dro_cron_hook’); if (!wp_next_scheduled(‘dro_cron_hook’)) { wp_schedule_event(time(), ‘everyweek’, ‘dro_cron_hook’); } }); add_filter(‘cron_schedules’, … Read more

Move specific javascript to the footer

It is generally not recommended to put move javascript files to the footer, especially WordPress dependencies. WordPress and plugins require and expect dependencies to be in the header and things can go awry if they aren’t. There are workarounds for this, but in many cases if you do move things to the footer and a … Read more

__FILE__ in WordPress plugins

It should work (and does when I test on a new WP install) with __FILE__, though it’s not recommended because it exposes the server path and is just generally an ugly URL. You can replace it with a unique identifier like ‘sb-generator-options’ or whatever really, as long as it’s unique. the important part is the … Read more