How to check if `comment_meta` exists before inserting the comment?

First off, you need to fix the comment_meta value. It should be an array of meta key and value pairs, and not just the meta value. So give the meta a key (or name), e.g. message_id, and then do something like so: ‘comment_meta’ => array( ‘message_id’ => preg_replace(‘~[<]~’,”,strstr($mail[‘header’]->message_id, ‘@’,true)), ), Now to check if a … Read more

How to create a custom wordpress plugin

That’s not really a question, but as a not really an aswer, here are a few guidelines that you should keep in mind. Code convention Always try to prefix your functions with something unique (ex. your company name). This will be used like a namespace to avoid function name collision. Database Creating and updating a … Read more

Conditional delete metadata does not works

Try applying these and your code might work: Looking at the expressions $type_of_running == ‘manually_run’ and $type_of_running == ‘planned_run’, where you’re expecting get_post_meta() to return a single meta value, you should then set the 3rd parameter to true: // Set the 3rd param to true to get a single meta value. $type_of_running = get_post_meta($post_id, ‘spusteni_dotazovani’, … Read more