Proper way to trigger a MySQL query via link in a plugin
Proper way to trigger a MySQL query via link in a plugin
Proper way to trigger a MySQL query via link in a plugin
First of all, please don’t use query_posts, but a new WP_Query. Outpu count based on page is just a matter of a simple arithmetic operation using current page number and posts per page number. global $wp_query; $paged = $wp_query->get(‘paged’) ? : 1; $posts_per_page = 10; // feel free to change this $args = array( ‘cat’ … Read more
Since you’re working with the tag archive index page query, this really won’t be all that difficult. You simply need to filter the query parameters at pre_get_posts, using your criteria. For example: function wpse137627_pre_get_posts( $query ) { // If this is the tag archive index, // and is the main query if ( is_tag() && … Read more
Correct, “save_post” saves along with the meta_data which is stored in $_POST, $_GET or $post_data and then it is inserted into the posts table . let me know if that’s helpful.
Multiple Taxonomies Using Custom SQL Query
There is way to improve this query? wordpress get post data and some meta data
Pagination in custom loop for custom post type throwing 404 error
Problems With Query and/or Template Part and/or PHP
You could use rewrite rules but doing it the way you’ve put should be fine. It’s safe so long as you sanitize the query string. Using add_query_arg() you can add a query to the end of your current URL, like this: $link = add_query_arg( ‘orderby’, ‘name’, get_permalink() ); You can then, for example, apply it … Read more
Technically, pre_get_posts is an action, not a filter, and you don’t need to return anything and $query is passed in by reference, but that code should nonetheless work. Cleaned up it would be: function excludeCat($query) { if ( $query->is_home ) { $catid = get_cat_ID(‘watch-isatv’); $query->set(‘cat’, ‘-‘.$catid); } } add_action(‘pre_get_posts’, ‘excludeCat’); There are several potential points … Read more