New answers tagged

0

You can change the slug as you want in wordpress. Just go to the post or to the page. Edit the Post or the Page you want to change the slug. On the right side there is a button: Screen Options. Click it and Check slug. Then you'll manually can give what ever slug you want for the post or page.


0

For now I used the sanitize_title filter, and removed all unwanted characters, which forces my users to use only [a-z0-9-] as a valid input for titles. ## Allow only [a-z0-9-] in the slug function my_clear_title($title) { $pattern = '/[^a-z_0-9- ]/i'; $replace_with = ''; return preg_replace($pattern, $replace_with, $title); } ...


1

It would be easier to add this on a menu link. The attributes for each link pass through the nav_menu_link_attributes filter. You should be able to use it to add a custom one, along the lines of (not tested): add_filter( 'nav_menu_link_attributes', function( $atts, $item ) { // check if $item is what you need $atts['data-slug'] = 'something'; return ...


1

Place the following code in your theme's functions.php file: add_filter( 'bp_core_enable_root_profiles', '__return_true' ); I hope this helps.


2

I suppose you could filter wp_unique_post_slug and have it return the original slug for posts, but I'm not sure what kind of side-effects this may have: add_filter( 'wp_unique_post_slug', function( $slug, $post_id, $post_status, $post_type, $post_parent, $original_slug ) { if ( $post_type == 'post' ) $slug = $original_slug; return $slug; }, ...


0

Too bad no-ones answered you on this simple question. I guess you've allready figured it out, but for anyone else wondering the same: A WooCommerce Slug is the true path to a certain category/product the database uses to find the correct category/product (just like on a computer: usr:\\My_Computer\Desktop\ or c:\\programfiles\desktop\), and can often be ...



Top 50 recent answers are included