Adding Piklist Support to plugin causes fatal error
-
Hi,
Thank you for making this awesome plugin. However, I am very sad that I am facing problem with it. I have a function to query database to find all elementor templates and I used it in redux config file for displaying a settings with elementor template lists. It is a normal query. Everything works fine if I do not activate piklist. When I activate piklist and add support in my plugin for piklist then I get the following error:[07-Mar-2019 07:52:40 UTC] PHP Fatal error: Uncaught Error: Call to a member function get() on null in /Applications/MAMP/htdocs/themexdev/wp-includes/query.php:28 Stack trace: #0 /Applications/MAMP/htdocs/themexdev/wp-content/plugins/piklist/includes/class-piklist-wordpress.php(610): get_query_var('taxonomy_relati...') #1 /Applications/MAMP/htdocs/themexdev/wp-includes/class-wp-hook.php(288): Piklist_WordPress::relation_taxonomy(' AND ( \n ( wp_...') #2 /Applications/MAMP/htdocs/themexdev/wp-includes/plugin.php(251): WP_Hook->apply_filters(' AND ( \n ( wp_...', Array) #3 /Applications/MAMP/htdocs/themexdev/wp-includes/class-wp-query.php(2519): apply_filters_ref_array('posts_where', Array) #4 /Applications/MAMP/htdocs/themexdev/wp-includes/class-wp-query.php(3387): WP_Query->get_posts() #5 /Applications/MAMP/htdocs/themexdev/wp-includes/class-wp-query.php(3496): WP_Query->query(Array) #6 /Applications/MAMP/htdocs/themexdev/wp-content/plugins/xlaw-core/includes/xlaw-core-helper.php(15): WP_Query->__construct(Array) #7 /Applications/MAMP/htdocs/themexd in /Applications/MAMP/htdocs/themexdev/wp-includes/query.php on line 28
then I did some debugging, and I found some idea of the reason why it happens. If I call the function in the init hook then no error is generated. So, it means, your plugin-piklist, might have load my plugin and its file too early before WP_Query and other wp core functions are ready.
So, can you please tell me at which hook/time piklist load my plugin or how I can avoid such situation of getting error when using the WP_Query class.
Thanks a lot.
- The topic ‘Adding Piklist Support to plugin causes fatal error’ is closed to new replies.