How to get this JavaScript working with get_permalink

Probably the best way to do this is as suggested above by using wp_localize_script. You haven’t mentioned how you’re including the javascript – but I’m going to assume you’re doing it the WordPress way. So, something like this: add_action( ‘wp_enqueue_scripts’, ‘wwm_enqueue_scripts’ ); function wwm_enqueue_scripts() { //see the documentation if you don’t understand what’s going on … Read more

Dashes instead of slashes as permalink structure separator

You can replace the dash with something else, preferably not a hyphen, because that would be hard to parse back. In the following example, I use a dot. You have to change two parts: the outgoing permalinks (hook: “{$post_type}_link”) and the request (hook: request) parsing for “incoming permalinks”. The latter is harder, because it is … Read more

Change permalink for a single post entry

Try adding the following to your functions.php: function wpse221475_custom_rewrite_rules() { add_rewrite_rule( ‘^(special-project)?’, ‘index.php?post_type=projects&name=$matches[1]’, ‘top’ ); } add_action(‘init’, ‘wpse221475_custom_rewrite_rules’); Make sure to flush your rewrite rules after adding this rule. Visit: Dashboard -> Settings -> Permalinks Or if you wish, you can use flush_rewrite_rules() programmatically. To redirect requests for http://example.com/projects/special-project to http://example.com/special-project you can parse the … Read more

Date archive permalink modification

You can change the date links by directly modifying the date_structure: function wpd_change_date_structure(){ global $wp_rewrite; $wp_rewrite->date_structure=”news/%year%/%monthnum%/%day%”; } add_action( ‘init’, ‘wpd_change_date_structure’ ); Don’t forget to flush rewrite rules after the change. WordPress will use this to generate the rewrite rules for incoming requests as well as URL output when using API functions like get_year_link, so there’s … Read more

Custom Taxonomy URL

If all you wanted was ‘division’ in the URL, the trick is to register the custom post type with the slug option: ‘rewrite’ => array( ‘slug’ => ‘division’, ‘with_front’ => false ), However, since you want to substitute the current value of the division tag for the word division, the answer is much more interesting. … Read more

Rewrite-Rules not working on a vhost, everything goes to index.php

I’m not sure if this helps but its good practice, include the BEGIN and END WordPress comments around your rules as well as the check for mod_rewrite: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress Also: … Read more

Mass Permalink Changer

Maybe this doesn’t answer your question… but maybe you can adapt it to suit by changing what you put into $slug. Try this, which should loop over posts and reset the slug to match the post name. For pages, add ‘post_type’ => ‘page’ to the array passed to get_posts(). $posts = get_posts(array(‘posts_per_page’ => -1)); foreach … Read more

get the_title_attribute by id

hey just look in code and it also support fourth parameter post global $post; the_title_attribute(array(‘post’=>$post));//post object or global $post; the_title_attribute(array(‘post’=>$post->ID));//post id so you can use it like <a href=”https://wordpress.stackexchange.com/questions/111931/<?php echo get_permalink($id); ?>” title=”<?php the_title_attribute(array(‘post’=>$id)); ?>”> //where $id is post id Important Link the_title_attribute

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