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 do I attach a php file to an arbitrary slug and still have access to the wp-core functions?

I do this pretty regularly and have no issue with using functions in WordPress core. You can hook a bit earlier though and skip the 404 and header bits. In functions.php: function wpa88013_parse_query( $wp ){ if ( ‘nlm-admin-thumbnail’ == $wp->query_vars[‘pagename’] ) { include( dirname( __FILE__ ) . ‘/thumbnail.php’ ); exit; } } add_action( ‘parse_query’, ‘wpa88013_parse_query’ … Read more

Bulk update post slugs through database

Try this query, remembering to change out your_posts_table with the proper name in your database. Using CONCAT, you can add any number of strings, just pass post_name to add your changes before/after. update your_posts_table set post_name = CONCAT(‘pre-‘, post_name) More info on MySQL CONCAT Note: Use a WHERE clause if you only want to update … Read more

How do I change attachment slug from name to id

Use the add_attachment hook to update the slug after the attachment has been inserted: function wpse_182454_attachment_id_as_slug( $post_id ) { if ( get_post_field( ‘post_name’, $post_id ) != $post_id ) { wp_update_post( array( ‘ID’ => $post_id, ‘post_name’ => ( string ) $post_id, ) ); } } add_action( ‘add_attachment’, ‘wpse_182454_attachment_id_as_slug’ );

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