• i am trying to change the permalink structure on my blog , i have successfully implemented , the permalink has changed but it redirects to a 404 page.

    check code.

    add_filter('post_link', 'rating_permalink', 10, 3);
    add_filter('post_type_link', 'rating_permalink', 10, 3);
    
    function rating_permalink($permalink, $post_id, $leavename) {
    	if (strpos($permalink, '%monthname%') === FALSE) return $permalink;
    
            // Get post
            $post = get_post($post_id);
            if (!$post) return $permalink;
    
            // Get taxonomy terms
            $month= strtolower(get_the_time('M', $post->ID));	
    
    	return str_replace('%monthname%', $month, $permalink);
    }

Viewing 1 replies (of 1 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    All that code does is to change the permalink that is output. It doesn’t actually make the permalink work in any real meaningful way.

    You’ll need to hook into the rewrite system to parse the URLs and return the correct query variables to retrieve the data.

Viewing 1 replies (of 1 total)
  • The topic ‘Changing Monthnum to Monthname in Permalink’ is closed to new replies.