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 2 replies, has 2 voices.

Last updated by stefanoA-7 1 year, 2 months ago.

Assigned support staff: Rohan Sadanandan.

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


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


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:

If you have any doubts please let me know.


September 9, 2019 at 9:23 am #4535229


My issue is resolved now. Thank you!