• biglouis87

    (@biglouis87)


    Hi, I’m using get_page_by_path in a function to retrieve the thumbnail of a post from the URL of the page (got from external source).
    It worked well but when I switched to multisite installation the function doesn’t work anymore.
    This

    $url = "page-url"; (without hostname nor backslash)
    $page = get_page_by_path($url);

    returns nothing.
    I checked and $get_current_blog_id returns the right number (1).
    Even url_to_postid() doesn’t work.
    Do I have to call some other functions to get it work with multisite?
    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Are you 100% sure that the slug page-url is valid?

    Louis,
    Did you ever figure this out… I’m wondering if I’m having a similar issue with trying to use the below code, with get_path… on a multisite without luck… Thanks for the follow-up!

    <?php
    $post = get_page_by_path('www.anotherwordpresssite.com/page');
      $content = apply_filters('the_content', $post->post_content);
      echo $content;
    ?>

    (I’m trying to post the same sample page content on multiple “example” sites, so I’m not worried about google ranking or anything for identical content…)

    TIA

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_page_by_path not working with multisite’ is closed to new replies.