Articles of permalinks

Unabled to Change Permalinks – Even Using the “Edit” (Resets to Original Permalink on “Update”)

I have tried everything in every post I have been able to find about changing permalinks for existing posts and pages. I have gone to settings and change the permalink structure in hopes that it would reset it. This had no effect on “Pages”. If I change the title do “Page Title”, then click the […]

How to get permalink in foreach loop

What to do in situation when I don’t have an ordinary if-while loop, how do I get permalink? $page_children = get_page_children( 8, $all_wp_pages ); foreach( $page_children as $page ) : echo $page->post_title; the_permalink(); endforeach;

Link to the post displays ID instead of slug

I’ve met a strange error on my page. After I do an internal link in my site, like that in the page editor <a href=”/page-name”> then in the page source code it displays <a href=”/?page_id=784″> instead of the slug. Have anyone met something like that? How can I change that to display slug instead? I […]

Add custom query vars to pretty permalinks

I am creating a wordpress plugin where i have some custom query strings appended with the urls to achieve the desired functionality.I require pretty permalinks like post name in the wordress settings. How i can achieve that ? I have used some of the wordpress built in functions but that does’t work for me. i […]

Access or edit custom generated permalinks with WP_Rewrite

I want to create custom permalinks for my plugin using WP_Rewrite. I found the codex the have great examples and this stack topic also explained a lot to me. Currently I’ve got the following code based on the codex and update 3 from the stack overflow question: add_filter( ‘rewrite_rules_array’, ‘custom_permalinks’ ); add_filter( ‘query_vars’, ‘custom_query_vars’ ); […]

Permalinks not working in WordPress

In wordpress I’ve chosen “Day and name” for permanlinks but I am getting 404. The modrewrite module is loaded, the .htaccess is -rwxrwxrwx 1 www-data www-data 274 nov. 23 13:10 .htaccess i have put htaccess to 777 temporarily just to solve the problem but still it doesn’t work any suggestion ?

Get Posts Based on Tag Matching Page Title

I have the following written to retrieve a list of posts that match the title of the page, by their tag. The problem is it does not play nicely with tags that have multiple words (and perhaps special characters too but I have yet to run into that). <?php $title_post_tag = new WP_Query( array( ‘tag’ […]

Rewrite URL Parameter And Force 'Pretty' Permalink

I’m trying to pass a variable via a URL parameter and rewrite + force ‘redirect’ it. In other words, I have: /dir1/dir2/?my_var=123 and I want: /dir1/dir2/123/ Through the following code in my functions.php file, I am able to achieve that: function setup_filter_rewrites() { add_rewrite_rule(‘dir1/dir2/([^/]*)/?’, ‘index.php?pagename=dir1/dir2&my_var=$matches[1]’, ‘top’); } add_action( ‘init’, ‘setup_filter_rewrites’ ); function setup_filter_query_vars( $query_vars ) […]

Redirect User From Registration Page To CPT (profile page) with custom url

I am looking for a little advice regarding wp_redirect after successful registration, the plan is a new user registers and is then re-directed on success to a custom post type page ‘Agent’ wp stackexchange question asked here two years ago. The agent page is a profile page containing info entered entered at registration and will […]

WordPress modify Settings > Permalinks (options-permalink.php) Add CPT Permalink Options

How do I modify the Settings > Permalinks (options-permalink.php) admin page to add more custom permalink parameters? I’d like to add additional permalink parameters to the “Optional” section for custom taxonomies that I’ve created. Specifically, I’d like to add more base prefix options for the Custom Taxonomies that I created. The custom taxonomies are named […]