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

Remove YOAST suggestion in Permalinks page #58

Closed
ghost opened this issue May 17, 2019 · 4 comments

Comments

@ghost
Copy link

commented May 17, 2019

Just open Settings>Permalinks on WP Dashboard and check at the top for a box like this added by Yoast http://prntscr.com/np4hjx,

@senlin senlin added the help wanted label May 17, 2019
@senlin

This comment has been minimized.

Copy link
Owner

commented May 17, 2019

I had a look at this, but there are no classes added to this notice, so I cannot just simply hide it as it will also hide other, maybe important, notices.

Most likely this needs to be done programmatically, but I haven't figured out a way to do that yet. Any input welcome.

The code on Yoast SEO is as follows.

File: wordpress-seo/admin/class-admin-init.php L52:
add_action( 'admin_notices', array( $this, 'permalink_settings_notice' ) );

Same file L724-739:

	/**
	 * Shows a notice on the permalink settings page.
	 */
	public function permalink_settings_notice() {
		global $pagenow;

		if ( $pagenow === 'options-permalink.php' ) {
			$warning = esc_html__( 'WARNING:', 'wordpress-seo' );
			/* translators: %1$s and %2$s expand to <i> items to emphasize the word in the middle. */
			$message = esc_html__( 'Changing your permalinks settings can seriously impact your search engine visibility. It should almost %1$s never %2$s be done on a live website.', 'wordpress-seo' );
			$link    = esc_html__( 'Learn about why permalinks are important for SEO.', 'wordpress-seo' );
			$url     = WPSEO_Shortlinker::get( 'https://yoa.st/why-permalinks/' );

			echo '<div class="notice notice-warning"><p><strong>' . $warning . '</strong><br>' . sprintf( $message, '<i>', '</i>' ) . '<br><a href="' . $url . '" target="_blank">' . $link . '</a></p></div>';
		}
	}

PR welcome!

@senlin senlin removed the help wanted label Jul 27, 2019
@senlin

This comment has been minimized.

Copy link
Owner

commented Jul 27, 2019

closing this as no help is being offered and OP's account has been removed

@Dibbyo456

This comment has been minimized.

Copy link

commented Aug 24, 2019

Patch posted on #71

@senlin

This comment has been minimized.

Copy link
Owner

commented Aug 24, 2019

@Dibbyo456
Very helpful patch and resources Harry, thank you for digging in! I will add this to the other patches/fixes.

senlin added a commit that referenced this issue Aug 27, 2019
add remove_class function in order to remove the warning notice when changing permalinks; big thanks to Harry (Dibbyo456) for coming up with this creative solution; fixes #58 (and #71)
senlin added a commit that referenced this issue Aug 29, 2019
* release date August 29, 2019
* remove notice on permalinks page that warns the user of the implications of changing them, fixes [issue #58](#58)
* recode hiding of the admin columns into actually removing them, fixes [issue #65](#65)
* recode hiding of the seo score/readability score filters into actually removing them, fixes [issue #65](#65)
* remove advanced accordion menu at bottom of SEO metabox for post- and custom post types, fixes [issue #67](#67)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.