这正确地显示true/false 当选项Reduce the interface 通过GUI启用/禁用。
你确定吗isFeatureActive( \'reduceInterface\' ) 工作了吗?
因为我查看了源代码(参见wp-includes/js/dist/edit-post.js) 然后我发现功能名称实际上是reducedUI 而不是reduceInterface.
因此,请尝试reducedUI 而是:
let reduceInterface = wp.data.select( \'core/edit-post\' ).isFeatureActive( \'reducedUI\' );
console.log( \'before\', reduceInterface );
wp.data.dispatch( \'core/edit-post\' ).toggleFeature( \'reducedUI\' ); // enable/disable it
reduceInterface = wp.data.select( \'core/edit-post\' ).isFeatureActive( \'reducedUI\' );
console.log( \'after\', reduceInterface );
上述内容在WordPress 5.8和5.8.2(写作时的最新版本)上对我有效。