Forums

WP functions in custom functions (2 posts)

  1. nipponese
    Member
    Posted 1 year ago #

    I'm having problems calling WordPress functions in my custom in functions. In short, they don't work...

    Here's what I'm trying to do:

    function getMetadata($keyToPlayin) {
    	global $post;
    	if (get_post_meta($post->ID, '$keyToPlayin', true)) {
    		echo "working!!!";
    	};
    }
    getMetadata(client)

    It works fine when I take it out of the function.
    And I can grab the post ID, but get_post_meta() never runs... Sorry, I'm PHP n00b here.

  2. nipponese
    Member
    Posted 1 year ago #

    I should add, I can echo "client" just fine. The function gets stuck on get_post_meta()

Topic Closed

This topic has been closed to new replies.

About this Topic