Skip to content

Instantly share code, notes, and snippets.

@pavlo-bondarchuk
Created January 18, 2020 14:36
Show Gist options
  • Select an option

  • Save pavlo-bondarchuk/cc6b31247decaab61f460efac3d1ecf9 to your computer and use it in GitHub Desktop.

Select an option

Save pavlo-bondarchuk/cc6b31247decaab61f460efac3d1ecf9 to your computer and use it in GitHub Desktop.
Modify a Custom Post Type after it’s been registered
function grd_client_filter_products_cpt( $args, $post_type ) {
// If not courses CPT, bail.
if ( 'courses' !== $post_type ) {
return $args;
}
// Add additional courses CPT options.
$args = array(
'has_archive' => false,
);
// Merge args together.
return array_merge( $args );
}
add_filter( 'register_post_type_args', 'grd_client_filter_products_cpt', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment