Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 563591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:40:36+00:00 2026-05-13T12:40:36+00:00

I run a few side blogs that I sort of aggregate into my main

  • 0

I run a few side blogs that I sort of aggregate into my main blog.
I use simplepie to parse the feeds from my other blogs, so the posts are being created automatically.

My typical post is layed out like this:

  1. IMAGE
  2. CONTENT/TEXT
  3. HYPERLINK

What I’m looking to do is automatically grab the hyperlink, and insert it into a Custom Field. The custom field already exists in the post, but I need to insert the hyperlink contained in the post content as the value.

I would need just the link, without the html, so the value would be just a straight link – http://domain.com/fsdds

I know there are a number of plugins that accomplish this with images, but I haven’t seen anything that will do it with anything else, like hyperlinks.

I posted this question over at the WordPress forums and was told I’d have to parse the entire post content looking for the links, which I knew, the problem is I’m not too sure how to do that.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:40:36+00:00Added an answer on May 13, 2026 at 12:40 pm

    Building on Anthony’s answer, use the UPDATE POST META once you have your link…

    Put this in your functions.php file:

    function catch_that_link() {
          global $post, $posts;
          $first_link = '';
          ob_start();
          ob_end_clean();
          $output = preg_match_all('/(https?://)?(www.)?([a-zA-Z0-9_%]*)\b.[a-z]{2,4}(.[a-z]{2})?((/[a-zA-Z0-9_%])+)?(.[a-z])?/', $post->post_content, $matches);
          $first_link = $matches [1] [0];
    
          if(empty($first_link)){ //Defines a default image
            return 'no link found';
          }
          return $first_link;
        }
    

    Then in your query loop, category file or whatever php file you would do the following

    <?php 
    
    $post_id = 13; //replace the number with the specific post
    $meta_key = 'key_example' //replace with your custom field name
    $meta_value = catch_that_link();
    
    update_post_meta($post_id, $meta_key, $meta_value); 
    ?> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The problem: we have jobs that run from a few seconds to a few
I have this relatively large numerical application code that may run for a few
I am trying to use a for-if loop to run through a few CheckBoxList
I have a few NUnit tests that run Selenium. There are some prerequisite to
I have run into this problem a few times and I'm not happy with
EDIT: on the server-side, if I remove the code from the run method in
I have a few lines of code that I want to run asynchronously in
I would like to run a query that returns the first word only from
I am trying to use Jcrop for my application, though I have run into
I have run a few using batch jobs, but, I am wondering what would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.