• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

WP

Change WordPress URL

June 6, 2021

There are multiple ways to change URL in WordPress.

Here’s one via wp-config.php.

define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );

define( 'WP_HOME', 'http://example.com' ); define( 'WP_SITEURL', 'http://example.com' );

If you have a redirect in Apache, comment it out.

#Redirect permanent / https://yourdomain.com/

#Redirect permanent / https://yourdomain.com/

This is by far the easiest way to change URL in WordPress.

Filed Under: Linux, WP Tagged With: change, config, url, wordpress, wp-config.php

WordPress Critical Error

April 11, 2021

If you get a WordPress “There has been a critical error on your website” error, you probably have an issue with a theme or plugin. The quickest way to troubleshoot is to rename the plugins directory since there’s no way to login. This technically disables all plugins. Rename it back to plugins and enable each plugin one by one.

Disable all plugins.

mv plugins plugins-backup

mv plugins plugins-backup

Login and restore the plugins directory.

mv plugins-backup plugins

mv plugins-backup plugins

Enable each plugin one by one and check if the site is broken.

Filed Under: WP Tagged With: critical, error, plugins, themes

Disable Gutenberg

February 27, 2021

Two years ago, WordPress introduced Gutenberg block editor together with the release of WordPress version 5.0. Gutenberg essentially became the default editor starting with WordPress version 5.0. While many people love the Gutenberg editor, some people hate it. If you’re one of the many people who hate the Gutenberg editor, you can simply disable it by installing a plugin called Disable Gutenberg. This plugin will revert back to the classic editor.

Once installed, you should be able to see the Classic editor.

After working with Gutenberg for so long, I forgot the speed and agility of the classic editor. It’s much faster.

Filed Under: WP Tagged With: classic, disable, editor, gutenberg, wordpress

WordPress Read Only

November 29, 2020

Here’s how to create a WordPress site that’s read only. You will not be able to create, update and delete posts.

  1. Login to MySQL or MariaDB.
  2. Choose mysql database.
  3. Create a new user called ‘wpro’ for WordPress read only.
  4. Grant select permissions to all tables in ‘wordpress’ database.
  5. Flush privileges to commit your changes.
mariadb -u root -p
use mysql;
create user 'wpro'@'localhost' identified by 'yourpassword';
grant select on wordpress.* to 'wpro'@'localhost';
flush privileges;

mariadb -u root -p use mysql; create user 'wpro'@'localhost' identified by 'yourpassword'; grant select on wordpress.* to 'wpro'@'localhost'; flush privileges;

In MySQL or MariaDB, you have to terminate all commands with a semicolon.

Now edit your WordPress wp-config.php file. vim /var/www/wordpress/wp-config.php.

/** MySQL database username */
define('DB_USER', 'wpro');
 
/** MySQL database password */
define('DB_PASSWORD', 'yourpassword');

/** MySQL database username */ define('DB_USER', 'wpro'); /** MySQL database password */ define('DB_PASSWORD', 'yourpassword');

After saving the wp-config.php file, everything should work just like before, except that you will not be able to save, publish or delete posts, pages, or add or delete media files to your WordPress site. It’s working as intended.

Filed Under: Linux, WP Tagged With: create, grant, mariadb, mysql, read-only, select, user

Disable Post Title in Genesis

September 13, 2020

Here’s how to disable the post title in Genesis WordPress themes. Add code in themes.php.

add_filter( 'genesis_link_post_title', '__return_false' );

add_filter( 'genesis_link_post_title', '__return_false' );

Filed Under: WP Tagged With: disable, genesis, link, post, theme, title, wordpress

Custom Breadcrumbs

September 13, 2020

I’ve customized my breadcrumbs. Add code to functions.php.

add_filter('genesis_breadcrumb_args', 'customize_breadcrumbs');
function customize_breadcrumbs($args) {
    $args['labels']['prefix'] = 'Home';
    $args['home'] = '';
    $args['sep'] = '/';
    return $args;
}

add_filter('genesis_breadcrumb_args', 'customize_breadcrumbs'); function customize_breadcrumbs($args) { $args['labels']['prefix'] = 'Home'; $args['home'] = ''; $args['sep'] = '/'; return $args; }

Now it doesn’t say Home/Home on the front page.

Filed Under: WP Tagged With: breadcrumbs, customize, wordpress

Center Search Widget

August 1, 2020

Here’s how to center the Search widget in a WordPress Page or a post. This applies only if you’re using the default Search Widget. Div classes may vary based on theme being used. The CSS example below may not work for your theme. Check your theme’s source code to be sure.

.entry-content .wp-block-search {
  display:block;
  margin-left:auto;
  margin-right:auto;
  text-align: center;
}
.entry-content .wp-block-search label {
  display:none;
}
.entry-content .wp-block-search input {
  width:250px;
}

.entry-content .wp-block-search { display:block; margin-left:auto; margin-right:auto; text-align: center; } .entry-content .wp-block-search label { display:none; } .entry-content .wp-block-search input { width:250px; }

The CSS above centers the search block. It suppresses the search label, and finally sets the form’s input to a fixed width of 250px.

Filed Under: WP Tagged With: center, class, css, div, search, wordpress

Revolution Theme

July 26, 2020

I’m now using the Revolution theme from StudioPress. It’s a minimal design with lots of whitespace. The default font is Playfair Display which highlights headlines and blockquotes. The Playfair Display is available from Google Fonts if you’re interested. I think it’s a perfect theme for a photography blog. Although the theme seems to invite you to write more, something I haven’t been doing lately. And before I sign off, let’s take a look at what a blockquote looks like. Not bad at all. A beautiful theme.

It’s a minimal design with lots of whitespace.

By Studiopress

Filed Under: WP Tagged With: revolution, studiopress, theme, wordpress

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 8
  • Go to Next Page »
  • Home
  • About
  • Archives

Copyright © 2023