List of URLs from multi-value field

(I’m an absolute beginner at PHP, I worked in other coding languages.)

This pertains to a Wordpress website.

Please point to appropriate forum if this is not the right one.

I have a text field with words such as “Big dog”, “Small cat”, “École”, “Mac & Cheese”, etc. Number of values in the field will vary, currently comma separated. The field type is currently set to text, that can be changed.

I need to do the following in PHP.

(1) I need to first sort the list into alpha order, as there’s no guarantee it will have been created in alpha order.
(2) The words are titles of Wordpress pages. Given those titles, I need to look up the slug for each title. If no slug is found, then I need the operations to fail silently on that lookup and skip by it rather than blowing up.
(3) Then, I need generate a list of URLs from the results:


(Skipping the generation of a URL for any slugs that were not found.)

Help in writing this, or pointing to a better place for this, is appreciated. Many thanks.

Sponsor our Newsletter | Privacy Policy | Terms of Service