wordpress Because your install is not new, the sites in your WordPress network must use sub-domains — April 30, 2018

wordpress Because your install is not new, the sites in your WordPress network must use sub-domains

Add this code in your theme’s functions.php

add_filter( 'allow_subdirectory_install',
   create_function( '', 'return true;' )
);

Check full explanation here.

Advertisements
WordPress Ubuntu not able to create directory — April 18, 2018

WordPress Ubuntu not able to create directory

There can be several reasons for this. One of those can be the file ownership issue. Explaining a way to solve it

First of all check which server user is accessing your files. You can check it by

echo exec('whoami');

Now go to your server terminal and change ownership of your wordpress installation directory to this user or group. In ubuntu like this

sudo chown -R user:group /var/www/wordpress

Other issue can be the file and directory permission issue. You can make directory permission to 755 or 775. So a user or user-group can create/edit/delete files from directories. You can do it this way.

find /var/www/wordpress -type d -exec chmod 755 {} \;

OR

find /var/www/wordpress -type d -exec chmod 775 {} \;
WordPress after migration keep redirecting to installation steps — April 13, 2018

WordPress after migration keep redirecting to installation steps

So I imagine that you have imported your DB and uploaded wordpress files to new server and You have changed the DB variables in wp-config.php. But it still redirect you to installation screen( check screenshot )
The only reason is that WordPress is not able to find its tables. It is able to connect to you DB but not able to find tables. This is because you have forgot to change ‘$table_prefix’ in your wp-config.php

$table_prefix  = 'wp_some_other_prefix';

I made this mistake too 🙂

Ubuntu wordpress uploads permission issue —

Ubuntu wordpress uploads permission issue

So the issue I faced was

When I changed directory permission to www-data:www-data then WordPress was able to upload files but then ftpuser was not able to edit files.

So easy solution is to add that ftpuser to www-data group

Change the directory owner and group:

sudo chown [my ftp username]:www-data /var/www/[new directory]

allow the group to write to the directory with appropriate permissions:

sudo chmod -R 775 /var/www

Add ftpuser to the www-data group:

sudo usermod -a -G www-data [my ftp username]

Logout and login again.

Ubuntu Install wordpress command line —
WordPress send email to new registered user , created by wp_insert_user() — March 28, 2018
WordPress enqueue js script file in child theme — December 15, 2017

WordPress enqueue js script file in child theme

define( 'template_child_directory', dirname( get_bloginfo('stylesheet_url')));

function hermosa_child_enqueue_js() {
	wp_register_script('custom_js', template_child_directory . '/assets/js/custom.js', array( 'jquery' ),false,true);
	wp_enqueue_script( 'custom_js' );
//send any variable to script
    wp_localize_script( 'custom_js', 'custom', array(
        'ajax_url' => admin_url( 'admin-ajax.php' )
    ));
}
add_action('wp_enqueue_scripts', 'hermosa_child_enqueue_js');

For better explanation use wordpress documentation please.