get_the_ID() fails the first time, returns a value the second time it’s called
get_the_ID() fails the first time, returns a value the second time it’s called
get_the_ID() fails the first time, returns a value the second time it’s called
I Found my mistake. Basically, I had a bad prefix… I changed the function name of the get_post_meta to $gwrrest_stored_meta but then missed it in the echo of the text area content. I had “recycled” my code and accidentally left is as $prfx_stored_meta. So the line here: <textarea name=”specials-textarea” id=”specials-textarea”><?php if ( isset ( $prfx_stored_meta[‘specials-textarea’] … Read more
You can use UPDATEwp_postsSETpost_content=”” WHERE 1
It looks like the problem is with your IF statement. if($post->ID = 142) should be if($post->ID == 142) (notice the 2 equals signs) Otherwise you are just resetting the variable $post->ID to 142
For multiple category handling you need either category__in or a tax_query, for multiple custom fields you use meta_query. The various options for both of these are covered in the WP_Query codex page. $args = array( ‘posts_per_page’ => 10, ‘category__in’ => array( 163, 165 ), ‘meta_query’ => array( array( ‘key’ => ‘a_field’, ‘value’ => array( 1, … Read more
The custom fields I am using are from the plugin ACF (Advanced Custom Fields). I finally looked at the ACF website, which I should have done originally, and found the function get_field can specify a post so here is the working code: $posts = get_posts(array( ‘numberposts’ => -1, ‘post_type’ => ‘post’,)); foreach($posts as $post) { … Read more
Problem solved, I’ve used this: $d=new WP_Query( array( ‘category__in’ => array(4), ‘post_type’ => ‘post’, ‘posts_per_page’ => ‘-1’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘data’, ‘value’ => $t, ‘compare’ => ‘<=’ ), array( ‘key’ => ‘data’, ‘value’ => $o, ‘compare’ => ‘>=’ ) ), ) ); Instead … Read more
Register author, facebook connect, publish posts from front end
Custom Post Field -> Returning only the word “array”
Converting a checkbox filter for custom fields to a dropdown