Title: PHP snippet not executing polylang
Last modified: August 31, 2020

---

# PHP snippet not executing polylang

 *  [supportneeded9](https://wordpress.org/support/users/supportneeded9/)
 * (@supportneeded9)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/php-snippet-not-executing-polylang/)
 * I am using Polylang on Local developed wordpress website. I am trying to create
   a shortcode and later invoke it for Polylang flags with slugs in Neve theme header.
 * This is my code:
 *     ```
       <?php
       	function polylang_shortcode() {
       		ob_start();		 
       pll_the_languages(array(‘show_flags’=>1,’show_names’=>1,‘display_names_as’ => ‘slug’));
       		$flags = ob_get_clean();
       		return $flags;
       }
   
       if (function_exists('pll_the_languages'))
       {
       add_shortcode(‘polylang’, ‘polylang_shortcode’);
       };
       ?>
       ```
   
 * I invoke it with [polylang], but it does nothing but print exact string, “[polylang]”.
 * Does anyone know what to do?

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

 *  [codestylist](https://wordpress.org/support/users/codestylist/)
 * (@codestylist)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/php-snippet-not-executing-polylang/#post-13338163)
 * This is not an Polylang related issue. `add_shortcode()` is a WordPress feature.
 *  Thread Starter [supportneeded9](https://wordpress.org/support/users/supportneeded9/)
 * (@supportneeded9)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/php-snippet-not-executing-polylang/#post-13338890)
 * Is the Polylang part with pll_the_languages() well written then?
 * Plus, Polylang says it should be invokable with shortcodes, so it should be related
   to Polylang as well.
 * Also, would you mind pointing me to the right direction?
    -  This reply was modified 5 years, 9 months ago by [supportneeded9](https://wordpress.org/support/users/supportneeded9/).
 *  [codestylist](https://wordpress.org/support/users/codestylist/)
 * (@codestylist)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/php-snippet-not-executing-polylang/#post-13354207)
 * The first issue you have so solve is, your shortcode is not executed. And this
   is still not Polylang related. Bring it up and running and afterwards you can
   check the Polylang function further.

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

The topic ‘PHP snippet not executing polylang’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

## Tags

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

 * 3 replies
 * 2 participants
 * Last reply from: [codestylist](https://wordpress.org/support/users/codestylist/)
 * Last activity: [5 years, 9 months ago](https://wordpress.org/support/topic/php-snippet-not-executing-polylang/#post-13354207)
 * Status: not resolved