WordPress.org

Make WordPress Core

Ticket #22338: 22338-sw.diff

File 22338-sw.diff, 974 bytes (added by simonwheatley, 3 years ago)

Adds a filter to get_sample_permalink

  • class-post-public.php

    diff --git a/class-post-public.php b/class-post-public.php
    index a22b559..c349db4 100644
    a b class Babble_Post_Public extends Babble_Plugin { 
    111111                $this->add_filter( 'post_link', 'post_type_link', null, 3 ); 
    112112                $this->add_filter( 'post_type_archive_link', null, null, 2 ); 
    113113                $this->add_filter( 'post_type_link', null, null, 3 ); 
     114                $this->add_filter( 'get_sample_permalink', null, null, 5 ); 
    114115                $this->add_filter( 'single_template' ); 
    115116                $this->add_filter( 'the_posts', null, null, 2 ); 
    116117                 
    class Babble_Post_Public extends Babble_Plugin { 
    773774                return user_trailingslashit( $post_link ); 
    774775        } 
    775776 
     777        function get_sample_permalink( $permalink, $title, $name, $id, $post ) { 
     778                $permalink[ 0 ] = $this->post_type_link( $permalink[ 0 ], $post, $leavename ); 
     779                return $permalink; 
     780        } 
     781         
    776782        /** 
    777783         * Hooks the WP page_link filter to ensure correct virtual language directory prefix, etc. 
    778784         *