The “problem” seems to be the default value that order receives, its always DESC unless told otherwise.
You will need to create your own order after getting the posts, so something like this.
$my_query = new WP_Query($query_args);
$ordered_posts = [];
foreach(explode(',', $idpaginas) as $rpid) {
foreach($my_query->posts as $index => $fpid) {
if($fpid->ID == $rpid) $ordered_posts[] = $my_query->posts[$index];
}
}
$my_query->posts = $ordered_posts;
while ($my_query->have_posts()) : $my_query->the_post();
This code was based on this question, edited it a bit to fit your needs.
Related Posts:
- Problem with extract() with custom shortcode
- Pass Shortcode Attribute to footer Script
- Redirect to another page using contact form 7? [closed]
- Use a shortcode to display custom meta box contents
- Shortcode to insert default text and change one word throughout it?
- How To Show Shortcodes In WordPress Custom Fields?
- Shortcode to eliminate and replace with
- restrict access to specific urls on a specific period of time
- multible shortcodes (for differnt values) with one function
- Ajax not working properly
- Shortcode pagination not advancing
- create shortcode to list users with specific meta key value
- Variable if post is sticky in functions.php
- Having issues with a foreach inside of a shortcode with ACF gallery
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- Right way to update widget on dynamic new input field
- How to customly read JWPlayer’s “Playlist” items by using its “playlistid”?
- Shortcode inserts paragraphs before and after executing shortcode
- Having a Function Inside of the Loop
- Include default functions and methods
- Hard-coding custom menu elements for menu manager
- Display post shortcode content in the sidebar?
- Twentyten Child Theme: header images display messed up in admin panel
- How can I remove the main description text box in a Woocommerce product editor page? I only use the “Product short description” text box [closed]
- Wp_query function to search from product_title ‘OR’ product tags name
- How can I modify all existing tags while keeping the urls themselves?
- How to get the index number of the posts?
- Best practices regarding the creation of custom widgets?
- IF Statement on Button to make it complete and “uncomplete” based on user action / click
- Gravity Forms Button Text
- Find resources dynamically loading and change or add to the url
- Using shortcode content with nested shortcode
- When sale price is 0.00 show only regular price
- Calling an attribute from a plugin shortcode
- Unable to login using username
- Word Press – Dynamic Content [closed]
- How can I make a widget shortcode to control all the widgets?
- Custom shortcodes not inserting into visual composer columns
- How to filter $content in shortcode function
- Insert image in WordPress with HTML5 tag and caption function
- how can I just add to parent theme function(s) instead of redeclaring whole the function
- Create a custom taxonomy that will be used to create and filter markers in a Google Map
- Setting youtube size in functions.php
- Adding a colorbutton in tinymce dialog with current api
- Passing variable as add_shortcode argument
- Remove echo from shortcode
- Move Custom Fields on General Settings Page to New Location
- Display gallery on bottom after content
- Add button to kitchen sink toggle
- Skeleton Child Theme Add Icon Bar to Header Flex Grid
- Display tags that only appear in one category
- Excerpts are not displayed by a shortcode on category pages
- WordPress Shortcode function display outside of widget
- check if the user is owner of current page
- shortcode help require
- Optimizing a WordPress site
- different style sheet for just one page template
- Help With Creating Shortcode
- Use html inside shortcode function
- Condition OR for current user ID
- How to retrieve the current post’s generated featured image size?
- Shotcode argument issues
- Shortcode parse error – wrong syntax
- Exclude category from shortcode
- wp_nonce_field is breaking form for reasons unknown
- Visual Composer creating own shortcodes with vc_map() to return simple Image
- Custom Behavior when Adding New Custom Post Type in Dashboard
- Where do I store custom functions that call custom page template files?
- get_pages() Returns Only One Item
- Why There Is No “get content by ID” Function
- Function shortcode – Set Parameter
- Adding an option to a shortcode
- Custom HTML markup
- How to use author meta in shortcode?
- Using multiple line variable inside a function?
- Testing for a shortcode using a function. 404 page throwing PHP Notice
- Custom Query Not Paginating
- Echoing function into WordPress NextGen gallery
- Output loop to function return?
- How to echo the value of an array element using a function via a shortcode
- Reset postdata not working on WP_Query in functions.php
- How is $current_page passed in woocommerce_account_orders function?
- Create custom function for hero image
- Return multiple values in a shortcode attribute
- Randomizing wp_tag_cloud() in child theme
- How to parse a shortcode within a shortcode?
- Variables not showing in short code
- login_headertitle is deprecated since version 5.2.0
- How to append classname to body tag if guest user
- Woocommerce checkout field
- Where do I go to edit this area? [closed]
- How to include any template using Shortcode fuction?
- Replace plugin function with a custom function?
- How can I pass a shortcode value to the head in wordpress functions.php
- Add attribute only to first image of every post via functions.php
- Native gallery custom html output
- Different favicon on different pages
- Need to convert image url to a Base_64 data url with wordpress function..
- The_content and Preg_replace in loaded Iframe [closed]
- dynamic site link for future migration in echo do_shortcode()