Title: Turn PHP Script into Plugin
Last modified: August 19, 2016

---

# Turn PHP Script into Plugin

 *  [CBResources](https://wordpress.org/support/users/cbresources/)
 * (@cbresources)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/turn-php-script-into-plugin/)
 * Hi all,
 * I have developed a PHP Script that I will be using on our WordPress Installation.
   But I ned to know how to turn this into a plugin.
 * At the moment, for the purpose of testing it… I have installed a plugin called“
   PHP Execution” which allows me to run PHP scripts in WordPress PAges/posts… but
   I don’t want to have this installed on our live site.
 * What I want to do instead, is turn my PHP script into a plugin and then use an
   operator to call that plugin on the page of my choosing…
 * Can someone tell me how this is done?

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

 *  Anonymous User
 * (@anonymized-3085)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/turn-php-script-into-plugin/#post-1818990)
 * have a look at [Shortcode API](http://codex.wordpress.org/Shortcode_API)
 *  Thread Starter [CBResources](https://wordpress.org/support/users/cbresources/)
 * (@cbresources)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/turn-php-script-into-plugin/#post-1819166)
 * Hi Rich & thanks for the advice…
 * I took a look at that post and it was a bit too advanced for my level of WordPress
   knowledge.
 * What I really need at this stage is a step-by-step (sort of “for dummies” guide
   and possibly an example).
 * Literally all I want to do is call upon my plugin in a page or post by entering
   a “tag.”
 * I know what to enter at the top of the PHP file to have wordpress recognise it
   as a plugin, I just don’t know how to call upon that plugin in a page?
 *  Anonymous User
 * (@anonymized-3085)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/turn-php-script-into-plugin/#post-1819168)
 * that is what shortcodes do.
 * the basics:
    `add_shortcode('my-shortcode', 'my_shortcode_handler');`
 * creates a shortcode for use in your blog: [my-shortcode]
 * my_shortcode_handler needs to be a function. Simply put if you do something else
   this:
 *     ```
       function my_shortcode_handler(){
        include 'yourscripts.php';
       }
       ```
   
 * then within your scripts `return $string-to-print;` (ie don’t echo to the screen)
   it would work ok. I know I’ve done this a few times when I had to adapt scripts
   very quickly.

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

The topic ‘Turn PHP Script into Plugin’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: Anonymous User
 * Last activity: [15 years, 5 months ago](https://wordpress.org/support/topic/turn-php-script-into-plugin/#post-1819168)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
