Why my query is not “Main_query”?

And the anwser to my question: Don’t make new WP_Query object. Don’t try to overwrite main query. Use global $wp_query; In my example the function should be like this: public function askanban_display_board(){ global $wp_query; $wp_query->set(‘post_type’, ‘ticket’); $wp_query->set(‘posts_per_page’, -1); $posts = $wp_query->get_posts(); print_r($posts); }

How to get woocommerce orders with get_posts method in a shortcode

I found a solution to the problem, here is the code below. I just can’t get the pagination to work yet. Everything else works fine. Shortcode add_shortcode( ‘all_orders’ , ‘prc_orders’ ); function prc_orders() { // Get all orders for the current user. $customer = get_posts(apply_filters(‘woocommerce_my_account_my_orders_query’, array( ‘numberposts’ => -1, ‘meta_key’ => ‘_customer_user’, ‘meta_value’ => get_current_user_id(), … Read more

Paging result of get_posts in function

add this pagination function: function pagination( $query, $baseURL = get_bloginfo( $url ), $echo = true ) { $page = $query->query_vars[“paged”]; if ( !$page ) $page = 1; $qs = $_SERVER[“QUERY_STRING”] ? “?”.$_SERVER[“QUERY_STRING”] : “”; // Only necessary if there’s more posts than posts-per-page if ( $query->found_posts > $query->query_vars[“posts_per_page”] ) { $re=”<ul class=”paging”>”; // Previous link? … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)