PHP warning - Use of undefined constant ‘FORCE_SSL_LOGIN’ ‘FORCE_SSL_ADMIN’ on wp-config.php

I have a bothering PHP warning for ages, and I am wondering if someone has solution to this. The following two-line warning is constantly recording in my error_log file: PHP Warning: Use of undefined constant ‘FORCE_SSL_LOGIN’ - assumed '‘FORCE_SSL_LOGIN’' (this will throw an Error in a future version of PHP) in /home/myuser/public_html/wp-config.php on line 92 PHP Warning: Use of undefined constant ‘FORCE_SSL_ADMIN’ - assumed '‘FORCE_SSL_ADMIN’' (this will throw an Error in a future version of PHP) in /home/myuser/public_html/wp-config.php on line …
Category: Web

Error: Attempt to read property "ID" on null

I have the following error Attempt to read property "ID" on null in this code snippet global $wp_query; $categories = get_the_terms($wp_query->post->ID, 'live_stream_categories'); $cat_slug = ''; $live_stream_true = False; if(!empty($categories)){ foreach ($categories as $cat) { if($cat->slug != 'live-stream') { $cat_slug = $cat->slug; } if($cat->slug == 'live-stream') { $live_stream_true = True; } } } However I'm not sure what the workaround would be. Any advice? I've took over this site from a previous developer
Category: Web

How to display a warning when an uploaded image is too small?

I want to display a warning when a user uploads an image with too low a resolution. I don't want to block the upload, just give a warning. The only option I see is wp_handle_upload_prefilter, but there you can only return an error which blocks the upload. add_filter( 'wp_handle_upload_prefilter', function ( $file ) { if ( str_contains( $file['type'], 'image' ) ) { $image = getimagesize( $file['tmp_name'] ); if ( $image[0] < 1200 ) { //How do I display this warning …
Category: Web

WP_DEBUG is not set, but I'm still getting warnings

If WP_DEBUG is not set, as I understand it, you should never ever see warnings. But on some sites on some servers, I'm still seeing a few. Not all the warnings that would be displayed if WP_DEBUG was set, but a select few. I've tried changing the error level in php.ini, but that seems to have no effect on whether warnings appear or not, but they do appear in differing amounts on different servers (i.e. no warnings on development, one …
Category: Web

Warning: call_user_func_array() expects parameter 1 to be a valid callback - whenever i navigate to wp-admin

whenever i navigate to URL/wp-admin/ i face this error: Warning: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in /customers/0/c/3/saifaljazira.com/httpd.www/wp-includes/class-wp-hook.php on line 288 here is the function of error: public function apply_filters( $value, $args ) { if ( ! $this->callbacks ) { return $value; } $nesting_level = $this->nesting_level++; $this->iterations[ $nesting_level ] = array_keys( $this->callbacks ); $num_args = count( $args ); do { $this->current_priority[ $nesting_level ] = current( $this->iterations[ …
Category: Web

Warnings even when the WP_DEBUG set to false

The link https://vreqenz-stream.de/shop/ throws warning when opened on some devices and not on others. I thought it may be a cahce issue but I have cleared cache from WP-rocket and also browser. Just for the info I am using Plesk web admin tool. Below is my WP_Config settings ini_set('log_errors','On'); ini_set('display_errors','Off'); ini_set('error_reporting', E_ALL ); define('WP_DEBUG', false); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false);
Category: Web

Get WP CLI to hide debug warnings and notices in JSON output, same setting as website

Summary: WP CLI can be used to get a JSON output of all the plugins installed on a site, but the output gets corrupted due to warnings although log levels are set to low. Problem Unfortunately, I have a site that runs an outdated plugin producing some warnings. They are not shown on the website, as WP_DEBUG is set to false in wp-config.php. The website runs fine, because there are no fatal errors. WP CLI produces the correct JSON results, …
Category: Web

ftp_nlist() and ftp_pwd() warnings

I'm not sure when this warning started. I got an existing site to do its hosting and applied the following good practices: Updated Wordpress - from 5.3 to 5.4.0 (current WP version) Updated all plugins - it's a big list so I won't add it here Changed file permissions and owner - everything owned by my user (not Apache) and only the folder wp-content is writable by Apache (with some restrictions inside) -> WordPress Hardening Guide As a note, the …
Category: Web

Illegal string offset in PHP function

I'm creating a metabox to upload PDF files. I have the following warning notice for this line of code: $this_file = $filearray['url']; Warning: Illegal string offset ‘url’ in... The complete function code: function wp_custom_attachment() { wp_nonce_field( plugin_basename(__FILE__), 'wp_custom_attachment_nonce' ); $html = '<p class="description">Upload your PDF here.</p>'; $html .= '<input id="wp_custom_attachment" name="wp_custom_attachment" size="25" type="file" value="" />'; $filearray = get_post_meta( get_the_ID(), 'wp_custom_attachment', true ); $this_file = $filearray['url']; if ( $this_file != '' ) { $html .= '<div><p>Current file: ' . $this_file . …
Category: Web

Change ICL_LANGUAGE_CODE for WPML

I got an error: PHP Warning: Use of undefined constant ICL_LANGUAGE_CODE - assumed 'ICL_LANGUAGE_CODE' (this will throw an Error in a future version of PHP) in <path/functions.php on line 19 So I want to change ICL_LANGUAGE_CODE to wpml_current_language filter. But I can't make it. I want to change this: add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2); function change_existing_currency_symbol( $currency_symbol, $currency ) { switch( $currency ) { case 'AED': if(ICL_LANGUAGE_CODE=='ar'){ $currency_symbol = 'د.إ'; }else{ $currency_symbol = 'AED'; } break; } return $currency_symbol; }
Category: Web

CPT issue: Warning: call_user_func_array() expects parameter 1 to be a valid callback

I'm getting an error on the admin screen for the custom post type. I've searched lots of other answers but see nothing in my code that could be causing it. Here's my code. Any help would be greatly appreciated. // Register the post types and taxonomys add_action('init', 'register_post_types'); function register_post_types(){ // Property Post Type $labels = array( 'name' => __('Properties'), 'singular_name' => __('Property'), 'add_new' => __('Add New'), 'add_new_item' => __('Add New Property'), 'edit_item' => __('Edit Property'), 'new_item' => __('New Property'), …
Category: Web

PHP warning are displaying when using WP CLI

I'm running WP CLI 0.25.0 on Debian, PHP 7.0. I keep getting the PHP warnings displayed. In php.ini used for cli I have set error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING (and checked the change), but no difference, the warning is output. Ran WP CLI with --debug=false, still no effect. How to suppress the warning display, as it breaks the JSON output ? Edit 1 Before using error_log = Off : PHP Warning: Invalid argument supplied for foreach() …
Category: Web

I am receiving a pluggable.php warning sign on my only http:// page

I just recently shared a link to my site using he http to my site: http://thechronicalist.com but instead of redirecting, i just displays this: Warning: Cannot modify header information - headers already sent by (output started at /home/thecmltm/public_html/index.php:1) in /home/thecmltm/public_html/wp-includes/pluggable.php on line 1281 Warning: Cannot modify header information - headers already sent by (output started at /home/thecmltm/public_html/index.php:1) in /home/thecmltm/public_html/wp-includes/pluggable.php on line 1284 I have searched all over the web but they all talk about function.php or wp_configure.php but that is …
Category: Web

Block editors annoying warnings

When I am trying to edit or add a post/page using block editor, it shows me some weird warnings then they act like they disappear, but when I inspect the page, I see that they are still there. The warnings appear just when I am using my theme. Note 1: Most of the warnings are eather in the wp-admin or wp-includes folder, which I haven't touched at all. Note 2: I've installed classic editor and it works just fine. Warnings: …
Category: Web

"Warning: count()" error on php 7.2

I'm currently working with php 7.2 and when I use get_the_content() or get_the_excerpt() outside of a single template, in the functions.php for example, I get the following Warning: Warning: count(): Parameter must be an array or an object that implements Countable in /Applications/MAMP/htdocs/wordpress/wp-kona/wp-includes/post-template.php on line 284 What's wrong with it? Is it a wordpress core bug? Am I missing something.
Category: Web

Warning message (re. php) on the blog page

I've got a message below (the part "xyz/blog-name.com" was changed). That error message is not because of a Plug-in, as the message doesn't disappear even I stop all Plug-ins. "Warning: Use of undefined constant php - assumed 'php' (this will throw an Error in a future version of PHP) in /home/xyz/blog-name.com/public_html/wp-content/themes/stingerplus-child/st-footer-content.php on line 20" The line 20 in my wp currently reads as fallows; <a href="<?php//echo esc_url( home_url( '/' ) ); ?>"><?php// bloginfo( 'description' ); ?></a> Can anyone please advise …
Category: Web

I have this error notice 'wp_enqueue_script was called incorrectly' in my plugin

I have read all the previous posts about this but can't seem to get my head around what is wrong with my code. This is in a plugin that I have written. I thought I had it sorted but looks like I haven't is it the order in which I am calling these? function gedshow_ajaxurl() { echo '<script type="text/javascript"> var ajaxurl = "' . admin_url('admin-ajax.php') . '"; </script>'; } add_action('wp_head', 'gedshow_ajaxurl'); wp_enqueue_script('jquery'); add_action('admin_menu', 'gedshow_setup_menu'); function mw_enqueue_color_picker( $hook_suffix ) { // …
Category: Web

Word press and PHP error caused these errors

Warning: Declaration of Thesis_Comment::start_lvl(&$output, $depth, $args) should be compatible with Walker::start_lvl(&$output, $depth = 0, $args = Array) in /data/25/0/30/26/30678/user/31318/htdocs/dkbinc.net/wp-content/themes/thesis_16/lib/functions/comments.php on line 0 Warning: Declaration of Thesis_Comment::end_lvl(&$output, $depth, $args) should be compatible with Walker::end_lvl(&$output, $depth = 0, $args = Array) in /data/25/0/30/26/30678/user/31318/htdocs/dkbinc.net/wp-content/themes/thesis_16/lib/functions/comments.php on line 0 Warning: Declaration of Thesis_Comment::start_el(&$output, $comment, $depth, $args) should be compatible with Walker::start_el(&$output, $object, $depth = 0, $args = Array, $current_object_id = 0) in /data/25/0/30/26/30678/user/31318/htdocs/dkbinc.net/wp-content/themes/thesis_16/lib/functions/comments.php on line 0 Warning: Declaration of Thesis_Comment::end_el(&$output, $comment, $depth, $args) should be …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.