Last active
April 11, 2018 06:09
-
-
Save obiPlabon/b74390f9af6585fe5778f1302a021e92 to your computer and use it in GitHub Desktop.
Modify WordPress attachment ajax query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Show last 5 attachments in media popup | |
| */ | |
| /** | |
| * Attachment query arguments | |
| * @param array $args Query arguments | |
| * @return array Update query argumnets | |
| */ | |
| function op_update_attachment_args( $args ) { | |
| $args['posts_per_page'] = 5; | |
| $args['order'] = 'ASC'; | |
| return $args; | |
| } | |
| add_filter( 'ajax_query_attachments_args', 'op_update_attachment_args' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment