How to get rid of undefined variable in previous post image

I am working on a website on WordPress and I have it set to where the bottom of the post will automatically link to a random previous post with a picture from that previous link but a notice keeps popping up on the bottom. It says there is something wrong with the previous post image url but the website sets this automatically and it works for all my other posts. Since it is undefined should I try to define it …
Category: Web

Send specific users an email when posts are published

I've got the following code, which is supposed to run when a new post is published for the first time, check if a custom field 'specific_users' has data (this uses Advanced Custom Fields), and if so, send an email to each of the selected users. /** * Send users a notification of new grower posts */ function notify_growers($post) { // Only notify for grower posts if ( $post->post_type != 'grower_posts' ) return; $post_id = $post->ID; // ...run code once if …
Category: Web

How to enable error logs and debug mode in WordPress using Azure Cloud?

I am using Azure Cloud, multisite WordPress and have enabled these codes in wp-config.php file. // Enable WP_DEBUG mode define( 'WP_DEBUG', true ); // Enable Debug logging to the /wp-content/debug.log file define( 'WP_DEBUG_LOG', true ); // Disable display of errors and warnings define( 'WP_DEBUG_DISPLAY', true ); @ini_set( 'display_errors', 0 ); // Use dev versions of core JS and CSS files (only needed if you are modifying these core files) define( 'SCRIPT_DEBUG', true ); But there is no change. It shows …
Category: Web

Error on add_submenu_page() declaration

Was called incorrectly. The seventh parameter passed to an add_submenu_page() should be an integer representing menu position. Please see Debugging in WordPress for more information. (This message was added in version 5.3.0.) in /home3/prombooking/listandlink.com/wp-includes/functions.php on line 4986
Category: Web

Wordpress website working fine on localhost but not displaying front pages on webhost

The website works perfect on my localhost. I used duplicator plugin to upload it on my web-host. Database connections are established since mywebsite.com/wp-admin works perfect. I can login the wordpress wp-admin panel and all the plugins, pages, posts are there and are editable. Also the permalink on the homepage shows as http://mywebsite.com But when I open my website I see an absolutely blank page. There is no code in inspect element or no errors in console log. Website can be …
Category: Web

How to display only specific Error types in debug.log? No notices, warnings, etc

I can't find the right way to make it work. I tried many things, like putting this in wp-config.php define('WP_DEBUG', true); define('WP_DEBUG_DISPLAY', false); define('WP_DEBUG_LOG', 'wp-content/themes/mytheme/mylog.log' ); // yeah, customized it a bit. It logs everything ini_set('error_reporting', E_ERROR ); also tried to set it in the php.ini on various websites i manage. Not on managed hosting. Or at least not on the well known international ones. Can it be server side or syntax error, or not even possible what i want? …
Category: Web

error log is going to the wrong location, WP_DEBUG_LOG is ignored

My WordPress error log is going to /var/log/php-fpm/www-error.log. That's not where I want it. In fact, it took me too long to figure that out. (I'm new to WP and PHP). I've tried to redirect it with the following in my wp-config.php define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', '/var/www/html/wordpress/wp-content/wp-errors.log' ); error_log("hello from wp-config\n"); but it has no effect. This code is placed before/above the "stop editing" warning. I've tried other log file locations like /tmp, still, my WP_DEBUG_LOG setting is …
Category: Web

Finding which functions were called

Is there a way to see a trace of the list of functions called when I go to a certain page? Say I click on the "Register" button on my Wordpress page. It will probably call a set of both inbuilt and plugin functions before actually loading the page right? How do I see which functions are called and possibly in which files those functions are located? It will really help me customize my Wordpress theme the way I want.
Category: Web

How do I fix wp-admin error when exporting reusable blocks?

I am having trouble with the export to json feature of the reusable blocks shown below. I am getting the following console errors after pressing the export to json link: Access to fetch at 'https://public-api.wordpress.com/wp/v2/types/wp_block?_locale=user' from origin 'https://mytestsiteXXXXX.wordpress.com' has been blocked by CORS policy: Request header field x-wp-nonce is not allowed by Access-Control-Allow-Headers in preflight response. GET https://public-api.wordpress.com/wp/v2/types/wp_block?_locale=user net::ERR_FAILED Uncaught (in promise) {code: 'fetch_error', message: 'You are probably offline.'} It has been a while since I have used WP.com, so …
Category: Web

Unable to get WP_DEBUG, WP_DEBUG_DISPLAY, WP_DEBUG_LOG to work

I've got the proper debugging constants defined in wp-config.php: define('WP_DEBUG', true); define('WP_DEBUG_DISPLAY', true); define('WP_DEBUG_LOG', true); But they're not doing a darn thing. When I output something to the log file from my plugin (even without testing for WP_DEBUG === true) like this nothing happens on-screen and there's no debug.log to be found either: error_log('test!'); I'm sure that part of the code in the plug is being executed. What gives? I'm using WP 3.6.1. Thanks.
Category: Web

How to monitor server for error establishing a database connection

I know there are tools like pingdom.com and uptimerobot.com that will monitor your site and let you know if they're down, but I find that my WordPress site is experiencing the dreaded "error establishing a database connection" more often than desired, and I'd like to get some sort of notification when that happens (but not in the form of a user complaint!). Pingdom and Uptimerobot do not consider that an error, and thus do not push any notifications. Are there …
Category: Web

