New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When exporting a WP site that uses Divi/WPML, only the English posts are exported #156
Comments
Reading through the code I believe I understand why this is happening... github_filename() assembles the correct path plus get_name() (for pages) or get_the_time().get_name() (for posts). And for translated posts and pages the post_name in the wp_posts database is identical, but the guid is different (for example |
You can customize the exported file with the The filename collisions are the only problem you're having, correct? |
Thanks for the quick response! |
Hmm, did some more googling and wrote a tiny plugin to add a filter - I think I did this right as it does get called:
but unfortunately it only gets called once per post_name - so it looks like the wpghs logic already gives up on creating multiple files before this filter gets called :-( |
Continuing to talk to myself here :-) So it turns out that WPML filters the responses to WP_Query to only show the active language. So this does require a tiny change to wpghs:
Note the 'suppress_filters' => true Then a quick plugin that gives you reasonable document names for your export could be this:
and this seems to work fine for me. The slightly cumbersome way to get the $slug here uses the WPML api to get to the untranslated matching post and then uses its name - this way all the names are consistent. about.en Next I need to see if the opposite direction works as well. Not sure if / how this could be made generic so I don't need to patch wpghs - could you add an option to suppress the filters? |
OK, I guess I have a solution here - I'd love to see the "suppress_filters" argument somehow be enabled as an option, though. |
So just so we're on the same page, this line:
would need to be added/modified so you can filter the arguments passed to the WP_Query? |
If you look at my snippet above, I added one element to $args: 'suppress_filters' => true |
Correct. You generally want to avoid modifying plugin files directly, as those changes will get overwritten when you upgrade the plugin. So you should use the If you're new to WordPress, check out the Codex, which has a lot of info about the Plugin API. |
The funny thing is - I've used WordPress since 2003; I remember when 'Miles' became the first named release. And I have done a bit of work on themes in the early days. But I have never really become a PHP developer - I have been a C (and lately C++) developer for 30 years, though :-) Anyway, to prove my point that I'm not all that competent, I updated the plugin, but somehow managed to get my WP installation confused. It now tells me
when I try to activate the updated plugin. Any idea what I messed up? |
How did you update the plugin? Through the UI? |
No, I figured it would be easier to checkout the git repository, so I deleted the folder and then did a git clone (I run my own wordpress site on a dedicated server). I now deleted the plugin from the UI and installed it again from the UI and that seems to have worked. I just fail to understand why I ran into this problem in the first place... The added filter seems to have worked, but I do have some odd changes in my git repo that I want to track down (two new files were added without language designation and one file with language designation was deleted) - something is odd there, but it's possible that it's in my plugin that adds the filters. |
The git repo depends on composer, PHP's package manager, which installs an autoloader to load our dependencies. On .org and GitHub's releases, I ensure |
One of the things that would be extremely nice is to be able to use Github in order for the translators to collaborate... I push changes to the English posts and pages to Github, the translators can then add pull requests for the updated translations.
But it seems that wpgs only syncs the original English posts :-(
The text was updated successfully, but these errors were encountered: