Ultimate get current page’s slug function

There’s no such thing as a single permalink document name. It varies depending on what is being queried. Taxonomy terms use the slug of the term, pages and posts uses the slug of the posts. Post type archives sometimes use the post type name, but they might use something else entirely depending on how it’s … Read more

How to put title slug into content when create a new post?

You have to use the_content filter. Following example is to just adds a featured image set from the single post Edit screen which displays before the content on single posts only. You can change it to display title and permalink. add_filter( ‘the_content’, ‘featured_image_before_content’ ); function featured_image_before_content( $content ) { if ( is_singular(‘post’) && has_post_thumbnail()) { … Read more

can’t change page slug

My first guess would have been that the page was in the Trash, but you’ve said in the OP that it isn’t. So… If you have access to your MySQL database, run this query: SELECT * FROM wp_posts WHERE post_name=”page-title” That will return the post that’s using the slug.

list child pages as slug

Ok, this code should set you on the right path. It’s not designed to do exactly what you want, but judging by your code above, you seem fairly compitent, so should be able to amend as required. I’d also recommend looking at the Walker_Page Class, that way you can compare the methods below to those … Read more

How to Disable UNICODE slug?

My solution using 3 combined hooks wp_insert_post_data, wp_ajax_sample-permalink,name_save_pre //==================DISABLE GEORGIAN + Russian SLUGS for POSTS================ //disable slug on any update add_filter(‘wp_insert_post_data’, ‘myappend_slug’, 3); function myappend_slug($data) { $data[‘post_name’]= slug_modify($data[‘post_name’]);return $data; } add_action( ‘wp_ajax_sample-permalink’, ‘MyajaxSamplePermalink’,1); function MyajaxSamplePermalink($data) { // check that we’re dealing with a product, and editing the slug $post_id = isset($_POST[‘post_id’]) ? intval($_POST[‘post_id’]) : 0; … Read more

How to print partial URL after #? [closed]

First off, the “slug” is what it is by definition. There is no such thing as a “front slug”. As you do not elaborate/know on how the anchors/hashes are generated on the server side, all I can give you is a JS solution (proof of concept): if (window.location.hash) { alert(window.location.hash.substring(1)); }

Bulk-change Post slugs which have a suffix

First thing I would backup and restore the site on a local development environment. Then you can try use this tool on your local site: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ Make sure that when you rename you are giving them something unique otherwise you may get in trouble.

Category Name and Slug field need to be the same otherwise it breaks category pages

I can’t comment yet, but I can answer – I think your problem may be that you’ve declared your $terms variable twice in your code, within your loop: <?php $terms = get_the_terms( $post->id, ‘knowledgebase_types’ ); ?> and <?php $terms = get_the_terms( $post->post_id, ‘knowledgebase_topics’ );?> Though some more information about what result you are actually seeing … Read more

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