How can I manually reload the Media Library with custom arguments?
-
I’m working on a plugin that manipulates the WordPress 4.0+ Media Library.
I see that the attachments in the media library are loaded by an ajax call using the query-attachments action.
I need to programatically trigger this ajax call with my own custom arguments.
Here is a sample request that I’ve observed being sent to the server:
Array ( [action] => query-attachments [post_id] => 0 [query] => Array ( [orderby] => date [order] => DESC [posts_per_page] => 40 [paged] => 2 ) )
I would like to set the parameters myself, and then trigger this process from some custom JavaScript. Let’s say, for example, when a button is clicked – change the
order_by
value and send thequery-attachments
call to the server, repopulating the page with the results.How can I accomplish this?
Please let me know if I need to provide any more details.
- The topic ‘How can I manually reload the Media Library with custom arguments?’ is closed to new replies.