Why is my array_diff usage breaking things?

You’re getting the Fatal Error because array_diff() is comparing the WP_Term objects in your array to a string, and it can’t do that. Here’s one way to fix that: Replace $topic = array_diff($topic, [“expired”]); with: $my_topic = array(); foreach ( $topic as $term ) { if ( ‘expired’ !== $term->slug ) { // Adds $term … Read more

kali php problem [closed]

The use of curly braces ({}) in accessing an array index or string offset was deprecated in PHP 7.4 and later versions. You need to use square brackets ([]) instead. Update the code on line 82 (or there about) in call.php to fix the offending use of {}.

notify users when changed database

I don’t want Ajax request to be sent every 2 seconds. Is there a way to send me a notification only if the database changes in a certain meta? You can’t watch the database for changes like this. The most you could do is add filters on post meta changes on the PHP side to … Read more

A better way to write this php function

This answer is completely based on the code and help from -KIKO Software. I did have to add in the global ‘$current_user’ for it to work correctly. Also, per @kikosoftware foresight, I added a means to track by year, just in case a user did not visit the site until the same quarter the following … Read more

base64_encode conflict with convert_smilies in wordpress

Here’s the code from formatting.php if ( get_option( ‘use_smilies’ ) && ! empty( $wp_smiliessearch ) ) { // HTML loop taken from texturize function, could possible be consolidated. $textarr = preg_split( ‘/(<.*>)/U’, $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // Capture the tags as well as in between. $stop = count( $textarr ); // Loop stuff. The problem … Read more