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
- When should you, and when should you not, use wp_list_pluck()?
- Use AJAX in shortcode
- Include PHP file in Content using [shortcode]
- WP_Query in functions.php
- Shortcode producing headers already sent error
- opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);
- How to use get_media_embedded_in_content function
- Shortcode with parameters inside parameters
- What is wrong with this Shortcode? I get it in a wrong place inside the content
- Set default options for inserting media
- Default or Preset Content for Custom Post Types
- Remove tag on my RSS Feed
- How to Add a Random Custom Gravatar in the WordPress Comments?
- Gravity Forms field entries into wp_query loop [closed]
- How to mass-delete inline styles in WordPress custom post type automatically?
- Remove the deleted users avatar from list
- str_replace function in theme
- Display first name of logged in user?
- Shortcode pagination not advancing
- Having issues with a foreach inside of a shortcode with ACF gallery
- Right way to update widget on dynamic new input field
- Shortcode inserts paragraphs before and after executing shortcode
- Best practices regarding the creation of custom widgets?
- Word Press – Dynamic Content [closed]
- 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
- Remove echo from shortcode
- Add button to kitchen sink toggle
- Skeleton Child Theme Add Icon Bar to Header Flex Grid
- Display tags that only appear in one category
- Help With Creating Shortcode
- Shortcode parse error – wrong syntax
- Exclude category from shortcode
- Adding an option to a shortcode
- Custom HTML markup
- How to use author meta in shortcode?
- Testing for a shortcode using a function. 404 page throwing PHP Notice
- Custom Query Not Paginating
- How to append classname to body tag if guest user
- Woocommerce checkout field
- Tracking the number of shortcodes for a list?
- Need a method to prevent WP from adding in between my shortcodes
- Load scripts for do_shortcode( ‘ [ my_shortcode ] ‘ )
- Can I include a custom PHP function in a WordPress function?
- How to create a shortcode out of a php function
- Function to replace comment’s accented characters before posting
- New checkbox in custom widget isn’t saving data
- Linking Javascript in functions.php file
- Shortcode of a function
- How to add a shortcode to call a function
- How can I call a PHP function inside a hardcoded shortcode?
- Using One Function To Create Two Different Shortcodes
- Custom Form / Search with Custom Post Type Data
- Create a CUstom Archive by Year, but just for a Single Category
- Is it possible to create a shortcode to link to a specific post/page where the tag is just an attribute?
- Updating custom query var with multiple values
- Pagination not working – FrontPage
- How to replace ACTION url from original wordpress login form?
- page shows short code not output
- Function is printing twice – any suggestions?
- Function to function shortcode help [closed]
- Hide author info in single posts by certain users
- I want to display the sku in the product pages of my EDD website
- use add_action in a shortcode (gravity form – WordPress)
- I want to customize the_posts_navigation function by replacing prev and next with images
- How would I correctly implement a new if statement in a child functions file?
- Shortcode displaying outside the div [duplicate]
- Shortcode with pagination advancing multiple queries
- Get shortcode attribute value to another function
- How to retrieve image IDs from shortcode content?
- Display list of pages that contain a certain string within the slug
- WP_Query & shortcode : Return 3 articles from a category WordPress
- True email confirmation for registration (keeping unvalidated users from user table)
- custom post with loading script per single post
- How to display data from custom fields in my custom shortcode?
- Modify function Shortcode_atts
- Shortcode to output get_header not working
- Get Value of Custom Field
- child_of not working while searching
- Query is not work
- Add title & subtitle to shortcodes
- How to Delete Posts by title?
- trouble with passing class method data to outside function
- Integrating custom API for post content into Admin interface & Public Website [closed]
- Get term count on a category page
- Removing Facebook contact field from user contact not working
- How do grab the main loop, with conditions, and output via shortcodes
- How do I add functionality to images?
- Display function from functions.php in tag.php
- post_row_actions filter from parent theme not executing in child theme