Title: get_posts array parameters not changing
Last modified: January 19, 2017

---

# get_posts array parameters not changing

 *  Resolved [bradleekw](https://wordpress.org/support/users/bradleekw/)
 * (@bradleekw)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/get_posts-array-parameters-not-changing/)
 * Hello everyone
 * I have looked around for problems similar to mine but I can’t seem to find any
   solutions. I am using the get_posts function with the parameter array found at
   [https://codex.wordpress.org/Template_Tags/get_posts](https://codex.wordpress.org/Template_Tags/get_posts)
 * The way I am using the array is like this:
 *     ```
       $args = array( 'posts_per_page' => -1, 'offset' => 0, 'category' => 9, 'orderby' => 'ID', 'order' => 'ASC'  );
       $myposts = get_posts( $args );
       ```
   
 * It returns the category I select but I can change the other parameters such as“
   orderby” and “order” and it makes no difference on the order of the posts. “posts-
   per_page” and “offset” do change what is returned.
 * Any help on this topic will be greatly appreciated!

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

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/get_posts-array-parameters-not-changing/#post-8676310)
 * Your code is fine. More than likely some other code is altering your arguments
   through an action or filter, such as “pre_get_posts”. You can narrow down the
   source by disabling all plugins and switching to the twentysixteen theme. Add
   you code to a template file. Maintain a clean copy to restore to the theme. The
   ordering should work fine.
 * Switch back to your theme and retest. Activate plugins one at a time, testing
   after each. When you ordering fails, the last activated code is the problem.
 *  Thread Starter [bradleekw](https://wordpress.org/support/users/bradleekw/)
 * (@bradleekw)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/get_posts-array-parameters-not-changing/#post-8998647)
 * So sorry about the late reply!
 * Thank you for the advice, although I didn’t read it at the time it is what I 
   ended up doing 🙂
 * I was using a re-ordering plugin to change the order of posts. After disabling
   this plugin everything started working correctly again.
 * Thanks again!

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

The topic ‘get_posts array parameters not changing’ is closed to new replies.

## Tags

 * [get_posts](https://wordpress.org/support/topic-tag/get_posts/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [bradleekw](https://wordpress.org/support/users/bradleekw/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/get_posts-array-parameters-not-changing/#post-8998647)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
