Content only displays when content is in the body of the editor

I have created a custom-post-type using CustomPress. I have created a single page and an archive page for the custom-post-type.

However, I have created the custom-post-type with custom fields (for displaying numbers). For my use case, I do not need any text loaded in the "content editor" of the "post". However, when I leave it empty, the page doesn't display any content. When I type in "testing" in the content area and then update the post, the rest of the page appears.

I need to be able to show the page content without having to put words in the content box and just use the custom fields of the custom-post-type.


  • Nastia
    • Support Rock Star

    Hello David , I hope you are doing well!

    I've tested this on my site and can't replicate the same issue. Can you replicate the same with other plugins deactivated and with default WordPress theme? If everything is well, activate one plugin at a time to find the one that causes this.

    In case that this is not a conflict with another plugin, would you please grant access from WPMU DEV > Support so I can have a closer look?

    Please see the detailed instructions on the link below:

    Let me know when you do!

    Kind regards,

  • David
    • The Crimson Coder

    Nastia I have enabled Access.

    However, after reading it, I'm not sure I explained the proper way.

    I have created 5+ custom fields (text box) for each post with the custom_post_type of "pd_stats". When I just put in the custom fields with no text in the main wordpress content area, nothing is displayed. When I put anything in the main wordpress box (and still have custom fields filled out) then the custom fields is displayed properly. I duplicated on a fresh install. This means to tell me that Wordpress by default hides content in the loop if there isn't any content in the main box.

    Again, access is enabled.

  • Patrick
    • Support Monkey

    Hi there David

    If you have created the necessary templates, you need only add the php call in each one to get the custom fields to display. They will display on your page whether something is in the content box or not; you can even uncheck the content editor in for that post-type in CustomPress so it doesn't get in the way when you're crafting your posts.

    <?php echo do_shortcode('[custom_fields_block]'); ?>

    If you add it in the post loop, be sure to remove the php tags before & after. :wink:

  • David
    • The Crimson Coder

    Patrick Patrick, thank you for the response. However, that is what I have and I'm not having issues displaying the custom field information. The only issue comes in when I do not have anything in the main content editor (wordpress default), then it shuts down the loop and doesn't display anything (including the custom field php snippets).

    When I put in a simple word like "test" in the main box, all the custom fields that I have hard coded into the theme (single-pd_stats (which is my custom_post_type) appear correctly.

    There must be something shutting down the loop if there isn't any content in the box.

  • Nastia
    • Support Rock Star

    Hello David ,

    I've imported the CustomPress post type and custom fields to my site and still can't replicate the same. Since your site is running on PHP ver. 7.1.1, I've tested it too and again can't replicate the same.

    The only difference there is, when there is no content in a post, the following warning showing up in the developer's console:
    The resource was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it wasn't preloaded for nothing.

    Would you please try deactivating any minification features/plugin on your site and test this again?

    I duplicated on a fresh install.

    Please let me know, have you tested it with the default WordPress theme?

    Right now as a workaround I've placed <p></p> inside this post to hide any content.

    Do you have any development copy of this site so we could run some test? If not, would you please create one and grant to us access?

    Please advise,

    Kind regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.