PHP Session Variable to WordPress Error

You need to add your code to the functions.php file of your theme. (Actually, adding it to your Child Theme is best, since you don’t want a theme update changing things. Unless you are writing your own theme.) So this in your functions.php file: if(!session_id()) { session_start(); }

Add custom taxonomy to custom search for posts

you should go through all wpQuery docs for easily understand this. To do this task use this for for making query: $args = array( ‘post_type’ => ‘your_custom_postType’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘your texonomy ‘, //like category, actor, people etc. ‘field’ => ‘slug’, ‘terms’ => ‘your_term’, //like rock,bread, tom ), ), ); $query = … Read more

My own theme’s custom widget areas are not working

I fixed your functions.php code: <?php add_theme_support(‘post-thumbnails’); add_theme_support(‘menus’); /** * Enqueue scripts * * @param string $handle Script name * @param string $src Script url * @param array $deps (optional) Array of script names on which this script depends * @param string|bool $ver (optional) Script version (used for cache busting), set to null to disable … Read more

get_users when from meta key that has serialized values

I’m assuming that the meta_value has a serialized array, not the meta_key (For it would make no sense to have the meta_key to be a serialized array) You really should save the values in seperate fields to be able to query it by wordpress internal functions like get_users. If you definitely have to preserve this … Read more

How fix error in the WordPress loop?

You’ve set ‘posts_per_page’ => -1,, which means unlimited posts per page, but are checking $wp_query->max_num_pages > 1. There’s never going to be more than 1 page if you have unlimited posts per page.

PHP is_embed error showing up

The error itself is not because debug mode, it seems that the hook you’re using is being called before the $wp_query is set. what you can do is put inside your function function your_error_function(){ global $wp_query; if(! isset( $wp_query )){ return } …rest of my code } or change the hook you’re using to another … Read more

user update profile for custom code

I can see $topselected= get_the_author_meta( ‘user_top’, $user->ID ); , here you are using “user_top” as the meta_key but while updating you are using “user_chapter” update_usermeta( $user_id, ‘user_chapters’, $_POST[‘user_chapters’] ); Whatever name you are providing in <select name=”user_top” id=”user_top”>, should be used in $_POST[”] So here you are using “user_top” as your select name, so it … Read more