passle / passle-sync-wordpress

This plugin will sync your Passle posts and authors into your WordPress instance.
https://mercierandvelezviewpoints.com/
MIT License
0 stars 1 forks source link

Fatal error when using Relevanssi plugin to search Passle posts #77

Open brisull-siax opened 3 weeks ago

brisull-siax commented 3 weeks ago

After activating Relevanssi premium and building the index with Passle posts included, I get the error below when performing a search using WP_Query.

I think it may have to do with the filter property of the Passle object the class is trying to treat as a WP_POST, as described here: https://barn2.com/blog/learn-how-to-create-a-fake-wordpress-post-on-the-fly/

Fatal error: Uncaught Error: Cannot assign stdClass to property Passle\PassleSync\Models\PasslePost::$wp_post of type WP_Post in .../wp-content/plugins/passle-sync/class/Models/PasslePost.php on line 124

Call stack:

Passle\P\M\PasslePost::__construct() wp-content/plugins/passle-sync/class/Services/ThemeService.php:72 Passle\P\S\ThemeService::modified_the_content() wp-includes/class-wp-hook.php:324 WP_Hook::apply_filters() wp-includes/plugin.php:205 apply_filters() wp-content/plugins/relevanssi-premium/lib/excerpts-highlights.php:140 relevanssi_do_excerpt() wp-content/plugins/relevanssi-premium/lib/excerpts-highlights.php:1648 relevanssi_add_excerpt() wp-content/plugins/relevanssi-premium/lib/search.php:699 relevanssi_do_query() wp-content/plugins/relevanssi-premium/lib/search.php:88 relevanssi_query() wp-includes/class-wp-hook.php:324 WP_Hook::apply_filters() wp-includes/plugin.php:256 apply_filters_ref_array() wp-includes/class-wp-query.php:3161 WP_Query::get_posts() wp-includes/class-wp-query.php:3852 WP_Query::query() wp-includes/class-wp.php:696 WP::query_posts() wp-includes/class-wp.php:816 WP::main() wp-includes/functions.php:1336 wp() wp-blog-header.php:16 require() index.php:17

brisull-siax commented 3 weeks ago

I was able to get around this by adding the following at line 118 of class/Models/PasslePost.php. Let me know if you'd like me to create a pull request or if there is another way of avoiding this error.

image