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

Last updated by victorG-3 2 years, 4 months ago.

Assigned support staff: Shekhar Bhandari.

Author Posts
May 4, 2017 at 12:55 pm #1268131

claudiaD-5

Hi,
I'm trying to update all post languages using a plugin (Post Forking).
But when I try to update multiple posts using a bulk action I get the following error:
WP_Hook->do_action( )

...\plugin.php:453
11	3.0768	64727024	WP_Hook->apply_filters( )	...\class-wp-hook.php:323
12	7.9280	73623984	call_user_func_array:{C:\wamp\www\wordpress\wp-includes\class-wp-hook.php:300} ( )	...\class-wp-hook.php:300
13	7.9280	73624000	WPML_Admin_Post_Actions->save_post_actions( )	...\class-wp-hook.php:300
14	7.9301	73634688	WPML_Post_Translation->after_save_post( )	...\wpml-admin-post-actions.class.php:102
15	7.9541	73693328	WPML_Post_Synchronization->sync_with_translations( )	...\wpml-post-translation.class.php:246
16	8.0522	73764616	WPML_Post_Synchronization->sync_with_translations( )	...\wpml-post-synchronization.class.php:206 ....
....
...

And it looks like an infinite loop:

Fatal error: Maximum function nesting level of '256' reached, aborting!

How can I disable this behavior?

Best regards.

May 5, 2017 at 11:00 am #1269108

Arvish Mungur

Hello claudiaD-5,

Thank you for contacting WPML support.

I will be happy to help you with your ticket.

I believe you might have to increase your “xdebug.max_nesting_level” setting in the correct php.ini file.

The best way to do that is to create a phpinfo.php file and upload it on your server.
Create a file called phpinfo.php
Add this line of code into the phpinfo.php file

<?php phpinfo(); ?>

Upload phpinfo.php to your server where wp-config.php is present
Navigate to where you uploaded it on your server for example hidden link

The phpinfo file will tell you where your php.ini file is located.

hidden link

**It’s good practice to delete this file after as you don’t want others to see it**

From here, you will need to locate and increase the “xdebug.max_nesting_level” value within your php.ini file.

Example:

xdebug.max_nesting_level = 512

Depending on where your site is hosted and on your knowledge of server and PHP configuration, you might have to ask your hosting company to do that for you.

Additional references:
http://stackoverflow.com/questions/34432161/drupal-installation-set-xdebug-max-nesting-level-256-in-your-php-configuration

Let me know if this resolves your issue.

Kind regards

May 18, 2017 at 9:34 am #1278953

claudiaD-5

Hi, I did that but the result is the same.

I realized when I do an update to a post translation it triggers some kind of action and it enters a infinite loop, below is the function that I use on the bulk action.
Obs: This is an edited version of the Post Forking Plugin.

function merge( $fork ) {
		$user = wp_get_current_user();

		if ( !is_object( $fork ) )
			$fork = get_post( $fork );

		$fork_content_pre_merge = $fork->post_content;
        
        $idES = icl_object_id( $fork->ID , 'fork' , false , 'es' );
        $idEN = icl_object_id( $fork->ID , 'fork' , false , 'en' );

        $forkES = get_post( $idES );
        $forkEN = get_post( $idEN );

        $updateES = array(
            'ID' => $forkES->post_parent,
            'post_content' => $forkES->post_content,
        );

        $updateEN = array(
            'ID' => $forkEN->post_parent,
            'post_content' => $forkEN->post_content,
        );

		$update = array(
			'ID' => $fork->post_parent,
			'post_content' => $fork->post_content,
		);
        
        $parent_id = $fork->post_parent;
        $parent_idES = $forkES->post_parent;
        $parent_idEN = $forkEN->post_parent;
        
        remove_action('save_post', 'merge');
        wp_update_post( $updateES );
        #wp_publish_post( $parent_idES );
   
        wp_update_post( $updateEN );
        #wp_publish_post( $parent_idEN );
        #add_action('save_post', 'bulkMerge');

        wp_update_post( $update );
        #wp_publish_post( $parent_id );
        add_action('save_post', 'merge');

		return wp_update_post( $update );
    }

I'm using the remove_action because I'm using the wp_update_post -> https://developer.wordpress.org/reference/functions/wp_update_post/


