• Resolved jonitoi

    (@jonitoi)


    Hi,

    Fantastic plugin!

    I would like to disable the Custom Permalinks functionality for the standard post type and categories, but keep it for pages.

    This would mean the Custom Permalinks edit field wouldn’t appear on the post edit page, and none of the Custom Permalinks functions would fire when viewing/editing posts or categories.

    Is it possible to do this using remove_filter() and remove_action()?

    If so, which filters/actions need to be disabled?

    Many thanks,

    Jon

    • This topic was modified 7 years, 4 months ago by jonitoi.
Viewing 13 replies - 1 through 13 (of 13 total)
  • Hi, I join your question, I have exactly the same need to use custom permalinks only for pages

    Thread Starter jonitoi

    (@jonitoi)

    I should add that I’d like to do this to prevent users from setting the categories in the URL manually – it should be governed by the post category, as default in WordPress.

    • This reply was modified 7 years, 4 months ago by jonitoi.
    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi @jonitoi @vblank

    Does you guys only wants to remove edit functionality for Post Permalinks due to the complete URL Edit or does there any other point as well?

    Please elaborate them if have.

    Regards,
    Sami

    Thread Starter jonitoi

    (@jonitoi)

    Hi Sami,

    Thanks for the quick reply.

    What do you mean by complete URL edit?

    Best regards,

    Jon

    Thread Starter jonitoi

    (@jonitoi)

    Hi Sami,

    I just want to disable all Custom Permalinks functionality for posts and categories, and keep it on for pages.

    Is that possible?

    Thanks,

    Jon

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi Jon,

    This is not possible at this time but i’ll a filter by which you can exclude whenever you want.

    Thanks,
    Sami

    Thread Starter jonitoi

    (@jonitoi)

    Thanks Sami ??

    When do you plan to make the filter available?

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    @jonitoi Filter is available now in the version 1.2.6

    
    function yasglobal_exclude_post_types( $post_type ) {
      if ( $post_type == 'custompost' ) {
        return '__true';
      }
      return '__false';
    }
    add_filter( 'custom_permalinks_exclude_post_type', 'yasglobal_exclude_post_types');
    

    Permalinks of the old posts or which has been created/updated before applying the filter is excluded in it.

    Thanks for your query and stay tuned with us.

    Regards,
    Sami

    Thread Starter jonitoi

    (@jonitoi)

    Amazing, thank you Sami!

    Will try this out asap.

    Have a good day ??

    Works perfectly thank you very much !

    Thread Starter jonitoi

    (@jonitoi)

    Hi Sami,

    So, I need to use the ‘yasglobal_exclude_post_types’ function above, and in $post_type == ‘custompost’, I replace custompost with the post type I want to exclude, is that right?

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi @jonitoi

    Yes, you are right ??

    Hope, it works for you.

    Regards,
    Sami

    Thread Starter jonitoi

    (@jonitoi)

    Thanks Sami ??

    I’ll use $post_type == ‘post’.

    Kind regards,

    Jon

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Disabling Custom Permalinks by Post Type?’ is closed to new replies.