query_posts result differs from wp_query request result

You are improperly using query_posts. Don’t use query_posts, ever. If you want to iterate over an array of posts, use get_posts and assign the results to a var that isn’t a reserved global. $my_posts = get_posts( array( ‘posts_per_page’ => 5, ‘paged’ => 1, ‘post_status’ => ‘publish’ ‘orderby’ => ‘date’, ‘order’ => ‘desc’ ) ); foreach( … Read more

Simple URL rewriting gone wrong

First I would take it out from the WordPress block rules, as it will be overwrited when permalinks are refreshed if you don’t add the rule to Rewrite API. Then you could add at the bottom of your htaccess something like: Redirect 301 feed/sejururi.xml http://yoursite.com/feed/

How to limit the number of results for all query_posts on mysite

It is not that hard to enforce a hard limit on results: add_action( ‘post_limits’, function($limit) { $limits = explode(‘,’,$limit); if (isset($limits[1]) && 2000 < $limits[‘1’]) { $limits[1] = 2000; } $limit = implode(‘,’,$limits); return $limit; } ); I would not be surprised if that does not solve your problem though. Just searching over that many … Read more

Can’t see custom field after the Loop [closed]

When you output your get_posts results and do this: setup_postdata($post); You overwrite the original value of $post which the_field uses to fetch the field data. It’s trying to get that field belonging to the last post in $products_mono_posts instead of the page that the field actually belongs to. After running custom queries where the value … Read more

Show latest custom post types on dashboard

This is because by default the paramater for post_type is post. To include all the post type add the below to you arguements $args = array( ‘numberposts’ => 5, ‘post_type’ => ‘any’ ); The above will include all the post_types including pages and custom post types and if you would to include specific post types … Read more