Solution PHP Notice: Use of undefined constant x — assumed ‘x’

I once noticed the following notification when writing a PHP script:

PHP Notice:  Use of undefined constant uid - assumed 'uid' in /scripts/file.php on line 31
PHP Notice:  Use of undefined constant value - assumed 'value' in /scripts/file.php on line 32

Continue reading “Solution PHP Notice: Use of undefined constant x — assumed ‘x’”

Install phpMyAdmin

phpMyAdmin is a web application written in PHP that allows you to administer MySQL databases through a browser.

The easiest way to install phpMyAdmin is to download the archive with the latest version from the official website www.phpmyadmin.net and unpack it into the desired www directory, then you can open http://HOST/phpmyadmin/setup/ in the browser and follow the instructions. After that, move the config.inc.php file to the phpmyadmin root directory and close access to /setup/ or delete it altogether.
Continue reading “Install phpMyAdmin”

How to hide the Jetpack menu for users

To hide the Jetpack menu for subscribers and regular users, it’s enough to add the following code to the active theme functions.php file:

function ap_remove_jetpack_page( ) {
if ( class_exists( 'Jetpack' ) && !current_user_can( 'manage_options' ) ) {
remove_menu_page( 'jetpack' );
}
}
add_action( 'admin_menu', 'ap_remove_jetpack_page', 999 );

Also for this there are several plugins, but those that came across to me are quite old.

Jetpack error solution “Verification secrets not found”

I noticed some error when activating Jetpack:

The Jetpack server encountered the following client error: Verification secrets not found

The reason was found in restricted access over IP through .htaccess to the file wp-login.php, as it turned out that access to this file can not be blocked if Jetpack is used.

That’s why I found lines restricting access and commented them out by putting the # (before each line) symbol (the lines can be in the .htaccess file located in the root directory with WordPress and in the web server configuration files), for example:

#        <files wp-login.php>
#                order allow,deny
#                allow from 127.0.0.1 192.168.2.50
#        </files>

If the lines were in .htaccess, then Jetpack can already be activated, if in the configuration file of the web server, then you still need to restart it to apply the changes.

Also, an error can occur because of conflicting plugins, you can try to turn them off in turn.

Why Contact Form 7 does not work on iOS

Recently, on the WordPress site, I noticed the problem of sending messages via Contact Form 7 from devices with the iOS operating system.
If you used Google reCAPTCHA, when you clicked on the Send button, the page was updated for a very long time and reCAPTCHA reported a wait error, if you disable reCAPTCHA, then the message was sent after 1-2 minutes.

As it turned out, iOS somehow started blocking AJAX, which was used by default when updating the page.

So to solve the problem, I opened the configuration file wp-config.php and just before the line:

define('WP_DEBUG', false);

Added a line:

define ('WPCF7_LOAD_JS', false);

This line prohibits Contact Form 7 from using Javascript.
If you specify this variable at the end of the file, it will not work.

After this, the messages on iOS started to go immediately.