Title: Calling a function in the plugin file
Last modified: August 19, 2016

---

# Calling a function in the plugin file

 *  Resolved [Neji87](https://wordpress.org/support/users/neji87/)
 * (@neji87)
 * [15 years ago](https://wordpress.org/support/topic/calling-a-function-in-the-plugin-file/)
 * I’m trying to develop my first WordPress plugin and so far it’s gone well.
 * I’ve created a plugin which creates a table in the database and I’ve also added
   a page in the admin backend to all users to insert data into a form which is 
   then taken and added into the new table.
 * Now I’m at a point where I want to create a function which shows the data in 
   the table. Writing the function is no problem but how do I go about calling the
   function in a page? I want the homepage to show the data so I think I would need
   to call the function on the page.
 * Any help would be great.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [ext103](https://wordpress.org/support/users/ext103/)
 * (@ext103)
 * [15 years ago](https://wordpress.org/support/topic/calling-a-function-in-the-plugin-file/#post-2067670)
 * you will need to find a “hook” (search the codex for all available hooks) that
   will put your function in the right place.
 * then to call the function you would right it like this:
 * say your function looks like this:
 *     ```
       function(){
       //do stuff here
       }
       ```
   
 * when you call it you change a few characters like this:
 *     ```
       //calling the function
       function();
       ```
   
 * if you are adding it to a hook (say for instance the “the_content” hook)
 *     ```
       add_filter('the_content', 'function', 99);
       ```
   
 * if you just want it on the homepage you would probably need to add the `is_home()`
   check into the function before doing anything.
 *  Thread Starter [Neji87](https://wordpress.org/support/users/neji87/)
 * (@neji87)
 * [15 years ago](https://wordpress.org/support/topic/calling-a-function-in-the-plugin-file/#post-2067676)
 * Thanks, it works! I did have a look at hooks but couldn’t really get my head 
   around them so thanks for the simple explanation!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Calling a function in the plugin file’ is closed to new replies.

## Tags

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [Neji87](https://wordpress.org/support/users/neji87/)
 * Last activity: [15 years ago](https://wordpress.org/support/topic/calling-a-function-in-the-plugin-file/#post-2067676)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
