Skip Navigation

[Resolved] Search results not displaying correctly all of a sudden. Causing WordPress Error

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by Minesh 1 month, 4 weeks ago.

Assisted by: Minesh.

Author
Posts
#2758839
Screenshot 2024-09-26 at 19.41.31.jpg

Hi Support

I am trying to:
View the pages:
hidden link (as a guest user)
hidden link (as a logged in user)

I expected to see:
The search results on the right, analogue to the pages:
hidden link (as a guest user)
hidden link (as a logged in user)

Instead, I got:
The search results are not showing and the page is all screwed up. The Page is also displaying "There has been a critical error on this website." There were no changes on this page for several weeks.

If it were something general, I would expect both the find-a-job and find-a-nanny pages to be screwed up, but it's just the nanny pages.

I thought perhaps it may be due to some foreign character or something in one of the recent nanny or nanny-ad posts, but can't see anything unusual. I also thought it may be cache related, but even after clearing WP Rocket cache and deactivating the plugin, the problem persists.

Please help urgently to narrow down the issue, as this is our production environment and these are the pages which our paying users use to find Nannies.

I'm attaching you the debug.log file for clues via WeTransfer, the zip file also includes a test family user's credentials, which also work on hidden link for testing/comparison purposes:
hidden link

The same pages work fine on dev.native-nanny.de and to the best of my knowledge worked fine until today on production site (see screenshot)

Thanks and kind regards
Simon

#2760831

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

When I try to access the private access details you shared, I see a message:

This private information was removed to protect your privacy.

Can you please send me working admin access details as well as frontend user access details.

I have set the next reply to private which means only you and I have access to it.

#2761086
#2761442

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

The issue was with the code snippet added to "Custom Code" section namely "func-custom-field-shorten-string" where the custom shortcode added as given under:

function shorten_string( $atts ) {

	// Attributes
	$atts = shortcode_atts(
		array(
			'length' => '',
			'string' => '',
		),
		$atts
	);

		return substr($atts['string'], 0, $atts['length'])." ...";
}
add_shortcode( 'shorten_string', 'shorten_string' );

I've changed that to as given under where I passed the null to the length attribute.:

function shorten_string( $atts ) {

	// Attributes
	$atts = shortcode_atts(
		array(
			'length' => null,
			'string' => '',
		),
		$atts
	);

		return substr($atts['string'], 0, $atts['length'])." ...";
}
add_shortcode( 'shorten_string', 'shorten_string' );

Can you please confirm it's working as expected now.

#2761521

HI Minesh

Thanks for that quick fix - it appears to be working again! The two code snippets you just posted seem identical. However, just to confirm, it looks like you only changed line 6, right?

From:

'length' => '',

To:

'length' => null,

So I understand it to mean "if the field is NULL or an empty string" then do something, correct?

It's so strange that we have never faced the error before to be honest, I'm sure we could find cases where that field was empty. 🙂

Kind regards
Simon

#2761544

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ahh sorry, I have fixed that where I made the change and how it was looking before.

You're right what you shared. Glad to help.

#2761561

Great! Thanks Minesh

Have a nice weekend.