WordPress.org

Ready to get started?Download WordPress

Forums

CPT-onomies: Using Custom Post Types as Taxonomies
[resolved] Does wp_set_object_terms() requires $terms to be an array (2 posts)

  1. Jonathan Ogden
    Member
    Posted 1 year ago #

    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!

    http://wordpress.org/extend/plugins/cpt-onomies/

  2. Rachel Carden
    Member
    Plugin Author

    Posted 1 year ago #

    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!!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.