Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function attachments_per_post( $where ){
if( is_user_logged_in() ){
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
You can’t perform that action at this time.