Support » Plugin: Pods - Custom Content Types and Fields » pods field outputs NULL

  • Resolved perryb



    Something odd that I can’t explain, I’m currently trying to get the following simple thing to work:

    $pod = pods( 'my_pod', get_the_id() );
    $pod_field = $pod->field( 'pod_field' );

    var_dump of $pod_field gives me NULL

    var_dump of $pod does not include any of the fields in my pod.

    I can get stuff out of the pod with wp_query and get_post_meta but I don’t want to use this method as I’m trying to get to data in a related pod, so what might be the problem?

    I’ve tried disabling other plugins and so on.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter perryb


    OK – so it seemed to be because of how the code was positioned in my template, which is odd because it had worked there then it had stopped working.

    Plugin Author Jory Hogeveen


    Hi @perryb

    I think in your case get_the_ID() might return empty? This only works in the current post context is available.
    also, note the uppercase ID.

    Cheers, Jory

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘pods field outputs NULL’ is closed to new replies.