• Good afternoon,

    I’m trying to get the value of one of my custom fields but it keeps returning “array array array”. I figured it was because there were nested custom fields. When I broke it down, I got this:

    s:17:"content_main_area";
    		a:4: {
    			i:0;
    			a:6:{
    				s:20:"dynamic_element_type";
    				s:9:"_text_box";
    				s:7:"pb_area";
    				s:17:"content_main_area";
    				s:6:"_sizer";
    				s:10:"two-thirds";
    				s:9:"stb_title";
    				s:15:"Paying for Care";
    				s:11:"stb_content";
    				s:1875:" $mydata = '

    So it appears to me that my custom field contains a string within a string. I’m trying to get make something like this:

    $custom_field = get_post_meta($post->ID, $zn_meta_elements['content_main_area']['stb_content'], true);

    With $zn_meta_elements as my custom field and “content_main_area” and “stb_content” are the strings. The goal is to get the value of “stb_content” (which might be $mydata????). It seems my syntax is off and all my google searches are now showing purple links.

    Can anyone point me in the right direction? Thanks so much!

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi, try to use get_the_ID() function instead of $post->ID

    Thread Starter Gabums

    (@gabums)

    Hi!

    Thank you for your suggestion. Unfortunately it still returns the same thing

    $custom_field = get_post_meta(get_the_ID(), $zn_meta_elements['content_main_area']['stb_content'], true);

    I’ve also used other variations of get_the_ID() and tried with different field name and string combinations.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘custom fields and strings’ is closed to new replies.