Change the “page” slug in pagination

For some sites in German I use the following plugin to translate page to seite (the German word for page): <?php # -*- coding: utf-8 -*- /** * Plugin Name: T5 Page to Seite * Description: Ersetzt <code>/page/</code> durch <code>/seite/</code>. * Author: Fuxia Scholz * License: MIT * License URI: http://www.opensource.org/licenses/mit-license.php */ if ( ! … Read more

Theme localization of “slugs” (custom post types, taxonomies)

I wouldn’t try to localize your slugs. Instead, why not give your users the option to change them by adding another field to the permalink settings page? Hook into load-options-permalink.php and set up some things to catch the $_POST data to save your slug. Also add a settings field to the page. <?php add_action( ‘load-options-permalink.php’, … Read more

How does WordPress generate URL slugs?

As per @SinisterBeard‘s very valid comment to the question already a couple of years back now, this answer has long been outdated and the mentioned function(s) hence been replaced by a newer API: See wp_unique_post_slug. Original Answer Off the bat, I can’t give you a page/tutorial/documentation on how WP slugs are generated, but take a … Read more

Redeclare/Change Slug of a Plugin’s Custom Post Type

Yes, this is possible, but if the plugin is creating a custom post type using the rewrite => array(‘slug’ => ‘post_type’) parameter, then it’s not likely that you’re going to be able to replace the slug. Whenever custom post types are created, URL rewrite rules are written to the database. Depending on which action triggers … Read more

How to get a taxonomy term name by the slug?

The function you are looking for is get_term_by. You would use it as such: <?php $term = get_term_by(‘slug’, ‘my-term-slug’, ‘category’); $name = $term->name; ?> This results in $term being an object containing the following: term_id name slug term_group term_taxonomy_id taxonomy description parent count The codex does a great job explaining this function: https://developer.wordpress.org/reference/functions/get_term_by/

how to get page id of a page using page slug

Use get_page_by_path($page_path): $page = get_page_by_path( ‘about’ ); echo get_the_title( $page ); This will return a regular post object. Documentation: https://developer.wordpress.org/reference/functions/get_page_by_path/ https://developer.wordpress.org/reference/functions/get_the_title/