• I have a custom post type, called Models. I’m trying to retrive a specific post/model (‘model-a’).

    What would be a best practice for achieving this?

    I read this can be done with get_page_by_title function. However I tried this code:
    print_r(get_page_by_title('model-a', OBJECT, 'model'));
    and this code:

    $page = get_page_by_title('model-a', OBJECT, 'model')
    print_r($page)

    and it printed nothing to my screen.
    Print_r should print “Prints human-readable information about a variable” so I understand there is some problem with my get_page_by_id.

    Any suggestions?

    • This topic was modified 7 years, 3 months ago by benherzliya. Reason: style
    • This topic was modified 7 years, 3 months ago by benherzliya.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting a specific post with WordPress – Finding a good practice’ is closed to new replies.