I’m getting an error
-
It works super. It is simple and works with more. I’m just getting an error.
Notice: Undefined offset: 1164 in wp-content / plugins / custom-permalinks-for-custom-post-types / custom-permalinks-for-custom-post-types.php on line 110
function rflms_post_type(){ register_post_type('result', array( 'labels' => array( 'name' => __('Results'), 'singular_name' => __('Results'), 'all_items' => __('Results All'), 'add_new' => __('New Results'), 'add_new_item' => __('New Results'), 'edit_item' => __('Edit Results'), 'view_item' => __('View Results'), 'search_items' => __('Search Results'), 'no_found' => __('No Results Post Found'), 'not_found_in_trash' => __('No Results Post in Trash') ), 'public' => true, 'publicly_queryable'=> true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'show_in_nav_menus' => true, 'show_in_rest' => true, 'show_admin_column' => true, 'capability_type' => 'page', 'hierarchical' => true, 'rewrite'=> [ 'slug' => _x('results', 'URL slug'), 'with_front' => false ], 'show_in_nav_menus' => true, 'cptp_permalink_structure' => '%results_category%/%postname%-%post_id%/', 'menu_position' => 21, 'supports' => array('title','editor', 'thumbnail','page-attributes'), 'has_archive' => true )); flush_rewrite_rules(); } add_action('init', 'rflms_post_type'); function rflms_themes_taxonomy() { register_taxonomy( 'results_category', 'result', array( 'label' => __( 'Results Categories' ), 'rewrite'=> [ 'slug' => _x('results', 'URL slug'), 'with_front' => false ], 'cptp_permalink_structure' => '/%results_category%/', 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'query_var' => true ) ); } add_action( 'init', 'rflms_themes_taxonomy',0); function rflms_add_taxes_to_api() { $taxonomies = get_taxonomies( '', 'result' ); foreach( $taxonomies as $taxonomy ) { $taxonomy->show_in_rest = true; } } add_action( 'init', 'rflms_add_taxes_to_api', 30 );
The topic ‘I’m getting an error’ is closed to new replies.