Feed to Post version 2.8 introduced a feature called Custom Field Mapping, that gives advanced users more power over what data to bring into their posts, and is most notably useful for users that import into other custom post types, or use themes which display custom data.
NOTE: This feature requires the use of “Custom Fields”. Many times these are hidden in the Edit Post screen of your WordPress site. If you cannot see the Custom Fields metabox in the Edit Post screen (below the content area), go to Screen Options on the top-right of the screen and tick the checkbox next to the label “Custom Fields”.
The Custom Field Mapping interface consists of a list of mappings. You can have as many mappings as you wish, but keep in mind your server’s load, since every mapping is the equivalent of a single data-save.
Each mapping contains 3 important fields:
The URL of the namespace where the RSS tag can be found.
The namespaces shown for each mapping are managed from the Feed to Post settings page.
- RSS Tag
The name of the tag, in which the data that you wish to retrieve lies, without the namespace prefix.
As of v2.9.6, you can also retrieve data from a tag’s attribute by adding the name of the attribute in square brackets.
Example: author[name] retrieves the name attribute in <namespace:author name=“Author Name”>...
- Meta Field Name
The name of the meta field where you wish to store the retrieved data. You can name this field whatever you like.
The following images demonstrate the use of the Custom Field Mappings feature.
First, we will need to start with the namespaces. Let’s click on the Add another Namespace button to show a new row with two empty fields, fill them in as shown in the picture below and click Save Settings.
If you don’t know the Namespace URL, you can get it from the feed source. Create/Edit the feed source, and from the Custom Field Mappings meta box, use the Detect namespaces in Feed Source button:
If the feed source has more than one namespace, put the feed source URL in your browser, and examine which fields you wish to import. Their prefix will correspond to the namespace that you will want to use. For instance:
itms: prefix for each tag in the above iTunes RSS feed. The itms namespace is the one we want for this example, so we will copy its URL from the detector,
http://phobos.apple.com/rss/1.0/modules/itms/, and paste it into our namespace settings and call it “itms” (see Fig.1).
After adding the namespace in the settings, we can start adding mappings to our feed sources:
In the image shown above, the feed source will use the itms Namespace we created in the settings page, to search for the itms:artistLink. Let’s save the feed source and make sure it is Active so we can observe the results immediately.
The image below shows the resulting data saved in the imported posts, along with some other data added by WP RSS Aggregator and Feed to Post: