H
H
Httdientee2021-09-02 15:32:55
WordPress
Httdientee, 2021-09-02 15:32:55

Creating a wordpress plugin, can't add menu item?

I am writing a plug-in, I can’t understand why the item does not appear in the settings menu?

<?php
/*
Plugin Name: Export Information from Google Sheets
Description: Плагин для экспорта информации из гугл таблицы в личный кабинет пользователя.
Version: 1.0
Author: -
*/

class export_sheets {
    public function __construct() {
        add_action('init', 'function_export');
        add_action('admin_menu', 'function_settings');
    }

    public function function_settings() {
        add_menu_page('Настройка экспорта информации','Экспорт Google Sheets', 'manage_options', 'export_google_sheets_settings', 'export_sheets_menu_callback', 'dashicons-admin-generic', 5 );
        add_submenu_page('export_google_sheets','Настройка экспорта информации','Настройки','manage_options','export_google_sheets_settings','export_sheets_menu_callback');  
    }
    public function function_export() {
        $domain = get_site_url();
        $url = $domain.'/'.$_SERVER['REQUEST_URI'];

        if($url == $domain.'//lichnyj-kabinet/' && isset($_SESSION['email'])) {

        }
    }
}

$export_sheets = new export_sheets();
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
its2easyy, 2021-09-02
@Httdientee

https://wp-kama.ru/function/add_action ,
point #4 Adding an event from a PHP class

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question