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.

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. Mar 23, 2020 at 7:47
  • @MayeenulIslam I can't switch the theme. Can you suggest some other way? Mar 23, 2020 at 8:29
  • Don't worry. There's always a way. Please refer to the Debug tag. Mar 23, 2020 at 8:34
  • Please enlist all active plugins and your current theme (Own theme, Wordpress twenty series, 3rd party) Mar 23, 2020 at 9:30
  • @Pmpr I have enlisted the plugins and theme. Can you check? Mar 23, 2020 at 11:22

1 Answer 1

-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.

6
  • It's a live site which cannot go down. So I can't do that. Is there some way to debug without compromising the site? Mar 23, 2020 at 14:18
  • You need a local copy for development purposes. Do not touch the production at all. install a local copy and test the provided solution if you really want to solve it. Mar 23, 2020 at 19:41
  • I have a local copy. But thing is it's working on my local i.e. I can see the full post with the_content(), but not on production server. Mar 24, 2020 at 5:21
  • according to your comment on the question, a plugin is the cause. please accept my answer and ask another question, if you have problem with one of your plugins, as your current question got an answer now. Mar 28, 2020 at 16:01
  • Sorry but your answer didn't help me at all. I still haven't figured out the fix, so if you can help with that I'll be more than willing to accept your answer Mar 29, 2020 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.