最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

filters - the_content() not displaying the full post

programmeradmin1浏览0评论

When I use the_content() in the template php file, it displays the_excerpt() instead of the full post content.

I tried removing all filters with

remove_all_filters('the_content');

But it still displays the excerpt.

I found the workaround for displaying the full post content by fetching it directly from the database.

$post_data = get_post(get_the_ID());
echo $post_data->post_content;

This does not seem right though. I want to know why the_content() is not working and how to fix it?

List of all the plugins:

All-in-One WP Migration Version 7.18
Autocomplete WooCommerce Orders Version 1.1.0
Classic Editor Version 1.5 
Cloudflare Version 3.4.1 
Co-Authors Plus Version 3.4.2
Favorites Version 2.3.1 
Google Analytics for WordPress by MonsterInsights Version 7.10.4 
Gravity Forms Version 2.4.17    
Gravity Forms MailChimp Add-On Version 4.6 
Locations plugin Version 1.0.0
Order / Coupon / Subscription Export Import Plugin for WooCommerce (BASIC) Version 1.6.0 
Razorpay for WooCommerce Version 2.4.0  
Razorpay Subscriptions for WooCommerce Version 2.1.0 
Regenerate Thumbnails Version 3.1.3     
Teams for WooCommerce Memberships Version 1.2.1
Two Factor Authentication Version 1.7.2 
WooCommerce Version 3.9.0   
WooCommerce Extended Coupon Features FREE Version 3.1.2
WooCommerce Memberships Version 1.14.0 
WooCommerce PDF Invoices & Packing Slips Version 2.4.6
WooCommerce Price Based on Country (Basic) Version 1.8.22 
WooCommerce Price Based on Country Pro Add-on Version 2.8.6
WooCommerce Stripe Gateway Version 4.3.1
WooCommerce Subscriptions Version 2.5.7
WooCommerce Subscriptions Gifting Version 2.1.0
WP Pusher Version 3.0.2 
Yoast SEO Premium

Theme: A custom WordPress theme by Ink My Web

Edited: I am using it in the single article page template of the blog. It does not happen in other pages. I think what happens is the WC membership plugin cuts off the content as it should happen for the free user. But when displaying for paid user, I need to show the full content.

When I use the_content() in the template php file, it displays the_excerpt() instead of the full post content.

I tried removing all filters with

remove_all_filters('the_content');

But it still displays the excerpt.

I found the workaround for displaying the full post content by fetching it directly from the database.

$post_data = get_post(get_the_ID());
echo $post_data->post_content;

This does not seem right though. I want to know why the_content() is not working and how to fix it?

List of all the plugins:

All-in-One WP Migration Version 7.18
Autocomplete WooCommerce Orders Version 1.1.0
Classic Editor Version 1.5 
Cloudflare Version 3.4.1 
Co-Authors Plus Version 3.4.2
Favorites Version 2.3.1 
Google Analytics for WordPress by MonsterInsights Version 7.10.4 
Gravity Forms Version 2.4.17    
Gravity Forms MailChimp Add-On Version 4.6 
Locations plugin Version 1.0.0
Order / Coupon / Subscription Export Import Plugin for WooCommerce (BASIC) Version 1.6.0 
Razorpay for WooCommerce Version 2.4.0  
Razorpay Subscriptions for WooCommerce Version 2.1.0 
Regenerate Thumbnails Version 3.1.3     
Teams for WooCommerce Memberships Version 1.2.1
Two Factor Authentication Version 1.7.2 
WooCommerce Version 3.9.0   
WooCommerce Extended Coupon Features FREE Version 3.1.2
WooCommerce Memberships Version 1.14.0 
WooCommerce PDF Invoices & Packing Slips Version 2.4.6
WooCommerce Price Based on Country (Basic) Version 1.8.22 
WooCommerce Price Based on Country Pro Add-on Version 2.8.6
WooCommerce Stripe Gateway Version 4.3.1
WooCommerce Subscriptions Version 2.5.7
WooCommerce Subscriptions Gifting Version 2.1.0
WP Pusher Version 3.0.2 
Yoast SEO Premium

Theme: A custom WordPress theme by Ink My Web

Edited: I am using it in the single article page template of the blog. It does not happen in other pages. I think what happens is the WC membership plugin cuts off the content as it should happen for the free user. But when displaying for paid user, I need to show the full content.

Share Improve this question edited Mar 24, 2020 at 4:44 Saeesh Tendulkar asked Mar 23, 2020 at 7:39 Saeesh TendulkarSaeesh Tendulkar 1531 silver badge7 bronze badges 17
  • Can you please switch back to a default theme (like TwentyTwenty etc.)? If things work there, then IMHO, this could be a theme-specific question, and if so, this question would be out of scope of this site. You can consult the FAQ for clarification. – Mayeenul Islam Commented Mar 23, 2020 at 7:47
  • @MayeenulIslam I can't switch the theme. Can you suggest some other way? – Saeesh Tendulkar Commented Mar 23, 2020 at 8:29
  • Don't worry. There's always a way. Please refer to the Debug tag. – Mayeenul Islam Commented Mar 23, 2020 at 8:34
  • Please enlist all active plugins and your current theme (Own theme, Wordpress twenty series, 3rd party) – WordPress Speed Commented Mar 23, 2020 at 9:30
  • @Pmpr I have enlisted the plugins and theme. Can you check? – Saeesh Tendulkar Commented Mar 23, 2020 at 11:22
 |  Show 12 more comments

1 Answer 1

Reset to default -1

Step 1

Disable all plugins and try enabling plugins, one by one, while you refresh the problematic page after each plugin enabled, until you find the source of problem.
If no plugin was the cause, go to step 2.

Step 2

Edit your current theme's functions.php file and comment all occurrences of

add_action();
add_filter();

function calls, like this:

# add_action();
# add_filter();

Then try to uncomment them one by one, while you refresh the problematic page after each line uncommented, until you find the source of problem.

发布评论

评论列表(0)

  1. 暂无评论