disable column on post and user list

You can use the manage_{$screen->id}_columns hooks for this. To manage user columns we can use manage_users_columns which is passed an array of columns and whatever we don’t want we can unset(). /** * Manage User Admin Display Table Columns * * @param Array $columns * [cb] => <input type=”checkbox” /> * [username] => Username * … Read more

Different template for posts of all subcategories of category

You can check if current category is a child of blog category with cat_is_ancestor_of() function or term_is_ancestor_of(), or maybe better, use in_category(), as you are currently doing, but checking child categories as well. add_filter( ‘single_template’, ‘get_custom_cat_template’ ) ; function get_custom_cat_template( $single_template ) { // You want to filter only template for single posts of default … Read more

Custom excerpt length filter doesn’t work

For anyone wondering, as custom excerpts don’t get trimmed by the excerpt_length filter hook, try adding this filter: function trim_custom_excerpt($excerpt) { if (has_excerpt()) { $excerpt = wp_trim_words(get_the_excerpt(), apply_filters(“excerpt_length”, 55)); } return $excerpt; } add_filter(“the_excerpt”, “trim_custom_excerpt”, 999);

Create an article from another Java application

Yes, there is a REST API at /wp-json with core content endpoints for posts pages etc For example, my current latest blog post: https://tomjn.com/2018/07/23/deployment-and-wordpress/ Is available via a GET request as a JSON object at: https://tomjn.com/wp-json/wp/v2/posts/862 And I can send a similar object via an authenticated POST request to create a new post to https://tomjn.com/wp-json/wp/v2/posts/, … Read more

How do I add a custom body class to the admin area of a page?

Use admin_body_class both with global post_id and get_current_screen function: add_filter(‘admin_body_class’, ‘wpse_320244_admin_body_class’); function wpse_320244_admin_body_class($classes) { global $post; // get_current_screen() returns object with current admin screen // @link https://codex.wordpress.org/Function_Reference/get_current_screen $current_screen = get_current_screen(); if($current_screen->base === “post” && absint($post->ID) === 8) { $classes .= ‘ home-admin-area’; } return $classes; } You can also use $pagenow variable. It seems that … Read more

Unwanted Duplicate Posts Showing in Pagination Pages

Try with a custom WP_Query to rule out any possible code messing up with your main query pagination. Like this: <?php $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; $query = new WP_Query( array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 5, ‘paged’=> $paged) ); ?> <?php while($query->have_posts()) : … Read more

How many post WordPress can handle?

There isn’t a hard upper limit of how many posts WordPress can handle. The practical limit for your site depends on these things in this order: The queries your codebase runs Server power Disk space But before we go into this, WP will not generate 404’s because there are too many posts. If this is … Read more