$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Why activated plugin does not appearing in left side menu bar of WordPress admin area?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

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

matteradmin9PV0评论

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";
}
Post a comment

comment list (0)

  1. No comments so far