Support » Plugin: Import any XML or CSV File to WordPress » Bulk Edit Record Matching by Slug

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @toddedelman,

    When it comes to Record Matching, we want to match by post slug.

    Are you trying to match by the current post slug? If so, you’d have to use a custom PHP function (see documentation) in the “Post ID” field under Record Matching. You’d pass the post slug to your function, then your function would look up the post by its slug and return the post ID.

    Here is an example function:

    function my_get_post_by_slug( $slug, $post_type = 'post' ) {
    	if ( $post = get_page_by_path( $slug, OBJECT, $post_type ) ) {
    		return $post->ID;
    	}
    }

    Usage:

    [my_get_post_by_slug({articleurl[1]})]

    If you’re matching a custom post type, be sure to pass the post type slug as the second parameter:

    [my_get_post_by_slug({articleurl[1]},"product")]

    Plugin Author WP All Import

    (@wpallimport)

    Hi @toddedelman,

    I’m marking this as resolved since we haven’t heard back from you in a while. If you still have questions, you can follow up in this thread.

    Anyone else with questions, please open a new topic.

    Was looking for the same thing. Worked great!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.