Can No Longer Force Publish with Classic Editor?

I’m not adopting the new Block features of WordPress and am sticking with Classic.

I just noticed that the WP Discourse plugin had an update for a setting I use, Force Publish:

This setting is only applied when the Block Editor is used to publish posts.

Bummer, but where there’s a will, there’s a way. Anyone else run into this problem and come up with a custom solution, something to add to the ol’ functions.php file in the theme perhaps?

Thanks

3 Likes

Hey @oopsyscoops, yes, there are some limitations with supporting both editors. You can still use “Auto Publish” setting with the classic editor. Is there an issue with using that in your case?

2 Likes

Auto Publish would be fine if this was a single-user blog.

However, as a multi-author blog, Force Publish was very helpful.

Before I go digging through the changelog, do you happen to know off the top of your head what version of WP Discourse moved this feature to the Block editor and removed it from the Classic editor?

I’m not suggesting that I’ll rollback to that version (which would be a terrible idea), but maybe I can dig around the code and patch the old solution back in through my theme.

I hope WP Discourse doesn’t eventually completely abandon Classic. There are over 6 million (verifiably at least, but it’s probably more) websites using Classic still, and I’m sure millions of people will continue using Classic features indefinitely.

I intend on it and I suspect that Classic features will eventually become officially (and optionally) supported in WP (not relying on plugins) again after the demand is clear, when they realize that even after years, some people simply prefer the Classic and won’t adopt new Block features.

2 Likes

I do understand where you’re coming from, but this could just be a case of author training and seeing whether it causes issues in practice? You know your authors better than me, but I wouldn’t discount that as an option.

Classic editor is still definitely supported.

I doubt it, but I’ve been wrong before (at least three times that I know of :wink: )

PR would be welcome if you can address the issues that @simon was seeking to address when removing it (see for example). He can perhaps explain more.

3 Likes

It simply isn’t practical. I’ve been an editor for over a decade and trained and managed dozens of writers of every skill level, from complete Luddites, to coders. I’ve only had a handful of good writers that were also tech-savvy and organized enough to follow ALL the guidelines I laid out for them (without struggling).

I could be a stricter Editor (I’m already pretty OCD as it is), but then I’d lose valuable voices. There are just too many great writers I’ve had contribute over the years, who barely knew how to turn on a computer. Many of them have a learning curve in just learning how to publish with WordPress, and wished they could just email me a Word doc instead. :stuck_out_tongue_closed_eyes:

And so, I train the best I can, but at the end of the day, automation is sanity.

Anyway, I’d love to learn more about why this feature is too difficult to maintain for Classic AND Block, if I can get a brief recap, @simon? For what it’s worth, I have a partner on one project that insists I allow them to use the Block editor (while everyone else on the team uses the Classic editor), so I do have some experience mixing both, and I get how it can become a pain.

Thanks

3 Likes

Yes, it would be great to get the Force Publish option to work with both editors. It’s a couple of years since I last looked at this. I’m not certain what the cause of the issue was, but I suspect it’s something that could be resolved.

3 Likes

Okay, we’re looking at this file:

/lib/discourse-publish.php

And comparing 2.1.2 and 2.1.3, here are the only differences (concerning Force Publish):

if ( ( 0 === $force_publish_max_age ) || $post_time >= $min_date ) {

was changed to:

if ( ( ( 0 === $force_publish_max_age ) || $post_time >= $min_date ) && $is_rest_request ) {

And these additional lines were added:

// The Force Publish setting can't be easily supported with both the Block and Classic editors. The $is_rest_request
// variable is used to only allow the Force Publish setting to be respected for posts published with the Block Editor.
$is_rest_request = defined( 'REST_REQUEST' ) && REST_REQUEST;

If I had to guess, maybe the old way was throwing errors in the Block editor? So, could it be as simple as using a conditional?

is_block_editor or use_block_editor_for_post might work:

if ( is_block_editor() ) {
	// do it the new way
} else {
	// do it the old way
}
1 Like

Want to give it a shot and make a PR?

1 Like

If you’re talking to me, I’m definitely not going in guns a blazin’ until @simon recalls why it was removed in the first place (or retraces his steps to learn what it was again). It could be some unknown nightmare to do with the core of WordPress, Discourse, or WP Discourse that’s not simply an issue contained to these few files and lines of code.