Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 10 replies, has 4 voices.

Last updated by michalK-20 10 months, 1 week ago.

Assigned support staff: Bruno Kos.

Author Posts
November 14, 2019 at 9:03 am

sylvainM-7

Hello

I am trying to send some GET params to WooCommerce account subpages but I receive an 404 error ONLY when special chars (for ex. spaces: %20 or +) are used in GET values.

Link to a page where the issue can be seen:
hidden link or hidden link

You can try WITHOUT space in GET value, it works:
hidden link

I expected to see the subpage like this:
hidden link

Instead, I got 404 error.

When I disable the WPML CMS plugin, it works.

However, it is important to know that when I reactivate WPML and deactivate SiteOrigin Page Builder (the only other plugin installed), it also works.

So I'm thinking of a conflict between your plugin and the SiteOrigin Page Builder one.

However, the page builder is NOT USED on the My Account page.

I would like to point out that I have reproduced this problem on a fresh installation of WordPress. All installation settings have been left by default. And it's not a theme issue because I did the test with several.

Many thanks in advance.

PS: I send you the editor ID so you can see the error (sorry I can't give you admin access). You should be able to reproduce this problem quite easily on your side.

PLEASE: If possible I would like my domain name to remain confidential, could you hide the links?

November 14, 2019 at 10:19 am
November 14, 2019 at 10:37 am #4945687

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

This has been escalated to our Compatibility team and may take some debugging time, I'll get back to you as soon as I have any news or questions for you.

Regards,
Bruno Kos

November 20, 2019 at 6:17 am #4976867

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Can you try commenting out this line:

$post_id = url_to_postid( $current_url );

in /siteorigin-panels/inc/sidebars-emulator.php, does it yield expected results in your case?

Regards,
Bruno Kos

November 20, 2019 at 9:25 am #4978173

sylvainM-7

Hi Bruno,

I can confirm it solves my issue. Thank you very much.

While SiteOrgin fixes this definitively, do you think that commenting this instruction may generate other problems?

Best regards,
Sylvain

November 20, 2019 at 10:09 am #4978515

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi Sylvain,

I really cannot tell if this will have any consequences on other parts of the plugin, because the plugin itself is quite complex, but perhaps you could ask their support on what is line of code is responsible for, in which scenarios it may appear and what would happen if you remove it.

Regards,
Bruno Kos

November 20, 2019 at 10:22 am #4978599

sylvainM-7

Ok I understand.

Do you confirm that your compatibility team is taking care of the transmission and follow-up of this issue with the SiteOrigin team?

Should I close this topic as resolved on your site?

Thanks,
Sylvain

November 20, 2019 at 10:44 am #4978853

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Can you tell me one thing - where exactly will you be using this? This is the main consideration our compatibility team has, because we need to understand where is this going to be used and how. Orders is an endpoint from WooCommerce and not a real page, so we need to have a better understanding of the whole scenario before engaging into further development.

Can you perhaps show us this here?
hidden link

Regards,
Bruno Kos

November 20, 2019 at 3:32 pm #4981719

sylvainM-7

Hi again,

Sure, the GET method can be used in many applications because these endpoints allow you to display absolutely all the content you want!

In my case, just visit this link: hidden link

And now this one: hidden link!

Sorry I can use '%20' between you first and lastname 😉

FYI:
- WC Custom Tab: hidden link
- Contact Form : hidden link

Best Regards,
Sylvain

November 21, 2019 at 7:58 am #4985737

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Got it! Our 2nd tier escalated this to our developers and it is up to them to decide when and how will they implement this in the future versions of WPML. Apart from the workaround suggested above, it is also possible to use this:

Go to wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php and change:


		$html             = '<a href="' . $url . '">removeit</a>';
		$alp_broken_links = array();
		remove_filter( 'url_to_postid', array( $this, 'url_to_postid' ) );
		$html = $absolute_links_object->_process_generic_text( $html, $alp_broken_links );
		add_filter( 'url_to_postid', array( $this, 'url_to_postid' ) );
		$url = str_replace( array( '<a href="', '">removeit</a>' ), array( '', '' ), $html );

to

		$html             = '<a href="' . $url . '">removeit</a>';
		$alp_broken_links = array();
                $trace = debug_backtrace( FALSE, 5 );
		if (! $trace[4]["class"] == "SiteOrigin_Panels_Sidebars_Emulator" && ! $trace[4]["function"] == "register_widgets") {
			remove_filter( 'url_to_postid', array( $this, 'url_to_postid' ) );
		};
		$html = $absolute_links_object->_process_generic_text( $html, $alp_broken_links );
		add_filter( 'url_to_postid', array( $this, 'url_to_postid' ) );
		$url = str_replace( array( '<a href="', '">removeit</a>' ), array( '', '' ), $html );we

Whether this solution will be implemented into the final version, this is also up to developers and I don't have any information at this point.

I will keep this thread updated as soon as I get any new information from them!

Regards,
Bruno Kos

June 25, 2020 at 10:21 am #6451731

Martin Schadegg Brønniche

Hi WPML

Why don't you just solve the real problem here instead of trying to complicate it with strange half solutions?

You are not escaping + in

AbsoluteLinks::get_regex_replacement()

.

If you replace:

$perm_url = '(' . rtrim( $home_url, '/' ) . ')?' . $langprefix . '/' . str_replace( '?', '\?', $dir_path );

With:

$perm_url = '(' . rtrim( $home_url, '/' ) . ')?' . $langprefix . '/' . str_replace( array('?', '+'), array('\?', '\+'), $dir_path );

Then it works as intended.

Please integrate this in your plugin since it is a huge issue on many sites. And now it just happens to be an incompatability with the Siteorigin Pagebuilder, but they just use a normal WP function.

If you use Bing Ads an utm_term and utm_content will be added with potential space (+ or %20) in the URL since Bing will add the search term.

You should also escape + in

AbsoluteLinks::get_regex_replacement_offline()

[/php].

August 13, 2020 at 7:59 am #6791965

michalK-20

When can we expect fix of this issue between WPML and Site Origin Page Builder? We have excatly the same issue. some URLs with CPT slug before /?utm... with %20 param leads to 404 page. Once I remove all %20 from the URL, the page is loading. It's happening randomly.

Commenting this line in site origin files
$post_id = url_to_postid( $current_url ); works temporarily, it's not ideal solution.