Created
April 8, 2015 12:13
-
-
Save backslash7/ece5d459253c41eb75cc to your computer and use it in GitHub Desktop.
Fix Wordpress gallery showing only to logged in users
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
function quickhack_fix_gallery( $query ) { | |
if ( $query->get( 'post_type', '' ) == 'attachment' ) { | |
$query->set( 'post_status', 'inherit' ); | |
} | |
} | |
add_action( 'pre_get_posts', 'quickhack_fix_gallery', 99 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment