Title: Adding a function?
Last modified: October 2, 2023

---

# Adding a function?

 *  Resolved [isdoo](https://wordpress.org/support/users/isdoo/)
 * (@isdoo)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/adding-a-function-2/)
 * Can this cope with functions?
 * function my_allowed_redirect_hosts( $hosts ) {
   $my_hosts = array(‘my.domain.com’,);
   return array_merge( $hosts, $my_hosts );};add_filter( ‘allowed_redirect_hosts’,‘
   my_allowed_redirect_hosts’ );
 * When added to functions.php it works fine.
   But not to this software.Not sure 
   what I am doing wrong – maybe it is the various options – I am running as php
   anywhere for example.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Mircea Sandu](https://wordpress.org/support/users/gripgrip/)
 * (@gripgrip)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/adding-a-function-2/#post-17095274)
 * Hi [@isdoo](https://wordpress.org/support/users/isdoo/),
 * Yes, WPCode can handle that type of code without issues and running it as code
   type PHP set to the auto-insert location “Run Everywhere” should have a similar
   effect to adding it to functions.php.
 * Is it possible to share more details regarding what redirect you are trying to
   whitelist your domain for? The only scenario that I can think of where this might
   not work is if the redirect is supposed to happen before the “plugins_loaded”
   action that is used to execute the snippets.

Viewing 1 replies (of 1 total)

The topic ‘Adding a function?’ is closed to new replies.

 * ![](https://ps.w.org/insert-headers-and-footers/assets/icon-256x256.png?rev=2758516)
 * [WPCode - Insert Headers and Footers + Custom Code Snippets - WordPress Code Manager](https://wordpress.org/plugins/insert-headers-and-footers/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-headers-and-footers/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-headers-and-footers/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-headers-and-footers/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Mircea Sandu](https://wordpress.org/support/users/gripgrip/)
 * Last activity: [2 years, 6 months ago](https://wordpress.org/support/topic/adding-a-function-2/#post-17095274)
 * Status: resolved