13 March 2022

how to create custom plugin menu in wordpress?

 custom plugin  menu and in wordpress?

make new folder in plugin after whatever you want your folder name, remember that file name and folder name same .

make folder in this folder wp-content/plugins/
exmaple : wp-content/plugins/viral/viral.php
viral is your plugin folder and viral.php is your plugin file
now add code in viral.php file.

viral.php

<?php
/**
 * @package viral
 */
/*
plugin Name: vira-plugin
plugin URI: https://vdcodin.blogspot.com/
Description: this is my custom plugin made by your name other wise details about plugin
Version: 4.1.7
Author: viral
Author URI: https://vdcodin.blogspot.com/
License: GPLv2 or later
text Domain: viral
*/
add_action('admin_menu','viral_menu');
function viral_menu(){
    add_menu_page(
        'viral', // page title
        'viral', // menu title
        'manage_options', // by-default admin site
        'dashboard', // this is called page slug
        'my_function',// callback function which we called
        'dashicons-dashboard', // this is our icon
        6      //  this is our plugin position 
    );
}

if you still confused watch my video:

No comments:

Post a Comment

If You have any doubt, or want to know about something, please let me know

how to create custom plugin deactivate hook and display all post in wordpress?

 how to create custom plugin deactivate hook and display all post in wordpress? make new folder in plugin after whatever you want your folde...