Calling get,add,update, or delete _post_meta functions break’s the PHP script with error code 500

I am attempting to make a plugin that when $_POST data is received, it will decode the JSON table from $_POST and use that to update the post_meta for the given post.
Data from the JSON table comes in like this:[{“aname”:”Random Name”,”abio”:”This is my biography”,”postid”:”1923″}]
And is handled like this:

<?php
$a = json_decode($_POST[‘my_string’],true);

$postid = intval($a[0][“postid”]);

//echo $postid,gettype($postid) ; <- Used for testing to confirm postid was made int value

$aname = $a[0][“aname”];
$abio = $a[0][“abio”];

update_post_meta($postid, ‘gm_gap_author_name’);

When calling on this PHP file, it would return an error 500, regardless of if I used update_post_meta(), add_post_meta(), delete_post_meta(), or get_post_meta().

It did not work when manually imputing a post id either.
I cannot spot anything that would cause the file to error out, but maybe I am missing a glaringly obvious mistake.

Read more here:: Calling get,add,update, or delete _post_meta functions break’s the PHP script with error code 500

Leave a Reply

Your email address will not be published. Required fields are marked *