Adding HTML to posts with certain tags?

When I want to add a site-wide HTML code (before the closing tag) to each post and page in my site, I always go to my:

  • WordPress Panel > Customize > Theme Settings > Header/Footer Scripts > Footer Scripts

And paste the code there. Works perfectly fine.

But now I want to add this code only to my posts with certain tags. I tried this (tags are X Y and Z):

function wpb_hook_javascript_footer() {
  if (has_tag ('X' 'Y' 'Z')) { 
    ?>
          // My HTML Code goes here
    <?php
  }
}
add_action('wp_footer', 'wpb_hook_javascript_footer');

But I guess it doesn’t work (update keeps loading, never ends)?

Any words of wisdom?

Go to Source
Author: user190411

No sound playback during call in Slack – Ubuntu 20.04

I’m on 20.04 and downloaded Slack using snap. I downloaded Spotify via snap as well as my speakers work. Not sure why Slack isn’t working. I tried every single sound source.

Go to Source
Author: Dan

Is it possible there is another volume control setting for Slack application that was missed out? It is sometimes hidden deep in the Sound Settings under Applications.

I had a similar experience with Zoom for Linux. I could not hear a sound at all. The main system volume was all the way up. The app was connected to the device’s audio correctly. I reconnected a couple of times. Only to find out later on that there was yet another set of input/output controls for Zoom that was not so obvious. I only had to turn it up to hear sound during a call. By default it always seems to be at 0 when I join a call, which is weird.

Secondary replica database file location in Availability Group

I inherit a setup of two nodes (primary & secondary replica) Availability Group.

On my secondary replica node, the SQL server instance default files are stored at:

enter image description here

My default primary replica node files are as follow:

enter image description here

When I look at the synchronizing database’s properties on my secondary replica, I see its database files as follow

enter image description here

They are primary replica node directories. Is this how it works in Availability Group?

That is when you look at the file group of your secondary replica database, they show the paths of the primary replica database even though the data file and log file are stored at a different local directory?

Go to Source
Author: Fylix

What firewall should I use?

What is the most comprehensive free firewall solution available for Windows? Personal machine, not work machine. I see a ton of choices online, but not sure which one to pick.

Go to Source
Author: PerpetualLearner

ANSWER

For home use I am fine with the built-in and free Windows Firewall (or Windows Defender Firewall) most of the time. It serves its purpose. Does the job. Not overwhelming to use. Customizable enough.

I would also explore the security options that comes with my home router. Many have it included nowadays, and with a little tweaking, should be able to add an extra layer of protection to one’s home network..

Easy way to bypass password on my computer

I was not able to formule a question so maybe this was already solved, and if that’s the case, sorry.
But I found a huge vulnerability on my computer. It’s a portable computer with a Win10/Ubuntu 20.04 dual boot.
When I’m logged in, and that I lock my session, this sends me to the login screen, okay. But then, if I do Ctrl+Alt+F3 to go to the terminal mode, and then do Ctrl+Alt+F7 to leave terminal mode, this simply unlocks my session !
It doesn’t work at computer start though, the session must be started and locked.
Note that when I close my computer this doesn’t lock my session even if it’s activated in the settings.
This is a critical vulnerability but it’s doesn’t work at all on my friend’s computer which is also a Win10/Ubuntu 20 dual boot.
I don’t know why this happens to me, any idea of solving this ?

Thanks for you time

Go to Source
Author: Double VĂ©

ANSWER

This does not seem to be a normal behavior from what I’ve experienced at all as far as I can remember. I know before I was fond of having my Linux desktop auto-login on startup. I think I also opted to have it login automatically after sleep/suspend. Perhaps the switch to a different TTY/console constitutes as the same behavior. This looks a lot like buggy behavior to me.

I would go so far as to document on how to replicate it, and report it as a bug. Call the attention of the developers so this can be looked into and fixed if necessary.

How to manage user java deployments in a small team, across different java applications (which require different java versions)?

I provide a java application (desktop client) which requires jdk11 (it really does).
We installed that SDK on all users and were happy for a while.

Then, someone shared with us his java application (also a desktop client, but unrelated to mine), which only works with jre8 (he is not willing to recompile to 11 and his status in the company is such that we must conform to him at all costs)…

I’ve instructed the team members to change their JAVA_HOME between an installed jre8 and jdk11, as they need, but this doesn’t seem like more than an annoying manual stop gap.

I am wondering what is a good, modern approach to allow, for example: a system-wide jre8 for the applications I don’t control but also code a little something into my project that can switch to jdk11 for the duration of their use of my application?

Since I am delivering a project with source code (which compiles every time they run, because they sometimes need to modify some of the java code), I am thinking along the lines of including a portable jdk11 and have the project refer to that as the SDK, relatively (so that they don’t have to install anything to get my application going).

I actually tried this a little bit but couldn’t get it done and I am wondering if it’s a good approach that is worth fixing or there is a better idea?

Can you share your experience about this relatively common problem?

Edit: + I am not sure a containerized solution is viable. It sounds like I’ll have to help them set up their system to support that and then wrap my project in a container – which sounds like a can of worms for someone with my skills (middleweight java dev, at best)

Go to Source
Author: DraxDomax

Erase the HTML website and replace it with a WordPress website -301 Redirection

We are going to erase the HTML website and replace it with a WordPress website (New redesigned site).
We already have 301 redirection( http to https) in .htaccess file. Is this 301 redirection is enough for maintain the SERP ranking/pass the link juice.
Or
Is we need to add extra page level 301 redirection for all the pages/important pages to its corresponding wordpress pages.

