After switching to PHP8 you might encounter the following warning:
PHP Warning: Attempt to read property "ID" on null in .../zip-recipes/class.ziprecipes.php on line 1569
Here is a quick fix to check whether $post has set prior to access its properties.
--- class.ziprecipes.org.php 2022-10-11 09:50:30.928611488 +0200
+++ class.ziprecipes.php 2022-10-11 09:55:14.265627257 +0200
@@ -1566,7 +1566,7 @@
$recipe_json_ld = array();
// get recipe id - limitation: only 1 recipe is supported
- if (Util::has_shortcode($post->ID, $post)){
+ if (isset($post) && Util::has_shortcode($post->ID, $post)){
// Find recipe
$recipe = new Recipe(false, $post->ID);
$recipe_json_ld = $recipe->jsonld();
Cheers!
]]>First off, love the plug-in, does exactly what it says without extra bloat.
Now, the reason I made this topic. On our site we’ve disabled the WP cron and made an actual cronjob on the server. This cronjob is currently showing a repeated PHP notice.
See below the notice:
PHP Notice: Trying to access array offset on value of type null in /wp-content/plugins/theme-switcha/inc/plugin-core.php on line 81
Currently this line is this:
if (!$options['enable_plugin']) return $current;
I believe this notice can be prevented if this is changed to:
if (!isset($options['enable_plugin']) || !$options['enable_plugin']) return $current;
Could this please be implemented?
Kind Regards,
JJ
Fatal error: Cannot use isset() on the result of an expression (you can use “null !== expression” instead) in /home/…/public_html/plugins/content-aware-sidebars-admin/admin_bar.php on line 135
I had to go into my c-panel to access the php file and edit line 135 from:
if (isset(self::DOCS_MAP[$module->get_id()])) {
to
if (null !== (self::DOCS_MAP[$module->get_id()])) {
I’m not sure if this change breaks anything else, but my site is loading for now.
Please update the plugin to avoid this error in your next release.
Thank you.
]]>https://nsa40.casimages.com/img/2020/08/18//200818085559897740.png
a PHP error that completly crash my website.
i think this is caused by a deprecied function.
Regards
]]>I would like to write a condition with ‘isset’. It works:
if ( isset( $_GET['fwp_hidden_tags'] )
but I also want to include “=gdgb”. How do I write this?
]]>function exclude_tagged_posts( $query ) {
if ( $query->is_main_query() && $query->is_home() ) {
$query->set( 'tag__not_in', array( 404 ) );
}
}
add_action( 'pre_get_posts', 'exclude_tagged_posts' );
It excludes posts with a tag with ID = 404 from the search. Now, I would like to call a function from the address bar that only displays tags with ID = 404. How to do that? All I know is that you have to use a condition:
is_home() && isset( $_GET['function_name'] )
Right?
]]>My code suddenly creates problems. When I save the page wordpress crashes und I get a text only page with zero style elements – like you open a text page in your browser.
One the frontend the page renders – but the side panel is missing.
I found the backend troublemaker, but I wonder why.
Bad code:
<?php
if(isset($_POST['imodel'])){ $mod = $_POST['imodel']; } ELSE {$mod = 'iPhone Xs'; $linkinsert ='iphone-xs';}
if(isset($_POST['imemory'])){ $mem = $_POST['imemory']; } ELSE {$mem = '64';}
if(isset($_POST['curr_option'])){$curr_option = $_POST['curr_option']; } ELSE {$curr_option = 'USD';}
Changed and working in backend:
<?php
if(!empty($_POST['imodel']) || !empty($_POST['imemory'])){
$mod = 'iPhone Xs'; $linkinsert ='iphone-xs'; $mem = '64';
}
if(isset($_POST['curr_option'])){$curr_option = $_POST['curr_option']; } ELSE {$curr_option = 'USD';}
However, in the frontend the side-panel still disappears on reload.
Need to add that the bad code did run in PHP 5.6 (or previous WP version) without problem.
]]>add_filter( 'yikes-mailchimp-filter-before-submission', 'maybe_supply_FNAME_to_merge_field', 10, 1 );
function maybe_supply_FNAME_to_merge_field( $merge_fields ) {
if ( empty( trim( $merge_fields['SALUTATION'] ) ) && ! empty( $merge_fields['FNAME'] ) ) {
$merge_fields['SALUTATION'] = $merge_fields['FNAME'];
}
return $merge_fields;
}
It turns out that the expression
empty( trim( $merge_fields['SALUTATION'] ) )
always returns TRUE, whether the subscriber has entered a value in the SALUTATION field of the form or not.
I have confirmed that the merge field SALUTATION is correctly set in the Yikes form
I have also tried the expression:
!isset( $merge_fields['SALUTATION'] )
with the same result.
So how to fix that?
]]>I’m trying to check if am variable is set in GET method but if(isset($_GET['thread_id']))
not working because wordpress link is: https://beta.onemillionnights.com/chat/?thread_id=57 and / before ? in link stops execution of the isset function?
How can fix it?
Thanks
Warning: Illegal offset type in isset or empty in /home/mydomain/example.com/public_html/wp-includes/plugin.php on line 211
Warning: Cannot modify header information - headers already sent by (output started at /home/mydomain/example.com/public_html/wp-includes/plugin.php:211) in /home/mydomain/example.com/public_html/wp-includes/pluggable.php on line 1174
Every time I try to save changes made to the plugin on settings page, I get the above errors. I’m not sure if this is a plugin conflict or not. Just letting you know.
]]>