Stripping unicode characters out of slug

‘/(ṁ|ṭ|ḍ|ṇ|ṅ|ñ|ḷ|ṃ)/’ is a valid regex to process what you want. $string = ‘/(ṁ|ṭ|ḍ|ṇ|ṅ|ñ|ḷ|ṃ)/ is my regex and my chosen string is: ṁ, ṭ, ḍ, ṇ, ṅ, ñ, ḷ, ṃ’; echo preg_replace( ‘/(ṁ|ṭ|ḍ|ṇ|ṅ|ñ|ḷ|ṃ)/’, ”, $string, ); // Returns ‘/(|||||||)/ is my regex and my chosen string is: , , , , , , , ‘ EDIT: … Read more

Make wp_list_pages print slugs instead of titles

I would recommend using get_pages() rather than wp_list_pages() for this purpose. The get_pages() function will return an array of objects of Pages, and you can use the array data to build your own HTML list. e.g.: <?php // Wrap in a function, for later output; function wpse47989_list_pages() { // Get an array of pages using … Read more

How to manage same slug posts suffix method?

Developers can use the following filter: /** * Filters the post slug before it is generated to be unique. * * Returning a non-null value will short-circuit the * unique slug generation, returning the passed value instead. * * @since 5.1.0 * * @param string|null $override_slug Short-circuit return value. * @param string $slug The desired … Read more

slug: should I use latin characters only?

I will agree with King Li. Furthermore there is a very old plugin you can download from my dropbox that is still functional and will be of great help to you. What it does is changing the greek slugs to latin characters (greeklish) automatically for all new posts/pages/custom posts . You will have to manually … Read more

Do post_names have to be unique?

Slugs need to be unique-ish. The function that determines what a slug will be is called, appropriately enough, wp_unique_post_slug. Attachment slugs need to be unique across the whole set of slugs. Meaning that they cannot be shared with anybody, anywhere. Page slugs (or any hierarchical post type) needs to be unique within that specific post … Read more

How can I automatically set a post slug based on the post title during post publish?

As long as haven’t touched the slug WordPress will generate a new one after you entered a title. Update To change other peoples slugs use a filter (not tested!): add_filter( ‘wp_insert_post_data’, ‘prevent_numeric_slugs’, 10, 1 ); function prevent_numeric_slugs( $post_data ) { if ( ! isset ( $post_data[‘post_title’] ) or ! is_numeric( $post_data[‘post_name’] ) ) { // … Read more

Hook on slug generator

I think you should be able to do this using the wp_unique_post_slug filter (which is applied in the function of the same name): add_filter(“wp_unique_post_slug”, function($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) { if($meta = get_post_meta($post_ID, “my-meta”, true)) { $slug = $meta . ‘-‘ . $slug; } return $slug; }, 10, 6); As this is applied at … Read more

Show all wp_get_post_terms slugs

This is more of a PHP question, but the solution is simple – you need to use a foreach-loop on $getslug, because you just echo the slug of the first taxonomy. The function wp_get_post_terms() does not return a single object, but an array of objects. You are right with the [0], this indicates that you … Read more

custom slug always ends in “-2”

Modification of a slug happens when wordpress detect that the slug is already in use. “In use” in this case includes the posts that are trashed. In your case if you don’t need the id to be associated with the date then you might get better result by using the post id as the id, … Read more

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