porter_default_object_args

apply_filters( 'porter_default_object_args', $args, $group );

Filters the default arguments for a group (e.g. posttype) before registration.

Parameters

$args array

The default arguments for this group.

$group string

The group name.

Source

includes/porter-config.php
$args = apply_filters( 'porter_default_object_args', $args, $group );

Example

Filter the default post type arguments

add_filter( 'porter_default_object_args', function( $args, $group ) {
    if ( 'posttype' === $group ) {
        // Add a new field to the 'supports' section
        $args['supports'][] = 'author';

        // Modify other properties, e.g., make the post type searchable
        $args['exclude_from_search'] = false; // Enable searching for the post type
    }
    return $args;
}, 10, 2 );

Last updated