Common WordPress Issues

Common WordPress Issues

Error establishing a database connection

Reasons this might have occurred

  • Your MySQL database password was changed in a way other than the MySQL Password Reset tool. This could be done using the CLI or in phpMyAdmin. Often this might have occurred accidentally while following directions for a different class in Weblab.

  • The main configuration file for WordPress (wp-config.php)  was modified either on purpose or inadvertently.

Steps to resolve

Using the MySQL Reset Tool

  1. Use the MySQL Password Reset tool to reset your database password – this works by changing your database password AND updating your password configuration in the WordPress configuration. This is available in the Weblab portal, in the main menu, https://weblab.uni.edu/tools/mysql_reset

  2. You will receive an email with a new password in it. Leave this set instead of manually changing it in phpMyAdmin or through another tool.

Correcting wp-config.php Manually

This assumes you know the password to your database.

  1. Connect to weblab.uni.edu using an SFTP tool (or via SSH). Inside the correct wordpress directory (usually just wordpress – unless you have multiple installs), find the file wp-config.php 

  2. Open this file in an editor. Set the password in the line containing: define( 'DB_PASSWORD', '*' );.

If this doesn't resolve your issue – or there are other problems with your WordPress installation please submit a ticket on https://servicehub.uni.edu

Site does not load as expected or Site Name was configured incorrectly

Reasons this might have occurred

  • If you configured Settings > General > either Site Address (URL) or . This setting is cosmetic only – it does not actually update the necessary settings for the database.

  • A change for other database or site configuration caused a database entry to get changed.

How to avoid this?

WP Option

Can I change this without breaking my site?

WP Option

Can I change this without breaking my site?

Site Title

Yes

Tagline

Yes

WordPress Address (URL)

No

Site Address (URL)

No

Administrative Email Address

Yes

Membership

Yes

New User Default Role

Yes

Site Language

Yes

Date/Time Settings (all)

Yes

Only change your site name settings from within the Weblab portal. If you're eligible for the buzz domain name changes you'll have an option to select "Set Buzz Domain" in your site's manage options.

Steps to resolve

Submit a Ticket in Service Hub

This is a technical resolution – if you are not comfortable either editing MySQL or changing site settings via shell access, please don't hesitate to submit a ticket in Service Hub.

Using MySQL

If you have access to MySQL or phpMyAdmin, you can edit the fields in the wp_options table:

  • site_url 

  • home 

Using WP CLI (shell access)

If you are familiar with accessing files and applications on a server using SSH you can use this to connect and run the WordPress Command Line tool to find and fix your site settings.

  1. Connect using SSH. On Windows this can be PuTTY or just command line/Powershell. On MacOS, open Terminal.

    ssh catid@weblab.uni.edu
  2. Change directories to your WordPress install (typically, web/wordpress – although it might be different if you have multiple sites). From there you can run the wp  tool to see your site details.

    cd web/wordpress wp option get siteurl wp option get home
  3. You can use the search and replace tool to change all instances that are wrong (see above commands that will show if what might need to be replaced).

    wp search-replace https://weblab.uni.edu/not-working-site https://weblab.uni.edu/joneswac/wordpress

Updating failed. The response is not a valid JSON response

You'll see this error message when editing/saving a post or page. You may also see it when working with media or a theme.

Loss of work possible!

Please copy the content of your post out of the editor when you encounter this error! You may be at risk to lose unsaved work!

Reasons this might have occurred

The cause of this error is unknown. There are multiple possible fixes as of now. - @Wesley P Jones Mar 1, 2021 

  • Permalinks incorrectly implemented: For a variety of possible reasons permalinks didn't save correctly or have been changed while editing the post.

  • Block editor has malfunctioned: It is possible that the WordPress Block Editor (~v.5+) had an issue.

Steps to Resolve

Option 1: Re-apply permalinks setting

  1. Go to Settings > Permalinks and choose a different option (temporarily).

  2. Verify that this setting applies by checking the URL of a post, either go to a post on your blog or check the sidebar in the editor and you can see the permalink.

  3. Go back to Settings > Permalinks and reconfigure your permalinks setting as desired.

More details about permalinks and this issue

Option 2: Switch to Classic Editor

This has been the preferred option in the past. In fact, I suspect that just toggling to Classic Editor and then back to the Block or Gutenberg Editor is enough. - @Wesley P Jones Mar 1, 2021 

  1. Go to Plugins > Add new; and choose to install and activate, Classic Editor (it should show as a top installed plugin or you can search for it).

    1. https://wordpress.org/plugins/classic-editor/

  2. Click the Settings option in the Classic Editor plugin details or go to Settings > Writing, and choose Allow users to switch editors; set it to Yes. You can also set the default editor here. Click Save Changes.

  3. In a post or page you can now choose to change the editor in the settings menus:

    • Classic editor: find in side menu

  1.  

    • Block editor: find in Options menu