• Resolved zeitschichten

    (@zeitschichten)


    Hello,

    I am trying to do the following:

    Get the ID of a category that is specified in a custom field of a page

    $latest_posts_category = get_post_meta( $post->ID, $shortname.'_latest_posts_cat', true ) ;
    $cat_id = get_cat_id( $latest_posts_category );

    Get the ID of a tag that is specified in a custom field of a page

    $latest_posts_tag = get_post_meta( $post->ID, $shortname.'_latest_posts_tag', true ) ;
    $tag_id = get_tag_id( $latest_posts_tag );

    Query for posts that belong to the specified category and that have the specified tag
    $latestPosts->query( 'cat='.$cat_id.'&tag='.$tag_id.'posts_per_page=10' );

    The problem is that get_tag_id() is not a wordpress function. Do you know of any way that I can achieve what get_cat_id() does for tags?

    Thank you very much for any suggestions.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Getting Tag ID from Custom Field?’ is closed to new replies.