I'm writing an export plugin for WooCommerce. I want to print the product categories and subcategories in separate columns while exporting the products in the plugin I developed. My code is as below. function wpae_wp_all_export_csv_headers( $headers, $export_id ) { global $wpdb; $last_id = $wpdb->get_var( 'SELECT id FROM ' . $wpdb->prefix . 'bek_export' . ' ORDER BY id DESC LIMIT 1 '); if ( $export_id == $last_id++ ) { $additional_headers = array( 'Category 1', 'Category 2', 'Category 3', 'Category 4', 'Sub-Category …
I am developing a plugin for wordpress. I have created table in SQL for export ID. I need to call back this ID by adding 1. The code I use is as below This is how I query the ID in SQL table. global $wpdb; $last_id = $wpdb->get_var( 'SELECT id FROM ' . $wpdb->prefix . '_bek_exports' . ' ORDER BY id DESC LIMIT 1'); This is how I use it in the code below if ( $export_id == (++$last_id) ) …
I am trying to export results to a csv file using the following code. The export appears to work, but when I open the file, it contains the html code from the page. Any help is appreciated. ob_start(); global $wpdb; $domain = $_SERVER['SERVER_NAME']; $table = $wpdb->prefix . "qi_project_requests"; $filename = "export.csv"; $sql = $wpdb->get_results("select * from $table"); $header_row = array( 'Date Submitted', 'Requestor Name' ); $data_rows = array(); foreach ($sql as $data) { $row = array( $data->date, $data->rname ); $data_rows[] …
How to export all posts from one single day. I've tried Tools > Export > Post. But problem is that there's only monthly backup, not date-wise as in "only 5th July 2015". How can I achieve this?
I am stuck on an issue here. I have this one theme which has the post type called 'listing' and I have this new theme with the post type 'iwp_property' When I use the Wordpress Exporter/Importer tool and goto import the data, I get this error 'Invalid post type listing' My question is what would be the most efficient way to export and import with mapping...I am completely open to suggestions...
hello guys i donot have experience working with the csv. I have a very big form i wanted to make a custom csv export for this form and a new csv is generated every time the form is submited. i am using gravity form and gravity form gform_post_submissiom hook to capture the entry. Everything is working fine until this point. I have created a sub dir in uploads folder. Csv for every entry is being created in this folder. I …
I exported blog posts to an xml file from a WordPress website and then imported them to another. I moved over all the images in their correct folders via FTP and then used a plugin to register them in the media gallery. They are in their correct months too. So, I have the blog posts, I have the images. I even ran a search and replace in the database to change all the domain names to the new one yet …
I have a form with some fields that I need to implement in a WordPress template. If I do it in vanilla PHP it works but when I put it in a WordPress template it doesn't work, can it be a problem with $_POST? <?php /** * Template Name: Telesales */ ?> <?php if(isset($_POST['submit'])){ $firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $DOFMonth = $_POST['DOFMonth']; $DOFDay = $_POST['DOFDay']; $DOFYear = $_POST['DOFYear']; $Content = "Name,LastName,Birthday\n"; $Content .= "$firstName,$lastName,$DOFMonth-$DOFDay-$DOFYear\n"; $FileName = $firstName."-".date("d-m-y-h:i:s").".csv"; header('Content-Type: application/csv'); …
I have a big client (50k orders, 70k customers), I'm working today on the migration of his site on a new version of WordPress on a new server. I need to export and import the products / customers / orders on the new WordPress without any ID modification. Problem, after working on the site I realize that the import is impossible because various customer and order IDs are already taken. How do you do exports / imports like this? Do …
Hi everyone I have the code below, but when I click on the link generated a new page is open with 0 display on it. What I'm doing wrong? function list_reservation_to_csv() { global $wpdb; $table_name = $wpdb->prefix . 'prenotazione_eventi'; $file = 'email_csv'; // ?? not defined in original code $results = $wpdb->get_results("SELECT * FROM $table_name",ARRAY_A); if (empty($results)) { return; } $csv_output = '"'.implode('";"',array_keys($results[0])).'";'."\n";; foreach ($results as $row) { $csv_output .= '"'.implode('";"',$row).'";'."\n"; } $csv_output .= "\n"; $filename = $file."_".date("Y-m-d_H-i",time()); header("Content-type: application/vnd.ms-excel"); …
I need to migrate a wordpress database to another server but first i need to change all old url's, stored inside any table, to new ones. To do that, i'm using wp-cli search-replace function with --export flag. Everything regarding the search-replace method is working good except the encoding of all text of the entire dump. Is there any way to preserve the initial encoded text on the export process ? Like --default-character-set=utf8mb4 or something ? Heres an example of the …
When I try to export posts via the command line, I get an immediate error that the term is missing a parent: $ wp export Starting export process... Error: Term is missing a parent: name-of-tag (123) When I looked in Wordpress, the ID applied to a tag, which has no applicable parent/child model to it. So what is going on here and how do I fix it?
How do I extract the last published post? I would be grateful if someone can just point out the relevant action hooks that I should check out. I have seen publish_post, edit_post, save_post, get_the_tags, sanitize_** functions in post.php but so far no success. I want to export the entire array of the last published post from the database. How do I do that?
I need to update a production site with changes I made on a staging site's menu structure. On the staging site I reorganized the menu in Appearance > Customize > Menus. What table in the database would this change be saved? I tried importing wp_terms but that didn't work. I also tried https://wordpress.org/plugins/customizer-export-import/ but that didn't work either. Thanks!
I'm exporting a Wordpress site from localhost to a web host, and I am unable to import the Media Library, as the web host is unable to contact localhost. I've uploaded all of the localhost files from /wp-content/uploads/..., and I'm thinking I just need to isolate the part of the MySQL database which contains the Media Library, and adjust the URL, then import the SQL into the web host database. Can you tell me where the Media Library lives in …
My tools>export option has vanished - even when reverting to the default TwentySeventeen theme. Direct access to /wp-admin/export.php delivers 'Sorry, you are not allowed to access this page.' I'm wondering 'why', and what the fix is. UPDATE... I restored the missing option by adding this to functions: $admin_role = get_role( 'administrator' ); $admin_role->add_cap( 'export', true ); And now, even when that code is commented-out, 'export' is available. I don't pretend to understand why.
I'm upgrading a pre-Wordpress 5.0 site to the latest WP version using blocks. I created a staging site and went through all the pages/posts and converted the content into blocks. Now I need to export ONLY the page/post content (+ custom fields) and import it into production without effecting anything else. I've tried the default WP import/export tool but this does not appear to work on existing pages that are already on production. I found this topic often when I …
I've been updating a staging site's content and would like to export then import this content into a production site. All of the content is built using custom blocks I've created. What is the best way to export/import this page content? I've tried using the built in Wordpress export/import and several other things without luck, surely there has to be an easy way to do this!