| @@ -17,14 +17,13 @@ | ||
| 17 | 17 | function forumax_ajax_forum() { |
| 18 | 18 | check_ajax_referer( 'forumax-nonce', 'nonce' ); |
| 19 | 19 | |
| 20 | 20 | // received values from front end forum |
| 21 | - $data_forum = isset( $_POST['data_forum'] ) ? sanitize_text_field( wp_unslash( $_POST['data_forum'] ) ) : ''; | |
| 21 | + $data_forum = isset( $_POST['data_forum'] ) ? sanitize_text_field( $_POST['data_forum'] ) : ''; | |
| 22 | 22 | |
| 23 | 23 | $args = [ |
| 24 | 24 | 'post_type' => 'topic', |
| 25 | 25 | 'posts_per_page' => 9, |
| 26 | - 'no_found_rows' => true, | |
| 27 | 26 | ]; |
| 28 | 27 | |
| 29 | 28 | if ( 'solved' === $data_forum ) { |
| 30 | 29 | $args['meta_query'] = [ |
| @@ -100,10 +99,19 @@ | ||
| 100 | 99 | } elseif ( 'featured' === $data_forum ) { |
| 101 | 100 | |
| 102 | 101 | $super_stickies = bbp_get_super_stickies(); // Get global super sticky topics |
| 103 | 102 | |
| 104 | - // Get sticky topics from all forums in one query. | |
| 105 | - $stickies = forumax_get_all_forum_stickies( true ); | |
| 103 | + // Get sticky topics from all forums | |
| 104 | + $stickies = []; | |
| 105 | + $forums = get_posts( [ | |
| 106 | + 'post_type' => 'forum', | |
| 107 | + 'posts_per_page' => -1, | |
| 108 | + 'fields' => 'ids', | |
| 109 | + ] ); | |
| 110 | + | |
| 111 | + foreach ( $forums as $forum_id ) { | |
| 112 | + $stickies = array_merge( $stickies, bbp_get_stickies( $forum_id ) ); | |
| 113 | + } | |
| 106 | 114 | |
| 107 | 115 | // Merge both sticky types |
| 108 | 116 | $sticky_topics = array_merge( $super_stickies, $stickies ); |
| 109 | 117 | $sticky_topics = array_unique( $sticky_topics ); |