bobbingwide / oik-loader

WordPress Must Use plugin to load required plugins
0 stars 0 forks source link

404's for unregistered taxonomies stopping blocks from working #8

Closed bobbingwide closed 4 years ago

bobbingwide commented 4 years ago

Related to #7, when Easy Digital Downloads is not activated then the taxonomies associated with the Products ( download post type) are not registered ( download_category and download tag). It appears that the Downloads block depends on a response from a REST request in order to correctly display the block in the editor.

Would it be possible to include the request URL in the oik-loader.site.csv file for the site? How easy would it be to build these URLs automatically from the WordPress registry?

https://blocks.wp.a2z/wp-json/wp/v2/download_category?
per_page=100&orderby=name&order=asc&_locale=user

Workaround

Try quick hack to see if the existing logic will actually work. ie. append the following to the file

/wp-json/wp/v2/download_category,0,easy-digital-downloads/easy-digital-downloads.php 
bobbingwide commented 4 years ago

The quick hack took a little longer than expected. I needed to add two rows to the oik-loader.10.csv file

/wp-json/wp/v2/download_category,0,edd-blocks/edd-blocks.php,easy-digital-downloads/easy-digital-downloads.php
/wp-json/wp/v2/download_tag,0,edd-blocks/edd-blocks.php,easy-digital-downloads/easy-digital-downloads.php

This was to satisfy the requests for when the block wanted to display Download Categories or Download Tags

AND also needed to extend the solution for #7 to also include edd-blocks/edd-blocks.php as as dependent plugin. This alowed the meta data to be returned in the REST request. When edd-blocks was not explicitely loaded the block only showed the Title and Full Content. When loaded it would also display: Buy Button, Price and Thumbnails.