Will removing tags move Posts to Trash?

No, deleting tags, or any other terms, does not remove any posts. It shouldn’t even “touch” posts table. All it does is (you can see the code yourself: https://core.trac.wordpress.org/browser/tags/4.9.6/src/wp-includes/taxonomy.php#L1664): remove given term remove this term from all posts refresh caches But… There are some hooks in it, so some plugin or theme can modify this … Read more

add_rewrite_rules for type of post

the URL index.php?pagename=to-kill-a-mockingbird&post_type=book&book_type=fiction works only for simple post or page. when you have a custom post type, the URL is index.php?book=to-kill-a-mockingbird&book_type=fiction. then try this code : add_rewrite_rule( ‘^books/fiction/([^/]*)/?$’ , ‘index.php?book=$matches[1]&book_type=fiction’ , ‘top’ );

Duplicating Table of Contents for Paginated Post

You split post content into multiple pages with <!–nextpage–>, so you can use $page_number = get_query_var( ‘page’ ) to get current page number and global variable $numpages to get the number of pages in current post. Displaying table of content: global $numpages; $post_link = get_permalink(); $page_number = get_query_var( ‘page’ ); $toc = [ 1=>’Introduction’, ‘I2C … Read more

Reset Popular post query?

If you’re ok resetting it weekly – as in have views start from 0 every Monday – rather than trying to show the most read in the last 7 days, then the simplest change would be to have a different meta key for every week of the year. Then when you query the posts, you … Read more

Plain permalinks not working!

Plain permalinks of the form /?p=14523 (or /index.php?p=14523) don’t necessarily need any .htaccess file since they don’t require mod_rewrite to rewrite the URL (unlike the the custom permalinks you mention). However, for a URL of the form /?p=14523 (as opposed to /index.php?p=14523), where you don’t explicitly state the index document (ie. index.php) in the URL … Read more

How to disable edit post option 12 hours after post publication for contributors?

The other suggestions (and the accepted answer in your link) temporarily change a user’s capabilities globally. That is a hack. There is hook specifically designed for conditionally adjusting capabilities for specific content: map_meta_cap. When WordPress checks whether a user can edit a post, it checks if the user can edit_post. WordPress decides which actual capability … Read more

Show all posts in sidebar in single.php

Initiating new WP_Query($post) shows all posts. Credit to @Latheesh V M Villa Add: $loop_query = new WP_Query($post) Then change loop values like: have_posts() to: $loop_query->have_posts() loop.php <?php $loop_query = new WP_Query($post); if ($loop_query->have_posts()): while ($loop_query->have_posts()) : $loop_query->the_post(); ?> <article class=”loop-template” id=”post-<?php the_ID(); ?>” <?php post_class(); ?>> <!– article content here –> </article> <?php endwhile; ?> … Read more

How to automatically apply a category based on the post title?

You could try this. I havn’t really tested it, so I’m not sure it works – might require some small tweaks aswell. function add_category_based_on_title( $post_id ) { // title $title = get_the_title( $post_id ); // get first part of title $substr = explode( ” “, $title )[0]; // get category id $category_id = get_cat_ID( $substr … Read more