If I understood you correctly, this should be pretty straight forward:
$rawcontent = get_field("myfield");
$rawcontent = preg_replace("!</?p[^>]*>!", "", $rawcontent); // remove <p>
$all_links = preg_split("/\s*,\s*/", $rawcontent);
foreach($all_links as $link) {
if(!trim($link)) continue;
print "<li>$link</li>";
}
A comma certainly would work, but note that this would break if you had commas inside the link text (<a href="https://wordpress.stackexchange.com/questions/285760/...">hello, world</a>
).
You could easily alter the preg_split
line to split on other things, though, like line breaks (\n
). I’m not sure what the ACF editor inserts when you just press enter, but I’m sure that you can split it.
Related Posts:
- How can I remove the “Add New” button in my custom post type?
- Get Custom Taxonomy ID within loop
- Is it possible to create an “export to PDF” option?
- Categories under custom post types doesn’t show properly
- how to use two permalinks for one custom post type
- Clean URL permalink for custom post type
- WP insert post PHP function dynamically generated Custom Fields
- Inserting data into `post meta` table?
- WordPress is executing URL in code when called via wp_mail()
- How to append element after thumbnail
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- I am having a problem with form updating/editing WordPress post on the frontend
- Using several custom fields as custom post title
- Custom Post Type without an archive page
- Adding custom tables to WordPress
- Return the thumbnail meta data for getter and setter
- What’s the difference between same wp functions get_posts(); functions in different form?
- how to check if custom post type column already exists?
- Custom Post-Type not in admin menu
- Page vs Custom Post Types Differences/Issues
- Can I list a custom post type within another custom post type in the admin area?
- I would like to have different styles for my posts based on the content of each post
- Checking if Post Title is Unique as Loop Criteria
- Set URL link to featured image of custom post type
- AJAX load more for different custom post type loops
- On update or create post redirect to current post position in list
- Changing wordpress publication date to ACF date and time picker date not working
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- creat filter with wp_query
- How do I add a custom screen for a custom post type to be called from custom post row action?
- How to display custom WP menus?
- Problems wp_insert_post and save_posts filter
- categories should be available across all custom post types
- Cant get paginations on single.php to work with my custom post types
- Including all post id’s of a custom post type into an array
- How can I group posts by months and years?
- Trying to Create a PHP Variable for post_type that can be referenced Site Wide
- Not sure why this template for custom post type posts isn’t displaying anything. What’s missing?
- Custom Post not working as expected
- Saving fields in a drop-down in WordPress
- Assigning a category to a custom post type in WordPress
- finding and using post type fields in WordPress
- I need to add a filter to prepend the term ‘National – ‘ to the post title if the post is tagged to multiple states
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- After creating Custom post type by user delete old one
- Show message when query has no posts
- Query entries from custom post type in an ACF flexible content field
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- How to add new post using a form to categories when categories are using as menu
- Template code to split a post and print a custom field?
- Accessing a protected property of a post
- Foreach loop returning more than one item when querying taxonomy
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- Post type Echo code is repeating on homepage
- Need help with simple “if statement” checks to output particlular CPT data depending on what client uploads/fills out
- How can I increase the post count for custom post types only?
- WordPress sitemap with Custom Post Types
- How can I sort the order of multiple custom field values in a custom post type?
- Custom post type page with parameter
- Display All Courses in Course Archive Page
- Custom fields array to display it monthly
- How to show the post which checkbox is not selected
- php dynamic content inside shortcode
- I want to rewrite the URL of a specific post with a specific custom field to easily analyze in Google Analytics
- Is it possible to hide nav menu items only when they are page titles (on specific templates) but not on the dashboard?
- Get all post under custom post type grouped by custom filed value in custom taxonomy
- Grouping custom wordpress post types by acf value
- Check that a slug is present in the get_terms request
- open custom post type in popup window instead of page
- Show code dependant on CPT & category
- Get category name of custom post type
- when looping through custom post data not appearing
- Getting a Post ID to show its content in a Popup
- pagination problem listing custom post types of taxonomy in wordpress
- In the php, how can I have a category of a custom post type display?
- I’m trying to create an if statement that will only display my button link for tickets if its under ‘admission-event’… what is wrong with my code?
- Taxonomy doesn’t follow slug permalink structure
- Disable Sidebar on certain pages
- Looping to organize and display custom posts by category using PHP and WordPress
- Show parent category and subcategory once in while loop
- Custom Post By Category
- Display a list of sub-pages of Custom Post Type Parent Page
- test if something is a post or a taxonomy
- CPT: execute code after load if parameter is set
- Display related post content and custom field content
- The most recent post of custom taxonomy
- Custom 404 redirect for a luddite
- Show tags of custom post types in WordPress
- can’t see categories in appearance-menu-categories
- Meta Box not being added in plugin
- wordpress form processing to custom post type not working
- WordPress custom field images not getting inserted into array
- Meta-Box to add multiple items one at a time and on publish save all
- Values inside a custom field to determine which category posts to display
- Posts without featured image using other post’s featured image
- Add number in increment of one to DIV ID
- Building a List of Posts grouped by custom taxonomy as the section header only to be displayed if at least one post is in that tax
- What is the most efficient way to manage changes my product comparison tables?
- Dynamically change Custom Post Type Template OR Change Permalink?
- Store custom post type with JSON content