Support » Plugin: CPT-onomies: Using Custom Post Types as Taxonomies » Does wp_set_object_terms() requires $terms to be an array

  • Resolved Jonathan Ogden


    As always, let me start by commending you for an amazing plug-in.

    After upgrading from WordPress 3.4.2 and CPT-onomies 1.1 to WordPress 3.5 and CPT-onomies 1.2, I received an error from line 1450 of cpt-onomy.php when doing the following:

    $postid = 12345; //my post number
    $terms = 'test';
    $cpt_onomy->wp_set_object_terms( $postid, $terms, 'testcategory', FALSE );

    This worked fine prior to upgrading.

    After reviewing cpt-onomy.php, I created $terms_arr as an array and loaded it with $terms. This worked fine. Here is my new code:

    $postid = 12345; //my post number
    $terms = 'test';
    $terms_arr = array( $terms );
    $cpt_onomy->wp_set_object_terms( $postid, $terms_arr, 'testcategory', FALSE );

    Is this the way it is now intended to work? Or, perhaps, am I overlooking something?

    Thanks, Rachel, for all you do!

Viewing 1 replies (of 1 total)
  • Plugin Author Rachel Cherry


    I think I see what the problem is. The line of code that allowed you to send the data as a string, or basically not as an array, got bumped behind some new code and it should have been left alone.

    I’ll get it all fixed up for the next release. Thanks for the find!!! I’m glad you’re still enjoying CPT-onomies!!

Viewing 1 replies (of 1 total)
  • The topic ‘Does wp_set_object_terms() requires $terms to be an array’ is closed to new replies.