Support

Account

Home Forums General Issues wp set post terms function with custom field ?

Unread

wp set post terms function with custom field ?

  • Hi,

    I have this function that I want to add to the edit bulk options, whereas the post_title bit should be replaced with a ACF custom field called keyword.
    what would be the best way to do this, do I need to echo the value or … ?

    thanks in advance

    foreach( $posts as $p ) :
            //set term as first letter of post title, lower case
        $taxonomy = 'alphabetical_letter';
            wp_set_post_terms( $p->ID, strtolower(substr($p->post_title, 0, 1)), $taxonomy );
            endforeach;
Viewing 1 post (of 1 total)

The topic ‘wp set post terms function with custom field ?’ is closed to new replies.