Developers: Available YARPP Filters

You may add the following filters in your theme’s functions.php file to customize YARPP further.

Customize the priority order for Automatic Placement (the_content):

add_filter( 'yarpp_content_priority', 1 );

Default: 1200

Customize the priority order for RSS Feed Placement (the_content_feed):

add_filter( 'yarpp_feed_priority', 1 );

Default: 600

Customize the priority order for RSS Feed Excerpt Placement (the_excerpt_rss):

add_filter( 'yarpp_excerpt_rss_priority', 1 );

Default: 600

To disable automatic creation of YARPP thumbnail sizes:

add_filter( 'yarpp_add_image_size', '__return_false' );

Disable YARPP Automatic Display in specific categories:

function yarpp_disable_categories() {
  if ( in_category( array( 'my_category_1_slug', 'my_category_2_slug' ) ) ) {
    return true;
  }
}
add_filter( 'noyarpp', 'yarpp_disable_categories' );

Dequeue YARPP's CSS Style Sheet (related.css):

add_filter( 'yarpp_enqueue_related_style', '__return_false' );

Dequeue YARPP's Thumbnails Template Style Sheet (styles_thumbnails.css):

add_filter( 'yarpp_enqueue_thumbnails_style', '__return_false' );

Disable the request-for-feedback modal when deactivating the plugin:

add_action(
  'admin_init',
  function(){
    remove_all_filters( 'shareaholic_deactivate_feedback_form_plugins' );
  },
  11
);

Disable YARPP Review Notice:

function yarpp_disable_review_notice() {
  remove_action( 'admin_notices', array('YARPP_Admin', 'display_review_notice' ) );
}
add_action( 'admin_init', 'yarpp_disable_review_notice', 11 );

To change the arguments of all YARPP shortcodes by default:

add_filter( 'shortcode_atts_yarpp', function( $atts ) {
  $atts['post_type'] = 'page';
  return $atts;
});

To ignore certain words:

if ( function_exists( 'yarpp_related' ) ) {
  function add_additional_overused_words($overusedwords) {
    $additional_words = array('of', 'that', 'on'); // Add your words here
    return array_merge($overusedwords, $additional_words);
  }
  add_filter('yarpp_keywords_overused_words', 'add_additional_overused_words');
}

To add CSS classes to YARPP's parent <div>:

function yarpp_extra_css( $yarpp_classes ) {
  $yarpp_classes[] = 'class_1 class_2';
  $yarpp_classes[] = 'class_3';
  return $yarpp_classes;
}
add_filter( 'yarpp_parent_css_classes', 'yarpp_extra_css' );
Was this article helpful?
8 out of 8 found this helpful