‘Attempt to modify property of non-object’ warning

Some simple php, check if it’s set before trying to unset it. function my_filter_plugin_updates( $value ) { if( isset( $value->response[‘duplicator/duplicator.php’] ) ) unset( $value->response[‘duplicator/duplicator.php’] ); //Duplicator return $value; } add_filter( ‘site_transient_update_plugins’, ‘my_filter_plugin_updates’ );

WordPress Page Restrict

You can check for if a user is logged in or not by is_user_logged_in() if logged in then show the page if not then redirect them. Perfect hook to use for this template_redirect. Example function check_and_redirect(){ if( is_page( 45 ) && !is_user_logged_in() ) { wp_redirect( wp_login_url() ); exit(); } } add_action(‘template_redirect’, ‘check_and_redirect’); is_page() is used … Read more

How do you Permanently Delete Sidebars

Thanks for the comment @Rarst! That was the issue. For whatever reason I had that extra sidebar method call in there and that was causing the problem. register_sidebar( array( ‘name’ => ‘Sidebar’ ) ); register_sidebar( array( ‘name’ => ‘Sub Menu’ ) ); WordPress saves the data from the widgets in the DB but it doesn’t … Read more

Impossible to call wordpress function inside an include?

I’ve had this problem in past try using include with locate_template: I don’t exactly remember the reason but this code still works: Example: include(locate_template(YOUR_TEMPLATE_PATH)); Here’s a complete demonstration too, using the same idea, if you need more help. For Admin Panel include simply works in admin panel. You might want to modify your code like: … Read more

How to create an onclick event on an image in a post?

Without specifics, in general, the page code that is output is generated by your theme code. So you would need to look into the theme’s template that is used for that page. The template used is determined by the WordPress Theme Heirarchy , details are here: https://developer.wordpress.org/themes/basics/template-hierarchy/ ; take a look at the graphic which … Read more

How to load parent theme template parts in child theme

From the WordPress documentation on child themes (Referencing or Including Other Files): To reference the parent theme directory, you would use get_template_directory() instead. Therefore, in your child theme, you could include your parent template file like this: <?php include get_template_directory() . ‘/template_parts/layouts/profile/profile-modern.php’; ?>