Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to register a Custom Post Type with the YARPP (Yet Another Related Posts Plugin) in Wordpress
<?php
/**
* This is the method to register a custom post type adding YARPP support in it.
*
* @param $data array The original CPT args.
* @param $post_type string The CPT slug.
*
* @return array
*/
function register_my_cpt() {
// Preparing args.
$args = array(
'public' => true,
'label' => 'Books'
'yarpp_support' => true,
);
// Register my Custom Post Type.
register_post_type( 'book', $args );
}
// Adding wordpress action hook.
add_action( 'init', 'register_my_cpt' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment