Ok, found the problem.
I had to add 'type' => 'numeric',
to my query.
So the final code looks like:
$adsAll = array(
'post_type' => $postType,
'meta_key' => $metaKey,
'orderby' => $orderBy,
'order' => $order,
'posts_per_page' => $PostsPerPage,
'meta_query' => array(
array(
'key' => 'preco_anuncio',
'value' => array('8700','500000'),
'compare' => 'between',
'type' => 'numeric',
),
),
);
Related Posts:
- Efficient way of querying for a “fallback” post?
- Display page content in different sections – based on page break block?
- Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error
- Latest posts feed with a specific post always first
- Show the subcategory name based on current product
- How to output values from a loop into a javascript array
- WordPress Ajax filter: Create two loops for different output styles?
- How to display sticky post always at the top (before regular post) in wordpress?
- adding or removing endforeach; throws error!
- Return to the beginning of the results of a for loop
- How to count posts posts if they are in a separate content page?
- Adding PHP to an if else loop
- Accordion headings cuts off to second line on collapsing a accordion heading (used acf repeater)
- WordPress Recent Posts – Loop
- Exclude category and post from loop in custom category.php
- ACF background-color per post in a WordPress loop
- How can I get my pagination loop to display the correct number of total pages?
- Meta query not showing result properly
- Advertisement in Loop Posts wordpress
- How do if all posts has this category ID then do this
- Thumbnail wouldn’t scale to size properly
- ERR_TOO_MANY_REDIRECTS / To Force SSL Logins and SSL Admin Access
- How to sort (orderby) a query done by a template function before the ‘foreach’ loop?
- Date of last blog update for specific authors only?
- View tag description on page
- Making list of posts with chosen description
- Get current_post in reverse order with pagination
- PHP for loop not working as intended
- WP_query meta_query slow with OR and DATES
- Get meta_query value by user meta array
- How to use something like meta_query but for fields?
- How fix error in the WordPress loop?
- what’s the syntax for if the image exists get the image?
- Adding custom PHP to existing loop in Genesis
- How to Pass Current Taxonomy Terms into new WP_Query?
- Problems with the WordPress loop [closed]
- Add div after every 4 posts then every 2 posts for a responsive loop
- how to remove replicating a tag inside loop?
- My query keeps looping infinitely ! how to stop it?
- Insert div after every three posts in home.php [duplicate]
- WordPress while loop with aphabetic counting like one, two, three
- Display product attributes for current product
- Retrieving specific images from Media Library
- For each 3 posts, show a different post type
- Div Missing In Custom Loop Query
- Add post class in custom loop (WP_QUERY)
- Loop 1 user randomly
- Create a hierarchical loop at predefined markup requirements
- enumerating custom taxonomies?
- Loop returns more items than exist?
- Using page template to fetch posts in page
- Modify category archive page loop on functions.php
- Custom Taxonomy Link Text Echo Name Not Slug
- WP_Post is not from correct array
- Post formating on Home page
- divide custom field values in div every two values
- Create Customization Controls from Array
- Adding unique marketing messages between certain products whilst using isotope/Infinite Scroll
- I want my wordpress loop to only display posts of the standard format
- Automatically create a loop for post ID
- WP Knowledge Base Theme bug – Subcategories and Articles, Need to change WP_Query
- Limit ads appearing more than three times
- Problems With Query and/or Template Part and/or PHP
- Two loops in one function
- ACF loop and php formatting
- How to display thumbnail if post is assigned one otherwise not
- How to have post count after each listed category
- Inserting A Feed and Sidebar into an HTML Page
- How can I put a custom field as the link of a button shortcode?
- Pagination on Custom Loop
- Pagenav Not appearing on custom Template
- Error trying import one category on page
- What is the best way to get the first few post from WordPress in different divs using a loop?
- why is this content-template not showing any of my blog-entries?
- Transient Loop Not working as expected
- the_post_thumbnail unless video id is added
- Advanced Taxonomy query, with 3 post types
- Remove the_content From Loop
- Trying to display ads on only a third of posts in a loop. Keep getting Error 500?
- Custom Meta Box If Else Statement
- Custom single.php files for different post formats
- Adding if statement to content for homepage
- Tables not showing divs and loop/php items
- How to call the_author_meta and make it work?
- Troubleshooting “loopback requests that take too long”
- Why does a meta_query break this WP_Query?
- Conditional in foreach loop is outputting content twice
- WordPress post pagination on custom template not working
- Alternative loop syntax error [closed]
- Pagination in category.php not functioning
- is there away to hide php code in wordpress not to show in PAGES
- Implement “No related posts for this entry” into the loop?
- For each loop will not append to the_content hook
- Excerpt all post content Content Same Size without word cutting off
- How to handle parent and child pages?
- Options.php loop won’t show!
- Loop on a wordpress Page instead of content coming from the WP text editor
- Too many if’s and else if’s ?? – Must be better way [closed]
- How do I remove blog entries from home page Twenty Eleven child theme?
- How to create a loop where loop changes every post?