<?php | |
/** | |
* Display Posts Lockdown | |
* | |
* Disables the ability to query by post status and certain post types | |
* | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/code/display-posts-lockdown | |
* | |
* @param array $args, WP_Query arguments | |
* @param array $atts, Shortcode attributes | |
* @return array $args | |
*/ | |
function be_display_posts_lockdown( $args, $atts ) { | |
$args['post_status'] = 'publish'; | |
$excluded_post_types = array( 'revision' ); | |
if( isset( $args['post_type'] ) && in_array( $args['post_type'], $excluded_post_types ) ) | |
$args['post_type'] = 'post'; | |
return $args; | |
} | |
add_filter( 'display_posts_shortcode_args', 'be_display_posts_lockdown', 10, 2 ); |
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