Skip to content
No results
MEC Knowledgebase
  • Installation
    • Installation
    • Activation
    • Auto Update
    • Manual Update
    • Change License Domain
  • Settings
    • General
    • Archive Page
    • Slugs/Permalinks
    • Currency
    • View All
  • Single Event
    • Single Event Settings
    • How to Add Event In MEC Plugin?
    • MEC Single Sidebar
    • Custom Fields
    • View All
  • Event Modules
    • Speakers
    • Organizers
    • Locations
    • Map
    • View All
  • Booking Settings
    • Booking Module
    • Booking Elements
    • Booking Form
    • Payment Gateways
    • View All
  • Event Submission
    • General
    • Access Level
    • FES Sections
    • Required Fields
    • View All
  • Integrations
    • Mailchimp
    • Paid Memberships Pro
    • BuddyPress
    • LearnDash
    • View All
  • Notifications
    • Booking Notification
    • Booking Confirmation
    • Booking Reminder
    • Admin Notification
    • View All
  • Addons
    • Elementor Single Builder Addon
    • Ticket and Invoice Addon
    • Event Seat Addon
    • Virtual Events Addon
    • View All
  • Other
    • Appearance Settings
    • Translation
    • Knowledge
    • Troubleshooting
    • Developer
MEC Knowledgebase

  • Categories
    • Installation
      • Installation
      • Activation
      • Auto Update
      • Manual Update
      • Change License Domain
    • General Settings
      • General
      • Archive Pages
      • Slugs/Permalinks
      • Currency
      • View All
    • Single Event
      • Single Event Settings
      • MEC Single Sidebar
      • How to Add Event In MEC Plugin?
      • Custom Fields
      • View All
    • Event Modules
      • Speakers
      • Organizers
      • Locations
      • Map
      • View All
    • Booking Settings
      • Booking Module
      • Add a Booking System
      • Booking Form
      • Organizer Payment Settings
      • View All
    • Event Submission
      • General
      • Access Level
      • FES Sections
      • Required Fields
      • View All
    • MEC Integrations
      • Mailchimp
      • BuddyPress
      • LearnDash
      • Paid Memberships Pro
      • View All
    • Notifications
      • Booking Notification
      • Booking Confirmation
      • Booking Reminder
      • Admin Notification
      • View All
    • Addons
      • Elementor Single Builder Addon
      • Ticket and Invoice Addon
      • Event Seat Addon
      • Virtual Events Addon
      • View All
    • Other
      • Appearance Settings
      • Translation
      • Knowledge
      • Troubleshooting
      • Developer

Submit a Ticket
MEC Knowledgebase

Toggle
  • Manually Importing Events via SQL
    • Key Considerations While Importing Events to MEC

Developer

Importing Events via SQL

 Importing Events via SQL in the Modern Events Calendar can be done via the following method.

Manually Importing Events via SQL

The first method for importing events to Modern Events Calendar is to use the option in the plugin.

In this method, you can simply go to the MEC dashboard> Import / Export section get the XML output, and then put the action below in the functions.php:

do_action ('mec_import_file', XML_PATH);

For the second method which will be done via SQL, note that MEC events are created using WP post type + a record in [wp_prefix]_mec_events table so you should import both, otherwise, the event is incomplete and it won’t be shown on the front-end of the website.

For importing the post types, you can simply use the solution that you use for other post types such as posts, pages, etc.

For the mec_events records, we suggest creating a SQL export file from your mec_events table on your demo website and then write a simple PHP code to run the .sql file queries into the client website.

You can use codes like this:

$query_file = '/path/to/mec_events.sql';
$queries = file_get_contents($query_file);
$sqls = explode(';', $queries);
// WordPress DB
global $wpdb;
foreach($sqls as $sql)
{
    $sql = trim($sql, '; ');
    if(trim($sql) == '') continue;

    $sql .= ';';

    $wpdb->query($sql);
}

Key Considerations While Importing Events to MEC

You should be careful about the WP table prefix.

We suggest changing the prefix in the SQL file to something unique.

For example, change the INSERT INTO wp_mec_events to INSERT INTO #__mec_events in the SQL file and replace #__ with $wpdb-> prefix before calling the query.

Another way is to assign the queries to a PHP variable and then run it by $wpdb->query() function.

Something like this:

global $wpdb;
$query = "INSERT INTO ".$wpdb->prefix."mec_events ......";
$wpdb->query($sql);

Note: The post_id column of the mec_events table should match the Post ID of the event otherwise they won’t link together.
 

Share

Report Out Dated Content

If you think the content of this page does not reflect updated information, please let us know.

Report Now
Login Submit
4 Comments
Cyloe December 2, 2020
| |

Hello, 
The event calendar has a great otion to import locations, organiziers and, most important, events through .csv and column mapping etc… I think that is the most important problem in your plugin. That needs to be done asap because without that…… 

0 0
0
Reply
Sarah Wang December 5, 2020
| |
Cyloe Hello,  The event calendar has a great otion to i

Hello,
I will forward your comment to our developer team and they’ll surely receive it. If it is possible they will add this feature in the upcoming updates of the Plugin.

0 0
0
Reply
aktionerapp June 17, 2020
| |

Hi there, is there a CSV import option or is this something that is appearing in a future update? If so, when can this be expected? Thank you

1 0
0
Reply
Sarah Wang June 20, 2020
| |
aktionerapp Hi there, is there a CSV import option or is this

Hello,
unfortunately, currently, it’s not possible.
I will forward your comment to our developer team and they’ll surely receive it. If it is possible they will add this feature in the upcoming updates of the Plugin.
we can’t give you an ETA. Suggestions are prioritized based on the number of user requests.

2 0
0
Reply

Still no luck? We can help!

If you did not find what you were looking for, please submit a ticket in our support system.

Submit a Ticket
Webnus Banner
Modern Events Calendar

Please read our Terms and Conditions and Privacy Policy.

Review us on Trustpilot

Copyright © 2023. All rights reserved. Webnus Inc.