san19 Posted June 29, 2022 Share Posted June 29, 2022 Fatal error: Uncaught Error: Call to a member function the_post() on null in /home/u529199620/domains/xxxxxxxx.com/public_html/wp-includes/query.php:979 Stack trace: #0 /home/u529199620/domains/xxxxxxx.com/public_html/wp-content/plugins/td-cloud-library/wp_templates/tdb_view_category.php(17): the_post() #1 /home/u529199620/domains/xxxxxxx.com/public_html/wp-includes/template-loader.php(106): include('/home/u52919962...') #2 /home/u529199620/domains/xxxxxxxx.com/public_html/wp-blog-header.php(19): require_once('/home/u52919962...') #3 /home/u529199620/domains/xxxxxxxxx.com/public_html/index.php(17): require('/home/u52919962...') #4 {main} thrown in /home/u529199620/domains/xxxxxxx.com/public_html/wp-includes/query.php on line 979 - The Line 979 : 977 function the_post() { 978 global $wp_query; 979 $wp_query->the_post(); 980 } Please help me any solution Quote Link to comment https://forums.phpfreaks.com/topic/314976-help-fatal-error-php-on-category-wordpress/ Share on other sites More sharing options...
ginerjm Posted June 29, 2022 Share Posted June 29, 2022 I don't know what "category wordpress" means. But looking at the code you showed it appears you have written a function that calls itself. Hence an infinite loop. Quote Link to comment https://forums.phpfreaks.com/topic/314976-help-fatal-error-php-on-category-wordpress/#findComment-1597722 Share on other sites More sharing options...
san19 Posted June 29, 2022 Author Share Posted June 29, 2022 i mean that some plugins on wordpress do this problem category on wordpress means like page on wordpress or homepage Quote Link to comment https://forums.phpfreaks.com/topic/314976-help-fatal-error-php-on-category-wordpress/#findComment-1597726 Share on other sites More sharing options...
ginerjm Posted June 29, 2022 Share Posted June 29, 2022 (edited) Do you have to write a function simply to call another function? And does that global var you are using really exist cause the message is implying that it doesn't? Edited June 29, 2022 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/314976-help-fatal-error-php-on-category-wordpress/#findComment-1597727 Share on other sites More sharing options...
maxxd Posted June 29, 2022 Share Posted June 29, 2022 It means $wp_query is null at the time the function is called. If I'm remembering correctly, this can happen if your function is called before the 'posts_selection' action is fired - if you're not in the loop. Quote Link to comment https://forums.phpfreaks.com/topic/314976-help-fatal-error-php-on-category-wordpress/#findComment-1597736 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.