Good morning, I found many similar questions, but none of the answers matched my problem. The point is very simple: I have my own loop with get_posts (), and I want to exclude the display of the current message.
The code:
$args = array( 'posts_per_page' => 3, 'orderby' => 'meta_value', 'order' => 'ASC', 'post_type' => 'fasthomepress_pt', 'post__not_in' => array(get_the_id()), 'meta_query' => array( array( 'key' => 'custom_richiesta', 'value' => array($custom_boxes['custom_richiesta'][0] - 10000, $custom_boxes['custom_richiesta'][0] + 10000 ), 'type' => 'numeric', 'compare' => 'BETWEEN' ) ) );
I tried:
'post__not_in' => array(get_the_ID), 'post__not_in' => array($post->ID), 'exclude' => $post->ID, 'exclude' => get_the_ID,
and with many other combinations with or without an array. Damn, the current post-id is correctly reflected before this loop, and if I try to echo ($ post-> ID) and echo (get_the_ID ()), I have the same, correct result.
I really donβt know what is happening, thank you very much for your help,
Marco
Marco source share