Changing language issue

Changing language issue

When we change the language of the site while trying to add an event to our website, a 404 error message appears. However, this issue is now fixed with a simple code that needs to be pasted in the function.php. Now the error message does not appear while adding an event after changing the language. Or you can create a child theme and paste the code in the child theme’s function.php

Here is the code

  1. add_action('init', function() {
  2.     if (is_admin()) {
  3.         return;    
  4. } 
  5.     $current_locale = get_locale();
  6.     $flushed_locale = get_option('last_flushed_locale');     
  7. if ($current_locale !== $flushed_locale) {
  8.         flush_rewrite_rules(false);
  9.         update_option('last_flushed_locale', $current_locale);
  10.     }
  11. });
    • Related Articles

    • Changing the event slug/permalink

      In this guide, we will show you how you can change or customize the event slug or permalink. It usually appears like this: http://yoursite.com/events/event-listing-title in the default settings. To customize this with WP Event Manager, you can use ...
    • Changing the priority of field for event submission form

      Changing the priority of field like country field for events This tutorial will show you how you can edit fields with the Editing Event Submission Form Fields doc and display it on a single event listing. Changing the priority of field for the ...
    • Translating WP Event Manager

      WP Event Manager is capable of being translated into any language using the standard WordPress localization methods and is not necessarily to be used in the English Language. All language files are located within the wp-event-manager/languages/ ...
    • Changing Default Email Address

      The sender email address, also known as the “From” in the admin panel helps your event attendees identify you and your business. That is why it is essential for you to add an easily recognizable sender’s email address while filling up your ...
    • Event listings throw 404 page error

      Users may come across the 404 error while accessing the event listings. In this article, we will tell you how you can solve this issue. Here are the steps you need to take to solve this issue: Make sure that it is not a permalink issue: Go to your ...