Eg : /about.html to /about

Go to Source
Author: jeens

Adding Custom Endpoint in WordPress Rest API

I have been working on custom WordPress rest API Endpoint. Goal is to create a WordPress custom route in this route i want to get Category Id and convert it to Category Name. I have written the function but its returning null for the category Id. The function simply get the categories of the WordPress and register the route.How Can I get the all Categories Id and convert category Id into category name.

{

    $categories = get_categories();

    $data = [];
    $i = 0;

    foreach ($categories as $category) {

        $data[$i]['id'] = $category->ID;
        $i++;
    }

    return $data;
}
add_action('rest_api_init', function () {
    register_rest_route('w/v2', 'trending', [
        'methods' => 'GET',
        'callback' => 'w_categories',
    ]);
});```

Go to Source
Author: Shahryar Rafique

Extending an extended partition with following unallocated disk space

There seem to be many scenarios, I read quite a few, but I caould not find a match for my problem.

I have this gparted view on my system:
gparted screen

I had sda6 swap sit right behind sda5; I moved that sawp space to another disk. Then swapoff and deleted sda6; then extended sda5 to consume the free 8GB… all good so far.
These two (sda 5 and sda6) were in the same “extended” partition.

However, allocating the unallocated 256 GB does not work; as I cannot extended the sda3 partition.
My understanding is that the 0.25 version of gparted allows for online disk extending.
What options do I have?
Can this be done on a live system?

Go to Source
Author: MaxG

Connecting to mysql db server from a remote server to a local machine

As per my understanding, there are two main things to check before connecting to a remote mysql db server.

1. Bind address.
2. Grant privileges.

I was able to connect to a remote mysql db server from my Mac, it was easy (mysql -uroot -h x.x.x.x -p)

Imagine a scenario for my own learning, I want to connect to a mysql db instance on my Mac from a remote server. Imagine I am logging into this remote linux machine from my Mac and trying to connect to my own Mac db server?

mysql -uroot -h x.x.x.x -p

is raising an error 2003 mysql cannot connect 10060 cannot connect to the x.x.x.x server. It is similar to the reverse proxying while connecting to the local machine from a remote one, can someone direct to right resource (if there is a similar question please comment) which can help me figure out this thing?

Go to Source
Author: JumpMan

Phpmyadmin access denied every time ubuntu restarts

I have a xampp installation on my ubuntu machine. And I am trying to use phpmyadmin to access mysql. But every time I start xampp and try to open phpmyadmin I get an error that says mysqli::real_connect(): (HY000/2002): Connection refused. I have read some questions and changing mysql password seems to fix this. But I don’t want to change mysql password every time I restart my pc. Is there any way to fix this? Any help would be appreciated. Thanks

Go to Source
Author: Abdulaziz Yesuf

How to reproduce SQL Injection problem by sending single quote in MySQL?

This is Damn Vulnerable Web Application (DVWA) and it’s vulnerable to SQL injection (SQLi).

Let’s begin by sending normal request

http://127.0.0.1/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#

Output via browser

ID: 1
First name: admin
Surname: admin

This is how the request looks like in MySQL

mysql> SELECT first_name, last_name FROM users WHERE user_id = '1';
+------------+-----------+
| first_name | last_name |
+------------+-----------+
| admin      | admin     |
+------------+-----------+
1 row in set (0.00 sec)

mysql> 

Common way to identify SQL injection is by sending single quote ' char in the parameter.

E.g. id='

Give it a try on the url and it works.

http://127.0.0.1/dvwa/vulnerabilities/sqli/?id='&Submit=Submit#

Web browser will display SQL error indicates that the site is vulnerable to SQLi

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''''' at line 1

I didn’t know how the query looks like in MySQL ..

So I’ve tried SELECT first_name, last_name FROM users WHERE user_id = '''; but I didn’t get the same error.

Instead, I was getting '> symbol from MySQL shell.

mysql> SELECT first_name, last_name FROM users WHERE user_id = ''';
    '> 
    '> 
    '> '
    -> 
    -> ;
Empty set (0.00 sec)

mysql> 

What is the right way to query id=' or user_id = ' (single quote) request in MySQL?

Go to Source
Author: Wolf

Wifi disconnects automatically after sometime

My WiFi disconnects automatically after sometime and is working again only after a reboot.

Here is the result of lshw -C network

  *-network
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: eno1
       version: 15
       serial: 80:ce:62:7c:c1:77
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 firmware=rtl8168h-2_0.0.2 02/26/15 latency=0 link=no multicast=yes port=MII
       resources: irq:16 ioport:4000(size=256) memory:b1104000-b1104fff memory:b1100000-b1103fff
  *-network DISABLED
       description: Wireless interface
       product: RTL8723DE 802.11b/g/n PCIe Adapter
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: wlo1
       version: 00
       serial: 40:9f:38:f7:ca:8f
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress cap_list ethernet physical wireless
       configuration: broadcast=yes driver=rtw_pci driverversion=5.4.0-33-generic firmware=N/A latency=0 link=no multicast=yes wireless=IEEE 802.11
       resources: irq:130 ioport:3000(size=256) memory:b1000000-b100ffff

and here is result of iwconfig

wlo1      Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off

i am using ubuntu 20.04

EDIT: output of rfkill list all

0: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
1: hci0: Bluetooth
    Soft blocked: no
    Hard blocked: no

Go to Source
Author: parv desai