Title: Where Does Plugin Php Go?
Last modified: August 31, 2016

---

# Where Does Plugin Php Go?

 *  Resolved [johnywhy](https://wordpress.org/support/users/johnywhy/)
 * (@johnywhy)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/where-does-plugin-php-go/)
 * hi
 * noob question, i’m developing a super-simple plugin, using the WORDPRESS PLUGIN
   BOILERPLATE GENERATOR [http://wppb.me/](http://wppb.me/)
 * i generated the zip file successfully, now just trying to figure out where to
   put the code. I checked [this,](https://codex.wordpress.org/Writing_a_Plugin)
   but still confused.
 * The code is very simple:
 *     ```
       <?php
       function bp_redirect($user) {
           $redirect_url = 'http://www.mysite.com/yeah';
           bp_core_redirect($redirect_url);
       }
   
       add_action('bp_core_signup_user', 'bp_redirect', 100, 1);
       ?>
       ```
   
 * Does it go in `activate_redirect_after_register`, `run_redirect_after_register`,
   or someplace else?
 * i’m guessing this part should go in the ‘activate’ function
    `add_action(‘bp_core_signup_user’,‘
   bp_redirect’, 100, 1);`
 * and everything should go in the ‘run’ section. Correct?
 * thx!
 * also asked here:
    [https://buddypress.org/support/topic/how-to-redirect-after-registration/](https://buddypress.org/support/topic/how-to-redirect-after-registration/)

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

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/where-does-plugin-php-go/#post-7039117)
 * Your code goes on its own code page, named the same as your plugin’s name slug.
   This file also needs a specifically formatted comment header at the top of the
   page. One page plugins can go in the wp-content/plugins/ folder, but it’s better
   to have your own folder in plugins/. More information can be found in [Writing a Plugin](http://codex.wordpress.org/Writing_a_Plugin).
   I know you’ve seen this, if that page and my response here is not enough, what
   specifically are you still confused about?
 * An example for a plugin called “My Plugin”: Create a new folder in plugins/ called`
   my-plugin`. Make a new code page in that new folder called `my-plugin.php`. That
   page must have a comment header as explained here: [https://developer.wordpress.org/plugins/the-basics/header-requirements/](https://developer.wordpress.org/plugins/the-basics/header-requirements/)
   
   Your plugin’s PHP code goes beneath the header comment. The plugin code so organized
   is loaded automatically (assuming the plugin has been activated on the plugins
   admin screen)
 * General PHP coding tip: If the last code on your PHP page is PHP and not HTML,
   do not provide the usual closing `?>` at the end of the code. Blank lines after
   the final `?>` can cause strange “headers already sent” errors on your site. 
   Blank lines without the final `?>` are not a problem 🙂
 *  [amadeu](https://wordpress.org/support/users/amapeu/)
 * (@amapeu)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/where-does-plugin-php-go/#post-7039118)
 * Maybe place it in theme’s functions.php?
 *  Thread Starter [johnywhy](https://wordpress.org/support/users/johnywhy/)
 * (@johnywhy)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/where-does-plugin-php-go/#post-7039133)
 * thx for the detailed answer.
 * resolved by making a simple, one file plugin, instead of using the boilerplate
   generator. everything goes in that file.
 * instructions here:
    [http://www.wpcue.com/wordpress-plugin-development-beginners/](http://www.wpcue.com/wordpress-plugin-development-beginners/)
 * thx!

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

The topic ‘Where Does Plugin Php Go?’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 3 replies
 * 3 participants
 * Last reply from: [johnywhy](https://wordpress.org/support/users/johnywhy/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/where-does-plugin-php-go/#post-7039133)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
