The drop-down of page parents doesn't appear in some sites as of upgrading to WordPress 5.0.+

closed as off-topic by Jacob Peattie, fuxia Jan 23 at 9:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?" – Jacob Peattie, fuxia
If this question can be reworded to fit the rules in the help center, please edit the question.


It seems the problem is with shortcodes, specifically if they echo any content - which of course they shouldn't. We had shortcodes registered to programmatically generate content on some pages on the front-end of the site but the functions the short-codes call appear to get called from the backend, even when creating a new page that doesn't call the shortcode, breaking the lazy-loading of that field.

As a quick fix I wrapped the function's content in a is_page() test and that seems to fix the problem:

`add_shortcode('my_shortcode_str', 'my_shortcode_fx');

 function my_shortcode_fx() {
    if (is_page()) {
      /* only render on front-end, otherwise kills lazy load of page parent field in WP edit screen */
      $content =  /*something*/;
      return $content;
    } // ends is_page

The proper solution is to make sure the shortcode's function only returns the content and doesn't output anything itself.

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