Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Can't add custom taxonomy to custom post type post

UserPost

4:12 pm
March 8, 2011


jonathan

Member

posts 4

1

I am using WP 3.1 (although the problem existed in 3.0.x, too). I have a custom post type defined using the Custom Post Type UI 0.7 plugin. I have a custom taxonomy (non-hierarchical) created using the same plugin that is associated with the custom post type. When RS 1.3.27 is enabled, if I go to a post of the custom post type and try to add an existing entry of the custom taxonomy, it is added to the list for that taxonomy. However, when I click update post, the taxonomy entry disappears. If I disable RS 1.3.27, the process of adding the entry for the taxonomy works fine.

Just to be clear, I am trying to add an existing entry from the taxonomy to the post. I'm not trying to add a new entry to the taxonomy. Also, it doesn't matter whether or not I tell RS to manage the permissions of the custom taxonomy. It behaves the same either way.

Any idea what might be causing this problem? It's the only thing standing in the way of me using RS, and it really has some great features!

Thanks,

Jonathan


3:00 pm
March 10, 2011


Kevin

Admin

posts 2503

2

I'm not seeing this with 1.3.27 or 1.3.28-dev.

What is the role of the user who can't add the existing custom taxonomy terms? Have you defined any RS restrictions / roles?

Can you confirm that after saving the post the selected terms do not show under "Quick Edit" in the Posts listing either?

Any other active plugins that deal with tags?

1:39 am
March 11, 2011


jonathan

Member

posts 4

3

I've disabled all plugins except Custom Post Type UI 0.7 and RS 1.3.27. I've reverted all RS settings to default. I have not enabled any special role settings, and the user I'm using is a WordPress administrator. When I try to add a taxonomy entry, I don't see anything added to the WordPress table wp_term_relationships, but if I disable RS, then the entry gets added to this table. I have used other plugins that have created stuff in my database such as Contact Form 7 and Relevanssi Search. The problem definitely occurs when the Update post button is clicked because if I go to a post that previously had a custom taxonomy entry, the taxonomy entry goes away when I click Update.

The custom taxonomy doesn't show up under the Quick Edit listing when RS is enabled.

My webhost is unfortunately only running MySQL 4.1.20. I don't know if that would matter. If I have time I'll try installing on a fresh install of WordPress to see if I can duplicate the problem with a minimum of steps.

Thanks for your help.

9:57 am
March 11, 2011


Kevin

Admin

posts 2503

4

Okay, I was never able to confirm this in 1.3.27, but did find that a recent change in 1.3.28-dev had this side effect. I've fixed it in the updated Role Scoper development version (1.3.28-dev).

2:54 pm
March 11, 2011


jonathan

Member

posts 4

5

Thanks for looking into the problem. I tried 1.3.28-dev and that didn't fix the problem.

However, I have figured out how to fix the problem! Within Custom Post Type UI, I had created a custom post type and a custom taxonomy. Within the custom post type, I had checked the box for my taxonomy under Built-in Taxonomies. Within my custom taxonomy, I had checked the box Attached to Post Type for my custom post type.

To fix the problem, I unchecked the Built-in Taxonomies check box and left the Attached to Post Type check box. That made everything work while keeping RS enabled! I haven't looked into whether I'm using Custom Post Type UI correctly, but everything seems to function as intended.

Thanks again for your time. Now I can use your great plugin!

3:04 pm
March 11, 2011


jonathan

Member

posts 4

6

As I've been re-enabling my plugins, I've noticed the problem reappears when RS is enabled in conjunction with a different plugin, Custom Post Permalinks 1.1.4. I am looking into why this might be, now.

4:03 pm
March 11, 2011


Kevin

Admin

posts 2503

7

jonathan said:

Within Custom Post Type UI, I had created a custom post type and a custom taxonomy. Within the custom post type, I had checked the box for my taxonomy under Built-in Taxonomies. Within my custom taxonomy, I had checked the box Attached to Post Type for my custom post type.


Thanks for alerting me to that configuration detail. That allowed me to recreate your symptom and identify a bug in the RS code which was responsible. The updated Role Scoper development version (1.3.28-dev) has this fixed so term selection for non-hierarchical taxonomies is never filtered at all.

As I've been re-enabling my plugins, I've noticed the problem reappears when RS is enabled in conjunction with a different plugin, Custom Post Permalinks 1.1.4.

Probably that other plugin is registering the taxonomies for each post type they are associated with (the equivalent of automatically selecting your "built in taxonomy" checkboxes).

9:32 am
March 31, 2011


aglekis

Member

aglekis

posts 12

8

Hello

The same for me. And I don't have any restriction on both: custom post type and custom taxonomy.See image below

9:39 am
March 31, 2011


Kevin

Admin

posts 2503

9

aglekis, this is a different issue.

