• Resolved tinyCoder

    (@tinycoder)


    I have an endpoint /bills, with several meta keys such as type and status which show without any problems, how ever the meta keys such as car and total plus 5 other keys always show as null even if they are not empty and have values.

    I saw this issue before and the author suggested to fill the Custom Meta Key value, however, it didn’t work for me.

    Please help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • @tinycoder,

    I’d love to help you but I don’t really know what you’re doing so its hard to say what could be going wrong.

    Are you building a custom post type and those are custom meta that you’ve added to that custom post type?

    Do you have code samples of the code you’ve used to add these meta values into your custom post type if thats what you did?

    Pretty much any information that lead you do this point could help me figure out what you’re doing and then help you get the results you’d like to see in your endpoint!

    Also, a side note if you’re registering your meta with register_post_meta() did you use the argument 'show_in_rest' => true?

    Cheers,
    Freddie

    Thread Starter tinyCoder

    (@tinycoder)

    Hi, it is a simple custom post type, I already activated 'show_in_rest' => true, i said that some keys are showing clearly, as I activated them in the Controller plugin. However, some fields are showing null for all posts even if they are filled with normal data just like other keys.

    All the keys are simply added with add_post_meta() function.

    Let me show you in details with screenshots:

    1- Here is the post type with the active keys:

    https://i.ibb.co/0jvQfgF/image.png

    2- Here you can see the post id 994 meta keys

    https://i.ibb.co/vm00zNf/image.png

    3- Here you can see the result from the REST URL, with the values null even if they are filled with data (like services_discount and total).

    https://i.ibb.co/9nFFn6P/image.png

    • This reply was modified 5 years, 2 months ago by tinyCoder.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Simple meta keys return null’ is closed to new replies.