oneblackcrayon
Forum Replies Created
-
@usamaazad99 My apologies for not replying sooner.
I have added the code snippet to my functions.php file and there is not a change.
I have alsocleared permalinksand no visible change.
Is there another method for triggering the function to work that I have not tried?Hello,
The following code DOES work in a MU-Plugin file for some reason (perhaps creating a new post & re-saving the Settings > Permalinks and/or cleaning transients) but not for any other custom post type when duplicating and changing parameters:add_filter( 'fb_og_enabled', 'disable_fb_og_for_custom_post_type', 10, 1 );
function disable_fb_og_for_custom_post_type($post) {
if ( 'custom-post-type' === $post->post_type ) {
return false;
}
}Yet, this fails if I attempt to use it for any other custom post type when used in a MU-Plugin file or the Functions file :
add_filter( 'fb_og_enabled', function ( $status ) {
global $post;
if ( 'custom_post_type_2' === $post->post_type ) {
return false;
}
return $status;
} );
// OR
add_filter( 'fb_og_enabled', 'disable_another_fb_og_for_custom_post_type', 10, 1 );
function disable_another_fb_og_for_custom_post_type($post) {
if ( 'custom-post-type_2' === $post->post_type ) {
return false;
}
}Any ideas?
- This reply was modified 7 months, 1 week ago by oneblackcrayon.
I tried using this function in my functions.php and a mu-plugin.php file with no success.
Does the following modified code prevent the function from working?add_filter( 'fb_og_disable', function ( $fb_og_disable ) {
global $post;
if ( 'custom_post_type' === $post->post_type ) {
return false;
}
if ( 'custom_post_type_2' === $post->post_type ) {
return false;
}
return $fb_og_disable;
} );Thank you for your reply and action to forward this message to the Technical Team.