apply_filters( 'register_post_type_args', array $args, string $post_type )

Filters the arguments for registering a post type.


Description Description


Parameters Parameters

$args

(array) Array of arguments for registering a post type.

$post_type

(string) Post type key.


Top ↑

Source Source

File: wp-includes/class-wp-post-type.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note content
    Contributed by hwk-fr

    Example of Custom Post Type args change via filter hook. Changing rewrite slug from movies to films:

    add_filter('register_post_type_args', 'movies_to_films', 10, 2);
    function movies_to_films($args, $post_type){
    
        if ($post_type == 'movies'){
            $args['rewrite']['slug'] = 'films';
        }
    
        return $args;
    }

You must log in before being able to contribute a note or feedback.