Title: Plugin Development
Last modified: February 28, 2018

---

# Plugin Development

 *  [Doddox](https://wordpress.org/support/users/doddox/)
 * (@doddox)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/plugin-development-23/)
 * Hi everybody
 * I’m trying to create a plugin. But i wanna do it in OOP and i encounter an ‘undefined’
   problem when i try to use wordpress’s functions in my class. My question is this:
   How can i use wordpress’s functions like ‘add_menu_page()’, ‘add_plugins_page()’,‘
   add_action()’, …?
 * Thanks for your help.

Viewing 1 replies (of 1 total)

 *  [anurag.deshmukh](https://wordpress.org/support/users/anuragdeshmukh/)
 * (@anuragdeshmukh)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/plugin-development-23/#post-10023163)
 * You need to pass $this before adding/mentioning the functions. If you are developing
   plugin with OOP concept, you need to add/use $this else your functions won’t 
   come into action.
 *     ```
       class My_Class_Name
       {
   
       	function __construct() 
       	{
       		if (is_admin()) {
       			add_action('admin_menu',array(&$this,'my_class_admin_settings'));
       		}
       	}
   
       	public function my_class_admin_settings()
       	{
       		add_menu_page('Page Title','Menu Title','manage_options','my_menu_page',array($this,'my_func_menu_page'),'dashicons-welcome-widgets-menus', 6);
       	}
   
       	public function my_func_menu_page()
       	{
       		// Your functionality goes here
       	}	
       } // end class
   
       For the callback name, use this: array($this,'<function name>')
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Plugin Development’ is closed to new replies.

## Tags

 * [functions](https://wordpress.org/support/topic-tag/functions/)
 * [oop](https://wordpress.org/support/topic-tag/oop/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [anurag.deshmukh](https://wordpress.org/support/users/anuragdeshmukh/)
 * Last activity: [8 years, 2 months ago](https://wordpress.org/support/topic/plugin-development-23/#post-10023163)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
