You can run WordPress query to associate category to all posts.
Here is the code. What this code will do is check if a post is already in category id 67, if it’s not then it will assign category id to it.
<?php
$args = array( 'posts_per_page' => -1, 'orderby' => 'post_date' );
$posts = get_posts( $args );
foreach ( $posts as $post ) :
setup_postdata( $post );
$category_id = 67;
if ( !(in_category( $category_id )) ) {
wp_set_object_terms( get_the_ID(), array( $category_id ), 'category', false );
}
endforeach;
?>
Paste this code in header or footer and load your website in browser. Check category id’s in admin section if all has been changed. If not then load website in browser again.
Don’t forget to remove this code once done.
Related Posts:
- Different post sort order within different categories
- How to add metabox for post of specific category
- Manipulate post category after time
- How to get Category Id from Post Id ?
- Categories box not showing on post edit pages
- List only child categories a post is in, of a specific parent category
- Add custom field to all posts in specific category
- Exclude category on blog list page
- is there a better way of combining this?
- How to choose a sort order (for posts) per category? (ideally when creating a new category)
- wp_list_categories link to first post of category instead of calling taxonomy template
- WordPress Child Category Display All Posts
- How to Add ‘Post Categories’ to the Dashboard Sidebar
- How only display all post related to category
- Display posts in alphabetical order for a particular category
- How to make search for the custom post type?
- How to display related posts by subcategory and not parent category
- Category Template: Need to display different content on first page of archives
- How to automatically apply a category based on the post title?
- Direct link to “New post” in specific category?
- Extracting post categories
- Using permalinks, category slugs, and tag slugs
- How to limit posts by category
- How do I retrieve then print the currently viewed sub categories?
- Get attachments for posts that belongs to a specific category
- How can I setup a relationship using categories in WordPress?
- Related posts by category not working right
- How to list recent posts in a wp nav menu?
- Dynamic dependent Dropdown lists for categories, sub-categories and posts
- Listing Specific Categories from Current Post with Depth
- How to Mysql select a list of posts with meta_values AND all relevant categories?
- get_the_category listing in hierarchial order
- why does wordpress ignore the post args?
- Sort by last word in title
- How to call posts under a specific category on static front page?
- Give posts a particular template based on the assigned category
- Show posts on front page only
- Post-Archive like a page in a specific subdirectory
- Post is in descendant category not working in home.php
- How to get posts ordered by using their categories?
- Hide parts of the post content after typing it’s name or searching it by category
- SQL Bulk Move old posts by one author to another category
- How to display only one category in a custom post type?
- load more posts by category
- Get only X number of categories
- Display Related Posts by Category in Random
- inserting a category into post
- Getting posts from some categories plus some individual posts
- Change layout of post depending on category
- How to show beneath posts the full category path?
- latest post showing up twice on posts page
- wp_list_categories() Exclude All Categories Except One
- Possible?! A contextually titled back link
- Display Current Posts Category (with the most posts)?
- Allow / show post comments in category pages
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Display default matabox of posts(add category) wordpress
- ACF date picker to trigger category change
- Get category slug of the Parent category of a Product
- How to get tags when using publish_post
- exclude particular category in api
- How do you change the permalink for posts for a single category?
- Make categories appear random
- how to create a category with wp_insert_post and post_category
- Exclude posts in a category on one page but show those posts on a different page
- Excluding category from post navigation in WordPress?
- How to make a page show posts only from specific categories without editing php files
- Get posts from category from custom query
- How to show posts ordered by random [duplicate]
- How to Get Position of a Post from a category and tag
- Display new posts categories in separated divs
- Querying posts from current category, using a variable as array argument
- Add Categories To Custom Post
- Query posts from newest category
- Precedence of page permalinks over woocommerce product category links?
- Display Posts by Categories
- Ajax – Post Categories and Load More
- Need help writing loop to display posts by categories in separate divs
- Edit Posts Page but not category specific pages?
- Add category selection to function request
- Query post category & remove any post id
- Multiple Post Repeat for Related Post Loop by Category
- Show Post number of specific Category
- How to organise post by category and date
- Show post if in category
- How to display custom content in post with category XXX
- Displaying categories items among posts
- how to show posts on different pages if number of post per page is one
- Displaying different posts Via wp_list_categories()
- Is it possible to have different header style blog titles in different categories?
- Category pages vs single post pages
- Display ONLY Latest Post From Several Categories
- How do we display a certain category type on a page while hiding all others?
- Show all posts in category
- Polylang – display one post into 3 categories with different lang [closed]
- Export Posts Without Categories In An XML File
- Sort Posts Alphabetically Based on Specific Category (Divi)
- I have a blog and want to prompt the user to select a category they like and have that select a random blog post
- I have a website issue I am trying to resolve
- How to sort posts alphabetically based on a specific parent category