New answers tagged

1

I don't have a WooCommerce currently to test this out on, so it's very rough and ready, and may not even work... But, I think the logic is fairly sound. Give this a go: // Store session value for table number add_action('init', 'store_table_number'); function store_table_number() { if( $_GET['dining'] ) { global $tableNo; $tableNo = array(...


1

From what you have described, could you not simply pass in a variable in the url string which then gets stored in a session for the guest? Your URL might look something like this: https://www.therestaurant.com/menu?dining=22 You can then of course retrieve that table number using a PHP get: $tableNumber = $_GET['dining']; This would give you the facility to ...


0

Using remove_query_arg() to remove query string from the URL. For example, to remove the paged query string from the current page URL: remove_query_arg('paged', false); //FALSE, means to use the current URL If you have specific URL: remove_query_arg('paged', 'http://domain.com/?cat=4&paged=2&order=DESC'); Or if you have multiple query string and ...


0

A safer way to archive the same result since WP 5.1, is to use http_request_reject_unsafe_urls filter: function performize_turn_off_reject_unsafe_urls($ret,$url) { //here you can use regex or anything you want to check the url if($url==='https://urltowhitelist') $ret = false; return $args; } add_filter( '...


0

I realize this is an old question, however one thing I've noticed is no-one mentioned using get_queried_object(). It's a global wp function that grabs whatever relates to the current url you're on. So for instance if you're on a page or post, it'll return a post object. If you're on an archive it will return a post type object. WP also has a bunch of helper ...


0

First thing to check is make sure you visit permalinks page, or call the flush_rewrite_rules function once after you call add_rewrite_rules otherwise the rule will not get applied. So to restate your question, is it correct that you're trying to achieve rewriting this: example.com/project-centers/kitchen/x/y/z To this: eample.com/index.php?pagename=kitchen&...


0

Thanks for the reply, problem solved ! It was in the Woocommerce general settings "Default customer address". Had it set up on "geolocalize users with cache support". Just changed it and v=hash disappeared.


0

I have a Big Confusion about this topic ,and its made me a bad situation and headache , someone please clear this for me . I have this situation on wocommerce ( not really different from WordPress post structure ) If i Have a product in Category-A and Subcategory-B we have tow form of URL's : First Form is : site-address/shop/Category-A/Subcategory-B And ...


0

If your submenu is missing the admin.php?page= prefix, you should register the parent menu first, then the submenu. add_action( 'admin_menu', function() { // Parent menu first add_menu_page( 'Page title', 'Menu Title', 'capability', 'parent-slug', 'callback' ); // Then the submenus add_submenu_page( 'parent-slug', 'Submenu Page Title', 'Submenu Title', '...


0

So firstly whilst this may be possible I imagine that it is probably not best practice. This is because semantically, and for SEO it makes more sense to have fewer URLs. It could be understood that if your page is /en/foo and I want to switch to French, I can just go to /fr/foo. People may do this manually, and some automated tools may understand the site ...


0

This is what worked for me (short and clean solution that includes the query strings in the URL too): $current_url = add_query_arg( $_SERVER['QUERY_STRING'], '', home_url( $wp->request ) ); The output URL will look like below http://sometesturl.test/slug1/slug2?queryParam1=testing&queryParam2=123 The solution was taken from here


Top 50 recent answers are included