add_post_meta unique value for all custom posts

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

Want to add custom post type for facebook feed

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

How to automatically update ACF field value every year?

If you don’t want to use a scheduler (ex: Action Scheduler) or a cron job, and you only want to update once per year, then an option that tracks the next update time is probably the simplest approach (untested): add_action( ‘init’, static function () { $option_name=”cpt_ages_next_update”; $option = absint( get_option( $option_name ) ); if ( … Read more

Change formatting of Date parameter on custom post type

Use the post_date_column_time filter to change the time format. The documentation says it changes the “published time of the post”, but it will change the scheduled time as well (ticket). Tested: add_filter( ‘post_date_column_time’, static function ( $time, $post ) { if ( ‘wp_events’ !== get_post_type( $post ) || ‘future’ !== get_post_status( $post ) ) { … Read more

hide “Open in New Tab” checkbox in link field

Site-Wide Checkbox Hide You can add a simple function to your functions.php to change its visibility (and will also set the default checked state to false): function disable_open_new_window() { ?> <script type=”text/javascript”> jQuery(document).ready(function ($) { $(‘input#link-target-checkbox’).prop(‘checked’, false); $(‘#wp-link .link-target’).css(‘visibility’, ‘hidden’); }); </script> <?php } add_action (‘after_wp_tiny_mce’, ‘disable_open_new_window’); This will change the visibility of that checkbox … Read more

Query custom fields with three dates – start and end does not work

There is one issue I see in your code. Within ‘meta_query’ you cannot use ‘meta_key’, but it should be ‘key’. For example: array( ‘key’ => ‘_reservation_date_hour’, ‘value’ => $GMT_checkHour,//the value it is grab using ajax form ‘compare’ => ‘>=’, ‘type’ => ‘DATETIME’, ) So with your previous code all ‘meta_key’ lines were ignored. To identify … Read more