• Hi guys whatever I try I can’t seem to remove the front base from the slug. I’m using the plugin (not code in functions.php) with settings without front base (of course). I’ve checked and even in the export file it says "rewrite_withfront":"false" it’s a mystery!

    Thanks for any help,

    Nick

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Good day Nick,

    Just out of curiosity, in case it is somehow playing a part, have you flushed your permalinks? We try to do that ourselves, but it never hurts to manually force it as well.

    What permalink setting are you using?

    Are you willing to send your export data to me so that I could register the post type on my own and see if anything stands out?

    Thread Starter Nick van de Veerdonk

    (@nmvdvjr)

    Hi Michael thank you for your swift reply!

    Got them pretty permalinks (/postname) and yes I’m flushing like a madman ??

    Thanks again!

    Debug:

    ### Begin Custom Post Type UI Debug Info ###

    Multisite: Yes

    SITE_URL: https://wordpresswebsite.amsterdam
    HOME_URL: https://wordpresswebsite.amsterdam

    WordPress Version: 4.9.1
    Permalink Structure: /%postname%/
    Active Theme: Parallax jaaadesign 9999

    Registered Post Types: post, page, attachment, revision, nav_menu_item, custom_css, customize_changeset, oembed_cache, acf-field-group, acf-field, nf_sub, product, product_variation, shop_order, shop_order_refund, shop_webhook, vc4_templates, portfolio_page, vc_grid_item, plugin_filter, plugin_group

    PHP Version: 5.6.33
    MySQL Version: 5.5.5
    Web Server Info: Apache/2

    Show On Front: page
    Page On Front: Home (#5)
    Page For Posts: (#0)

    WordPress Memory Limit: 3000MB

    TOTAL PLUGINS: 181

    MU PLUGINS: (1)

    Plugin Organizer MU: 9.3.4

    ACTIVE PLUGINS: (41)

    Advanced Custom Fields: Font Awesome: 2.1.0
    Advanced Custom Fields PRO: 5.5.14
    Column Shortcodes: 1.0
    Custom Post Type UI: 1.5.6
    Duplicate Post: 3.2.1
    Easy Smooth Scroll Links: 2.1.1
    Font Awesome 4 Menus: 4.7.0
    Genesis 404: 1.5.0
    Genesis Extender: 1.8.1
    Genesis Simple Edits: 2.2.0
    Headroom.js: 0.1
    Import External Images: 1.4
    More Privacy Options: 4.6
    New Blog Templates: 2.8.5
    New RoyalSlider: 3.3.5
    Ninja Forms: 3.2.8
    Optimize Database after Deleting Revisions: 4.4.2
    Page Links To: 2.9.9
    Photoswipe Masonry: 1.2.7
    PHP Text Widget: 1.0.8
    Plugin Organizer: 9.3.4
    Related Posts By Taxonomy: 2.3.2
    Simple Image Sizes: 3.1.1
    Simple Tooltips: 2.1.3
    Snapshot Pro: 3.1.4.1
    Superfly Menu: 4.3.3
    Table of Contents Plus: 1601
    WooCommerce: 3.2.6
    WooCommerce FreshBooks: 3.10.0
    WooCommerce PDF Invoices & Packing Slips: 2.1.3
    Wordfence Security: 6.3.22
    WordPress MU Domain Mapping: 0.5.5.1
    WPBakery Visual Composer: 5.2.1
    WP Featherlight: 1.2.0
    WP Google Analytics Events Pro: 2.2.6
    WP Google Fonts: v3.1.4
    WP Menu Cart Pro: 3.0.4
    WPMU DEV Dashboard: 4.3.2
    WP Smush Pro: 2.7.4.1
    Ye Olde Text Widget: 1.0.1
    Yoast SEO Premium: 4.9

    INACTIVE PLUGINS: (140)

    ACF Enhanced Message Field: 1.1.1
    ACF Options page: 1.0
    Active Plugins: 1.7
    Add From Server: 3.3.3
    AddQuicktag: 2.5.2
    Admin Columns – Advanced Custom Fields add-on: 1.3.5
    Admin Columns – WooCommerce add-on: 1.4
    Admin Columns Pro: 4.0.5
    Admin Quick Jump: 1.4
    Advanced Custom Fields: 4.4.12
    Ajax Search Lite: 4.7.12
    Ajax Search Pro: 4.9.7
    AMP: 0.5.1
    AMP Author Box: 1.0.4.1
    AMP footer widgets: 1.0.6.1
    AMP Recent Posts: 3.1.1
    AMP Related Posts: 2.2
    AMP Social Share: 2.2.1
    amr shortcode any widget: 3.6
    AuthorSure: 2.3
    Better Search Replace: 1.3.2
    Breadcrumb NavXT: 6.0.3
    BuddyPress: 2.9.2
    Carousel Anything for VC: 1.8
    Cloner: 1.7.7
    Contact Form 7: 4.9.2
    Custom Dashboard Widget: 1.0
    Custom Related Products for WooCommerce: 1.3
    Default featured image: 1.6.1
    Display Posts Shortcode: 2.9.0
    Disqus Conditional Load: 10.2.3
    Easy Content Types: 2.8.1
    Facebook Comments Plugin: 2.3.6
    Favicon Rotator: 1.2.7
    Follow-Up Emails: 4.4.18
    Gallery Carousel Without JetPack: 0.7.5
    GC Testimonials: 1.3.2
    Genesis Connect for WooCommerce: 0.9.9
    Genesis Favicon uploader: .1.1b
    Genesis Grid: 1.4.2
    Genesis Responsive Slider: 0.9.6
    Genesis Simple Sidebars: 2.1.0
    Genesis Tabs: 0.9.4
    Genesis Toolbar Extras: 1.6.0
    Genesis Translations: 2.4.1
    Genesis Widgetized Footer: 1.4.0
    GilidPanel: 2.1
    Glue for Yoast SEO & AMP: 0.4.2
    Google XML Sitemaps: 4.0.9
    Hide Admin Menu: 2.1.5
    Hyper Cache: 3.3.4
    iframe: 4.3
    Juiz Last Tweet Widget: 1.3.6
    Juiz Social Post Sharer: 1.4.8
    Lazy Facebook Comments: 2.0.1
    Limit Post Revisions Network Option: 4.6
    Local Search SEO Contact Page: 2.1.7
    Login Redirect: 1.0.9
    Looader: 2.07
    Microdata Manager: 1.0.0
    Minit: 0.9
    MinQueue: 1.1.2
    Mobile Menu: 2.5
    Multisite Plugin Manager: 3.1.6
    New User Approve: 1.7.5
    Ninja Forms – File Uploads: 3.0.3
    Ninja Forms – Layout & Styles: 1.2.7
    Ninja Forms – Multi-Part Forms: 1.3.5
    Pinterest Pin It Button For Images: 1.1.0
    Pinterest RSS Widget: 2.3.1
    Popup contact form: 6.3
    Postman SMTP: 1.7.2
    Recent Tweets Widget: 1.6.8
    Regenerate Thumbnails: 3.0.1
    Resize Image After Upload: 1.8.3
    Royal PrettyPhoto: 1.3
    Scroll Back to Top: 1.1.3
    Sharpen Resized Images: 2.0
    Shortcoder: 4.1.4
    Simple Follow Buttons Plus: 1.0.1
    Simple Lightbox: 2.6.0
    Simple Local Avatars: 2.0
    Simple Share Buttons Adder: 7.3.10
    Simple Share Buttons Plus: 1.1.4
    Simple Social Icons: 2.0.1
    Simply Show Hooks: 1.2.1
    Social Circles: 0.9.2
    Social Media Feather: 1.8.4
    Special Recent Posts PRO Edition: 3.0.6
    Subscribe by Email: 3.5.4
    Tabs Shortcode: 2.0.2
    Templatera: 1.1.10
    TG Facebook Comments: 1.5
    UberMenu – Flat Skins Pack Extension: 3.0
    UberMenu – Sticky Menu Extension: 3.0
    UberMenu 3 – The Ultimate WordPress Mega Menu: 3.2.7
    UberMenu Icons: 3.2.4
    Ultimate Addons for Visual Composer: 3.16.16
    Ultimate Branding: 1.9.0.1
    Use Any Font: 4.7.3
    User Synchronization: 1.1.5.6
    Ustyle: 1.0
    Velvet Blues Update URLs: 3.2.7
    Widget Icon: 1.1.3
    WooCommerce Customer/Order CSV Export: 4.3.5
    WooCommerce Local Pickup Plus: 1.13.5
    WooCommerce PayPal Express Gateway: 3.7.2
    WooCommerce PayPal Pro (Classic and PayFlow Editions) Gateway: 4.4.7
    WooCommerce PDF Invoices: 3.3.0
    WooCommerce Product Add-ons: 2.8.0
    WooCommerce Quantity Increment: 1.1.0
    WooCommerce Review for Discount: 1.6.3
    WooCommerce Stripe Gateway: 3.2.2
    WooCommerce Subscriptions: 2.1.3
    WooCommerce Tab Manager: 1.8.2
    WordPress Importer: 0.6.3
    WP-CRM: 1.1.3
    WP-DBManager: 2.79.1
    WP-FFPC: 1.11.2
    WP-Invoice: 4.1.9
    WP-Invoice: PDF: 2.1.0
    WP-Invoice: Quotes: 2.0.0
    WP All Export Pro: 1.3.0
    WP All Import – ACF Add-On: 3.1.0
    WP All Import Pro: 4.3.0
    WP Better Emails: 0.3
    WP Google Analytics Events: 2.5.0
    WP Google Maps: 6.4.06
    WP Google Maps – Pro Add-on: 5.60
    WPML CMS Nav: 1.4.20
    WPML Multilingual CMS: 3.7.1
    WPML Sticky Links: 1.4.1
    WPML String Translation: 2.5.4
    WPML Translation Management: 2.3.1
    WPPC Front End Form Extension for ACF (Free): 1.0.20
    WP Sticky Menu: 1.1.0
    Yoast SEO: 6.0
    Yoast SEO: Local: 4.9
    Yoast SEO: WooCommerce: 4.9
    YoImages: 0.1.8

    NETWORK ACTIVE PLUGINS: (8)

    New Blog Templates :2.8.5
    More Privacy Options :4.6
    Optimize Database after Deleting Revisions :4.4.2
    Snapshot Pro :3.1.4.1
    Wordfence Security :6.3.22
    WordPress MU Domain Mapping :0.5.5.1
    WP Google Analytics Events Pro :2.2.6
    WPMU DEV Dashboard :4.3.2

    Post Types:
    {"portfolio_page":{"name":"portfolio_page","label":"Portfolio pages","singular_label":"Portfolio page","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","show_in_rest":"false","rest_base":"","has_archive":"false","has_archive_string":"","exclude_from_search":"false","capability_type":"page","hierarchical":"false","rewrite":"true","rewrite_slug":"","rewrite_withfront":"false","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"","supports":[],"taxonomies":[],"labels":{"menu_name":"","all_items":"","add_new":"","add_new_item":"","edit_item":"","new_item":"","view_item":"","view_items":"","search_items":"","not_found":"","not_found_in_trash":"","parent_item_colon":"","featured_image":"","set_featured_image":"","remove_featured_image":"","use_featured_image":"","archives":"","insert_into_item":"","uploaded_to_this_item":"","filter_items_list":"","items_list_navigation":"","items_list":"","attributes":""},"custom_supports":""}}

    Taxonomies:
    {"custom_related_posts":{"name":"custom_related_posts","label":"Custom related posts","singular_label":"Custom related post","description":"","public":"false","hierarchical":"false","show_ui":"true","show_in_menu":"true","show_in_nav_menus":"false","query_var":"true","query_var_slug":"","rewrite":"true","rewrite_slug":"","rewrite_withfront":"1","rewrite_hierarchical":"0","show_admin_column":"false","show_in_rest":"false","show_in_quick_edit":"true","rest_base":"","labels":{"menu_name":"","all_items":"","edit_item":"","view_item":"","update_item":"","add_new_item":"","new_item_name":"","parent_item":"","parent_item_colon":"","search_items":"","popular_items":"","separate_items_with_commas":"","add_or_remove_items":"","choose_from_most_used":"","not_found":"","no_terms":"","items_list_navigation":"","items_list":""},"object_types":["page"]}}

    Thread Starter Nick van de Veerdonk

    (@nmvdvjr)

    Post Types:
    {"portfolio_page":{"name":"portfolio_page","label":"Portfolio pages","singular_label":"Portfolio page","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","show_in_rest":"false","rest_base":"","has_archive":"false","has_archive_string":"","exclude_from_search":"false","capability_type":"page","hierarchical":"false","rewrite":"true","rewrite_slug":"","rewrite_withfront":"false","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"","supports":[],"taxonomies":[],"labels":{"menu_name":"","all_items":"","add_new":"","add_new_item":"","edit_item":"","new_item":"","view_item":"","view_items":"","search_items":"","not_found":"","not_found_in_trash":"","parent_item_colon":"","featured_image":"","set_featured_image":"","remove_featured_image":"","use_featured_image":"","archives":"","insert_into_item":"","uploaded_to_this_item":"","filter_items_list":"","items_list_navigation":"","items_list":"","attributes":""},"custom_supports":""}}

    Taxonomies:
    {"custom_related_posts":{"name":"custom_related_posts","label":"Custom related posts","singular_label":"Custom related post","description":"","public":"false","hierarchical":"false","show_ui":"true","show_in_menu":"true","show_in_nav_menus":"false","query_var":"true","query_var_slug":"","rewrite":"true","rewrite_slug":"","rewrite_withfront":"1","rewrite_hierarchical":"0","show_admin_column":"false","show_in_rest":"false","show_in_quick_edit":"true","rest_base":"","labels":{"menu_name":"","all_items":"","edit_item":"","view_item":"","update_item":"","add_new_item":"","new_item_name":"","parent_item":"","parent_item_colon":"","search_items":"","popular_items":"","separate_items_with_commas":"","add_or_remove_items":"","choose_from_most_used":"","not_found":"","no_terms":"","items_list_navigation":"","items_list":""},"object_types":["page"]}}

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    It’s my belief that things are working the way the parameter is meant to, but potentially not in the way you are thinking it should.

    From the codex:

    ‘with_front’ => bool Should the permalink structure be prepended with the front base. (example: if your permalink structure is /blog/, then your links will be: false->/news/, true->/blog/news/). Defaults to true

    Please correct me if I’m wrong, but you’re wanting to get something like: “https://mysite.com/portfolio-item/” for a permalink, and are instead getting: https://mysite.com/portfolio_page/portfolio-item/”

    The inclusion of the post type slug isn’t the “front” that is targeted with the parameter, and is actually a different topic.

    This tutorial post may help, and is worth trying out: https://kellenmace.com/remove-custom-post-type-slug-from-permalinks/

    The biggest thing to keep in mind is that the presence of the post type slug is what helps WordPress query for and find the correct content to display.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Any changes or new developments with this one @nmvdvjr ?

    Thread Starter Nick van de Veerdonk

    (@nmvdvjr)

    Hi Michael, excuse me for late reply! Thanks for your follow up on this, I see now. I was hoping to create a CSS selector/PHP conditional for a different page style by making it a custom post type but the way this works does not make for a good fit.

    Thanks again for your help and a fantastic plugin!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I would check out your body tag, <body> and see if there are various classes already being appended to that, that you could use for different page styles based on where you are in the site. May prove fruitful for you.

    Thanks for the kind review as well. We appreciate it.

    Thread Starter Nick van de Veerdonk

    (@nmvdvjr)

    Thank you Michael!

    Hi @tw2113,

    I’m having the same problem.

    Trying to change the URL structure from https://mysite.com/portfolio_page/portfolio-item/ to https://mysite.com/portfolio-item/.

    And so I am also confused why the “with front” option does not remove the slug.

    You quoted the codex saying that the with front arg is used for something else, but from the codex description is seem to be exactly that, an arg used to remove the slug.

    This is their example in the codex:

    false->/news/, true->/blog/news/

    Which, to follow on your Portfolio example, I think is saying this:

    false->/portfolio-item/, true->/portfolio_page/portfolio-item/

    Correct? If that’s not the case, then what is it used for?

    Your link (https://kellenmace.com/remove-custom-post-type-slug-from-permalinks/) for an alternate solution looks good, but I would rather not mess round with custom code if I don’t have to because there’s a high chance it will break in the future, causing a huge headache.

    • This reply was modified 6 years, 10 months ago by bruceleebee.
    • This reply was modified 6 years, 10 months ago by bruceleebee.
    • This reply was modified 6 years, 10 months ago by bruceleebee.
    • This reply was modified 6 years, 10 months ago by bruceleebee.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    the “front”, as far as I’ve ever seen, doesn’t relate to the post type slug, but instead oa “front base” value from permalink settings. This post may offer some understanding as well https://keetrax.com/blog/2015/04/wordpress-tip-add-blog-front-blog-urls/

    Unless WordPress core devs take a sudden turn on backwards compatibility, chances are that you’re safe using Kellen’s tutorial for the foreseeable future.

    Thanks for explaining that further.

    I checked out your link that provides some custom code for removing the slug, and unfortunately the code is already broken. It does not work with the latest version of WordPress.

    But if anyone else is looking for a solution I found this plugin which seems to do the trick: https://www.ads-software.com/plugins/permalinks-customizer/

    Just have to hope they keep it updated when WordPress changes again!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Broken in what way?

    I looked it over and it all looks valid to me and I don’t see why it wouldn’t work. However, insight from what you experienced would help me evaluate how readily I should consider recommending it.

    It just didnt do anything at all. There was no change, but also no adverse effect. Lots of people in the comments having the same problem.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Just tried it myself via functions.php and some breakpoints for halting code execution, and it looks like Kellen missed a small detail.

    With the slug still in the url:

    https://cloudup.com/cRVlCazTZ8P

    Without the slug still in the url:

    https://cloudup.com/cUBf7shUdCj

    The missed detail from his code is in this spot:

    add_filter( 'post_type_link', 'gp_remove_cpt_slug' );
    

    That line needs to be changed to:

    add_filter( 'post_type_link', 'gp_remove_cpt_slug', 10, 2 );
    

    He forgot to specify the accepted arguments amount, thus the $post parameter isn’t getting passed in, which is need to check for post status and post type.

    I have given Kellen this feedback, as he happens to be a coworker these days, and hopefully that snippet in the post can be updated to match soon.

    Give it a try, if you’re still in a spot where you can. No worries otherwise, I’m happy to just have the detail noted for future cases.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Can’t remove front base’ is closed to new replies.