Title: same get_posts function works diffrently in tag.php and functions.php
Last modified: November 10, 2016

---

# same get_posts function works diffrently in tag.php and functions.php

 *  [missill](https://wordpress.org/support/users/missill/)
 * (@missill)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/same-get_posts-function-works-diffrently-in-tag-php-and-functions-php/)
 * Hi,
    I have a strange issue that i don’t really understand, I explain : In my
   tag.php, i have an infinite scroll with custom post types thanks to the active
   tag and ajax.
 * I do the same get_posts in functions.php in my ajax function :
 *     ```
       $posts = get_posts( array(
           'post_type' => 'video',
           'posts_per_page' => 6,
           'paged' => 1,
           'post_status' => 'publish'
       )) ;
       ```
   
 * This simple get_posts not returning same values !
    I replaced ‘paged’ with ‘offset’
   and nothing changed ! How it’s possible ? What i forgot ? If i add ‘order’ =>‘
   ASC’ and ‘orderby’ => ‘ID’ for example, it’s the worst ! Any ideas ? Thanks for
   help me.

Viewing 1 replies (of 1 total)

 *  Thread Starter [missill](https://wordpress.org/support/users/missill/)
 * (@missill)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/same-get_posts-function-works-diffrently-in-tag-php-and-functions-php/#post-8419679)
 * I found that it’s my ajax function in functions.php which is responsable but 
   i don’t know why !

Viewing 1 replies (of 1 total)

The topic ‘same get_posts function works diffrently in tag.php and functions.php’
is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [missill](https://wordpress.org/support/users/missill/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/same-get_posts-function-works-diffrently-in-tag-php-and-functions-php/#post-8419679)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
