Refund

Support General RefundResolved

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #13626
    ToomasToomas
    Participant

    Hello,

    Since the plugin doesn't work together with wordpress CPT-onomies plugin, I'd like to get refund for the 79 USD bundle of Metabox plugin.

    Regards,
    Toomas

    #13632
    Anh TranAnh Tran
    Keymaster

    Hi Toomas,

    Sorry for the problem. I'm happy to send you the refund. However, can you please give me a few days to check the incompatibility with CPT-onomies plugin and probably provide a fix for that?

    Also, would you please give the name of the plugin that has conflict with CPT-onomies? Since you bought a bundle, there are 12 plugins in there.

    Another thing, I think CPT-onomies is used for creating relationships between objects. So, why don't you use MB Relationships instead?

    Thanks
    Anh

    #13641
    ToomasToomas
    Participant

    Hello,

    CPT-onomies make custom posts act as taxonomies. When I create taxonomy field with the metabox builder, while editing post, I just can't set custom taxonomies (created with CPT-onomies) to the posts. But if I create custom taxonomies with the metabox custom taxonomies plugin, then custom fields are nicely set. MB Relationships makes things too complicated, I just want to set custom taxonomies to the posts.

    Thanks
    Toomas

    #13649
    Anh TranAnh Tran
    Keymaster

    I got it. I've looked at the CPT-Onomies plugin and found a solution for that. Please paste the following code into your theme/plugin:

    add_action( 'save_post', function( $post_id ) {
        prefix_save_custom_tax( $post_id, 'location', 'taxonomy_2' );
    }, 20 );
    
    function prefix_save_custom_tax( $post_id, $taxonomy, $field_id ) {
        global $cpt_onomies_manager, $cpt_onomy;
    
        // Make sure its a valid CPT-onomy.
        if ( ! $cpt_onomies_manager->is_registered_cpt_onomy( $taxonomy ) ) {
            return;
        }
    
        $new = isset( $_POST[ $field_id ] ) ? $_POST[ $field_id ] : array();
        $new = array_unique( array_map( 'intval', (array) $new ) );
        $new = empty( $new ) ? null : $new;
    
        // Set the terms.
        $cpt_onomy->wp_set_object_terms( $post_id, $new, $taxonomy );
    }

    Note that I separated the function that save terms, so you can call it multiple times for different taxonomy field.

    I hope that works for you. Please let me know after you tested it.

    #13664
    ToomasToomas
    Participant

    Hello,

    no it doesn't work, no difference. I just can't set taxonomy terms to posts via Metabox custom fields. Without using Metabox I can set them. Where do I need to put this code exactly? I pasted it into my theme's functions.php file and also tried Code Snippets plugin. It didnt make any difference. Since I'm not a coder I need some help in understanding your code. What "location" in your code means? "Taxonomy_2" is the name of a custom taxonomy field?

    Best regards,
    Toomas

    #13665
    ToomasToomas
    Participant

    My custom fields code:

    add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
    function your_prefix_register_meta_boxes( $meta_boxes ) {
        $meta_boxes[] = array (
            'title' => 'books',
            'id' => 'books',
            'post_types' => array(
                0 => 'post',
                1 => 'books',
            ),
            'context' => 'side',
            'priority' => 'high',
            'fields' => array(
                array (
                    'id' => 'taxonomy_2',
                    'type' => 'taxonomy',
                    'name' => 'Taxonomy Field',
                    'taxonomy' => 'books',
                    'field_type' => 'select_tree',
                ),
            ),
        );
        return $meta_boxes;
    }
    #13667
    Anh TranAnh Tran
    Keymaster

    Hi Toomas, sorry for the confusion.

    Where do I need to put this code exactly?

    Please put them directly below your code to register meta box. Or in the theme's functions.php file.

    What “location” in your code means? “Taxonomy_2” is the name of a custom taxonomy field?

    I should have mentioned you need to change the "location" to the name of the custom post type created by CPT-Onomies plugin (in your case, it's "books") and "taxonomy_2" - the ID of the taxonomy field (in your case, it's still "taxonomy_2").

    Please try again and see if it works.

    #13696
    ToomasToomas
    Participant

    Thanks, it works now! I guess I will keep the plugin.

    Best regards,
    Toomas

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.