Custom Fields
Re-Envisioned
Support Meta Box Conditional Logic Conditional Logic seems broken since update

  • Creator
    Topic
  • #24210
    Resolved Alex Mansfield
    Participant

    I’m trying to display meta boxes specific to the category that a post belongs to. This was working before the update, but now it’s not. It looks like all conditional logic is broken, because I can see the condition to “Test = Not Test” and it will still show the meta box (even though “Test” is definitely not equal to “Not Test”. Any idea what might be causing this?

Viewing 10 replies - 1 through 10 (of 16 total)
  • Author
    Replies
  • #24214
    Long Nguyen
    Moderator

    Hi,

    Do you mean after updating Meta Box AIO v1.13.0 then the conditional logic is broken? Can you please follow the step Debugging Information and let me know what’s going on?
    https://metabox.io/support/topic/how-to-create-a-new-topic/

    You can also share the code to create the conditional logic, I will test it on my demo site.

    #24240
    Alex Mansfield
    Participant

    Yes, I believe the update to AIO v1.13.0 is when the issue began. I do have automatic updates enabled though, so I’m not 100% sure that’s when it happened. I’m using the Builder extension, but here’s the code it generated:

    <?php
    add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
    
    function your_prefix_function_name( $meta_boxes ) {
        $prefix = '';
    
        $meta_boxes[] = [
            'title'      => __( 'Search Engine Optimization Details', 'your-text-domain' ),
            'id'         => 'search-engine-optimization-details',
            'post_types' => ['plugin'],
            'autosave'   => true,
            'visible'    => [
                'when'     => [['_wpo_plugin_category', 'in', 6]],
                'relation' => 'and',
            ],
            'fields'     => [
                [
                    'name'    => __( 'Editing', 'your-text-domain' ),
                    'id'      => $prefix . '_wpo_seo_editing',
                    'type'    => 'checkbox_list',
                    'desc'    => __( 'Which settings can be edited through the SEO plugin\'s interface?', 'your-text-domain' ),
                    'options' => [
                        'Bulk editing'     => __( 'Bulk editing', 'your-text-domain' ),
                        'Canonical URLs'   => __( 'Canonical URLs', 'your-text-domain' ),
                        'Meta information' => __( 'Meta information', 'your-text-domain' ),
                        'robots.txt'       => __( 'robots.txt', 'your-text-domain' ),
                        '.htaccess'        => __( '.htaccess', 'your-text-domain' ),
                    ],
                ],
                [
                    'name'    => __( 'Social', 'your-text-domain' ),
                    'id'      => $prefix . '_wpo_seo_social',
                    'type'    => 'checkbox_list',
                    'desc'    => __( 'Which social media structured data is supported?', 'your-text-domain' ),
                    'options' => [
                        'Facebook Open Graph' => __( 'Facebook Open Graph', 'your-text-domain' ),
                        'Twitter Card'        => __( 'Twitter Card', 'your-text-domain' ),
                        'Instagram'           => __( 'Instagram', 'your-text-domain' ),
                        'Pinterest'           => __( 'Pinterest', 'your-text-domain' ),
                        'YouTube'             => __( 'YouTube', 'your-text-domain' ),
                        'LinkedIn'            => __( 'LinkedIn', 'your-text-domain' ),
                        'oEmbed'              => __( 'oEmbed', 'your-text-domain' ),
                        'Discord'             => __( 'Discord', 'your-text-domain' ),
                    ],
                ],
                [
                    'name'    => __( 'Structured Data', 'your-text-domain' ),
                    'id'      => $prefix . '_wpo_seo_structured_data',
                    'type'    => 'checkbox_list',
                    'desc'    => __( 'Which structured data types are supported?', 'your-text-domain' ),
                    'options' => [
                        'Dublin Core'            => __( 'Dublin Core', 'your-text-domain' ),
                        'Google Knowledge Graph' => __( 'Google Knowledge Graph', 'your-text-domain' ),
                        'Article'                => __( 'Article', 'your-text-domain' ),
                        'BlogPosting'            => __( 'BlogPosting', 'your-text-domain' ),
                        'Breadcrumbs'            => __( 'Breadcrumbs', 'your-text-domain' ),
                        'Course'                 => __( 'Course', 'your-text-domain' ),
                        'Custom schemas'         => __( 'Custom schemas', 'your-text-domain' ),
                        'Event'                  => __( 'Event', 'your-text-domain' ),
                        'FAQ'                    => __( 'FAQ', 'your-text-domain' ),
                        'HowTo'                  => __( 'HowTo', 'your-text-domain' ),
                        'Job'                    => __( 'Job', 'your-text-domain' ),
                        'Local business'         => __( 'Local business', 'your-text-domain' ),
                        'Logo'                   => __( 'Logo', 'your-text-domain' ),
                        'NewsArticle'            => __( 'NewsArticle', 'your-text-domain' ),
                        'Organization'           => __( 'Organization', 'your-text-domain' ),
                        'Person'                 => __( 'Person', 'your-text-domain' ),
                        'Product'                => __( 'Product', 'your-text-domain' ),
                        'Recipe'                 => __( 'Recipe', 'your-text-domain' ),
                        'Review'                 => __( 'Review', 'your-text-domain' ),
                        'Service'                => __( 'Service', 'your-text-domain' ),
                        'Sitelinks searchbox'    => __( 'Sitelinks searchbox', 'your-text-domain' ),
                        'Software application'   => __( 'Software application', 'your-text-domain' ),
                        'Video'                  => __( 'Video', 'your-text-domain' ),
                    ],
                ],
                [
                    'name'    => __( 'Automation', 'your-text-domain' ),
                    'id'      => $prefix . '_wpo_seo_automation',
                    'type'    => 'checkbox_list',
                    'desc'    => __( 'Which settings can be automatically generated by the plugin?', 'your-text-domain' ),
                    'options' => [
                        'Title'           => __( 'Title', 'your-text-domain' ),
                        'Description'     => __( 'Description', 'your-text-domain' ),
                        'Structured data' => __( 'Structured data', 'your-text-domain' ),
                        'Image alt'       => __( 'Image alt', 'your-text-domain' ),
                        'robots.txt'      => __( 'robots.txt', 'your-text-domain' ),
                        'Open Graph'      => __( 'Open Graph', 'your-text-domain' ),
                        'Twitter Card'    => __( 'Twitter Card', 'your-text-domain' ),
                    ],
                ],
                [
                    'name'    => __( 'Sitemap Support', 'your-text-domain' ),
                    'id'      => $prefix . '_wpo_seo_sitemap_support',
                    'type'    => 'checkbox_list',
                    'desc'    => __( 'Which types of sitemaps are supported?', 'your-text-domain' ),
                    'options' => [
                        'XML'    => __( 'XML', 'your-text-domain' ),
                        'HTML'   => __( 'HTML', 'your-text-domain' ),
                        'Author' => __( 'Author', 'your-text-domain' ),
                        'Image'  => __( 'Image', 'your-text-domain' ),
                        'News'   => __( 'News', 'your-text-domain' ),
                        'Video'  => __( 'Video', 'your-text-domain' ),
                    ],
                ],
                [
                    'name'    => __( 'Additional Features', 'your-text-domain' ),
                    'id'      => $prefix . '_wpo_seo_additional_features',
                    'type'    => 'checkbox_list',
                    'desc'    => __( 'What other features does this plugin support?', 'your-text-domain' ),
                    'options' => [
                        'Content analysis'          => __( 'Content analysis', 'your-text-domain' ),
                        'Data migration'            => __( 'Data migration', 'your-text-domain' ),
                        'Import/export'             => __( 'Import/export', 'your-text-domain' ),
                        'CSV meta import'           => __( 'CSV meta import', 'your-text-domain' ),
                        'Redirect attachment pages' => __( 'Redirect attachment pages', 'your-text-domain' ),
                        'RSS optimization'          => __( 'RSS optimization', 'your-text-domain' ),
                        'Google preview'            => __( 'Google preview', 'your-text-domain' ),
                        'Social previews'           => __( 'Social previews', 'your-text-domain' ),
                    ],
                ],
            ],
        ];
    
        return $meta_boxes;
    }
    #24267
    Long Nguyen
    Moderator

    Hi,

    Follow your code I understand that the meta box search-engine-optimization-details is shown up when the field (outside of this meta box) _wpo_plugin_category has a value of 6. Just check on my local site with Meta Box AIO 1.13.0 and do not see any error.

    Can you please deactivate all plugins except Meta Box, Meta Box AIO, and switch to the default theme of WordPress (Twenty TwentyOne) to check this issue again?

    #24276
    Alex Mansfield
    Participant

    I disabled the rest of the plugins and activated the Twenty Twenty One theme, but I still had the same issue. I even took the relevant code generated by the Meta Box Builder extension, added the code to the functions.php file, and deactivated the AIO plugin, but that didn’t help either. Is there a way for me to let you log in and take a look?

    #24277
    Alex Mansfield
    Participant

    Conditional Logic seems to be the problem. I can’t get any conditions to have an effect on the visibility of a custom meta box.

    #24282
    Long Nguyen
    Moderator

    Hi,

    Conditional logic only works when the plugin Meta Box Conditional Logic or Meta Box AIO (go to Meta Box > Extensions and make sure that extension Meta Box Conditional Logic enable.) activated. Can you please leave Meta Box and Meta Box AIO activated then check this issue?

    #24291
    Alex Mansfield
    Participant

    Yes, I understand that. I have Meta Box AIO installed, and the Conditional Logic extension is enabled. I even re-installed AIO from scratch just to make sure that wasn’t the issue. Updating to 1.13.0 is the problem. If I delete 1.13.0 and install 1.12.0 instead, then conditional logic works again.

    #24293
    Long Nguyen
    Moderator

    Hi,

    Please share your site credentials via this contact form https://metabox.io/contact/, I will take a closer look.

    #24304
    Alex Mansfield
    Participant

    Thanks Long. I just sent my login details through the form you mentioned.

    #24315
    Long Nguyen
    Moderator

    Hi,

    Maybe the CPT slug plugin caused the issue. I’ve tested to assign two field groups to post and do not see any issue so back to the CPT, I changed it to plugin1 slug and conditional logic works as well. Screen record https://share.getcloudapp.com/o0uEx2o1.

    It might relate to the Reserved Terms in the new version of WordPress.
    https://docs.metabox.io/extensions/mb-custom-post-type/#reserved-terms

Viewing 10 replies - 1 through 10 (of 16 total)
  • You must be logged in to reply to this topic.