• Resolved smoothstep

    (@smoothstep)


    Hi, I have multilingual site with over 1000 custom posts. The plugin widget fails when editing one item in WordPress, this prevents WYSIWYG editor and other panels from loading. When the plugin is disabled the the editing works fine.

    I have tried to delete posts on a test site leaving around 500 and then the plugin works fine. Tried to increase the memory limits with no luck.

    https://wordpress.org/plugins/multisite-language-switcher/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Dennis Ploetner

    (@realloc)

    Please use the experimental autocomplete fields with that amount of posts.

    Thread Starter smoothstep

    (@smoothstep)

    Hi, managed to get it working with 2000+ posts

    I have optimized render_select() function in MslsMetaBox.php file, now it requires much less memory, the listing loop has been upgraded to:

    $my_query = new WP_Query(
    							array(
    								'post_type' => $type,
    								'post_status' => get_post_stati( array( 'internal' => '' ) ),
    								'orderby' => 'title',
    								'order' => 'ASC',
    								'posts_per_page' => -1,
    								'fields' => 'ids'
    							)
    						);
    
    					if ( $my_query->have_posts() )
    						foreach ($my_query->posts as $my_id) {
    							$options .= sprintf(
    								'<option value="%s" %s>%s</option>',
    								$my_id,
    								selected( $my_id, $mydata->$language, false ),
    								get_the_title($my_id)
    							);
    						}

    Please include this upgrade to the next version, some credits would be appreciated as well 😉

    Plugin Author Dennis Ploetner

    (@realloc)

    Sorry but as I said before

    Please use the experimental autocomplete fields with that amount of posts.

    because I’m not sure if improving that part is a really great idea.

    Please avoid to post code here if you like to contribute to the plugin. There is a repository at GitHub for this.

    Cheers,
    Dennis.

    Thread Starter smoothstep

    (@smoothstep)

    Your listing query was getting all the post fields and then preparing the post object for each listed item requiring huge amount of RAM if many posts are present, after my optimization the query just gets and array the post IDs, and then gets the title for each post ID which is cached by internal WordPress cache.

    I estimate the memory requirements have been reduced 10 times if not more, also substantial increase in rendering speed 😉

    Thread Starter smoothstep

    (@smoothstep)

    Posted at GitHub as a proposed change.

    Plugin Author Dennis Ploetner

    (@realloc)

    Where did you post it?

    Thread Starter smoothstep

    (@smoothstep)

    Plugin Author Dennis Ploetner

    (@realloc)

    This is my repository and there is no pull-request right now… did you fork the repository and did a pull-request too?

    Thread Starter smoothstep

    (@smoothstep)

    Here is the pull request, there are two suggestion, the first one is incomplete but I was unable to modify it, corrected with the second suggestion:

    https://github.com/lloc/Multisite-Language-Switcher/pull/94

    Plugin Author Dennis Ploetner

    (@realloc)

    Ok, very good. I will accept this.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘MSLS fails when editing post’ is closed to new replies.