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.

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by stefanoA-7 1 month, 1 week ago.

Assigned support staff: Rohan Sadanandan.

Author Posts
September 6, 2019 at 1:56 pm #4525677

stefanoA-7

We created a shortcode with an older version of WPML years ago, now with the new PHP(7.2) and WordPress, we get an error for this function.

PHP Fatal error: Uncaught Error: Call to undefined function icl_object_id()

This refers to this line:
$icl_object_id = icl_object_id( $contact_us_page_id , 'post', true );

Can anyone offer any advice?

September 6, 2019 at 4:24 pm #4526697

Rohan Sadanandan
Supporter

Languages: English (English )

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

Hello,

Thank you for contacting WPML Support.

The icl_object_id() function has been deprecated.
You can use the "wpml_object_id" hook for the same.
for eg:

echo apply_filters( 'wpml_object_id', $pid, 'post', TRUE  );

Please read this documentation for more information:
https://wpml.org/wpml-hook/wpml_object_id/

If you have any doubts please let me know.

Thanks,
Rohan

September 9, 2019 at 9:23 am #4535229

stefanoA-7

My issue is resolved now. Thank you!