Why do I have categories with duplicate slugs?

Just to note: There will not be a delete option on a category on the Category page if posts are assigned to that category. (Added see below.) If you want to delete a category, you have to first change those posts to another category. You can do this on the Posts page, sort by category, … Read more

How to echo a PHP Code After the Content

You can try my approach which is used to do your requirement: function themename_your_content_after($content) { if( is_single() ): ob_start(); ?> <div class=”css”> <?php if ( should_display_link() ) : ?> [subscribe-author-button] <?php echo ‘<a class=”btn” style=”background-color:#1f1fff; border-radius:100px;” href=”‘.site_url(‘chat/’).’?new-message&to=’.get_the_author_meta( ‘user_login’ ).'”>Chat</a>’ ; ?> <?php endif; ?> [simple-author-box] <?php if ($post->post_status == “publish”) { ?> <h4>[post-views]</h4> <?php } … Read more

How to remove a post from results by ID after query?

Perhaps something like this would work? // Assuming $posts = new WP_Query( $args ); $post_to_remove = 123; // If using post objects foreach ( $posts->posts as $i => $post ) { if ( $post_to_remove == $post->ID ) { unset( $posts->posts[$i] ); break; // no need to continue the loop as the post has been found … Read more