wpmetabox / meta-box

The best plugin for WordPress custom fields and custom meta boxes
https://metabox.io
1.19k stars 422 forks source link

4.8.0 update breaks select_advanced field type (multiple = true) #771

Closed ryanlabelle closed 8 years ago

ryanlabelle commented 8 years ago

After upgrading to 4.8.

Before: http://new.tinygrab.com/6407caa59e5d54225e42221118aaba162e8420551f.png

After: http://new.tinygrab.com/6407caa59e1d50292986c9a10b6ab2bb6e325b81a5.png

Thanks for the urgent response, we are supporting thousands of installs. :)

I originally posted under a recent issue ticket but realized this is a separate issue involving just the core metabox plugin.

funkatron82 commented 8 years ago

Can you post the code you are using for select_advanced? Also, what does it do if you use a regular select?

ryanlabelle commented 8 years ago

Sure thing. Thanks.

Our code looks like this:

$options = array(
        'id'          => "KEY",
        'name'        =>  'Select individually',
        'type'        => 'post',
        // Post type
        'post_type'   => $post_type,
        // Field type, either 'select' or 'select_advanced' (default)
        'field_type'  => 'select_advanced',
        'multiple'    => true,
        'placeholder' =>  'Select an Item',
        'desc' =>   $desc,
        'query_args'  => array(
            'post_status'    => 'publish',
            'posts_per_page' => - 1,
        ),
        'class' => 'checkbox-condition',
        'tab'  => 'select_list',
    );

Regular select seems to work well.

ryanlabelle commented 8 years ago

Also, the markup looks close, the posts (select options) are coming through but the select list just isn't working.

Before: http://new.tinygrab.com/6407caa59ecfd5b5a4e347b82617cd78a4bc8f8683.png

After: http://new.tinygrab.com/6407caa59ee2072cb8cfa2e569179905972a9283fa.png

I don't see any JS console errors.

funkatron82 commented 8 years ago

Okay, think I fixed it in https://github.com/rilwis/meta-box/commit/774e4ed0278c401a4f38e3cf973e3b005130bbc2. The select fields were getting an extra [] on the name by accident. Fixed the culprit. Download the latest version from github for now, Rilwis will do an update on wordpress.org later tonight.

ryanlabelle commented 8 years ago

Thanks. Just testing and I"m not getting the fix but I'll test some more.

ryanlabelle commented 8 years ago

Sorry bud, still getting a blank box.

Here is the markup after the recent update: http://new.tinygrab.com/6407caa59e8498cba0a5931455c313c08915eaad17.png

Here is a screen of the controls: http://new.tinygrab.com/6407caa59e00474cdc1ee9156ce2a5939e8e7e18bc.png They are there but when active (mouse click) there is no dropdown

What it normally looks like: http://new.tinygrab.com/6407caa59e18f169707480f9ebb4976e03c572fc70.png

Let me know how I can help debug.

No JS console errors.

funkatron82 commented 8 years ago

So the select_advanced doesn't work at all? When you click on it nothing comes up?

ryanlabelle commented 8 years ago

That's right. Nothing comes up.

ryanlabelle commented 8 years ago

Okay, seems to be an issue with WooCommerce. Perhaps a conflict with chosen?

Confirmed, issue with the latest version of WooCommerce version 2.5.2 - Would you like me to open a new ticket?

funkatron82 commented 8 years ago

Woocomerce, again......

ryanlabelle commented 8 years ago

LOL, I feel your pain, it's a beast! We've added support for it in our latest themes and there are so many plugins to support. Unfortunately WP is now married to it.

funkatron82 commented 8 years ago

This is like the third time WooComerce has caused compatibility issues.

ryanlabelle commented 8 years ago

How can I help debug? Can I do some testing to assist you?

rilwis commented 8 years ago

Looks like WooCommerce uses an older version of Select2 library (3.5.4) and that breaks the JS code of Meta Box (uses 4.x version).

Previously WooCommerce used Chosen library, now Select2. :(

rilwis commented 8 years ago

OK, made a fix for that. Works for me. Please test it.

ryanlabelle commented 8 years ago

Thank you. I'll test it out tonight. :)

ryanlabelle commented 8 years ago

Fix works great. Thank you very much.