Post Undeleted by Jack Johansson
3 added 16 characters in body
source | link

The problem is that you are using 'orderby'=> 'rand'. The sorting is done byYou could use 'order'meta_query to search in the meta data, so your arguments should look like this insteadand then sort them as random:

$args = array(
        'posts_per_page' => 4,  
        'post_type' => 'projekte', 
        'orderby'=> 'meta_value_num''rand',
        'post__not_in' => array( get_the_ID() ),
        'meta_key''meta_query' => array(
            array(
                'key' => 'ecpt_skills', 
        'meta_value'        'value' => $projektart, 
        'meta_compare'        'compare' => 'LIKE', 
        'post__not_in' => array( get_the_ID() ),
        'order' => 'rand'),
    );

There is also a mistype in your code, the post__not_in should be written as 'post__not_in'.

And also, if your meta value is not numeric, you should use meta_value instead of meta_value_num.

The problem is that you are using 'orderby'=> 'rand'. The sorting is done by 'order', so your arguments should look like this instead:

$args = array(
        'posts_per_page' => 4,  
        'post_type' => 'projekte', 
        'orderby'=> 'meta_value_num' 
        'meta_key'  => 'ecpt_skills', 
        'meta_value' => $projektart, 
        'meta_compare' => 'LIKE', 
        'post__not_in' => array( get_the_ID() ),
        'order' => 'rand',
    );

There is also a mistype in your code, the post__not_in should be written as 'post__not_in'.

And also, if your meta value is not numeric, you should use meta_value instead of meta_value_num.

You could use meta_query to search in the meta data, and then sort them as random:

$args = array(
        'posts_per_page' => 4,  
        'post_type' => 'projekte', 
        'orderby'=> 'rand',
        'post__not_in' => array( get_the_ID() ),
        'meta_query' => array(
            array(
                'key' => 'ecpt_skills',
                'value' => $projektart,
                'compare' => 'LIKE',
            )
        ),
    );

There is also a mistype in your code, the post__not_in should be written as 'post__not_in'.

And also, if your meta value is not numeric, you should use meta_value instead of meta_value_num.

    Post Deleted by Jack Johansson
2 added 105 characters in body
source | link

The problem is that you are using 'orderby'=> 'rand'. The sorting is done by 'order', so your arguments should look like this instead:

$args = array(
        'posts_per_page' => 4,  
        'post_type' => 'projekte', 
        'orderby'=> 'meta_value_num' 
        'meta_key'  => 'ecpt_skills', 
        'meta_value' => $projektart, 
        'meta_compare' => 'LIKE', 
        'post__not_in' => array( get_the_ID() ),
        'order' => 'rand',
    );

There is also a mistype in your code, the post__not_in should be written as 'post__not_in'.

And also, if your meta value is not numeric, you should use meta_value instead of meta_value_num.

The problem is that you are using 'orderby'=> 'rand'. The sorting is done by 'order', so your arguments should look like this instead:

$args = array(
        'posts_per_page' => 4,  
        'post_type' => 'projekte', 
        'orderby'=> 'meta_value_num' 
        'meta_key'  => 'ecpt_skills', 
        'meta_value' => $projektart, 
        'meta_compare' => 'LIKE', 
        'post__not_in' => array( get_the_ID() ),
        'order' => 'rand',
    );

There is also a mistype in your code, the post__not_in should be written as 'post__not_in'.

The problem is that you are using 'orderby'=> 'rand'. The sorting is done by 'order', so your arguments should look like this instead:

$args = array(
        'posts_per_page' => 4,  
        'post_type' => 'projekte', 
        'orderby'=> 'meta_value_num' 
        'meta_key'  => 'ecpt_skills', 
        'meta_value' => $projektart, 
        'meta_compare' => 'LIKE', 
        'post__not_in' => array( get_the_ID() ),
        'order' => 'rand',
    );

There is also a mistype in your code, the post__not_in should be written as 'post__not_in'.

And also, if your meta value is not numeric, you should use meta_value instead of meta_value_num.

1
source | link

The problem is that you are using 'orderby'=> 'rand'. The sorting is done by 'order', so your arguments should look like this instead:

$args = array(
        'posts_per_page' => 4,  
        'post_type' => 'projekte', 
        'orderby'=> 'meta_value_num' 
        'meta_key'  => 'ecpt_skills', 
        'meta_value' => $projektart, 
        'meta_compare' => 'LIKE', 
        'post__not_in' => array( get_the_ID() ),
        'order' => 'rand',
    );

There is also a mistype in your code, the post__not_in should be written as 'post__not_in'.