How to exclude first 2 posts from a specific category for a custom post type archive page
How to exclude first 2 posts from a specific category for a custom post type archive page
How to exclude first 2 posts from a specific category for a custom post type archive page
PHP Works only for logged in users: [closed]
this code on functions.php should work or using this code on a plugin or in a snippet. Just change the ‘yourpage’ to your respective page and the link on the wp_redirect function. add_action( ‘wp_head’, ‘custom_if_user_is_logged’ ); function custom_if_user_is_logged(){ if(is_page(‘yourpage’) && !is_user_logged_in()) { wp_redirect(‘https://your_website.net/wp-admin’); } } also when is a normal page from wordpress its possible … Read more
Add adjacent post function inside custom recent post function
This might work, not tested though. First add this to join the postmeta table: add_filter( ‘posts_join’, ‘search_filters_join’, 501, 2 ); function search_filters_join( $join, $query ) { global $wpdb; if ( empty( $query->query_vars[ ‘post_type’ ] ) || $query->query_vars[ ‘post_type’ ] !== ‘product’ ) { return $join; // skip processing } if ( ($this->is_ajax_search() || $this->is_search_page()) && … Read more
No WordPress does not track that information. You can’t find it because it does not exist. Unless you specifically wrote code to track when post meta was added/modified, that information doesn’t exist, and it’s rare that any plugin would implement this as it would result in a lot of data collection. It would also be … Read more
I’m having some trouble understanding your code. It looks like you’re: Looping over every search result. For each result, getting all tempo terms. For each tempo, querying all posts that belong to that term. Doing nothing with the queried posts. This is all extremely inefficient and doesn’t do anything like what you say you’re trying … Read more
You commented, “As far as I can see rewrite is only possible for one taxonomy?“. So no, that’s not true, it’s possible for every taxonomy. Just remember that each taxonomy should have a unique rewrite slug, so that it does not conflict with other permalinks (for other taxonomies and for post types like post, page, … Read more
Found the solution in case anyone is having the same problem. Before the Query call I ran: remove_all_actions(‘pre_get_posts’);
The error indicates that the WP_Widget::__construct() function expects at least two arguments to be passed but none were passed in the line of code where the error occurred. This could due to the upgrade to PHP 8 which is stricter about argument counts. To fix the issue, you need to modify the code in the … Read more