Programmatically inserting page breaks

Overriding the default page breaking – with external content parts The page breaking takes place in the WP_Query::setup_postdata() method, when we call the_post() in the loop. The page parts are stored in the global $pages array and fetched with get_the_content() function. This happens all before the the_content filter is applied to the content. We can … Read more

Pagination for Pages and Posts

Post Navigation Here’s the way its done in the Twenty Twelve themes single.php file however it looks like Twenty Fourteen has a better solution which works for pages as well. <nav class=”nav-single”> <h3 class=”assistive-text”><?php _e( ‘Post navigation’, ‘twentytwelve’ ); ?></h3> <span class=”nav-previous”><?php previous_post_link( ‘%link’, ‘<span class=”meta-nav”>’ . _x( ‘&larr;’, ‘Previous post link’, ‘twentytwelve’ ) . … Read more

how to hide specific post from google search

Hook into the action wp_head, test if you are on the category archive or a single post with that category, and print the proper meta element: add_action( ‘wp_head’, ‘wpse_91073_noindex’ ); function wpse_91073_noindex() { if ( ( is_singular() && in_category( ‘CATEGORY_SLUG’ ) ) or is_category( ‘CATEGORY_SLUG’ ) ) { print ‘<meta name=”robots” content=”noindex”>’; } } Replace … Read more

post_exists() in an external script?

post_exists() doesn’t exist because you forgot to include the file where the function is declared. Looking to https://developer.wordpress.org/reference/functions/post_exists/#source you can see that it’s declared in wp-admin/includes/post.php Add this to your existing code juste after the require of taxonomy. require_once ABSPATH . ‘/wp-admin/includes/post.php’; The best way to achieve what you want is to use wp-api in … Read more

Change default screen option value for posts per page

Just an addiction to @KrzysiekDróżdż answer. When viewing a specific post status the url query string variable ‘post_status’, is set to the name of the status, so you can use $_GET[‘post_status’] to narrow the effect of @KrzysiekDróżdż code only for pending posts: function my_edit_per_page( $result, $option, $user ) { $status = filter_input( INPUT_GET, ‘post_status’, FILTER_SANITIZE_STRING … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)