how to bulk add one line in the first paragraph of all posts

I’d go for solution posted by @butlerblog – it’s a lot easier to manage and change in the future and it’s better WP practice. But… If you’re asking… Here are the ways you can do this: 1. WP way: function prepend_content_to_posts() { $to_prepend = ‘This will be prepended’; $posts = get_posts( array( ‘posts_per_page’ => -1 … Read more

Custom bulk_action

I think the latest major release warrants a new answer to this question, considering the popularity of this question. Since WordPress 4.7 (released December 2016) it is possible to add custom bulk actions without using JavaScript. The filter bulk_actions-{$screen} (e.g. bulk_actions-edit-page for the pages overview) now allows you to add custom bulk actions. Furthermore, a … Read more

How to assign posts without any category to the default category

You can use wp_insert_post like this: $my_post = array( ‘post_title’ => ‘My post’, ‘post_content’ => ‘This is my post.’, ‘post_status’ => ‘publish’, ‘post_author’ => 1, ‘post_category’ => array(8,39) ); // Insert the post into the database wp_insert_post( $my_post ); Ref: https://codex.wordpress.org/Function_Reference/wp_insert_post use wp_update_post to update posts.

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