Exist some WordPress function that retrieve the list of links (in my
specific case only one) that are into a post?
Check out the core wp_extract_urls()
function:
$urls = wp_extract_urls( $content );
that will extract urls from any given content.
Example
$content="Two test sites: <a href="http://foo.tld">Foo.tld</a> and https://bar.tld";
$urls = wp_extract_urls( $content );
print_r( $urls );
with output:
Array
(
[0] => http://foo.tld
[1] => https://bar.tld
)
Related Posts:
- Stop WordPress Wrapping Images In A “P” Tag
- How to get ‘post_content’ without stripping tags?
- Access post from post id in URL
- How to add category to: ‘wp-admin/post-new.php’?
- Get content from one page and show it on another page
- How to Check if a Page Exists by URL?
- Removing any and all inline styles from the_content()
- Strategy for handling hierarchical pages with empty parent content
- How to disable content pagination?
- Modify ‘Read more’ link adding a new class
- Open WordPress ‘Add New Post’ admin page with parameters set via $_GET
- Adding a div class or id inside the_content()
- How do you get all the urls of images attached to a post?
- Divide Post content into separate divs for every 500 characters (or any other character counts)
- Post content being duplicated by the_content();
- How to allow slashes in single posts when i click in the edit permalink button
- Possible to create a permalink to sort with meta_key?
- how to grab first link in post… and of course call it
- Content editor creating blank paragraphs in spaces and creating   in the_excerpt
- How to add custom content (text/image) at start of content (IN content ie the same line)
- Testing for post title in ‘if/else’ statement returns no content
- Create a separate JS application for an individual post?
- Display the Content of a Post with qTip2
- How to show video from specific category on sidebar?
- custom post type grid with content in lightbox [closed]
- Remove slashes (both before and after) in relative post url
- Random post category URL
- Uppercase first sentence in every post
- Why content_arr[‘extended’] removes paragraph tags?
- Modify Image Source With The_Content Filter?
- How to add pagination in between post and comments?
- Paginated Posts – Social Media Buttons Share First Page URL
- WordPress not opening posts with only numbers if permalink is post_name
- Adding the_date inside tags around the_content
- Assign category to new post via URL
- Show the content that is after the excerpt using child theme
- filter RSS feed in URL
- get query() without post content?
- How to show full post?
- Permalink doesn’t get displayed in Twitter button (Local WordPress problem?)
- Retrieve post ID from “querying” URL
- Filter only the text in the_content
- Start post pagination at 0 instead of 1
- How to check if single.php has already called the_post_thumbnail function
- How do I Redirect a WordPress Page?
- Linking to pages/posts within the site
- WP move posts to different path
- How to disable the_excerpt from one post
- Make insterted image point to post url instead of attachment page
- Post is blank when I click on the link
- How to get the latest URL of my blog?
- Add div before the first paragraph the_content [closed]
- the_content() Not Grabbing All Content
- Inserting Media to WordPress Posts
- Custom Post Type, post-formats associated to custom post type > 404 archives
- Can Permalink structure of %postname%/%post_id% improve performance
- Adding if statement into the_content()
- how can i take wordpress post as embed?
- Does having category name in permalinks affect SEO when having a post in multiple categories?
- How to add a ‘News’ section to specific posts in WordPress
- Template for displaying CPT / Taxonomy URL issues
- Change WordPress names duplicate titles (url)
- How to generate an HTML link automatically from URL in a users’ post
- Prevent Archive URLs
- Category URL to use same string as Post URL Permalink
- if CPT content is empty then
- Querying posts from current category, using a variable as array argument
- Find post tags words in post content and link them to tag URLs
- If I moved the location of my generic “posts” page, do I need to change the slugs for all of the individual posts?
- Multipage Post URL correction
- Post & Category Archives URL structure
- Post URL duplication adds numerical value
- WordPress URL question
- Embed image in post from external url
- Add review box by function at top or bottom of content
- structure of posts and pages
- How to change post template via url?
- How to retrieve a post by inputing the url in a custom field and displaying it on an options page
- Post as frontpage – avoid duplicate content
- Custom URL Structure for posts with subcategories
- How can I display a specific number of post in a category via a url
- Add Image Before Posts Entry Title
- Showing content from WordPress ruins page CSS using WP_Query, without, content does not show
- Is there a Standard Format for Clean URLs for Archives of Custom Posts?
- Create custom URL with different levels
- Moving Posts to a new site and maintaining URLs
- Make Show Notes for Individual Podcast Episodes Easy to Find (multiple URL’s?)
- Rewrite a specific Post Format to URL slug
- Change the default video URL in a post to shortcode format
- Choose options via url
- Assign custom class to post content images
- the_content() not displaying the full post
- Stripping tag from elements in post
- How add class the_content();?
- Default post type doesn’t display in url
- Do I need to create a multisite for querying posts from multiple WordPress sites?
- Post page still linked to old site
- Blog posts are not appearing as subs of Blog Page
- How to add paraent in Blog post URL in wordpress
- Modify Post URL Programmatically