Hi,
I’m not totally surewhat you want but the following snippet will exclude all pages from the default featured image.
<?php
/**
* Don't show DFI on pages posttype
* https://wordpress.org/support/topic/featured-image-only-on-posts/
*/
function dfi_support_no_pages ( $dfi_id, $post_id ) {
$post = get_post($post_id);
if ( 'page' === $post->post_type ) {
return 0; // false image id
}
return $dfi_id; // the original featured image id
}
add_filter( 'dfi_thumbnail_id', 'dfi_support_no_pages', 10, 2 );
create a file in wp-content/mu-plugins/dfi_support_no_pages.php And paste this code inside.
(mu-plugins folder might not exist yet)
Hi,
Did this work?
For now I’m setting this issue to resolved.
it wont work, error code
still showing https://saham.news/submit
Any idea how to disable the featured image on all pages by feature only or code php?
I found this thread by googling this exact issue. Your code worked for me Jan, thank you very much!
Is this something that could be easily implemented with a future update? A checkbox to change this feature would be great for folks who aren’t comfortable with code
Hi @sahamdotnews,
Sorry for the late replay I was unavailable.
You say you get an error, can you share the exact error message?
The code I provided should exclude all pages.
@keezie Good to hear this worked.