wp-salt.php and wp-cli.yml File present in public_html folder

These are safe. Normally the contents of wp-salt.php is in the wp-config.php. The reason you site became inaccessible is due to the change in wp-config.php to include wp-salt.php. I.e. include(‘wp-salt.php’); You can delete wp-salt.php, but be sure to copy the defines into the wp-config.php were the “include(‘wp-salt.php’);” line is and remove the “include(‘wp-salt.php’);” line. The … Read more

How to add additional http header to a wp_error rest response

WP_REST_Response extends WP_HTTP_Response class, which has a header() method for setting headers. Using the rest_request_after_callbacks filter should allow setting the header, but will need to duplicate the functionality of WP_REST_Server->error_to_response(), which at time of writing calls rest_convert_error_to_response(), so that’s easy enough. Here’s what I think this will end up looking like (untested). add_filter( ‘rest_request_before_callbacks’, static … Read more

How to send email verification code for a form?

You need to put together some php & db calls to handle the form submission, generate some unique code for each email and sending the verification code. Below I added a very basic example that can achieve that. It’s not a production ready code but tested and it works just fine. Firstly, you need to … Read more

WordPress Related Posts by Title and Category

Probably the simplest approach is to combine the category query with a search query (untested): $cat_query = new WP_Query( array( ‘cat’ => $cat_id, ‘post__not_in’ => array( get_the_ID() ), ‘no_found_rows’ => false, ‘posts_per_page’ => 6, ) ); $title_query = new WP_Query( array( ‘post__not_in’ => array( get_the_ID() ), ‘s’ => get_the_title(), ‘no_found_rows’ => false, ‘posts_per_page’ => 6, … Read more

Adding more links to the tool bar

So what you need to do is repeat what you’re doing, and we’ll use a foreach loop to achieve it I’ll give you an example of code that basically does what you need, but it creates an array of arrays. You initially created array called $args which represented a single link, but you need to … Read more

I need help with this error [duplicate]

Check your themes and plugins for the string uthan_preloader. There is likely a hook or filter somewhere that calls the function above, but the function does not (or no longer) exists. An example of how that could come to be: maybe it was part of a plugin that got deactivated but is still referenced in … Read more

Adding a posts count in archive pages

If the theme your’re using doesn’t do anything fancy, but uses the_archive_title() to render the “Lignano Sabbiadoro”, then you should be able to modify it with the get_the_archive_title filter. Something along these lines. add_filter(‘get_the_archive_title’, ‘my_get_the_archive_title_filter’, 10, 3); function my_get_the_archive_title_filter(string $title, string $original_title, string $prefix): string { if (! is_category()) { return $title; } $current_category = … Read more