Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @deniscgn Do you mean post name from custom post type by id? Please explain in detail. Happy to help you.

    Thread Starter DenisCGN

    (@deniscgn)

    Hello @weboccults

    i have created a custom Post Type and gave it the name EVENT and another ohne with VENUE.

    Now I have the POST iD and like to get the Post Type Name EVENT or VENUE, By the Post ID I have.

    So I can use the name in the post CONTENT.

    Hope that makes it clear.

    Cheers,
    Denis

    Moderator bcworkz

    (@bcworkz)

    I think you want something like $name = get_post( $id )->post_type;

    $name would be the post type’s slug name used for registration. If you’re after the type’s label (as specified in registration args), it could be extracted from global $wp_post_types, but there could be a more elegant way I’m unfamiliar with.

    You cannot drop PHP code directly into content. Dynamic content can be inserted via “the_content” filter, or shortcode, or custom block.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Post Type Name by ID’ is closed to new replies.