Page-parent field not appearing in editor

admin2025-06-04  2

Closed. This question is off-topic. It is not currently accepting answers.

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?

Closed 6 years ago.

Improve this question

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

Closed. This question is off-topic. It is not currently accepting answers.

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?

Closed 6 years ago.

Improve this question

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

Share Improve this question asked Jan 23, 2019 at 8:32 Andre ClementsAndre Clements 1347 bronze badges
Add a comment  | 

1 Answer 1

Reset to default -1

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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748983967a315381.html

最新回复(0)