Home Forums General Issues Multiple URLs in one field


Multiple URLs in one field

  • Hi, I’ve got a question about storing URLs.

    I want to put multiple useful links (number varies per post) in each custom post, and I was wondering if it is possible to have multiple URLs in one custom field.

    Or will I simply have to make one custom field for each link?


  • You would need to have multiple fields. This is a useful place for a repeater field.

  • Thanks John, that’s helpful. I’m looking to populate my custom fields based on an external database (each post is a product, each custom field is an attribute of a product). Is it possible to use a repeater field for this purpose?

    I can understand how it automatically adds a new field if you edit the information in manually, but how would it work if I’m adding in the information automatically from a database? (taking into account that the number of URLs per product will vary and may be added to later)

  • Imports are another story. Yes, repeaters can be used, but it requires special handling when importing from some other source. My personal preference is WP All Import Pro.

    If you’re talking about product attributes, if you’re using WooCommerce you might want to import into there instead of using ACF. But it all depends on what you’re going to do with the values and what the attributes represent. A useful links field seems like a good use of a repeater while it might not be the right choice for other types of data.

  • I see, I heard about WP All Import before, good to hear it works well with ACF. It would be more of an informational site about products, so I’m not using Woo. The repeater field sounds like the way to go.

    However, I’d like to have an external database which, if updated, automatically updates the info on WP, instead of manually importing a CSV file each time. Do you have recommendations of a solution that works well will ACF? Or will it have to be a custom coded solution in any case?

    Thanks for the help.

  • That depends. The Pro version of WP All Import will do automated imports from a URL. If you have a way to automate export the other DB to an XML or CSV file then it can be used to run automated updates using crons.

    I have a site for one client that cannot do automated exports and instead they need to manually do the export and upload the CSV to the site. I have 2 crons running on this site. Every 5 minutes the first cron runs and it looks at the file to see if it is new. If the file is new then this cron triggers WP All Import to run the import /wp-cron.php?import_key={$IMPORT_KEY}&import_id={$IMPORT_ID}&action=trigger' and records the file time of the csv in a text file for the next check. The second cron is set up to also run every 5 minutes and is set to the WPAI url to start running the import. This call is ignored if the import has not been triggered by the first cron.

    This same setup could be used for an automated export as well.

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Multiple URLs in one field’ is closed to new replies.