Skip to:
Content
Pages
Categories
Search
Top
Bottom

Member’s directory page ID is equal to 0


  • rtahina
    Participant

    @r1lita

    Wordpress 6.0.0
    Buddypress 10.3.0

    Hello,

    I created a new page “Directory” and set it as the member’s directory in Buddypress pages configuration. Now when I dump the $post variable on this page, the $post->ID is equal to 0. It looks like the $post object doesn’t really represent the page I created.
    What I’d like to know is, is this a normal behavior for Buddypress’ pages?

    object(WP_Post)#10833 (29) { ["ID"]=> int(0) ["post_author"]=> int(0) ["post_date"]=> int(0) ["post_date_gmt"]=> string(19) "2022-06-09 20:35:07" ["post_content"]=> string(0) "" ["post_title"]=> string(26) "Directory" ["post_excerpt"]=> string(0) "" ["post_status"]=> string(7) "publish" ["comment_status"]=> string(6) "closed" ["ping_status"]=> string(6) "closed" ["post_password"]=> string(0) "" ["post_name"]=> string(10) "directory" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2022-07-12 16:15:11" ["post_modified_gmt"]=> string(19) "2022-07-12 14:15:11" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(25) "http://wpbuddypress.test/members/" ["menu_order"]=> int(0) ["post_type"]=> string(4) "page" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" ["is_404"]=> bool(false) ["is_page"]=> bool(true) ["is_single"]=> bool(false) ["is_archive"]=> bool(false) ["is_tax"]=> bool(false) }

Viewing 2 replies - 1 through 2 (of 2 total)

  • shanebp
    Moderator

    @shanebp

    Yes. BP creates a ‘dummy’ post.
    For example, see
    public function single_dummy_post()
    in
    buddypress\bp-members\classes\class-bp-members-theme-compat.php

    To check if you’re on the members directory, use:
    if( bp_current_component('members') )


    rtahina
    Participant

    @r1lita

    @shanebp Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar