I have a custom post type that takes only the title field. Associated with it I have a custom meta field that takes a URL.
I am using the WordPress Importer plugin (http://wordpress.org/plugins/wordpress-importer/) to import posts from another site into this one, and by default WP checks whether there is the same post type and whether there are any same titles, in which case it skips over that record.
Now I not only want to check for title but also for that URL meta field, because in this case it is more of a unique identifier, how can I do that?
I guess you want to modify these lines in the WordPress-Importer plugin:
to add some post meta checks.
I don’t see any hooks inside the function
post_exists()
that we could use.Remark:
I don’t recommend editing plugin files, but if this is a one time import and you can’t find any other solution, then you might give it a try.
Idea:
So you could try to replace the above lines with the following snippet:
where you must modify the
$my_meta_key
to your needs.This idea is untested so remember to take a backup before testing.