"{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$this->name" . '&paged=$matches[1]', 'top' );
}
}
$permastruct_args = $this->rewrite;
$permastruct_args['feed'] = $permastruct_args['feeds'];
add_permastruct( $this->name, "{$this->rewrite['slug']}/%$this->name%", $permastruct_args );
}
}
/**
* Registers the post type meta box if a custom callback was specified.
*
* @since 4.6.0
*/
public function register_meta_boxes() {
if ( $this->register_meta_box_cb ) {
add_action( 'add_meta_boxes_' . $this->name, $this->register_meta_box_cb, 10, 1 );
}
}
/**
* Adds the future post hook action for the post type.
*
* @since 4.6.0
*/
public function add_hooks() {
add_action( 'future_' . $this->name, '_future_post_hook', 5, 2 );
}
/**
* Registers the taxonomies for the post type.
*
* @since 4.6.0
*/
public function register_taxonomies() {
foreach ( $this->taxonomies as $taxonomy ) {
register_taxonomy_for_object_type( $taxonomy, $this->name );
}
}
/**
* Removes the features support for the post type.
*
* @since 4.6.0
*
* @global array $_wp_post_type_features Post type features.
*/
public function remove_supports() {
global $_wp_post_type_features;
unset( $_wp_post_type_features[ $this->name ] );
}
/**
* Removes any rewrite rules, permastructs, and rules for the post type.
*
* @since 4.6.0
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
* @global WP $wp Current WordPress environment instance.
* @global array $post_type_meta_caps Used to remove meta capabilities.
*/
public function remove_rewrite_rules() {
global $wp, $wp_rewrite, $post_type_meta_caps;
// Remove query var.
if ( false !== $this->query_var ) {
$wp->remove_query_var( $this->query_var );
}
// Remove any rewrite rules, permastructs, and rules.
if ( false !== $this->rewrite ) {
remove_rewrite_tag( "%$this->name%" );
remove_permastruct( $this->name );
foreach ( $wp_rewrite->extra_rules_top as $regex => $query ) {
if ( str_contains( $query, "index.php?post_type=$this->name" ) ) {
unset( $wp_rewrite->extra_rules_top[ $regex ] );
}
}
}
// Remove registered custom meta capabilities.
foreach ( $this->cap as $cap ) {
unset( $post_type_meta_caps[ $cap ] );
}
}
/**
* Unregisters the post type meta box if a custom callback was specified.
*
* @since 4.6.0
*/
public function unregister_meta_boxes() {
if ( $this->register_meta_box_cb ) {
remove_action( 'add_meta_boxes_' . $this->name, $this->register_meta_box_cb, 10 );
}
}
/**
* Removes the post type from all taxonomies.
*
* @since 4.6.0
*/
public function unregister_taxonomies() {
foreach ( get_object_taxonomies( $this->name ) as $taxonomy ) {
unregister_taxonomy_for_object_type( $taxonomy, $this->name );
}
}
/**
* Removes the future post hook action for the post type.
*
* @since 4.6.0
*/
public function remove_hooks() {
remove_action( 'future_' . $this->name, '_future_post_hook', 5 );
}
/**
* Gets the REST API controller for this post type.
*
* Will only instantiate the controller class once per request.
*
* @since 5.3.0
*
* @return WP_REST_Controller|null The controller instance, or null if the post type
* is set not to show in rest.
*/
public function get_rest_controller() {
if ( ! $this->show_in_rest ) {
return null;
}
$class = $this->rest_controller_class ? $this->rest_controller_class : WP_REST_Posts_Controller::class;
if ( ! class_exists( $class ) ) {
return null;
}
if ( ! is_subclass_of( $class, WP_REST_Controller::class ) ) {
return null;
}
if ( ! $this->rest_controller ) {
$this->rest_controller = new $class( $this->name );
}
if ( ! ( $this->rest_controller instanceof $class ) ) {
return null;
}
return $this->rest_controller;
}
/**
* Gets the REST API revisions controller for this post type.
*
* Will only instantiate the controller class once per request.
*
* @since 6.4.0
*
* @return WP_REST_Controller|null The controller instance, or null if the post type
* is set not to show in rest.
*/
public function get_revisions_rest_controller() {
if ( ! $this->show_in_rest ) {
return null;
}
if ( ! post_type_supports( $this->name, 'revisions' ) ) {
return null;
}
$class = $this->revisions_rest_controller_class ? $this->revisions_rest_controller_class : WP_REST_Revisions_Controller::class;
if ( ! class_exists( $class ) ) {
return null;
}
if ( ! is_subclass_of( $class, WP_REST_Controller::class ) ) {
return null;
}
if ( ! $this->revisions_rest_controller ) {
$this->revisions_rest_controller = new $class( $this->name );
}
if ( ! ( $this->revisions_rest_controller instanceof $class ) ) {
return null;
}
return $this->revisions_rest_controller;
}
/**
* Gets the REST API autosave controller for this post type.
*
* Will only instantiate the controller class once per request.
*
* @since 6.4.0
*
* @return WP_REST_Controller|null The controller instance, or null if the post type
* is set not to show in rest.
*/
public function get_autosave_rest_controller() {
if ( ! $this->show_in_rest ) {
return null;
}
if ( ! post_type_supports( $this->name, 'autosave' ) ) {
return null;
}
$class = $this->autosave_rest_controller_class ? $this->autosave_rest_controller_class : WP_REST_Autosaves_Controller::class;
if ( ! class_exists( $class ) ) {
return null;
}
if ( ! is_subclass_of( $class, WP_REST_Controller::class ) ) {
return null;
}
if ( ! $this->autosave_rest_controller ) {
$this->autosave_rest_controller = new $class( $this->name );
}
if ( ! ( $this->autosave_rest_controller instanceof $class ) ) {
return null;
}
return $this->autosave_rest_controller;
}
/**
* Returns the default labels for post types.
*
* @since 6.0.0
*
* @return (string|null)[][] The default labels for post types.
*/
public static function get_default_labels() {
if ( ! empty( self::$default_labels ) ) {
return self::$default_labels;
}
self::$default_labels = array(
'name' => array( _x( 'Posts', 'post type general name' ), _x( 'Pages', 'post type general name' ) ),
'singular_name' => array( _x( 'Post', 'post type singular name' ), _x( 'Page', 'post type singular name' ) ),
'add_new' => array( __( 'Add New' ), __( 'Add New' ) ),
'add_new_item' => array( __( 'Add New Post' ), __( 'Add New Page' ) ),
'edit_item' => array( __( 'Edit Post' ), __( 'Edit Page' ) ),
'new_item' => array( __( 'New Post' ), __( 'New Page' ) ),
'view_item' => array( __( 'View Post' ), __( 'View Page' ) ),
'view_items' => array( __( 'View Posts' ), __( 'View Pages' ) ),
'search_items' => array( __( 'Search Posts' ), __( 'Search Pages' ) ),
'not_found' => array( __( 'No posts found.' ), __( 'No pages found.' ) ),
'not_found_in_trash' => array( __( 'No posts found in Trash.' ), __( 'No pages found in Trash.' ) ),
'parent_item_colon' => array( null, __( 'Parent Page:' ) ),
'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ),
'archives' => array( __( 'Post Archives' ), __( 'Page Archives' ) ),
'attributes' => array( __( 'Post Attributes' ), __( 'Page Attributes' ) ),
'insert_into_item' => array( __( 'Insert into post' ), __( 'Insert into page' ) ),
'uploaded_to_this_item' => array( __( 'Uploaded to this post' ), __( 'Uploaded to this page' ) ),
'featured_image' => array( _x( 'Featured image', 'post' ), _x( 'Featured image', 'page' ) ),
'set_featured_image' => array( _x( 'Set featured image', 'post' ), _x( 'Set featured image', 'page' ) ),
'remove_featured_image' => array( _x( 'Remove featured image', 'post' ), _x( 'Remove featured image', 'page' ) ),
'use_featured_image' => array( _x( 'Use as featured image', 'post' ), _x( 'Use as featured image', 'page' ) ),
'filter_items_list' => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ),
'filter_by_date' => array( __( 'Filter by date' ), __( 'Filter by date' ) ),
'items_list_navigation' => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ),
'items_list' => array( __( 'Posts list' ), __( 'Pages list' ) ),
'item_published' => array( __( 'Post published.' ), __( 'Page published.' ) ),
'item_published_privately' => array( __( 'Post published privately.' ), __( 'Page published privately.' ) ),
'item_reverted_to_draft' => array( __( 'Post reverted to draft.' ), __( 'Page reverted to draft.' ) ),
'item_trashed' => array( __( 'Post trashed.' ), __( 'Page trashed.' ) ),
'item_scheduled' => array( __( 'Post scheduled.' ), __( 'Page scheduled.' ) ),
'item_updated' => array( __( 'Post updated.' ), __( 'Page updated.' ) ),
'item_link' => array(
_x( 'Post Link', 'navigation link block title' ),
_x( 'Page Link', 'navigation link block title' ),
),
'item_link_description' => array(
_x( 'A link to a post.', 'navigation link block description' ),
_x( 'A link to a page.', 'navigation link block description' ),
),
);
return self::$default_labels;
}
/**
* Resets the cache for the default labels.
*
* @since 6.0.0
*/
public static function reset_default_labels() {
self::$default_labels = array();
}
}
Fatal error: Uncaught Error: Class 'WP_Post_Type' not found in /home/svecomtr/deterjancim.com/wp-includes/post.php:21
Stack trace:
#0 /home/svecomtr/deterjancim.com/wp-settings.php(509): create_initial_post_types()
#1 /home/svecomtr/deterjancim.com/wp-config.php(106): require_once('/home/svecomtr/...')
#2 /home/svecomtr/deterjancim.com/wp-load.php(50): require_once('/home/svecomtr/...')
#3 /home/svecomtr/deterjancim.com/wp-blog-header.php(13): require_once('/home/svecomtr/...')
#4 /home/svecomtr/deterjancim.com/index.php(17): require('/home/svecomtr/...')
#5 {main}
thrown in /home/svecomtr/deterjancim.com/wp-includes/post.php on line 21