lundi 23 mars 2015

How can I trigger the media library "query-attachments" action manually?


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. How can I accomplish this?


Please let me know if I need to provide any more details.





Aucun commentaire:

Enregistrer un commentaire