• Resolved syntaxart

    (@syntaxart)


    Hi,

    Currently you can add custom post types to the sitemap. In my case I am url rewriting and customizing the permalink generated from the custom post type. Is it possible to add an apply_filter function after you generate the permalink so that it can be re-built or amended with an external function such as apply_filter().

    For example on line 196 of the sitemap-builder you get the permalink but it would be great if we could modify this permalink from our functions.php file. Currently I can do this by adding an apply_filters() function just after this code. Then I can safely modify my permalink and return it back to be added to the sitemap.

    Some code as an example: [modified at line 196 of sitemap-builder.php]

    //Full URL to the post
    $permalink = get_permalink($post);
    
    $permalink = apply_filters('modify_sitemap_permalink', $permalink, $post);

    I hope this change could go in then I can feel comfortable upgrading the plugin when changes have been made.

    https://www.ads-software.com/plugins/google-sitemap-generator/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Customize the permalink in the sitemap-builder.php – using apply_filter()’ is closed to new replies.