php – WP All Import take xml title and use it to get post ID

Question

I have a job listing site and I am trying to import an XML feed of jobs using WP All Import into custom fields, but in one of the fields on the XML feed it has the company name, I want to take this company name search the companies on the site (which are custom post types I believe) using this title and retrieve the ID back and import the ID into the custom field instead I have been trying this function:

function get_page_id($page_name){
    get_page_by_title($page_name, OBJECT, 'post');
    return $page_name->ID;
}

and calling the function in the custom field with

[get_page_id({companyname[1]})]

I can’t seem to get anything returning and have been searching for hours and can’t seem to get the answer

0
Brandon Morris 3 months 2022-05-04T09:57:09-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse