Skip to:

wp_pagenavi on homepage of group goes to page not found

  • Profile photo of _chris_


    I have a BIG problem. I create custom page for buddypress group. I get there posts added by users. Here is code:

    ` $query = “SELECT ID, post_title, post_date, post_content FROM $wpdb->posts JOIN $tabela ON ID = post_id WHERE group_id = $idGrupy “;

    $options = get_option(‘my_options’);
    $posts = $wpdb->get_results($query);
    $items_per_page = $options[‘posts_per_page’];

    $posty = array();

    foreach ($posts as $post) {
    $posty[] = $post->ID;

    $paged = (get_query_var(‘page’)) ? get_query_var(‘page’) : 1;

    ‘post__in’ => $posty,


    Then of course there is a loop. At the end there is: wp_pagenavi();

    Pagination is looking good. Correct number of sites. But when I clik on 2 3 or others I got page not found. Then the address is:

    But when I type into it is working good.

    I have noticed, that while var_dump query I see: (on the /page/2):
    ` [“paged”]=> int(2)
    [“is_paged”]=> bool(false) `

    and in query var:
    ` [“query”]=> array(2) { [“paged”]=> string(1) “2” [“pagename”]=> string(11) “strony/test” } [“request”]=> string(136) “SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND (wp_posts.ID = ‘0’) AND wp_posts.post_type = ‘page’ ORDER BY wp_posts.post_date DESC ” [“posts”]=> &array(0) { } [“queried_object”]=> NULL [“queried_object_id”]=> int(0) }`

    Where I could make a mistake?

  • The topic ‘wp_pagenavi on homepage of group goes to page not found’ is closed to new replies.
Skip to toolbar