• It looks like these two functions are not working for posts…

    Code:

    function test(){
    $pid = 645;   //any valid post id
    $post1 = get_post($pid);  //the post content is valid
    $post = get_page_by_path($post1->post_name,OBJECT,$post1->post_type);
    if ($post == null) return "not found, name:".$post1->post_name." Title:".$post1->post_title;
    else return $post->post_content;
    }

    same if you try with get_page_by_title,
    $post = get_page_by_title($post1->post_title,OBJECT,$post1->post_type);

    using the same for pages works like charm.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘get_page_by_path,get_page_by_title for posts’ is closed to new replies.