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 1 reply, has 2 voices.

Last updated by Itamar 1 month, 3 weeks ago.

Assigned support staff: Itamar.

Author Posts
August 31, 2019 at 10:16 am #4490603

haniA-4

I am trying to get all categories from back-end but I get an empty array on non-default language:

The default language shows the category menu below the main menu.
hsharabia.com

But I do not get anything in arabic language(non-default language)
hsharabia.com/ar

Here is my code(no custom query works):

    $taxonomy = 'product_cat';
    $order_by = 'include';

      $args = array(
            'taxonomy'     => 'product_cat',
            'orderby'    => 'include',
            'hide_empty' => false,
            'include'    => array( 233, 169, 305, 212, 274, 308, 309, 310)
      );
    //Both the get_categories and get_terms return empty array
    $all_categories_2 = get_categories($args);
    $all_categories = get_terms( $args );
    
    
    if(empty($all_categories)){
        //testing a general query using wpdb
        function testing_wpdb_get_results() {
            global $wpdb;
            $results = $wpdb->get_results( 
                    $wpdb->prepare("SELECT * FROM `wp_comments`") 
                 );
                 var_dump($results);
        }
        testing_wpdb_get_results();
    }
September 1, 2019 at 11:16 am #4492435

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

It is essential for me to state that supporting custom code is out of the scope of this support forum. Please see our support policy here. https://wpml.org/purchase/support-policy/

Nevertheless, we have extensive information for developers at the following link.
https://wpml.org/documentation/support/
And we have API hooks which you can use here.
https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/
If something is not working for you with one of our hooks and you can show us what is not working, we'll investigate why it is happening and advice to you how to use it or fix it if from our side needed.

But otherwise, as I wrote here, debugging a custom theme is out of the scope of this forum.
At this point, I would suggest you consider contacting one of our certified partners from this link: https://wpml.org/contractors/
Before doing so please have a look also here:
https://wpml.org/documentation/about-wpml-contractors/what-type-of-work-you-can-expect-from-contractors/

With our contractors, you might get the custom assistance you need to get on with your project.

Best Regards,
Itamar.