Det här tillägget har inte testats med någon av de 3 senaste huvudversionerna av WordPress. Det kanske inte längre underhålls och kan ha kompatibilitetsproblem när det används tillsammans med nyare versioner av WordPress.

World Flags


Add country flags anywhere in your WordPress blog using simple shortcodes and/or widgets, or show visitor country flag and info based on their IP address.

This is the first version of World Flags. This version uses the ip2country database and only wraps the IPV4 version. The plugin imports the csv file into a mysql table for fast queries. Fetching of the csv IP database can be scheduled weekly using the WP cron jobs, or manually via the plugin options page.


  • Supports shortcodes anywhere and widgets
  • Template functions and comments author flags (NEW!)
  • Uses software77 IP database with more than 3 billion addresses included
  • Multilingual interface
  • Scheduled downloads of the IP database file
  • MD5 checks to validate database before populating tables
  • Uses MySQL for super fast queries
  • 4 image sizes for country flags – 16, 24, 32 and 48
  • Different ways to insert HTML – simple, JavaScript and jQuery (with Ajax)
  • Plugin uninstall support

Multilingual Support

World Flags supports multilingual interface and currently has:

  • Persian (fa_IR)

You can also translate the data/country-codes.txt file for country names in your language.

All translation submissions are appreciated. Thank you.

Warning: Please be aware that may ban your IP if you send many download requrests. Visit for their license, privacy policy and specially the periodic download limit for the database file.

Visit BSurprised Home Page for updates, feature requests and information on future releases.


  • World Flags settings page


Installation is the same routine as most WP plugins:

  1. Upload ‘word-flags’ folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the Plugins menu in WordPress
  3. Find the World Flags submenu under Options menu in your WordPress to change some settings or manually update the IP database.

Notice: You need to manually fetch the IP database the first time as the plugin does not include the files.

Using World Flags

  • Place [flag code="your-country-code/auto" size="16/24/32/48" text="yes/no"] in your posts.
    Example: [flag code="auto" size="48" text="yes"]
  • Drag the plugin widget in your Widgets menu and customize its options to show what you want.
  • If you want to show the country flag for your visitor comments, you can add the flag before or after the comment text along with your custom text or use <?php if (function_exists('world_flags_comment_flag')) echo world_flags_comment_flag($comment); ?> inside your comments loop in your template. $comment is the variable that holds the comment inside your loop.
  • You can add <?php if (function_exists('world_flags_insert_flag')) world_flags_insert_flag(); ?> inside your template to add flags anywhere. Optional argument $code can be provided to override auto mode. Example: world_flags_insert_flag( 'US' )

Vanliga frågor

What are the options for the World Flags shortcode?

The shortcode supports these attributes:

  • code: Can be an ISO_3166-1_alpha-2 two-letter country code, or the keyword auto for the automatic display of the flags based on the visitor IP address.
  • size: Currently supports 16, 24, 32 and 48 pixel image sizes.
  • text: yes or no, whether to show the country name text beside the flag image.
What are the requirements for the plugin?
  • You need at least 15 megabytes of space on your hosting as the ip2country database file, when extracted, takes some space.
  • Plugin needs to have write permissions on its /data directory.
The plugin auto mode does not show visitor flags correctly. Why?

You probably have some sort of caching enabled like wp-supercache. You need to set the mode to jQuery for the flags to load by ajax calls.

Bidragsgivare och utvecklare

”World Flags” är programvara med öppen källkod. Följande personer har bidragit till detta tillägg.

Bidragande personer

Översätt ”World Flags” till ditt språk.

Intresserad av programutveckling?

Läs programkoden, kika på SVN-filförvaret eller prenumerera på utvecklarloggen via RSS.



* Comment flags based on comment author IP address
* function to include flags anywhere inside template
* Many new customizable options


* Fixed the cache problem by implementing ajax calls in jQuery


* First released version
* Supports shortcodes and widgets
* Uses software77 IP database
* Only IPV4
* Plugin uninstall support