Only allow users (that are not admins) to edit a specific post
Only allow users (that are not admins) to edit a specific post
Only allow users (that are not admins) to edit a specific post
How to conditionally change template based on ACF field in WordPress 6.5 with FSE theme?
If your posts store the date in a consistent format like YYYY-MM-DD HH:MM:SS, etc, you could compare with strings using regular expressions, like: $current_date = new DateTime(); $datemonth = $current_date->format(“m-d”); // MM-DD $args = array( // … ‘meta_query’ => array( array( ‘key’ => ‘birthday’, ‘compare’ => ‘REGEXP’, // Regular expression explanation: // ^ – Start … Read more
You should be able to order your posts by adding the following to your main args: ‘meta_key’ => ‘date’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, Example: $args_post = array ( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1, ‘fields’ => ‘ids’, ‘meta_key’ => ‘date’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘tipo-de-contenido’, … Read more
Yes for both 1 and 2. The filter acf/load_value can accept 3 parameters: $value, $post_id, $field. $value is the default value of the field, here you call it $content. $post_id is the post ID for this value. If you want to exclude some pages, you can use this. $field is all the information of the … Read more
you can use the save_post hook to validate the uniqueness of email and phone fields before saving the post. Replace seller with your actual post type slug and add below code in functions.php file // Add custom meta box for Seller post type function add_seller_meta_box() { add_meta_box( ‘seller_meta_box’, ‘Seller Details’, ‘render_seller_meta_box’, ‘seller’, ‘normal’, ‘default’ ); … Read more
So, in my case, the answer was simple, though it took a long time to find. Just in case anyone else ever has this issue, here is what solved it for me: I was calling the register_post_meta in a file that was only being included if is_admin() returns true (this is a plugin metabox conversion, … Read more
Recommend changing $wp_query to a different name: because it’s a custom WP_Query, best not to use a variable name that WP core uses. You likely don’t need wp_reset_postdata(), but I could be mistaken on that (I’ve not needed to wp_reset_postdata() recently).
You need to add the post via function call wp_insert_post. where you need to pass the parameter of post type as name of your custom post type. $wordpress_post = array( ‘post_title’ => ‘Post title’, ‘post_content’ => ‘Post Content’, ‘post_status’ => ‘publish’, ‘post_author’ => 1, ‘post_type’ => ‘custom_post_type’ ); wp_insert_post( $wordpress_post ); Hope this helps
You can use get_metadata() to retrieve all meta data for a post, by leaving the third and fourth parameters empty. $meta_key string Optional Metadata key. If not specified, retrieve all metadata for the specified object. get_metadata( ‘post’, $post_id );