Priyanka
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Custom rewrite rules stopped working after updating WP 5.5Hi @bcworkz,
Thanks for your help!
It works now with “pagename”, although it’s working without “canonical_url” filter.
Anyway thanks again.
Regards,
PriyankaForum: Fixing WordPress
In reply to: Custom rewrite rules stopped working after updating WP 5.5Hi @bcworkz,
As you have suggested, I have switched the theme to twentytwenty and deactivated all plugins. I have added the following code in the twentytwenty theme’s function file.
add_action('init', 'custom_rewrite_tag', 10, 0); function custom_rewrite_tag() { add_rewrite_tag('%catslug%', '([^&]+)'); } add_action('init', 'custom_rewrite_basic', 10, 0); function custom_rewrite_basic() { $prolist_pageid = get_id_by_slug('propositions'); add_rewrite_rule('^propositions/([a-zA-Z0-9\-]+)/?', 'index.php?page_id='.$prolist_pageid.'&page=propositions&catslug=$matches[1]', 'top'); }
What exactly I want to need and how I’m doing it for that is:
I am already having a page named “propositions” and it has the same slug (propositions). Now, by using a rewrite function, I want to add the extra slug just after the “propositions” so that I have taken the “catslug” parameter as you can see in the above code. After adding the code, I’m updating the permalink by hitting the save button only.
I want this URL to be worked: https://sitename.com/propositions/test-proposal
where the “test-proposal” is not an actual page but I’m passing it in the URL as a “catslug” parameter.The above URL should work and it was worked in the past version than WP 5.5 but now it’s not working and when I run that, it’s automatically redirected to https://sitename.com/propositions/ page.
Hope you understand what I explained and help with that.
Thanks!
Priyanka.Forum: Fixing WordPress
In reply to: Custom rewrite rules stopped working after updating WP 5.5Hi,
Thanks for your reply! I will try the way you have suggested. But as far as I know, I have updated all the plugins so there’s might be less chances of conflict with any plugin still will check and let you know.
Thanks!
Forum: Fixing WordPress
In reply to: Custom rewrite rules stopped working after updating WP 5.5Hi,
Please find the code below:
function custom_rewrite_tag() { add_rewrite_tag('%type%', '([^&]+)'); } add_action('init', 'custom_rewrite_tag', 10, 0); function custom_rewrite_basic() { $detail_pageid = 2; add_rewrite_rule('^actions/requests/([a-zA-Z0-9\-]+)/?', 'index.php?page_id='.$detail_pageid.'&page=requests&type=$matches[1]', 'top'); } add_action('init', 'custom_rewrite_basic', 10, 0);
Looking forward to your reply.
Thanks!
It has been fixed.
Thanks!Hi @bcworkz
Thanks for your reply!
I have checked for the REST API and tried to create user using “/wp-json/wp/v2/users” but it throws “rest_cannot_create_user” – “Sorry, you are not allowed to create new users”
After searching for such issue, have modified .htaccess on mulsite setup and tried with HTTPS but still, it can not create a user.
I have followed below reference:
REST API ? Create a User
REST API ? AuthenticationCan you please help as I have not used WP REST API before and have no idea to use it in the non-wp project.
Thanks!