Are you also using the Custom Post Type UI plugin? What WP and RS versions?

How do you have your "assign terms" capability defined?

What is the WordPress role of the user? You might need to go to Roles > General and give them an Assigner role for your custom taxonomy.

9:47 am
March 31, 2011


aglekis

Member

aglekis

posts 12

10

Hi Kevin

Thanks for your quick answer.

I've made the custom post type and custom taxonomy by my own.

My RS version is: 1.3.29-beta
My WP version is: 3.1

My capabilies terms are defined:

for custom post-types:

'capability_type' => 'conseils_membre',
        'capabilities' => array(
            'publish_posts' => 'publish_conseils_membres',
            'edit_posts' => 'edit_conseils_membres',
            'edit_others_posts' => 'edit_others_conseils_membres',
            'delete_posts' => 'delete_conseils_membres',
            'delete_others_posts' => 'delete_others_conseils_membres',
            'read_private_posts' => 'read_private_conseils_membres',
            'edit_post' => 'edit_conseils_membre',
            'delete_post' => 'delete_conseils_membre',
            'read_post' => 'read_conseils_membre',
        ),

for custom taxonomy:

  'capabilities' => array(
            'manage_terms' => 'manage_categories_membres',
            'edit_terms' => 'edit_categories_membres',
            'delete_terms' => 'delete_categories_membres',
            'assign_terms' => 'assign_categories_membres'
        ),

I try with Admin Role. So normaly it works. No?

9:56 am
March 31, 2011


Kevin

Admin

posts 2503

11

If you define custom capabilities like that, you are also responsible for adding them to your user's WordPress role. If you leave capabilities unspecified in the register calls, Role Scoper will customize them based on post type and taxonomy name.

10:12 am
March 31, 2011


aglekis

Member

aglekis

posts 12

12

First, with RS I try without this capabilies in RS, but when I assigned some restriction or roles on WP Contributor for instance, it didn't appear in the table. So I thought I was because no capabilities were defined.

Anaway, as you say, it's better to do not add capabilies in custom post type and custom taxonomy and make the set up with RS ?

note: I use this capabilies before with the "Members" plugin and it works great. But I prefer RS Embarassed

10:46 am
March 31, 2011


Kevin

Admin

posts 2503

13

Make sure your registration functions execute early on the init action:

add_action( 'init', 'my_type_registrations', 1 );

8:10 pm
March 31, 2011


aglekis

Member

aglekis

posts 12

14

Hi Kevin

I answer only now. That's because I'm in different time zone than you (i suppose).

I applie the set up you gave me.

add_action( 'init', 'my_type_registrations', 1 );

I'll try removing capability to see if it works.

Thanks a lot.

Grégoire

8:56 pm
March 31, 2011


aglekis

Member

aglekis

posts 12

15

Hi Kevin,

It works. Great.

I have an other problem with the custom taxonomy. I've restrited all of them and when I want to allow WP contributor to read them, it doesn't work.

And when I did the same process than for page and article. For them, it works perfect.

10:16 pm
March 31, 2011


Kevin

Admin

posts 2503

16

So you restricted the Conseils Membre Reader role for all terms, then assigned the Conceils Membre Reader role to [WP Contributor] for all terms… and those users still can't read the custom posts?

Make sure you have not also set a restriction on the post itself. In that case, they will remain unreadable unless the role is also assigned for the individual post.

7:48 am
April 1, 2011


aglekis

Member

aglekis

posts 12

17

that's exactly what I did.

For the page, if I make this kind of configuration I can see the restrictions selected on the page itself. But for the custom post type (with custom taxonomy) nothing. Strange

9:23 am
April 1, 2011


aglekis

Member

aglekis

posts 12

18

If I check manually in each custom post type of  the Conseils Membre Reader role for [WP Contributor] . It works

So, it doesn't work when I use the "Roles" interface of RS

9:31 am
April 1, 2011


Kevin

Admin

posts 2503

19

aglekis said:

If I check manually in each custom post type of  the Conseils Membre Reader role for [WP Contributor] . It works

So, it doesn't work when I use the "Roles" interface of RS


How did you set your restrictions? Roles > Taxonomy assignments are not intended to override restrictions set directly on a post via the WP edit form.

10:01 am
April 1, 2011


aglekis

Member

aglekis

posts 12

20

I know but that the only way I've found for make it working

Here are my set up for all custom taxonomy:

Here are my set up for the custom post type

Here is the result on one custom post type


I hope it help


About the Agapetry forum

Currently Online:

9 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1245

Posts: 5653

Members:

There are 1255 members

There are 1 guests


Kevin has made 2503 posts

Top Posters:

metal450 - 178

Ragnar - 108

YikYak - 70

whiteorb - 49

Daisy - 35

Administrator: Kevin | Moderators: Kevin