bobbingwide / oik-types

oik custom content type manager
http://www.oik-plugins.com/oik-plugins/oik-types/
GNU General Public License v2.0
1 stars 0 forks source link

Automatically support CPTs which are attached to the category taxonomy #30

Closed bobbingwide closed 2 months ago

bobbingwide commented 11 months ago

For the bigram plugin I associated the bigram CPT with the category taxonomy to enable both bigrams and posts to be displayed in the main query for the category archive.

For the wp-secrets.co.uk website I want to attach the category taxonomy to the oik-plugins CPT for a same reason: to be able to list both plugins and posts associated with a particular category term.

It should be possible to extend oik-types to cater for this automatically for any post type which is associated with the category taxonomy. Similarly, it should also be possible to support the post_tag taxonomy ( Tags ).

bobbingwide commented 10 months ago

There's a problem in wp-admin on the posts page. When you apply the Category filter, such as Gutenberg, the following message is displayed.

Warning: Array to string conversion in /home/customer/www/wp-secrets.co.uk/public_html/wp-admin/edit.php on line 344

When you then attempt to perform a Bulk actions action of Move to Bin the following message is displayed Invalid post type.

The URL indicates that the post_type value is incorrect.

https://wp-secrets.co.uk/wp-admin/edit.php?s=&post_status=all&post_type=Array&_wpnonce=9f86cc189e&_wp_http_referer=%2Fwp-admin%2Fedit.php%3Fs%26post_status%3Dall%26post_type%3Dpost%26action%3D-1%26m%3D0%26cat%3D5%26filter_action%3DFilter%26paged%3D1%26action2%3D-1&action=trash&m=0&cat=5&paged=1&post%5B%5D=2176&action2=trash

It would appear that oik-types is modifying the query on wp-admin, and this is affecting the logic on the posts page.

The problem is worse when you choose to Bin a single post.

Fatal error: Uncaught TypeError: Illegal offset type in /home/customer/www/wp-secrets.co.uk/public_html/wp-admin/edit.php:442 
Stack trace: #0 {main} thrown in /home/customer/www/wp-secrets.co.uk/public_html/wp-admin/edit.php on line 442

Note: Check if this problem also occurs when a custom taxonomy is applied to multiple post types.

bobbingwide commented 9 months ago

There's another problem when you view Posts > Categories

image

First of all there are some posts appearing before the table of categories.

Then the Desciption for some categories goes well dolally. image

This could be because the Description for the category bw_pages example contains

Posts which are used as examples for the [bw_pages] shortcode

and the shortcode is being expanded.

bobbingwide commented 9 months ago

This could be because the Description for the category contains the [bw_pages] shortcode which is being expanded.

Yes, it is. How do we stop that from happening?

Workaround: Remove the shortcode from the category's description. Alternative workaround: Change the shortcode to [bw_code bw_pages]. The shortcode still gets expanded but it just produces a link to the documentation.

bobbingwide commented 2 months ago

Delivered in v2.4.2