Issues when changing == to ===

The get_theme_mod() function could return an explicit false. The === operator looks for exact matches, so in the case of hide_logo not being set the function would return false and false is not an exact match to an empty string ”. The == operator is a bit more forgiving in that sense which is why … Read more

List posts that don’t have a specific tag?

I believe you can filter them out in your original WP_Query using Taxonomy Parameters. Then you can delete the for loop altogether. $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ =>-1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘post_tag’, ‘field’ => ‘slug’, ‘terms’ => array(‘fun’,’learning’), ‘operator’ => ‘NOT IN’, ), ), ); $wpb_all_query = new WP_Query( $args … Read more

Hide Featured Image Meta Box on Editor Screen

I tested it myself with the code you use and it only works with Gutenburg disabled. It seems to be related to the new editor. Assuming you want to use the new editor, and depending on your theme and plugins this code may work for you (it worked from my tests): add_action( ‘after_setup_theme’, function(){ // … Read more

Call to undefined function mysql_connect() After upgrading PHP 7.1 to 7.3

I mean your php.ini is changed, check for the entry extension=php_mysqll.dll. (If you has no knowledge where is your used php.ini – see https://stackoverflow.com/questions/8684609/dude-wheres-my-php-ini) Is this entry active, has no ; before the string. After change of the php.ini you need a restart of mysql, like sudo /etc/init.d/mysql restart. Also a note, check that mysql … Read more

Loading php file with AJAX in WordPress frontend

Try using get_template_part() function. use ob_end_clean() to Clean the output buffer and turn off output buffering. I have use html() to append data jQuery(‘#ajax’).html(response.content);. I have tested and working fine for me. jquery : jQuery(“#ajaxbtn”).click(function () { jQuery.ajax({ type : ‘post’, dataType : ‘json’, url : myajax.ajax_url, data : {action: ‘tablo’}, success: function(response) { jQuery(‘#ajax’).html(response.content); … Read more

Shortcode with PHP issue “Undefined index”

It’s because if the user enters large=”true”, then $atts[‘small’] isn’t defined. The normal solution is to use shortcode_atts() to set default values for the parameters, but you’re not putting the result of shortcode_atts() into $atts, you’re just just extracting it. This means that $small will be defined, but $atts[‘small’] won’t be. The proper way to … Read more

How to Return in WordPress Function php file?

Your function should look something like this function my_custom_function( $html, $content ) { $html .= get_post_field(‘post_content’, $post_id); $html = “<div class=”post”>” . $html . “</div>”; return $html; }

Can WP plugins access files outside the installation folder?

Can they theoretically develop a WP plugin to access the files (or even WP config, including DB credentials) of another WP installation? Yes. If your folders are owned by the same user, run as the same user in Apache/Nginx or have read/write access to each other, then it’s possible. Your installations are sandboxed at the … Read more