WordPress.org

Forums

Random Post Link
Limit to a category (2 posts)

  1. ocaptain
    Member
    Posted 2 years ago #

    Is there a way to limit the posts that are randomized to a category, I.e. "go to a random training" or "go to a random tip" if I have tips and training as categories?

    Thanks!

    http://wordpress.org/extend/plugins/random-post-link/

  2. tpecop
    Member
    Posted 2 years ago #

    function rpl_change_ptype( $args ) {
      $args['category_name'] = 'your_category_name_goes_here';
    
      return $args;
    }
    add_filter( 'random_post_args', 'rpl_change_ptype' );

    I took it from previus topic for custom post types, but its working as any other filter (category, tag, etc)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Random Post Link
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.