WordPress is removing http:// from my urls

I can’t really tell you what exactly happens. However, if you work with wordpress, you can as well use the functions that wordpress provides, as they may give you more information about what is happening and why. Let’s use wp_remote_get for your function: function check_if_species_exists( $species_name ){ $species_name = sanitize_text_field( $species_name ); //never trust user … Read more

Can Multisite and Custom Post Types work this way?

You can put something like this in a theme template: <?php switch ( get_current_blog_id() ) { case 9: $category = ‘alignment’; break; case 13: $category = ‘lists’; break; case 14: $category = ‘comments’; break; default: $category = ”; break; } switch_to_blog( BLOG_ID_CURRENT_SITE ); // root site. $category_posts = get_posts( array( ‘category_name’ => $category, ) ); … Read more

Can I remove these lines form my WordPress robots.txt

You can disable the robots.txt file by putting this code in an mu-plugin: remove_action( ‘do_robots’, ‘do_robots’ ); However, I don’t recommend that. It will make it harder for search engines to index your content, and it won’t really do anything to hide the fact that you’re using WordPress. There are a dozen ways that someone … Read more

add_editor_style now copying html styles to .editor-styles-wrapper?

I had a look at the code history in the Gutenberg repository, and it looks like html and body have been transformed since the very beginning, 5 years ago: https://github.com/WordPress/gutenberg/blame/15fc0c13eb33a6e4426ff4ad681b6bfb6d0adaec/packages/editor/src/editor-styles/transforms/wrap.js :root was added several months later. So yes, it appears to be intentional, but not new. If something has changed in your styles in 6.3 … Read more

condition for specific pages

The easiest way to do it would be: if ( is_category (‘4’) ) { echo ‘<a class=”btn” href=””>Enquire</a>’; } else { echo ‘<a class=”btn” href=””>Calendly link</a>’; } Obviously you would change “4” to whatever the specific category number is. Also, the WordPress template hierarchy could be helpful if you have add’l changes: https://developer.wordpress.org/themes/basics/template-hierarchy/#category If you … Read more

I have created a custom plugin. After activation it creating page but i am not getting how to add another php file at page content?

I would approach this in different way. In this original index.php file, keep it simple, like this: if ( ! defined( ‘ABSPATH’ ) ) { exit; } if ( ! class_exists( ‘My_Plugin’ ) ) { require_once __DIR__ . ‘/includes/class-my-plugin.php’; $my_plugin = My_Plugin::get_instance(); } In this new file you create class: class My_Plugin { protected static … Read more

How to tie two conditions to one statement

You can do this: $ac_inc = get_the_author_meta( ‘ac_inc’, $post->post_author ); if (has_tag(‘aria condizionata’, $post) && !empty($ac_inc)) { $ac_inc=”<div class=”ac_inc”>”. $ac_inc .'</div>’; } But actually the double “if” statement would be more optimal, as you would only run ‘get_the_author_meta’ when needed: if (has_tag(‘aria condizionata’, $post)) { $ac_inc = get_the_author_meta( ‘ac_inc’, $post->post_author ); if(!empty($ac_inc)){ $ac_inc=”<div class=”ac_inc”>”. $ac_inc … Read more

I think WordPress is blocking me on Google – and I don’t even use WordPress now, but the ‘discourage’ box remains?

The only thing the “discourage search engines from indexing” checkbox did was add a noindex tag to the header of your WordPress site. If you’re not using WordPress anymore that tag isn’t there anymore and it cannot have any effect. Any solution to the issue you’re experiencing now will not involve WordPress, so there’s not … Read more