How to check if a post meta key/value pair already exists for a specific post
I want to know if for a given post ID $post_id, there is a metadata key and value pair stored that matches a given key $meta_key and value $meta_value pair.
I want to know if for a given post ID $post_id, there is a metadata key and value pair stored that matches a given key $meta_key and value $meta_value pair.
TL;DR: I’m trying to get the meta_value display_type for a taxonomy, but it returns blank (even though I can see it in the database).
I am using the save_post hook to handle updates in a post that are done via the admin edit post page.
The standard or more obvious way to change a post author in WP is to use the wp_update_post() function, as shown in this question.
Firstly, sorry if this has been properly answered before. After reading a lot of questions and guides, I’m still not totally convinced on the best way of doing things.
Ok guys and gals, I’m losing my mind here…
I’m working on a plugin for WooCommerce which uses a cpt called Restock. In a Restock post you can enter products ( id ) plus restock. The user can add as many product restock pairs as they want per post.
I try to update wp_postmeta from SQL script.
I have created a form which collects information which I want to update a post with. The code I have works great, but instead of updating a post for the user, it creates a new one. Not sure what I am missing to get the current post to update instead of creating a new post. Here is the code I am using:
I defined a custom field named crimedate using standard date format Y-m-d. I defined the filters to make ordering by this date work in the post list of the backend, which works fine.