Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

IYBITWC on "Using update_post_meta inside of a function"

$
0
0

I can't seem to figure this one out. As a test, i'm using a single post ID, custom field key, and a value. Every time I use update_post_meta inside of a function it doesn't work. If I use update_post_meta outside of a function it works fine.

function article_init(){
	update_post_meta( 10123, 'phone-number', '8885551234');
}

My ultimate goal is to populate those three args using variables instead of constants. Which is the reason I'm trying to use this inside of a function. Any idea why this isn't working for me?

Thanks,
IYBITWC


Viewing all articles
Browse latest Browse all 8245

Trending Articles