apply_filters( 'sfwd_cpt_options', array $post_options, string $post_type )
Filters the custom post type registration options.
Description #
Parameters #
- $post_options
-
(array) An array of post options.
- $post_type
-
(string) Post type slug.
Source #
Examples #
Note: Extended code example below not guaranteed, you may need to consult with a developer
<?php
/**
* Example usage for sfwd_cpt_options filter.
*/
add_filter(
'sfwd_cpt_options',
function( $post_args = array(), $post_type = '' ) {
if ( $post_type == 'sfwd-courses' ) {
$post_args['has_archive'] = false;
}
// always return the $post_args array
return $post_args;
},
10,
2
);
Changelog #
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |