Forum Replies Created
-
AuthorPosts
-
September 14, 2023 at 6:07 PM in reply to: Issue with Relationship not displaying connected posts #43249
Tom
ParticipantFYI Metabox did get into contact with the Object Cache Pro Plugin Developer and they have a fix they are testing. They plan is to include it in the next version of MetaBox Full details here:
It works and allows you to reenable Object Cache Pro.
In summary you need to modify a bit of code in one of metaboxes files. The file is found here:
/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-relationships/inc/query
And the code change is here: (just 4 lines)
https://github.com/wpmetabox/mb-relationships/commit/06aa11e0d99be5663622c06eb39b0de9b0817bd9
September 12, 2023 at 7:36 PM in reply to: Issue with Relationship not displaying connected posts #43218Tom
ParticipantI have also reported this issue now to Cloudways since they control the integration of the Object Cache Pro plugin... (and we cannot roll back to an older version of Object Cache Pro)
@ScottN Maybe you could as well. The more people that report it the more it will most likely get fixed (since at this time it does look like the Object Cache Pro plugin is the issue and not necessarily Metabox).
Tom
ParticipantThe article makes sense and I did try that solution out, but in the end it did not work for me. Since you cannot specify the order CPT and taxonomies are registered via the Metabox UI you have to use a PHP snippet (which Metabox will generate for you) and register it that way. I tried it and still had the same issues.
So to get it to work just leave your CPT and taxonomy setup in Metabox as is and then add the code snippet above to your website. Once you modify the variables to suit your needs:
` $cpt = 'ess_article';
$cpt_rewrite = 'articles';
$ctax = 'ess_article_category';
$ctax_rewrite = 'categories';the rewrites should work fine.
Tom
ParticipantOkay I figured it out. Here is my solution:
// Example URLs (In WordPress settings, set Permalink Structure to 'plain') // https://example.com/?ess_article_category=news // https://example.com/?paged=2&ess_article_category=news function ess_article_category_taxonomy_rewrites(){ // Setup in Metabox AIO $cpt = 'ess_article'; $cpt_rewrite = 'articles'; $ctax = 'ess_article_category'; $ctax_rewrite = 'categories'; // For Taxonomy Archive with multiple pages // This must go before rule for main taxonomy archive page below else it will never get triggered add_rewrite_rule( $cpt_rewrite . '\/' . $ctax_rewrite . '\/([^\/]+)\/page\/([0-9]+)', 'index.php?' . $ctax . '=$matches[1]&paged=$matches[2]', 'top' ); // Match = CPT / Custom Taxonomy / Taxonomy slug variable // Must escape delimiter / with \ so = \/ // ([^\/]+) finds and returns text in matches array // ([0-9]+) finds and returns number in matches array add_rewrite_rule( $cpt_rewrite . '\/' . $ctax_rewrite . '\/([^\/]+)', 'index.php?' . $ctax . '=$matches[1]', 'top' ); } add_action( 'init', 'ess_article_category_taxonomy_rewrites' );Tom
ParticipantI just tried registering the taxonomy and CPT by code (with the taxonomy first and setting the ones I have in the MetaBox UI to draft status) using code and it didn't seem to make a difference
Tom
ParticipantThis article seems to indicate the fix is to make sure the custom taxonomy is registered before the CPT.
https://cnpagency.com/blog/the-right-way-to-do-wordpress-custom-taxonomy-rewrites/
Is this possible with the MetaBox user interface?
-
AuthorPosts