Hey @paolocappuccini,
Hope you’re well.
I want to replicate the issue, so can you tell me how did you create custom post types? With plugin, theme or custom coding. And also if can you give me exact instructions (or codes if you create with custom coding) it would be great.
Cheers,
Oguz
Hi Oguz, thanks for reply
I’m using the plugin Custom Sidebars and i wanted to apply replacing rule to my custom post type “knowledgebase” but the rule is not applied without the code modification that i showen in my previous message.
Debugging your code i noticed that the line of code “$post_type = get_post_type();” return wrong post_type (it defaults to “page”).
I don’t know if it is wordpress bug or wrong use of wordpress api but i am sure that my post is of type “knowledgebase”.
Checking wordpress documentation i can see that “get_post_type” is intended to be called by passing as first argument the post itself, unless you want to fallback in some default cases.
Hey @paolocappuccini,
Hope you’re well.
I understand the situation but I don’t understand how did you create that “knowledgebase” custom post type. When I create custom post type and assign the sidebar to it, it works well for every time. So I can’t replicate it.
That’s why I am asking that can you explain me how did you create custom post type? Or are you using any plugin for that?
Cheers,
Oguz
I use pressapps knowledge plugin. it uses custom post type and i wanted to use custom sidebar aside its articles.
what i wanted to say that u probably need a fix (the one i did works fine) to work with custom types created by other plugins
Hey @paolocappuccini,
Hope you’re well.
Okay, looks like the plugin you use is paid plugin, so I can’t test. But I asked the problem to our developers, once I have more information I will update this thread. By the way, if you can replicate from any other plugin that I can test, I would happy to hear that.
Cheers,
Oguz