Why activated plugin does not appearing in left side menu bar of WordPress admin area?

admin2025-06-05  0

can anyone help me i am trying to create a plugin for gallery but at the initiating a problem occurred,when i activate the plugin it activating but problem is that it does not appearing at left menu ,

this is my code of plugin startup:|

<?php
/*
Plugin Name:JaissGallery
Plugin URI:WWW.GOOGLE.COM
description: >-Jaiss gallery plugin
Version: 0.1
Author: Mr. Tahrid abbas
Author URI: 
*/

function doctors_gallery(){
    add_menu_page(
    "doctorsGallery",
    "Doctors Gallery",
    "Manage_options",
    "DoctorsGallery",
    "Doc_gallery_view"
    );
}
add_action('admin_menu','doctors_gallery');

function Doc_gallery_view(){
    echo "ghfhgfgh";
}

can somebody tell me please what i am missing there ?

can anyone help me i am trying to create a plugin for gallery but at the initiating a problem occurred,when i activate the plugin it activating but problem is that it does not appearing at left menu ,

this is my code of plugin startup:|

<?php
/*
Plugin Name:JaissGallery
Plugin URI:WWW.GOOGLE.COM
description: >-Jaiss gallery plugin
Version: 0.1
Author: Mr. Tahrid abbas
Author URI: http://mrtotallyawesome
*/

function doctors_gallery(){
    add_menu_page(
    "doctorsGallery",
    "Doctors Gallery",
    "Manage_options",
    "DoctorsGallery",
    "Doc_gallery_view"
    );
}
add_action('admin_menu','doctors_gallery');

function Doc_gallery_view(){
    echo "ghfhgfgh";
}

can somebody tell me please what i am missing there ?

Share Improve this question asked Dec 29, 2018 at 19:33 TahridabbasTahridabbas 831 silver badge6 bronze badges 1
  • Maybe another read of the Codex explanation and take a good look at the examples. Be aware that using caps on the wrong places is a no go- also. – Charles Commented Dec 29, 2018 at 19:56
Add a comment  | 

2 Answers 2

Reset to default 0

For Menu and Submenu,

function doctors_gallery(){
    add_menu_page(
        __( 'Doctors Gallery', 'textdomain' ),
        'Doctors Gallery',
        'manage_options', //  The capability required for this menu to be displayed to the user.
        'DoctorsGallery',
        'doc_gallery_view'
    );

    add_submenu_page(
        'DoctorsGallery',
        __( 'Doctors Submenu Page', 'textdomain' ),
        __( 'Doctors Submenu', 'textdomain' ),
        'manage_options',
        'DoctorsSubGallery',
        'doctor_submenu_callback'
    );

}

add_action( 'admin_menu','doctors_gallery' );

function doc_gallery_view(){
    echo "ghfhgfgh";
}

function doctor_submenu_callback(){
    echo "Sub Menu section";
}

Can you try this,

function doctors_gallery(){
    add_menu_page(
        __( 'Doctors Gallery', 'textdomain' ),
        'Doctors Gallery',
        'manage_options', //  The capability required for this menu to be displayed to the user.
        'DoctorsGallery',
        'doc_gallery_view'
    );
}
add_action( 'admin_menu','doctors_gallery' );

function doc_gallery_view(){
    echo "ghfhgfgh";
}
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749058758a316002.html

最新回复(0)