function my_set_category_posts_per_page( $query ) { $args = array( array( 'key' => 'category_sticky_post', 'compare' => 'EXISTS' ) ); $meta_query = new WP_Meta_Query($args); if ( 'category_sticky_post' === $query->get('meta_query', $meta_query) && ! is_paged() ) { $query->set( 'posts_per_page', 8 ); } } How would I alter the query only when the meta key is present for the posts in the current query? … [Read more...] about Alter query using pre_get_posts() if meta_key is present
Get post meta using meta key
The Complete Guide to Using The Yoast SEO WordPress Plugin
SEO > Tools > Import & Export So let’s say you’ve been using some other SEO plugin on your site for a long time and now everyone is telling you to use Yoast’s plugin. Will you have to start from scratch or lose all that meta data you already input in your other plugin? NO! Yoast provides an import feature here which allows you to move your exiting meta information from another plugin into WordPress SEO so that you don’t have to re-do everything. Likewise you can also export all of your Yoast data here as well. … [Read more...] about The Complete Guide to Using The Yoast SEO WordPress Plugin
How to set meta_query if get_post_meta returns nested array for that key?
$args = array( 'post_status' => 'published', 'posts_per_page' => 77, 'post_type' => 'post', ); $query = new WP_Query($args); while ($query->have_posts()) : $query->the_post(); $literature = get_post_meta(get_the_ID(), 'popis_literature'); var_dump($literature); endwhile; for some posts var_dump gives an array of data like this … [Read more...] about How to set meta_query if get_post_meta returns nested array for that key?
7 Useful Enterprise WordPress Plugins for 2019
Readability checkingContent analysisPermalink cleanupRSS enhancementsYoast SEO helps users toward what it calls sustainable SEO by improving text and image setup for better search engine usability and visibility. The premium version is sold as an annual subscription with tiered per-site pricing for multiple sites. A single site is $69 for one year of updates and support which comes down to about $5.75 per month. … [Read more...] about 7 Useful Enterprise WordPress Plugins for 2019
Use a Variable in update_post_meta as the $meta_key
<form action="#" method="post"> <select name="Week"> <option value="week_1">1</option> <option value="week_2">2</option> <option value="week_3">3</option> <option value="week_4">4</option> <option value="week_5">5</option> <option value="week_6">6</option> <option value="week_7">7</option> <option value="week_8">8</option> </select> <button class="btn btn-lg btn-primary" type="submit" name="submit" value="Selected a Week" >Selected a Week</button> </form> <?php if(isset($_POST['submit'])){ $week = $_POST['Week']; // Storing Selected Value In Variable echo "You have selected : ".$week." to be edited"; // Displaying Selected Value } ?> If you echo $week all is ok. … [Read more...] about Use a Variable in update_post_meta as the $meta_key