WordPress.org

Ready to get started?Download WordPress

Forums

[closed] How to set custom post terms for new post in P2? (3 posts)

  1. parandroid
    Member
    Posted 4 years ago #

    Hi, everybody!
    I'm using wordpress 3.0 beta1 and P2 v1.1.3.
    I tried add custom post terms for new post in P2.
    I has a custom taxonomy called "letter", I add code below in p2/inc/ajax.php(line 176, before "echo $post_id ? $post_id : '0';"):

    wp_set_post_terms( $post_id, 'A,B', 'letter');

    this didn't work.

    but wp_set_post_tags($post_id,'A,B') is work well.
    wp_set_post_tags() function in wp-includes/post.php, here it's code.

    function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) {
    return wp_set_post_terms( $post_id, $tags, 'post_tag', $append);
    }

    So, I creat a new function:

    function wp_set_post_letters( $post_id = 0, $tags = '', $append = false ) {
    return wp_set_post_terms( $post_id, $tags, 'letter', $append);
    }

    and I use wp_set_post_letters($post_id,'A,B'), it is still didn't work.

    Forgive me my bad english, Anyone has a solution for this?

  2. mrmist
    Forum Janitor
    Posted 4 years ago #

    Please stick to one thread per question, cheers.

Topic Closed

This topic has been closed to new replies.

About this Topic