WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the best way of getting a custom field value from a page which is not the one currently displayed? I know the title of the page i want to get custom field value from, but not the pageID.


share|improve this question
up vote 1 down vote accepted


$meta = get_post_meta($id, $key, $single);

With $single set to true if you don't want WP to return an array for unique meta keys.

share|improve this answer
I don´t have the post id available. I only know the title of the page – Espen Arnoy Nov 1 '10 at 12:26
Is there a way of submitting a page/ post title and get the ID in return? – Espen Arnoy Nov 1 '10 at 12:29
Not short of querying the db directly. (There's a function to get the post by url, though.) You can see the ID by editing the post - it appears in the url. – Denis de Bernardy Nov 1 '10 at 12:33
There is get_page_by_title() function, not sure if it works for posts (from brief look at code it takes $post_type argument so might). – Rarst Nov 1 '10 at 13:34
Oh woops. I stand corrected. :-) – Denis de Bernardy Nov 1 '10 at 15:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.