WordPress.org

Ready to get started?Download WordPress

Forums

Post Expirator
[resolved] Multiple call to _scheduleExpiratorEvent causes constant error (2 posts)

  1. Bas Schuiling
    Member
    Posted 12 months ago #

    I'm using a script that calls multiple times ( I have an array of posts-ID's to schedule ) to _scheduleExpiratorEvent. However by the way of defining postExpiratorDebug which is called starting the function every next iteration leads to a 'Notice: Constant is already defined' error.

    Below I'm just returning when the constant is already set which leaves me no further errors ( but I can image it can be done a bit more solid than this ).

    function postExpiratorDebug() {
    	$debug = get_option('expirationdateDebug');
    if (defined("POSTEXPIRATOR_DEBUG")) return; // <-- my addition
    	if ($debug == 1) {
    		define('POSTEXPIRATOR_DEBUG',1);
                    require_once(plugin_dir_path(__FILE__).'post-expirator-debug.php'); // Load Class
                    return new postExpiratorDebug();
    	} else {
    		define('POSTEXPIRATOR_DEBUG',0);
    		return false;
    	}
    }

    It's no biggie but maybe some small improvement for next version :)

    http://wordpress.org/extend/plugins/post-expirator/

  2. Aaron Axelsen
    Member
    Plugin Author

    Posted 11 months ago #

    I've made some adjustments in the development version that will be in the next release.

Reply

You must log in to post.

About this Plugin

About this Topic