?f ( $post->post_type == 'customposttype') not working?
-
Im trying to add the following code to function.php
without the “if ( $post->post_type == ‘customposttype’){ ” it works fine but it effects all the post types. I want this to only occure on one custom posttype.
Thank you.
function my_custome_slug($title){ global $post;
if ( $post->post_type == ‘customposttype’) {
return str_replace(‘*’, ‘-‘, $title); }
}
add_filter(‘sanitize_title’, ‘my_custome_slug’);
- The topic ‘?f ( $post->post_type == 'customposttype') not working?’ is closed to new replies.