Limited Time Offer

Save 50% on MetaSlider Pro!


Get MetaSlider
800,000+ WordPress sites are already using MetaSlider!

MetaSlider Documentation


Use this filter to modify the query arguments used to extract posts in a Post Feed slide.



(array) (required) WP_Query arguments as defined by the slide settings


(object) (required) Current slide data


(array) (required) Current slider settings


(array) (required) Current slide settings


The following code samples should be added to your theme’s functions.php file.

Display all posts tagged to the current category

Use this code to override the taxonomy restrictions defined in the slide settings, and instead extract all posts which are tagged to the current category. With this code in place you can create a single slideshow and add the Template Include to your category.php template. The slideshow will automatically show posts that are tagged to the current category.

function metaslider_restrict_to_current_category( $args, $slide, $slider_settings, $slide_settings ) {
    // check slide ID so we only apply this functionality where it's needed

    // replace "123" with the slide ID to target.

	if ( $slide->ID == 123 && is_category() ) {
		// remove any existing restrictions
		if ( isset ( $args['tax_query'] ) ) {
			unset( $args['tax_query'] );
		// restrict to posts tagged to the current category
	        $args['tax_query'][] = array(
	            'taxonomy' => 'category',
	            'field' => 'id',
	            'terms' => get_query_var( 'cat' )
	return $args;
add_filter( 'metaslider_post_feed_args', 'metaslider_restrict_to_current_category', 10, 4);

 Display Sticky Posts only

function metaslider_post_feed_sticky( $args, $slide, $slider_settings, $slide_settings ) {
    // replace "735" with the slide ID to target.
    // get the slide ID by hovering over the delete icon and noting down the "deleteSlide" ID in the status bar
	if ( $slide->ID == 735 ) {
		$args['post__in'] = get_option('sticky_posts');
		$args['ignore_sticky_posts'] = true;
	return $args;
add_filter( 'metaslider_post_feed_args', 'metaslider_post_feed_sticky', 10, 4);


Start Using Your Slider Today!

Create and publish WordPress slideshows in minutes… What are you waiting for?