(Xdebug Profiler) Why are there two cachegrind files generated for one page?

When I enable xdebug profiler, open a page in admin, it generates two cachegrind files with almost identical name cachegrind.out.1498219635_761795.crown__minilio_wp-admin_edit_php cachegrind.out.1498219639_141988.crown__minilio_wp-admin_edit_php The output name is defined as xdebug.profiler_output_name = "cachegrind.out.%u.%H_%R" I tried another page, got the same result. Why is that? Which file should I analysis?
Category: Web

Solution to White Screen of Death that does not require Web Server access?

I'm working on a live website, updated a plugin and got the dreaded White Screen of Death. I know exactly how to resolve the problem; simply deactivate or delete the plugin I upgraded. The problem is I cant access the WordPress Dashboard to deactivate or delete the plugin. The WSD occurs in /wp-admin aswell. To make things worse the owner doesn't know their web server login credentials so I cannot just FTP or CPanel in and delete the plugin that …
Category: Web

Changes to WordPress database using phpMyAdmin not reflected on blog

I am updating my database using the phpMyAdmin UI and the changes are not reflected on the WordPress blog. The reason for doing this is when some changes were made recently to the blog the site hanged and was looking at reverting the code changes from the database side. When updating a blog using the WordPress admin dashboard i am able to update it. But not able to update it from the back-end database. I have disabled the plugins and …
Category: Web

How do you change error reporting to only show errors in WordPress?

I'm working on a development site that has some plugins that produce notices. It's a bit annoying during development when you only want to see the errors your own code produces. How can you turn off notices in WordPress but keep reporting of errors enabled? I thought this should work, but it doesn't: define( 'WP_DEBUG', true ); error_reporting(E_ALL & ~E_NOTICE); Edit: I should point out that I added this code to the wp-config.php, just to be clear.
Category: Web

Unable to get a simple plugin admin page to work

Even though I have years of software development experience, I am new to WP & PHP development, so please bear with me. After reading through the plugin manual, I started with a WP plugin boiler plate, made all the required field and name changes, added a custom capability, and, as a first real functionality, tried to add a simple admin interface for the plugin like so: <?php class Plugin_Name_Admin { // some code ommitted, the actual code uses my plugin's …
Category: Web

Can't get rid of JQMIGRATE: Migrate is installed, version 3.3.2. Manually updated all the libralies and site. 5.8.2

Answers I found here are about the older versions of WordPress when it were transitioning into a new version of jQuery. (This is version 5.8.2) Since the one from WordPress is not logging active, I put <script src="https://code.jquery.com/jquery-migrate-3.3.2.js"></script> and manually checked each page. I fixed the bind/unbind, onload, onclick deprecated functions until no warnings shows up on console. After I removed my script tag and put WordPress's JQmigrate back (I had a plugin disabled WordPress's JQmigrate) it's still showing up …
Category: Web

strange characters in debug file

recently I get a weird log in WordPress debug file [09-Dec-2021 20:26:57 UTC] 03AGdBq27pjsLRdeIVXfN_q2XMOOFf1OY3rFj5GIEfJHVBrzTHplTE0-zMSneSJVhmFP_jRq37J59JWGUYLOUKt3zv8PLs0c8eU7Gb6xaIO_7DZpFVMVkJoK7_BkaW1rxG8bl03zMKeBkrkHIt0115t9QQmI_vO3Y3l1pvpF58P1GEtQase2IX7BUCd-gx4BiMNsNvZ5ImHcPQUuJKeqpXQffMi2cjPI_-YBYABv1U6GTEEAN8ZIoPZmpNPnXxbuI0IWBRFlCOB91G38MwrW3Fq5GN6sRtHR26IW0Tv-7gGCYHZKyVnwbhI9DI7ibMp80GBiadKIF-X2NLSmfvQZR5foXXF6PzJBI_RZL666kr0OHROY0hM7v2mMQReCaR00pRLbQhBSSC0abNF2EEvC4fftxqfu3582Gfgff3WWtwW7KcZaV1sPumTX5deBsI1hr1YzuvIWMweWAUbxMnfbI2ijDZ1H9DzENDja5vRZrqubWmUx4K5QCrDzk do you have any idea where is it come from?!
Category: Web

Notice on core function

I have this weird error (I guess) since this morning in my logs : [23-Nov-2021 14:46:50 UTC] PHP Notice: Undefined offset: 3322309 in ..../wp-includes/class-wp-query.php on line 3275 Where the 3322309 is increasing for no reason. I see this in my PHP logs, but it's increasing even if my server are down. This is the code concerned
Category: Web

Debugging JS errors

I'm struggling with this error and would appreciate some help. Wordpress with the MasterStudy theme and then MasterStudy LMS plugin. Elementor on top. Everything up to date. I have a caching plugin, but it's deactivated. Cloudflare on top. https://www.swingdancehome.com/en/all-courses/solo-jazz-english-spanish/ When I click on "Curriculum" I should see all the classes. Equally, when going back to "Overview" the content disappears as well. I'm not an experienced coder yet, so struggling how I could fix this. I do see erros in the …
Category: Web

About

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