Redirect users from admin pages the optimal solution

On two different sites I use two somewhat different solutions. Are they different in terms of security and performance? Which is better? Are there even better ones?

Solution 1.

/** Redirect users from admin pages if not administrators **/ add_action( 'admin_init', function() {     if( ! current_user_can( 'manage_options' ) && ( ! wp_doing_ajax() ) ) {         wp_safe_redirect( site_url() );         exit;     } } ); 

Solution 2.

/** Redirect users from admin pages if not administrators **/ add_action( 'admin_init', function() {     if( ! in_array( 'administrator', wp_get_current_user()->roles ) ) {         wp_redirect( get_bloginfo( 'wpurl' ) );         exit;     } } ); 

SEO Black Hat and distribution of malware by creating pages on lots of sites targeting the name of my site

My site made with WordPress is under SEO black hat attack. They’re creating many HTML pages using my site name such as following URLs with my site title & descriptions.

  • https://aaa.example111.it/my-site-name.html
  • https://bbb.example22222222.it/my-site-name.html
  • https://ccccc.example333.it/my-site-name.html

If you click the links of Google search results, first it displays ‘checking your browser before accessing’, then redirect to the malware site zvideo-live.com. Please see the attached list (although they are in Japanese).

What’s happening is very similar to ‘Japanese keyword hack’, but the difference is my site has not hacked and they are using another domains for this. (I thoroughly checked my site and Google tools.) Actually, the users don’t have any problems as far as they click my site domain on Google search results but my site and site domain are very new and most of the search results occupy these phishy sites and it’s annoying.

I made a abuse report to Google and OVHcloud, the domain company, but the malicious pages with new domains are being added every day and it’s very hard to keep doing this.

Following are the list of the domains that hackers are using. (As far as I detect.)

acquariobeb.it areaformativaliceomiranda.it brandoleseconsulenza.it byogastudio.it calabriamediterranea.it cmtservicesrl.it computerassistancesas.it domusvenetia.it fabioviglionephotography.it flanweb.it gabriellaricciocoach.it geniusdomus.it gpad.it granfondovalledelnisi.it lamonicaservizi.it macellerialimonenicola.it onmiccatania.it orsiinchianti.it pizzapadellino-slap-torino.it retedinapoli.it ristorantelafollia.it studiobaldin.it teatrokoine.it triede20.it xtecna.it zancleartecontemporanea.it 

enter image description here

Can “Corporation” structured data on pages about other companies get rich snippets for my site?

On my website I have a list of several hundred companies. And after you click any of them, you are navigating to the page, where you are able to see their details. For SEO on each company page, can I use "Corporation" schema markup to get a rich result for the company?

For the example, I have a few words about Google Inc on my page, so can I use some simple markup?

{   "@context": "https://schema.org",   "@type": "Corporation",   "name": "Google Inc",   "address": "some address",   "description": "A few words about Google inc." } 

Or maybe the rich snippet is reserved only for Google’s own website? Am I going to get some penalties for this? Or it will help me with SEO?

Adding an optional page title with background image to custom page templates (or all pages for that matter)?

I will explain what I’m trying to accomplish as I am having a difficult time figuring out the best way to ask this question. I have a custom theme that I am working on. I have several custom page templates for different page layouts etc.

I have one page template that places the page title centered below the header on top of a full width background image (featured image)…..a common template the user could use for interior pages if they want.

I realized that maybe they would want this feature at the top of some of the other layout templates. How can I add this to the top of every page template, but allow the feature to be checked on or off in the page editor? I feel like this should be somewhat standard, but I’m stuck.

Any help greatly appreciated!

Xampp 7.3.3 fresh install of WordPress 404 pages unless permalink is set to plain

I have been running xampp 7.3.3 for quite a while but i have recently installed 2 fresh installs of wordpress and if the permalinks are set to anything other than plain the pages are showing 404.

i have turned off all plugins and changed themes but the issue still happens

The home page will work ok I have tried resaving permalinks I have checked the Apache modules

Has anyone had this issue?

I am going to install a new version of xampp to see if it still happens.

Any advice appreciated