Loading within plugin

Support MB Conditional Logic Loading within plugin

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #3614
    carassiuscarassius
    Participant

    I have conflicts with multiple instances of conditional logic?

    This is my php to load within the plugin, but it returns the error that the class cannot be redeclared

    if( !class_exists( 'MB_Conditional_Logic' ) ) {
    	include plugin_dir_path( __FILE__ ) . 'meta/meta-box-conditional-logic/meta-box-conditional-logic.php';
    }
    #3615
    Anh TranAnh Tran
    Keymaster

    Do you include the conditional logic multiple times in plugins?

    #3616
    carassiuscarassius
    Participant

    Once per plugin, but across multiple plugins

    #3617
    weseoweseo
    Participant

    I do the same (also multiple plugins), but i have no problems:

    if (!class_exists('MB_Conditional_Logic'))
        require_once 'meta-box-conditional-logic/meta-box-conditional-logic.php';
    #3618
    carassiuscarassius
    Participant

    Wonder if the issue is with a difference of include and require_once then

    #3621
    Anh TranAnh Tran
    Keymaster

    Please try with require_once. Also which class the error says already declared?

    #3624
    Anh TranAnh Tran
    Keymaster

    I have told @tannguyen, the developer of Conditional Logic to check it carefully. Please wait.

    #3874
    Tan NguyenTan Nguyen
    Participant

    I've created 2 plugins named Plugin 1 and Plugin 2, and it works:

    
    <?php
    /*
    Plugin Name: Plugin 1
    Plugin URI: https://giga.ai
    Description: Test Plugin 1
    Version: 0.1
    Author: Tan Nguyen
    Author URI: https://giga.ai
    License: GPL2+
    */
    
    if( ! class_exists( 'MB_Conditional_Logic' ) )
    	include plugin_dir_path( __FILE__ ) . 'meta-box-conditional-logic/meta-box-conditional-logic.php';
    

    Can you please check if another locations has included this plugin? Or please check your hosting environment.

    Cheers!

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Loading within plugin’ is closed to new replies.