Internal post link creates comments on its own

This kind of automatic comments are called “trackbacks” and “pingbacks”. They are a blogging feature that consists of automatically notifying blogs that are linked to from an article when said article is published. This notification appears as a kind of comment on the mentionned article, with a link pointing back to the newly published one. … Read more

how to get post order by post id wp_query?

OK, so you want to define posts order by yourself. WP_Query allows you to do that – you’ll have to use orderby => post__in to achieve it. And that’s what you do. So why isn’t it working? Because of a typo 😉 Ordering posts by post__in preserves post ID order given in the ‘post__in’ array. … Read more

How can I add content to a post that only shows in single-post mode?

Looking at your specific example … You probably want to use a shortcode. Something like: add_shortcode(‘hide_from_summary’,’wpse_hide_stuff_here’); function wpse_hide_stuff_here($atts,$content){ global $post; // gives access to the post, so you can determine mode // don’t know if you’ll want/need $atts, so … generic stuff here $atts = shortcode_atts( array( ‘foo’ => ‘no foo’ ), $atts, ‘bartag’ ); … Read more

Delete pubished and unpublished posts with wp_delete_post?

get_posts() can receive an argument describing which post status to operate. I would say something like this: function remove_all_kba_data(){ //remove articles $articles = get_posts( [ ‘post_type’ => ‘kb_kba’, ‘posts_per_page’ => -1, ‘post_status’ => [ ‘published’, ‘draft’ ] ] ); foreach( $articles as $article ) { //delete post, bypass trash wp_delete_post( $article->ID, true); } }

Using wp_list_pages() after calling query_posts()

This is for future askers, Whenever you use query_posts or custom wp_query you should add wp_reset_query(); after your loop or when you are done processing your posts. This little line of code will help in solving pagination issues or in your case rest the global $post the original as before your query.

Automatically create a new page daily with last three posts

You can create date.php (you can copy the content for this from archive.php or index.php) in your theme folder which will handle all the “day” pages… <?php get_header(); ?> <div id=”container”> <div id=”content” role=”main”> <?php $day = get_query_var(‘day’); $monthnum = get_query_var(‘monthnum’); $year = get_query_var(‘year’); if ( is_day() ) : ?> <a href=”https://wordpress.stackexchange.com/questions/15424/<?php echo get_day_link($year, $monthnum, … Read more