Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Plugin Name: Show Hidden Posts Add-on
Plugin URI:
Description: Extension to show also hidden Posts ("Wordpress Hide Posts") for the premium widget Term and Category Based Posts Widget.
Author: TipTopPress
Version: 1.0.1
Author URI:
- Download the file and rename it to Show-hidden-Posts-Add-on.php
- Upload it to the plugins folder [your-wordpress-installation]/wp-content/plugins/Order-by-Add-on.php
- Go to WordPress > Admin > PlugIns and activate the Extension
- Now, hidden Posts should be shown just with the widget and not anywhere else
namespace termCategoryPostsPro\ShowHiddenPostsAddOn;
// Don't call the file directly
if ( !defined( 'ABSPATH' ) ) exit;
* Applied to the list of wp_query args.
* @return array of sort orders
* @since 0.1
function query_args ( $query_args, $that, $instance ) {
// Custom, Jeff: WordPress Hide Posts
// override widget filter ('Wordpress Hide Posts') pre_get_posts with prio 20
add_action( 'pre_get_posts', __NAMESPACE__.'\hidden_posts', 20 );
return $query_args;
add_filter( 'cpwp_query_args', __NAMESPACE__.'\query_args', 10, 3 );
// Custom, Jeff: WordPress Hide Posts
function hidden_posts ( $query_args ) {
$query_args->set( 'meta_key', '' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment