Fix errors in NS Cloner Pro plugin

I like developing with errors enabled. Unfortunately the team who makes NS Cloner does not, which results in tons of errors when using NS Cloner pro. These are mostly trivial errors like uninitialized variables and deprecation warnings. Regardless, they make the plugin unusable for me.

Here is a quick plugin that disables PHP errors altogether when you’re in the NS Cloner Pro tab. Save this snippet as: /wp-content/mu-plugins/ns-cloner-fix.php

(If you don’t have an mu-plugins directory, create it)

<?php
/*
Plugin Name: NS Cloner error fix
Plugin URI:
Description: Disables error reporting while we're on the NS Cloner tab
Version: 2014.04.01
Author: khromov
Author URI: http://profiles.wordpress.org/khromov/
License: GPL2
*/

add_action('muplugins_loaded', function()
{
    if(get_current_blog_id() === 1)
    {
        $siteurl = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
        if(strpos($siteurl, '/wp-admin/network/sites.php?page=ns-cloner-pro') !== false)
            error_reporting(0);
    }
});

1 thought on “Fix errors in NS Cloner Pro plugin

  1. Never Settle

    Thank you for working with the Cloner and sharing this band-aid on the issue. We’re taking your point to heart and rebuilding V3 with errors enabled :) We’ll also have all of this cleaned up when we release the next version in the near future, and are always open to feedback on how to improve our products!

    Much appreciated!
    NS

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Markdown is allowed in comments.