I implemented a custom field into one of my post formats called 'url'. When I enter a random string of characters into the field, it saves just fine and I display it in my template like this:

<h2><a href="<?php echo get_post_meta($post->ID, url, true); ?>"><?php the_title(); ?></a></h2>

However, whenever I enter a URL into this field, i.e "http://wikipedia.org", the value doesn't save. What is going on here? Am I doing something wrong or do I have to treat URLs differently?

  • How you save post meta value save ... please show me the complete code Nov 5, 2015 at 6:28
  • To save a custom field value as post meta you don't need to write any code, just use the Advanced Custom Fields plugin. This plugin will allow you to create custom fields for a certain post type or post format and save them as post meta values.
    – user304165
    Nov 6, 2015 at 1:38

1 Answer 1


After some testing, I figured out the issue. With the Advanced Custom Fields plugin, you have to make sure your field name is unique in order for it to save properly. For some reason, I had another custom field name called 'URL' that was interfering with my 'url' custom field. After changing the name of my custom field, it all works perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.