1	0.0015	450312	{main}( )	...\edit.php:0
2	3.0202	65422272	apply_filters( )	...\edit.php:167
3	3.0202	65422568	WP_Hook->apply_filters( )	...\plugin.php:203
4	3.0202	65423560	my_bulk_action_handler( )	...\class-wp-hook.php:298
5	3.0207	65425280	Fork_Merge->merge( )	...\functions.php:625
6	3.0773	65535680	wp_update_post( )	...\merge.php:74
7	3.0817	65571496	wp_insert_post( )	...\post.php:3578
8	3.4870	66123448	do_action( )	...\post.php:3505
9	3.4870	66123720	WP_Hook->do_action( )	...\plugin.php:453
10	3.4870	66123744	WP_Hook->apply_filters( )	...\class-wp-hook.php:323
11	6.3302	74505504	WPML_Admin_Post_Actions->save_post_actions( )	...\class-wp-hook.php:300
12	6.3322	74513488	WPML_Post_Translation->after_save_post( )	...\wpml-admin-post-actions.class.php:102
13	6.3620	74567880	WPML_Post_Synchronization->sync_with_translations( )	...\wpml-post-translation.class.php:246
14	6.4408	74616552	WPML_Post_Synchronization->sync_with_translations( )	...\wpml-post-synchronization.class.php:206
15	6.4837	74626336	WPML_Post_Synchronization->sync_with_translations( )	...\wpml-post-synchronization.class.php:206
16	6.5304	74636496	WPML_Post_Synchronization->sync_with_translations( )	...\wpml-post-synchronization.class.php:206
17	6.5780	74646208	WPML_Post_Synchronization->sync_with_translations( )	...\wpml-post-synchronization.class.php:206
18	6.6189	74655920	WPML_Post_Synchronization->sync_with_translations( )	...\wpml-post-synchronization.class.php:206

Can you tell me how to disable the action from WPML?

Best regards.

May 22, 2017 at 9:24 am #1281345

claudiaD-5

Any updates?

May 23, 2017 at 5:25 am #1282205

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hi there,

Arvish is not available at the moment, so I am taking care of this ticket. Hope that is Ok. 🙂

Based on the previous replies I can say that this seems like a custom programming work as you have edited the code of the plugin, and this type of work is beyond the scope of our support. If you want the plugin itself to work without any edits we can send the plugin to our compatibility team after doing further debugs, let me know if that helps.

At this point, I would suggest you consider contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/

You will get the custom assistance you need to get on with your project. Before doing so please have a look also here: http://wpml.org/documentation/support/wpml-contractors/guidelines-for-people-looking-for-consulting-help/

Let me know if that helps.

Thanks

May 24, 2017 at 8:41 am #1283404

claudiaD-5

Hi,

I haven't done any editing to the WPML Plugin.
I'm just looking to disable those actions that are interfering with my work. Those actions are not described in your documentation. Can you please send the documentation related to those hooks? I need to disable those hooks like I disabled the save_post hook from wordpress.

Best regards.

May 24, 2017 at 10:41 am #1283511

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hi there,

I'm just looking to disable those actions that are interfering with my work. Those actions are not described in your documentation. Can you please send the documentation related to those hooks? 

Could you please elaborate this a bit more, are you referring to disable the actions created by the post Forking plugin?

Look forward to your reply.

Thanks

May 25, 2017 at 8:50 am #1284277

claudiaD-5

Hi,
What I meant was: I want to disable the WPML action that are triggered when using the wp_update_post and the wp_publish_post. As you can see, the purpose of my function above is to merge to the original posts all translations. For example: I have 1 article available in 3 languages, when I create a "Fork" of one of them, I edit that one, then I send the Fork to translation. After the translation are done, I want to merge all 3 posts back to the "forked" posts. Using this, I can edit my posts along time without interfering with the published ones, until I'm ready to publish the Forks (Drafts).

Can you please send the documentation that I need?

Best regards.

May 26, 2017 at 11:50 am #1285309

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hi there,

You can find a list of our supported hooks here: https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference.

I am not totally sure how you are using the code for this and since custom programming is not supported by our support policy, I suggest you to contact WPML contractors.

Let me know if you have further questions.

Thanks

October 26, 2018 at 2:03 pm #2853216

victorG-3

Hi there,

The lines you need before executing your code are:

global $wpml_post_translations;
remove_action( 'save_post', array( $wpml_post_translations, 'save_post_actions' ), 100 );

Once again, I can reaffirm that WPML support is terrible. Sad.