Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Produce warning when permalinks are not enabled #4617

Closed
2 tasks
bobbingwide opened this issue Jan 20, 2018 · 3 comments
Closed
2 tasks

Produce warning when permalinks are not enabled #4617

bobbingwide opened this issue Jan 20, 2018 · 3 comments
Labels
Core REST API Task Task for Core REST API efforts [Feature] Permalink The permalink of a post or page and the experience of setting or editing it [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed

Comments

@bobbingwide
Copy link
Contributor

bobbingwide commented Jan 20, 2018

Issue Overview

When permalinks are not set things don't work properly. Gutenberg should be up front about this.

Steps to Reproduce (for bugs)

  1. As for withAPIData URL parameters and Plain Permalinks #3215 .

Expected Behavior

Gutenberg should let the user know that there could be a problem when a permalink structure is not defined.

Current Behavior

Unexpected messages in the browser log. Things not working as expected. No warnings that things might not work.

Possible Solution

Call this logic at the end of gutenberg_pre_init

/**
 * Verifies permalinks are set
 *
 * @since 2.0.1
 */
function gutenberg_check_permalinks() {

	if ( is_multisite() ) {
		if ( get_blog_option( null, 'permalink_structure' ) ) {	
			return;
		}
	} elseif ( get_option( 'permalink_structure' ) ) {
		return;
	}
	add_action( 'admin_notices', 'gutenberg_permalink_notice' );
}

/**
 * Issues a notice about permalinks
 */
function gutenberg_permalink_notice() {
	echo '<div class="error"><p>';
	echo __( 'Gutenberg works better with permalinks.', 'gutenberg' );
	echo '</p></div>';
}

Obviously the wording will need some tweaking. And the logic won't be necessary once WordPress TRAC 42382 has been delivered.

Screenshots / Video

Related Issues and/or PRs

#3215. Possibly #2704 and #2596. And, to be investigated, problems with reusable blocks.

Todos

  • Tests
  • Documentation
@danielbachhuber
Copy link
Member

@bobbingwide Gutenberg should work without pretty permalinks enabled. What specific issues have you run into?

@danielbachhuber danielbachhuber added the [Status] Needs More Info Follow-up required in order to be actionable. label Jan 23, 2018
@bobbingwide
Copy link
Contributor Author

@danielbachhuber regarding permalinks specifically... #3215, which for me was responsible for the problem reported in #3210.

I also had problems with saved blocks but wasn't able to confirm if this was just a performance issue on my local machine when I had my server tracing enabled. Additionally, I may have inadvertently overridden the registration of the wp_block post type accidentally turning off 'show_in_rest'.

The point is that anyone who fires up a brand new install to try Gutenberg may start trying to use it without having selected something other than plain permalinks.

@danielbachhuber
Copy link
Member

Ah, I should've clicked through on #3215 before I created the new issue. #3215 is the appropriate issue to fix.

@designsimply designsimply added Core REST API Task Task for Core REST API efforts [Feature] Permalink The permalink of a post or page and the experience of setting or editing it [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed and removed [Status] Needs More Info Follow-up required in order to be actionable. labels Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core REST API Task Task for Core REST API efforts [Feature] Permalink The permalink of a post or page and the experience of setting or editing it [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed
Projects
None yet
Development

No branches or pull requests

3 participants