- changed labels;

- fixed get_archives query based on restricted posts;
This commit is contained in:
Nikita Sinelnikov
2021-07-29 17:20:16 +03:00
parent 2e964ab408
commit f5278a462f
5 changed files with 31 additions and 10 deletions
+20
View File
@@ -62,6 +62,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
add_filter( 'widget_posts_args', array( &$this, 'exclude_restricted_posts_widget' ), 99, 1 );
add_filter( 'wp_count_posts', array( &$this, 'custom_count_posts_handler' ), 99, 3 );
add_filter( 'getarchives_where', array( &$this, 'exclude_restricted_posts_archives_widget' ), 99, 2 );
// callbacks for changing terms query
add_action( 'pre_get_terms', array( &$this, 'exclude_hidden_terms_query' ), 99, 1 );
@@ -1444,6 +1445,25 @@ if ( ! class_exists( 'um\core\Access' ) ) {
}
/**
* Exclude restricted posts in widgets
*
* @param string $sql_where
* @param array $parsed_args
*
* @return string
*/
function exclude_restricted_posts_archives_widget( $sql_where, $parsed_args ) {
$exclude_posts = $this->exclude_posts_array();
if ( ! empty( $exclude_posts ) ) {
$exclude_string = implode( ',', $exclude_posts );
$sql_where .= ' AND ID NOT IN ( ' . $exclude_string . ' )';
}
return $sql_where;
}
/**
* @param string $single_template
*