Why post__not_in is ignored?

As per the Codex entry: “post__not_in (array) – use post ids. Specify post NOT to retrieve. If this is used in the same query as post__in, it will be ignored.“ Try to make an array of the post id’s you do want to display, OR an array of the post id’s you want to exclude … Read more

Security for data obtained from the database

Well, it depends on the context. Usually we don’t need to protect data for only showing it in frontend. But the best practice is, always escape or validate data, no matter where they comes from. Like for your case you can do that like below- <label><?php echo esc_html( $data[‘title’] ); ?></label> <input type=”text” value=” <?php … Read more

get data match with extra field value using wp_query for custom post

Change your WP Query arguments like this: $args = array( ‘post_type’ => ‘assignment’, ‘post_status’ => ‘publish’, ‘meta_key’ => ‘batch’, ‘meta_value’ => ‘2017’, ); For multiple post meta you can use meta_query like this $args = array( ‘post_type’ => ‘assignment’, ‘post_status’ => ‘publish’, ‘meta_query’ => array( array( ‘key’ => ‘color’, ‘value’ => ‘blue’, ), array( ‘key’ … Read more

How to count posts with specific arguments

The easiest way to optimize this query would be to add ‘fields’ => ‘ids’ to the arguments. This way only ids of posts will be retrieved from DB (and usually that’s a big change). $args = [ ‘numberposts’ => -1, ‘post_type’ => ‘jobs’, ‘s’ => ‘developer’, ‘tax_query’ => [‘taxonomy’ => ‘IT’, ‘field’ => ‘slug’], ‘fields’ … Read more

Is there something wrong w/ this code?

It should be this: WP_Query Order By Parameters <?php $rp = new WP_Query(array( ‘post_type’ => array( ‘post’,’videos’,’projects’ ), ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘posts_per_page’ => 4 )); while ($rp->have_posts()) : $rp->the_post(); ?>

Redirect to another page using contact form 7? [closed]

Redirect to another page using contact form 7? [closed]