Title: PHP block
Last modified: July 23, 2020

---

# PHP block

 *  Resolved [wp_ris](https://wordpress.org/support/users/wp_ris/)
 * (@wp_ris)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/php-block-2/)
 * Hello,
    i am trying to use something like:
 *     ```
       <?php
       $browserlang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
       $lang = $browserlang[0] . $browserlang[1] . $browserlang[2] . $browserlang[3] . $browserlang[4];
   
       if (($lang=="sk_SK") OR ($lang=="sk-SK")) {
           header("Location: https://www.example.sk/sk");
       }
       else if (($lang=="en_EN") OR ($lang=="en-EN") OR ($lang=="en_GB") OR ($lang=="en_US") OR ($lang=="en-GB") OR ($lang=="en-US"))  {
           header("Location: https://www.example.sk/en");
       }
       else {
           header("Location: https://www.example.sk/en");
       }
   
       ?>
       ```
   
 * in a block but wont work, the php option is highlighted and the code is working
   if i test with ‘my custom function’ plugin which use php code.
 * Is there a special syntax i must use for php to be run in AIPro block?
 * Thanks

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

 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/php-block-2/#post-13163703)
 * You did not post page address with enabled remote debugging so we can’t check:
   
   [https://wordpress.org/support/topic/ad-inserter-support-before-you-ask-for-help/](https://wordpress.org/support/topic/ad-inserter-support-before-you-ask-for-help/)
 * If you write to the HTTP header you need to do it before any page content is 
   writen.
    So the block must be inserted into the header. Use one of these approaches:
   [https://adinserter.pro/documentation/header-and-footer-code#page-specific-header-footer](https://adinserter.pro/documentation/header-and-footer-code#page-specific-header-footer)
 *  Thread Starter [wp_ris](https://wordpress.org/support/users/wp_ris/)
 * (@wp_ris)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/php-block-2/#post-13172852)
 * Thanks! the header/hook revealed to me another ad-inserter beauty.
    Another question:
 * is it possible in the “Lists” to set for example:
    “Clients” [*Firefox/7*] and
   not [*Firefox/62*]
 * , sintax may be *Firefox/7*, !*Firefox/62*
 * I hope you got what i mean.
 * Regards!
 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/php-block-2/#post-13173957)
 * This is not possible yet.
    I’ll put it on the to do list.

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

The topic ‘PHP block’ is closed to new replies.

 * ![](https://ps.w.org/ad-inserter/assets/icon-256x256.jpg?rev=1502039)
 * [Ad Inserter - Ad Manager & AdSense Ads](https://wordpress.org/plugins/ad-inserter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ad-inserter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ad-inserter/)
 * [Active Topics](https://wordpress.org/support/plugin/ad-inserter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ad-inserter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ad-inserter/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Spacetime](https://wordpress.org/support/users/spacetime/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/php-block-2/#post-13173957)
 * Status: resolved