• Resolved KD35

    (@kd35)


    add_filter('wpseo_title', 'my_seo');
    function my_seo($title) {
    	$title = str_replace('-', ' ', $title);
    	return $title;
    }

    I wrote that little code but I want it to affect ONLY attachment pages, I run a gallery site so a lot of my images have – which Id rather replace with blank space. But when I run this code, it changes for all pages on my site, I want this code to only activate on the attachment pages.

    I know I have to use an IF statement(right?) but I am, stuck there, please assist.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘If page is attachment, THEN run this code’ is closed to new replies.