Created
February 7, 2018 14:42
-
-
Save lucasprogamer/98807579895563fe5a114ebc1340795d to your computer and use it in GitHub Desktop.
attachments_per_post.php
This file contains 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 | |
function devplus_attachments_wpquery_where( $where ){ | |
if( is_user_logged_in() ){ | |
// we spreken over een ingelogde user | |
if( isset( $_POST['action'] ) ){ | |
// library query | |
if( $_POST['action'] == 'query-attachments' ){ | |
$where .= ' AND post_parent != 0'; | |
} | |
} | |
} | |
return $where; | |
} | |
add_filter( 'posts_where', 'attachments_per_post' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment