WordPress

Get custom fields for pages

November 24, 2015 /1 min read

To get values of custom fields from a post we use get_post_meta() but it doesn’t work for pages. get_metadata function has to be used for that purpose. It will bring custom fields meta data for pages. I used it to get some demo urls for anchors from specific page using this function. Screenshot is given below.

<a class="view-demo" target="_blank" href="<?php get_metadata('post', $post->ID, 'demo_var_url_one' true); ?>" >View Demo</a>


Have fun! 🙂

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Let's build something exceptional.

I'm selectively available for consulting, security audits, plugin architecture, and product development partnerships. If you're building something that demands engineering excellence, I'd love to hear about it.

Looking for a detailed project estimation? Use Wizard

Fun Portfolio Projects

Cli Folio Comicbook Desktop Factory Game Folio Toons Folio
Hassan Raza