99w
Forum Replies Created
-
Hey @jonathandejong,
I’ve looked into this a bit more, so it appears the issue arises because (for rewrite based CPTs) this line:
$new_url = trailingslashit( get_post_type_archive_link( $current_post_type ) );
Will return domain.com/horses
Then later on it gets duplicated in this line:
$new_url .= trailingslashit( $value->rewrite['slug'] . '/' . $term_object->slug );
This line appears to be okay, it’s just that it already includes horses but the value of $new_url already has it and we are concatenating.
I changed this to:
$new_url = get_site_url(); $new_url .= trailingslashit( '/' . $value->rewrite['slug'] . '/' . $term_object->slug );
Which rebuilds the entire $new_url variable from scratch. It appears to work fine. However resetting the $new_url variable here isn’t the most elegant solution, you may want to consider some way of getting that $new_url to be set properly for rewrite based CPTs before it hits this condition.
It’s worth noting I didn’t check any other functionality other than rewritten CPTs after doing this unsure if it may have effected anything else.
Hopefully that helps in finding a solution for this issue when you come to update the plugin. If you need any further info just let me know and if you could keep me posted on this thread when you’ve checked it out as i’d like to push any updates on this when available. For now i am going to leave this plugin edit on my site, hopefully I can then just upgrade the plugin with the fixes later if in the next release.
Sorry I didn’t have time right now to setup the repo on GitHub, raise a PR, etc – although as above I don’t think this code is quite the perfect solution to the issue just yet.
Thanks
Hey @jonathandejong,
So looking into this, for any website which has a custom post type defined and if it uses the rewrite slug option when registering the post type then your code above would set the $new_url variable as https://domain.com/horses on the first line.
Then your code later on would concatenate the rewrite slug again causing the duplication in this line:
$new_url .= trailingslashit( $value->rewrite['slug'] . '/' . $term_object->slug );
Is this something you can look into fixing? If I get time I can look into a fix for you but I am not familiar with all the other code/functionality in this plugin which an edit here could effect?
Thanks,
Thanks for the info.
I am wondering if this is because I am running the website currently on https://localhost/folder-name maybe?
Hey there, thanks – the above is not going to feasible for us in our scenario and how it’s coded currently, for now I’m going to add in a check for Query Monitor being active and if it is display a notice to disable it while exporting. But yeah something in future to disable the output conditionally would be great.
Thanks, we are looking forward to the release of this fix into the next version.
Thank you, keep up the good work – great plugin.