Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem: When I try usual procedure - click "+" after which normally WPML site opens up, in case of the events, the fatal error comes up:

Fatal error: Uncaught InvalidArgumentException: Argument ID must be numeric and greater than 0

Solution: We've updated The Events Calendar plugin, and then we realized that the problem was only occurring with old events, the new events didn’t present any issues to be translated. So in order to solve the issue, we created translation records on the database for the events that have been already built.

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

Last updated by harunk-2 1 month ago.

Assigned support staff: Mateus Getulio.

Author Posts
March 16, 2021 at 2:36 pm #8322449

hannal-4

When I try usual procedure - click "+" after which normally WPML site opens up, in case of the events, the fatal error comes up:

(I can send debug now, but it is not available in the "update ticket")

Fatal error: Uncaught InvalidArgumentException: Argument ID must be numeric and greater than 0. in /home/users/hannalubek/public_html/YesheTest/wp-content/plugins/sitepress-multilingual-cms/classes/translations/class-wpml-translation-element.php:29 Stack trace: #0 /home/users/hannalubek/public_html/YesheTest/wp-content/plugins/sitepress-multilingual-cms/classes/translations/class-wpml-translation-element-factory.php(41): WPML_Translation_Element->__construct('0', Object(SitePress), NULL) #1 /home/users/hannalubek/public_html/YesheTest/wp-content/plugins/sitepress-multilingual-cms/classes/translations/class-wpml-translation-element-factory.php(33): WPML_Translation_Element_Factory->create_post('0') #2 /home/users/hannalubek/public_html/YesheTest/wp-content/plugins/wpml-media-translation/classes/media-translation/wpml-translation-editor/class-wpml-media-populate-media-strings-translations.php(33): WPML_Translation_Element_Factory->create('0', 'post') #3 /home/users/hannalubek/public_html/YesheTest/wp-includes/class-wp-hook. in /home/users/hannalubek/public_html/YesheTest/wp-content/plugins/sitepress-multilingual-cms/classes/translations/class-wpml-translation-element.php on line 29

March 16, 2021 at 8:10 pm #8325613

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

Welcome to the WPML support forum.

Other users have reported this same problem when selecting and sending jobs with images to Translation Basket. It can be fixed following these instructions:

- Make sure you have a working backup of your website before proceeding
- Go to: wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-post-with-media-files.php
- There, just before the line:

return apply_filters( 'wpml_ids_of_media_used_in_post', $media_ids, $this->post_id );

- add this line:

$media_ids = \WPML\FP\Fns::filter( 'get_post', $media_ids );

Give it a try and let us know if the issue is resolved. If don’t, I'm enabling the Debug Info template for your next reply. See how to retrieve and paste it here: https://wpml.org/faq/provide-debug-information-faster-support/.

In summary, these are the steps that you need to take to retrieve it:

- Go to WPML > Support > Debug Information
- Copy the Debug Information from there
- Find the “Additional Data” section below this chat
- Click on the “Debug Info” item to expand it

Please keep us posted. Thanks,
Mateus.

March 17, 2021 at 3:43 pm #8334839

hannal-4

Hi, as adviced I have done this:
- There, just before the line:

1
return apply_filters( 'wpml_ids_of_media_used_in_post', $media_ids, $this->post_id );
- add this line:

1
$media_ids = \WPML\FP\Fns::filter( 'get_post', $media_ids );

However it did not work. Please find debug info attached.

Thank you for your help!

March 17, 2021 at 8:15 pm #8336783

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello Hanna,

Thanks for your reply.

By looking at your debug info, we can see that the WP Memory Limit is set to 40M, while the recommended is 256. Changing it can solve the error. Please follow these instructions:

- Find your wp-config.php file in the root directory of your WordPress installation
- Open the wp-config.php file with a text editor, then locate the line that includes: define('WP_DEBUG', false)
- Then add after it, the below line of code: define ('WP_MEMORY_LIMIT', '256M');
- Save the wp-config.php file, then refresh your website

