• Resolved yepecece

    (@yepecece)


    Is there a way to add a filter that will disable the use of custom permalink for pages.

    When updating a page, it automatically adds a permalink in “post type permalinks” which results in 404 when accessing some terms nested under that page.

    If I delete the automatically added permalinks everything goes back to normal.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi @yepecece

    Why don’t you try to add the separate structure for the Page? so, the permalink doesn’t goes wrong.

    Let’s suppose, if you are using the default permalink which may looks like this:
    /%category%/%postname%/

    so, you can define the permalink for page which may looks like this:
    /%postname%/

    It’s upto you, how you need to structure your permalink. You can easily separate the Permalink Structure from the Settings Page of the Plugin.

    Let me know, if you have any other question.

    Thanks,
    Sami

    Thread Starter yepecece

    (@yepecece)

    Hi Sami,

    thanks for you email.
    The permalinks for pages are setup to be /%postname%/
    So my page “About” is /about/
    and the for a couple of terms I need them to be under the “About” page like this:
    /about/term_name and /about/term_name/child_term_name

    I have customised the permalinks for those terms and it works fine, but as soon as the page “About” is updated a value is created on the “PostTypes Permalinks” page and all the terms links results in a 404. As soon as I delete the entry that was auto created it re-works.

    The strange part is that the “About” page has the same permalink structure (/about/) when being added by Permalink customizer”.

    Do you have any idea as to why is this happening and how it could be solved?

    Thanks.

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi @yepecece

    Sorry about the delay in responding to your query. I was busy with my projects so did’t get quite time to reply to your query. Hope, you can understand that.

    I don’t know why this is happening.. Would you like to have a skype call for discussing this issue or can you provide me your site access to investigate this?

    Regards,
    Sami

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi @yepecece

    To avoid creating permalinks for pages, you can use the filter as defined below:

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

    Note: page is the PostType name. You can exclude any other PostType as per your wish.

    Thanks,
    Sami

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Avoid creating permalinks for pages (via filter)’ is closed to new replies.