skip to Main Content

I just installed WordPress and run on local machine everything works fine.

So I created one custom plugin under wp-content/plugins folder as like this:

<?php 
    /*
    Plugin Name: Lottery
    Description: Plugin for displaying products from an OSCommerce shopping cart database
    */

?>

So then I run the admin panel in my system the created plugin is not listed on plugins section in my administration

I do not know why its not display custom plugin. Could anyone help me out where I done the mistake or anything I want to import to display my plugin.

2

Answers


  1. To display your plugin name in admin panel you have to give the following code:

        <?php 
            /*
            Plugin Name: Lottery
            Description: Plugin for displaying products from an OSCommerce shopping cart database
            */
    
        add_action('admin_menu', 'function_name');
    
        function function_name(){
           add_menu_page( 'page_title', 'menu_title', 'capability', 'menu_slug', 'function1' );
        }
        function function1(){
               /* Plugin Code */
        }
            ?>
    

    Get more details from here https://developer.wordpress.org/reference/functions/add_menu_page/

    Login or Signup to reply.
  2. Make sure your path where you are trying to add your plugin is correct

    you can create a new folder inside plugin to make it more specific

    then add a php file with same name to identify it more clearly

    Add the following file and it you will be done.

    <?php
       /*
       Plugin Name: Your plugin name
       Plugin URI: Your plugin url
       Description: Here goes the description
       Version: 1.0
       Author: Author name
      */
    
      // No direct file access
      ! defined( 'ABSPATH' ) AND exit;
    ?>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search