Check if the issue persists. If so, we can try the solution of this errata: https://wpml.org/errata/fatal-error-uncaught-exception-invalidargumentexception-with-message-argument-id-must-be-numeric-and-greater-than-0/

- Please get access to your files and search for the ../wpml-media-translation/classes/images-translation/ folder
- Open the class-wpml-media-image-translate.php file
- Use the following code to replace the get_translated_image_by_url function: https://pastebin.com/zF5pWEHZ

Test adding the translation for events now. If the problem isn't fixed, I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**

- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link

Please, let me know if you need any additional details. Have a nice day.
Mateus.

March 18, 2021 at 8:29 pm #8346315

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello Hanna,

Please, take a look at my previous private reply and let me know when the migration process is done. Thanks.

March 18, 2021 at 9:54 pm #8346737

hannal-4

Hi, I have started the migration and it is gonna take a longer while. We have 11pm here so I will leave the computer to work and will go to sleep 🙂 However you can probably check it in couple of hours.

March 19, 2021 at 6:27 am #8348859

hannal-4

=> Good news! Your site has completed its migration to Cloudways. We encourage you to check out your site at hidden link.

March 19, 2021 at 1:29 pm #8352119

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

I checked this out but so far I couldn't find a fix for it.

I asked my colleagues to have a look at this issue in order to see if there's anything I'm missing.

I'll come back here as soon as one of my colleagues reply back to me (which it shouldn't take long).

Thanks,
Mateus.

March 19, 2021 at 3:26 pm #8352957

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi,

I have escalated this ticket to our 2nd tier of support where our 2nd tier specialists will take a deeper look at this issue and will try to find a solution.

I will get back to you as soon as I get an answer from them.

Best regards,
Mateus

March 20, 2021 at 7:21 am #8357093

hannal-4

Thank you, looking forward to hearing good news 🙂

March 22, 2021 at 11:55 am #8367495

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello Hanna,

Thank you for waiting.

Upon further inspection, the issue seems to fix itself through a manual reinstall process. Could you please give it a try on your end? Just follow these instructions:

- Backup your site and database
- Deactivate all core WPML plugins (WPML, String Translation, Translation Management and Media Translation)
- Login via FTP to your wp-content/plugins/ folder
- Delete all WPML folders
- Go to http://wpml.org/my-account/downloads/ and download the latest WPML Multilingual CMS Plugin, then extract it
- Upload the plugin via FTP to wp-content/plugins/ folder
(alternatively you could upload the .zip folder using Dashboard > Plugins > new > upload)
- Activate the WPML plugin via WP Dashboard > plugins
- Complete the setup, if needed
- Register WPML for your site (at the end of setup, click on the "generate key" button)
- Navigate to Dashboard > Plugins and locate WPML Multilingual CMS
- Click on the blue link that says "Registered"
- Download and activate all needed WPML addon plugins

We just tested it in the copy version of your site and it is working properly.

Please try it and tell us the results. Thanks,
Mateus.

March 24, 2021 at 7:19 am #8386157

hannal-4

Hello Mateus,

we did that and still it's not working, showing the same error... Are there any chances you could have a look directly on our website?

All the best

March 24, 2021 at 12:32 pm #8389503

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

Thanks for the updates.

If you try to flush your cache, the issue gets fixed? If it doesn't help, I would like to request temporary access to your site to take another look at the problem. I’m enabling the needed fields for this below the comment area when you log in to leave your next reply.

Please send me new credentials, it looks like the ones you provided previously no longer work.

Looking forward to your reply,
Mateus.

March 24, 2021 at 8:20 pm #8393949

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

It looks like the credentials that you shared with us are not working on our end. We are receiving a ‘wrong username/password’ error message.

Can you please review that information and get back to us?

I’m marking your next message as private again. Thank you, please let us know.

March 25, 2021 at 1:48 pm #8400339

hannal-4

Looks like it is not private? I added All my data and I could see it being logged out... Maybe there is safer space to share this data?