Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save carmoreira/a377c38521bfe142189f7f0690a39a12 to your computer and use it in GitHub Desktop.
Save carmoreira/a377c38521bfe142189f7f0690a39a12 to your computer and use it in GitHub Desktop.
Add Custom Post Type Support for Yet Another Related Posts Plugin
<?php
/**
* Filter the CPT to register more options
*
* @param $args array The original CPT args.
* @param $post_type string The CPT slug.
*
* @return array
*/
function my_custom_register_room_post_type( $args, $post_type ) {
// If not our CPT, exit.
if ( 'my_custom_post_type' !== $post_type ) {
return $args;
}
// Add additional yarpp support option.
$cpt_args = array(
'yarpp_support' => true
);
// Merge args together.
return array_merge( $args, $cpt_args );
}
add_filter( 'register_post_type_args', 'my_custom_register_room_post_type', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment