Support » Fixing WordPress » Menu Issue after Installing a plugin

  • Resolved dinhuakt

    (@dinhuakt)


    HI.

    After creating a test plugin, called ‘especies’ and activated it, a menu page, called also ‘especies’ too stop working and now redirects to home (like a non exist page).

    I have unninstalled the plugin, deleted and recreated the page and nothing…

    <?php
    /**
    * Plugin Name: AKT Espécies
    * Description: Plugin para criação de Espécies Marinhas.
    * Version: 1.0
    * Author: Me
    * License: GPL12
    */
    
    // Register the Custom Music Review Post Type
     
    function register_cpt_especies() {
     
        $labels = array(
            'name' => _x( 'Espécies', 'especies' ),
            'singular_name' => _x( 'Espécie', 'especies' ),
            'add_new' => _x( 'Adicionar Nova', 'especies' ),
            'add_new_item' => _x( 'Adicionar Nova Espécie', 'especies' ),
            'edit_item' => _x( 'Editar Espécie', 'especies' ),
            'new_item' => _x( 'Nova Espécie', 'especies' ),
            'view_item' => _x( 'Ver Espécie', 'especies' ),
            'search_items' => _x( 'Pesquisar Espécie', 'especies' ),
            'not_found' => _x( 'Nenhuma Espécie Encontrada', 'especies' ),
            'not_found_in_trash' => _x( 'Nenhuma Espécie Encontrada na Lixeira', 'especies' ),
            'parent_item_colon' => _x( 'Espécie-Pai:', 'especies' ),
            'menu_name' => _x( 'Espécies', 'especies' ),
        );
     
        $args = array(
            'labels' => $labels,
            'hierarchical' => true,
            'description' => 'Espécies Marinhas',
            'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes' ),
            'taxonomies' => array( 'reinos' ),
            'public' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'menu_position' => 5,        
            'menu_icon' => 'dashicons-format-audio',
            'show_in_nav_menus' => true,
            'publicly_queryable' => true,
            'exclude_from_search' => false,
            'has_archive' => true,
            'query_var' => true,
            'can_export' => true,
            'rewrite' => true,
            'capability_type' => 'post'
        );
     
        register_post_type( 'especies', $args );
    }
     
    add_action( 'init', 'register_cpt_especies' );
    
    function reinos_taxonomy() {
        register_taxonomy(
            'reinos',
            'especies',
            array(
                'hierarchical' => true,
                'label' => 'Reinos',
                'query_var' => true,
                'rewrite' => array(
                    'slug' => 'reino',
                    'with_front' => false
                )
            )
        );
    }
    add_action( 'init', 'reinos_taxonomy');
    
    ?>

    Any clue?

    Ty in advance

    • This topic was modified 5 years, 7 months ago by dinhuakt.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,

    Perhaps it’s a cache issue.
    If you are using a cache plugin, you will need to clear your cache content.
    Clear your browser history too.

    If your menu still does not work properly, you can go to Appearance -> Menus to check your menu item or re-assign it. Maybe you had code in your plugin that modified the menu?

    Thank you

    Thread Starter dinhuakt

    (@dinhuakt)

    Hi Denzel,

    I have completly delete the page, created another one with the same “especies” name and reassigned a menu…..but still nothing.

    As you can see in my plugin (already unninstaled), I have assigned a menu “especies”….same name the page already exists….I guess it cause the conflict…and I’m wondering how to fix it.

    TY

    Thread Starter dinhuakt

    (@dinhuakt)

    Any clue ?

    Hi,

    You can try flushing your permalinks.
    https://www.wpkb.com/can-flush-wordpress-permalinks/

    I am sorry, but this is all I can come up with.

    Hope it helps.

    Thank you

    Thread Starter dinhuakt

    (@dinhuakt)

    Flush worked!

    Ty a lot Denzel !

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Menu Issue after Installing a plugin’ is closed to new replies.