• [email protected]

    (@dannigutierrezgmailcom)


    Hi there.

    As I am relatively new to this topic I did not realize where I should put the call to a function (declared in functions.php) to hide a menu item admin panel.

    If it’s not too much trouble could you give me an example.

    Thank you.

    Daniel.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there,

    To reach the admin panel from your functions.php WordPress offers a series of actions and filters. See https://codex.www.ads-software.com/Plugin_API/Action_Reference

    For instance if you would like your code to run when the admin panel initiates you could use the action admin_init. Example:

    add_action( 'admin_init', 'my_function_name' );
    
    function my_function_name() {
    	// your code here
    }

    Be aware of using echo in some actions as many of them are usually run before the HTML-document has been created. To place something in the admin header, there is an action called admin_head where it is safe to echo stuff.

    But again, be careful, and read the Action Reference and Filter Reference

    Happy coding!

    Thread Starter [email protected]

    (@dannigutierrezgmailcom)

    Tnkx brother ??

    Daniel.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘functions in function.php’ is closed to new replies.