Monday, August 1, 2022
HomeWordPress Developmentcustomized publish varieties - Uncaught Error: Name to a member operate add_rewrite_tag()...

customized publish varieties – Uncaught Error: Name to a member operate add_rewrite_tag() on null in wp-includesrewrite.php:176


Once I add the second publish kind (program), I get following error
Uncaught Error: Name to a member operate add_rewrite_tag() on null in D:CoursesWeb Dev – PracticeXAMPPhtdocsfictional-universitywp-includesrewrite.php:176

My code in mu plugin is

<?php
// SECTION: EVET POST TYPE
operate university_post_types()

// EVENT POST TYPE
{
    // register_post_type('Identify of publish kind',array of choices to explain publish kind );
    register_post_type('occasion', array(
        'show_in_rest' => true,
        'helps' => array('title', 'editor', 'excerpt'),
        'rewrite' => array('slug' => 'occasions'),
        'has_archive' => true,
        'public' => true,
        'labels' => array(
            'title' => 'Occasions',
            'add_new_item' => 'Add New Occasion',
            'edit_item' => 'Edit Occasion',
            'all_items' => 'All Occasions',
            'singular_name' => 'Occasion',
        ),
        'menu_icon' => 'dashicons-calendar',
    ));
};
// Program Put up Kind
{
    // register_post_type('Identify of publish kind',array of choices to explain publish kind );
    register_post_type('program', array(
        'show_in_rest' => true,
        'helps' => array('title', 'editor', 'excerpt'),
        'rewrite' => array('slug' => 'packages'),
        'has_archive' => true,
        'public' => true,
        'labels' => array(
            'title' => 'Applications',
            'add_new_item' => 'Add New Program',
            'edit_item' => 'Edit Program',
            'all_items' => 'All Applications',
            'singular_name' => 'Program',
        ),
        'menu_icon' => 'dashicons-awards',
    ));
};

add_action('init', 'university_post_types');

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments