Created
June 7, 2018 15:58
-
-
Save carmoreira/a377c38521bfe142189f7f0690a39a12 to your computer and use it in GitHub Desktop.
Add Custom Post Type Support for Yet Another Related Posts Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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