Page-parent field not appearing in editor [closed]

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.