WP_Query get always custom post_type for first
WP_Query get always custom post_type for first
WP_Query get always custom post_type for first
Updating a custom post status after an expiry date rather than trashing it
Is the use of many custom field not good for server?
For those who are looking for an answer – after trial and error i found the “if” statement i was looking for. Full code as follows: $variablename = get_field(‘dcfg_global_item_select’); if ( !empty( $variablename ) ) {?> <div class=”container”> <?php foreach($variablename as $variablename2):?> <a href=”<?php echo get_page_link($variablename2 ->ID);?>”> <center> <img src=”<?php echo get_the_post_thumbnail_url($variablename2->ID, ‘medium’);?>”> </center> </a> … Read more
Query posts by post type, author and post meta
Seems like you need to change your action to publish_post. publish_post only fires when a post is published. The callback function will only receive only one argument, the post id, with it you can do all your needed checks and update the meta as needed. By the way, update post meta doesn’t play well with … Read more
try this (assuming your custom acf field is of type text), $source = get_field(‘source’, get_the_id());
How can Use custom input field in functions.php page?
wp_insert_post_data is applied before the post data are inserted to the database. use the save_post hook instead to set the custom taxonomy terms. That was it. Thanks Sally for the recommendation.
The shortcode callback function should always echo its output, not return it. Your code should be something like this: function wcal_abandoned_cart_id_shortcode_callback( $atts ) { $atts = shortcode_atts( array( ‘post_id’ => get_the_ID(), ), $atts, ‘wcal_abandoned_cart_id’ ); echo get_post_meta( $atts[‘post_id’], ‘wcal_abandoned_cart_id’, true ); } add_shortcode( ‘wcal_abandoned_cart_id’, ‘wcal_abandoned_cart_id_shortcode_callback’ ); If the output of your callback was HTML, besides … Read more