Bulk append URL (add word to slug)

Here is your code: if ( isset($_GET[‘slug-update’]) ) { $posts = get_posts(); foreach($posts as $singlepost) { if($singlepost->post_status === ‘publish’){ $post_id = $singlepost->ID; $current_slug = $singlepost->post_name; $updated_slug = $current_slug . ‘-word’; } wp_update_post( array( ‘ID’ => $post_id, ‘post_name’ => $updated_slug ) ); } die(‘Slug Updated’); } Add this to your theme’s function.php. Then run this with … Read more

Apply template by path/slug related to custom post type?

You can’t set a project as a base of permalink because you would have to enter rewrite rules for each one. What you can do is create a custom taxonomy related-resources: function wpse_287202_related_resources_taxonomy() { $labels = array( … ); $args = array( ‘labels’ => $labels, ‘hierarchical’ => true, ‘public’ => true, ‘show_ui’ => true, ‘show_admin_column’ … Read more

Delete Redirect Slug For Specific Post

The wp_postmeta table (all meta tables in WP work similarly) has the following fields: id: the primary key of the metadata item post_id: the primary key of the post that this metadata relates to meta_key: the metadata “key”, or name of the metadata meta_value: the actual metadata value itself To find old slug entries for … Read more

How to change a WordPress term’s slug before saving

You add the following snippet to your theme’s functions.php file; The “wp_insert_term_data” filter allows you to modify a term’s name, slug or term_group before it is added to the database. This works for terms added via WP All Import and also manually through admin as well. The filter passes all taxonomy terms, not just woocommerce … Read more

Matching slug terms from one array to those in array of WP_Term objects to output term names

Perhaps array_map ? This will give you an array of term names which matched your slugs in $active_filters: $matched_terms = array_map(function($term) use ($active_filters){ if(in_array($term->slug, $active_filters)){ return $term->name; } else{ return false; } }, $tax_terms); //remove the empty array elements which came from terms which didn’t match a slug $matched_terms = array_filter($matched_terms);

how to get category`s slug in WP_Query loop?

get_the_category() retrieves WP_Term objects for all the categories assigned to the post. You can combine that with wp_list_pluck() to just get the slugs: $categories = get_the_terms( null, ‘project-category’ ); $category_slugs = wp_list_pluck( $categories, ‘slug’ ); $category_slugs will now be an array of slugs for the categories of the post.

I’ve removed my /author/ slug but it clashes with new and existing pages. Any fixes?

There is no way around uniqueness being necessary, with the effects you described. Personally I wouldn’t remove the part that makes ensuring uniqueness of the slug much easier, like the author part, in my mind it is just a sign of a well structured site. Anyhow, there is validate_username() function with the validate_username hook. You … Read more

Duplicate slug/permalink issue

You can do that using Custom Permalinks Plugin, you need to add a full slug manually [shows/2017/any]. It also allow you customize your permalink: [anyname/another/2017/example/slug]. You should still using this plugin, if you deactivate it, all permalinks will return to default [shows/2017/%postname%]

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)