Severe issue – not displays attachment page image after uninstall
-
Hello, I tested the plugin on a child theme and a block editor. It worked fine until I decided to uninstall it (I tested its options – I liked it). After uninstalling the plugin, all featured images on attachment pages stopped showing. Before installing plugin attachment pages works well. It only happens within the child theme. As soon as I use the parent theme, everything is ok. I downloaded the plugin as a standalone and had its code reviewed by AI. It didn’t find anything that would help. So after uninstalling the plugin, you need to add a code to the function.php file that returns the object id, if we are on the attachment page.
add_filter( 'get_post_metadata', function( $value, $object_id, $meta_key, $single ) {
// Check if WordPress is requesting the featured image (_thumbnail_id) for an attachment type
if ( '_thumbnail_id' === $meta_key && 'attachment' === get_post_type( $object_id ) ) {
return $object_id; // Return the attachment's own ID as its featured image
}
return $value;
}, 10, 4 );The strange thing is that restoring the system files from a backup including the database didn’t help either(not sure if backup not affected yet). Maybe its something changed in JSON? This code is currently the only solution to display images on attachment pages after uninstalling the plugin. (For sure, I deleted all content from child function.php and it did not help either. )
- This topic was modified 6 months, 3 weeks ago by . Reason: additional info
- This topic was modified 6 months, 3 weeks ago by . Reason: corrected
- This topic was modified 6 months, 3 weeks ago by . Reason: clearing
- This topic was modified 6 months, 3 weeks ago by . Reason: correct meaning in title, template>attachmnet
- This topic was modified 6 months, 3 weeks ago by . Reason: Added info
The topic ‘Severe issue – not displays attachment page image after uninstall’ is closed to new replies.