Sorry you’re having trouble with this. I think you understood the instructions in the readme correctly.
So, you’re saying the code related_posts (array ('exclude' => array (1,2,3,4,5))); isn’t working? You have to make sure the numbers in exclude there are term_taxonomy_ids, not term_ids. Is that what you’ve done?
Hi mitcho,
I’m using the PHP method in this way:
related_posts (array ('exclude' => array (285,514)));
(same as above)
I have found the category IDs by hovering over the categories in WP-Admin Categories admin page and viewing the link that displays in the bottom left of my browser. Do you know if those are the term_taxonomy_ids?
It still does not seem to exclude those categories. I’ve also tried the Pool options in WP-admin and that doesn’t seem to work when I use the PHP method.
Do you have any idea what I might be doing wrong?
Thanks in advance and really great plugin by the way.
Chris
I think the category IDs that are displayed in the link are *not* the term_taxonomy_ids required. If you have access to your MySQL database, that would be the most direct way of identifying the term_taxonomy_ids of relevant categories.
Ah OK great thanks mitcho. I’ll have a look at the MySQL as I can access that. I will post an update once I have got it working correctly.
Just confirming that indeed, the category ID is not what’s needed to exclude categories. I had to dig into the database to find out what term_taxonomy_id is associated with the categories I wanted to exclude.
For others that might be trying to figure this out, here’s how you find the term_taxonomy_id for a category…
- Find the ID of the category you want to exclude by going to Posts -> Categories in WP-Admin, and hovering over the category’s name in the list. Look down at the status bar in your browser and note the tag_ID.
- You’ll need to access your database somehow. Most servers have phpMyAdmin installed, and this is what I used. Browse the wp_term_taxonomy table and sort if by term_id.
- Find the ID of the category you’re after. Look at the value in the term_taxonomy_id column – this is the value you need for the exclude parameter.
Hope that helps clear things up.