Importing posts with existing ID - wordpress

I'm trying to import posts from an XML export. Some posts are missing its featured image, since the ID of the featured image already exists in the new system, hence creating the featured image is skipped.
Is there anything I can do about that?

Try importing it with a tool like WP All Import. This plugin allows you to provide action when data already exists (like updating). If you have a proper XML this import tool should do the trick.
You should never try to import data where you forcefully want the same ID, that messes things up. So allow new ID's to be created (the plugin does this for you).

Related

Extra meta fields in posts table that loads my db

A simple woocommerce store, when exporting a csv products catalog, I noticed my sheet contains thousands of extra fields that had no value, I have no clue where did it all came from and cannot associate it with any plugin that I'm using at the moment. for example:
meta:158275-wpfoof-google
meta:157909-wpfoof-identifier_exists
meta:157911-wpfoof-adsensecustom
Wondering how can I safely get rid of this additional custom fields.
Thanks.
These entries are coming from this plugin:
https://www.pixelyoursite.com/plugins/product-catalog-feed-for-woocommerce
Haven't figured out how to disable that in the plugin settings, but I suspect you could remove them without any issues.

Disappearing ACF field reference on non-imported field after running an import with WP All Import

So here is my setup, we have a custom post type (products) that uses ACF fields. We import the content for this custom post type using WP All Import from an in-house API.
The field in question is a Repeater field and is excluded from and explicitly ignored in the import I setup for this. I did this in the import settings of the specific import by checking "Update existing products with changed data in your file." Under that I have "Advanced Custom Fields" checked. Under that, I have "Leave these ACF fields alone, update all other ACF fields". And under that, I have my ACF field and all the fields under it included.
These items are excluded because we want to manually enter the information via the CMS admin.
When I run the import everything looks fine. But when I load the products that have this repeater field filled out it loads nothing on the product page. If I load the edit page for this product in admin, the information is still there. When I hit save and then revisit the product page the data shows up again.
Doing some digging today with xDebug, I found that the reference to the field for this post ID in wp_postmeta goes away. BUT the reference to the fields within the Repeater field still exists. So it is just this parent Repeater field that seems to be the problem. All of these are in that exclude list mentioned above.
We are using the following plugins that are related to this:
Advanced Custom Fields PRO (5.8.11)
WP All Import Pro (4.6.1)
WP All Import - ACF Add-On (3.2.6)
We also have Yoast SEO and other plugins installed, but seem unrelated to this. I will mention that Yoast fields are set to ignore and don't seem to have a problem. I am also running Wordpress 5.4.2.
Does anyone know what is going on and how to fix it? I am at a loss right now.

Wordpress: Advanced Custom Fields: Exporting and Importing fields to a new wordpress install

I've created two custom field groups in a temporary wordpress install and would now like to use the export of them to import them into a new wordpress install, however it doesn't seem like there's a way.
How have others done this?
Advanced Custom Fields stores the field groups as Custom Post Types, so the XML export is compatible with the standard WordPress XML format, and can be imported using the WordPress Importer plugin.
You can also get to the install directly by visiting /wp-admin/import.php on your site (under Admin > Tools > Import) and clicking the WordPress link at the bottom. Once installed you just need to import the XML export file you created for the ACF field groups.
For importing from ACF 4 (exported to PHP) to ACF 5 Pro I used ACF-PHP-Recovery. Works like a charm.
To build on antongorodezkiy's answer:
His suggestion to use ACF-PHP-Recovery worked for me, but I had to make a couple of other edits first. My ACF 4.x PHP export used the function "register_field_group". But the ACF website references the function "acf_add_local_field_group". The property fields of both functions are almost identical -- the one major difference is that the old function used 'id' as one of its first keys, and the new function uses 'key'.
Making those changes to the PHP allowed the ACF-PHP-Recovery plugin to recognize my ACF data and import it.
By the way, the generated PHP goes into your functions.php file. Once you've used the plugin to upload the data, remove the PHP from functions.php.

How to import 1500 products into WP eCommerce with Custom Meta information?

I have a CSV file of products I need to import with the Custom Meta information but from what I have seen, the CSV examples only covers a few of the product details to import and not the Custom Meta information.
I have looked into a plugin I found by Visser Labs and although it looks like the thing I need, it is a super expensive and I am hoping there is someone who has done something similar for far cheaper?
Otherwise, if I have overlooked something and there is a simpler method, please let me know?
Many thanks!
This LINK describes the accepted import categories, as well as a Wordpress Plugin to import a CSV for eCommerce.
Best part of this page is the clarification of import fields acceptable by WP eCommerce.
As for importing custom meta:
meta_* - Custom meta data can also be included by creating a column
that has meta_ prefixed to it. For example if you want to have a
custom meta field called brand associated to your product you can
create a column called meta_Brand.

WordPress Media as a Custom Post Type

I am building a WordPress website that will allow members to upload media such as videos, images, etc. They will do this on a public form at for example: domain.com/upload
The form will ask for a Title, a brief summary, show some categories to choose from, and finally a file uploader. The user will then be able to submit the form and it will appear on the site as a post but instead of being just text it is a piece of media.
I have created a custom post type and all seems to be fine, the problem I have is how to deal with the media upload, as the default WP method is to upload an item and then manually insert it into the post (and you can have as many inserted as you like). Where as I want users to be only able to upload one file per post and not have to insert the file into a post because the file itself is the post. They will also be able to upload a featured image.
Any ideas on how I can develop this? Thanks.
You could use WP upload methods to upload your file to the server. Then (depending on your upload's media type) you would insert HTML representation of the file into the post (e.g. parse a text file, create tag for image or embed a video).
If you want to see some working example, please let me know. I just outline the flow:
wp-handle_upload() to physically upload a file
wp_update_post() or wp_insert_post() depending on whether you're creating a new user post or editing existing one. Both methods require one argument - Post object. That's where you put your content (as a post_content field of course) and post data

Resources