WordPress.org

Ready to get started?Download WordPress

Forums

SuperCPT
[resolved] Filters example (2 posts)

  1. Karzin
    Member
    Posted 11 months ago #

    I've already seen this page about your filters and actions but there aren't any examples. Could you give me any directions on how to use this filter (scpt_plugin_{$this->type}_meta_save_{$field}) for example?

    I'm trying to use like this:

    $superCustomCPT = new Super_Custom_Post_Type('mycustomcpt');
    $superProductCPT = new Super_Custom_Post_Type('product');
            $superProductCPT->add_meta_box(array(
                'id' => 'attribute_groups',
                'title' => 'My title',
                'fields' => array(
                    'prod_attribute_groups' => array( 'type' => 'checkbox', 'label' => false, 'data' => 'mycustomcpt', 'multiple' => 'multiple' )
                )
            ));
    
    function test($test){
                _log('asdasd');
                _log(print_r($test,true));
            }
            add_filter('scpt_plugin_product_meta_save_attribute_groups','test');

    But this error is showing up: Undefined index: 'attribute_groups'

    http://wordpress.org/plugins/super-cpt/

  2. Matthew Boynes
    Member
    Plugin Author

    Posted 11 months ago #

    Hi Karzin,
    It's the field name, not the meta box id. So in your case, prod_attribute_groups.

    Examples of this is a good idea, I'll add it to my list to add to the wiki.

    Thanks,
    Matt

Reply

You must log in to post.

About this Plugin

About this Topic