qtranslate / qtranslate-xt

qTranslate-XT (eXTended) - reviving qTranslate-X multilingual plugin for WordPress. A new community-driven plugin soon. Built-in modules for WooCommerce, ACF, slugs and others.
GNU General Public License v2.0
550 stars 103 forks source link

slugs forgotten #1275

Closed vonsch76 closed 1 year ago

vonsch76 commented 1 year ago

Seems that there is a problem with the slugs module in 3.13.0 After a day the slugs set are simply forgotten, disappear even from the DB. Both the first and second language slugs disappear, no error message goes with that. Had no issues with earlier versions.

herrvigg commented 1 year ago

In 3.13.0 I only made a minor change in Slugs about initialization sequence. I don't think it can explain this. IMO if there's a real problem it's not due to 3.13.0.

After a day the slugs set are simply forgotten

They are stored in the post meta. If you don't update the post there's no reason why qTranslate would delete them.

herrvigg commented 1 year ago

I would rather look at other plugins to find an explanation. Is there any other you could think of?

vonsch76 commented 1 year ago

The only plugin I upgraded was the qtranslate-xt, that is why I suspect it to be the problem.

herrvigg commented 1 year ago

I'm getting a bit lost with the discussion in the other thread. If there's still a problem of data being erased, do you have possibility to do some experiments? We could try from 3.13.0 and restore the slugs code from 3.12.1 though I don't think this explains the problem.

vonsch76 commented 1 year ago

The other thread is partly unlreated. SasaHref01 just found a friendly face. I am happy to do the experment, but how can we log it. I already had the data loss twice, then went back to the earlier and that works without data loss.

herrvigg commented 1 year ago

You could try taking 3.13.0 and revert the change in slugs, there's only one commit: https://github.com/qtranslate/qtranslate-xt/commit/e13fa39945f1c1abc409fa2e0dbe1e7eac872ca5. If you have git you could use git revert but it's also easy to do by hand. The first change in module/slugs/qtx_module_slugs. should not matter at all, if that code is run, the module has to be active. The change in module/slugs/slugs.php below the includes.

# 3.13.0
if ( is_admin() ) {
    include_once( dirname( __FILE__ ) . '/admin/slugs-admin.php' );
}

add_filter( 'qtranslate_convert_url', 'qtranxf_slugs_convert_url', 10, 2 );

global $qtranslate_slugs;
$qtranslate_slugs = new QTX_Module_Slugs();
$qtranslate_slugs->init();

Revert that to

# 3.12.1
global $qtranslate_slugs;
$qtranslate_slugs = new QTX_Module_Slugs();

if ( is_admin() ) {
    include_once( dirname( __FILE__ ) . '/admin/slugs-admin.php' );
}

add_action( 'plugins_loaded', array( $qtranslate_slugs, 'init' ) );
add_filter( 'qtranslate_convert_url', 'qtranxf_slugs_convert_url', 10, 2 );
herrvigg commented 1 year ago

The goal is to narrow it down. I don't think it's the reason, the problem could be there already in 3.12.1 more or less hidden. But if this revert works with the 3.13.0 baseline it would be surprising.

vonsch76 commented 1 year ago

I also don't believe that it is something that existed earlier. Maybe some interaction between php 7.4, wp 5.7.7, but now moved to php 8.1 and wp 6.0. Testing, nothing so far - but only half a day passed.

herrvigg commented 1 year ago

I also don't believe that it is something that existed earlier.

I don't think there's a regression in 3.13.0. The plugins_loaded hook is legacy code from the time Slugs was a plugin. The modules don't need this and should not use it. Each module entry point is called in QTX qtranxf_init_language which itself is already a callback for plugins_loaded. The only potential problem here is the order in which other components are loaded.

Testing, nothing so far - but only half a day passed.

Testing which QTX version or which changes?

vonsch76 commented 1 year ago

The newest QTX, 3.13.0. Still nothing, but let's give it another 2-3 days.

vonsch76 commented 1 year ago

@herrvigg everything seems to work fine, no unexpected events. The good part is that qtx is solid, thanks to you for that. The bad part is that I have no clue what caused the issue earlier. Anyway I believe you can close this ticket.

fintinc commented 1 year ago

Same problem here! After the update all slugs in posts, tags and categories in wp editor are empty... they reappear after updating the post. they still seem to work in the frontend but some languages are messed up. e.g. some french tags now appear between german tags.

image

image001

vonsch76 commented 1 year ago

@fintinc can you specify the WP and QTX versions you have? Maybe connected.

fintinc commented 1 year ago

@vonsch76 WordPress 6.1.1 and it happend after updating to QTX 3.13.0

vonsch76 commented 1 year ago

Try to go back to WP 6.0, the Metaslider issue also seems to be on WP 6.1.

herrvigg commented 1 year ago

After the update all slugs in posts, tags and categories in wp editor are empty... they reappear after updating the post.

Maybe there's something we missed, but if it's sorted out by updating it becomes a minor problem.

they still seem to work in the frontend but some languages are messed up. e.g. some french tags now appear between german tags.

@fintinc Is it still the case? Did you try with WP 6.0?

herrvigg commented 1 year ago

No update for 1 month, I close this ticket.