WP-CLI Search and Replace only on POSTS not PAGES

I am trying to use WP-CLI to do a search and replace on about 10,000 posts that were imported from another CMS and it has a great deal of old inline styles and spans and such. I would like to be able to use the search and replace function to remove a lot of chaff using regex. I have no issue creating the regex or limiting my command to just the content column in the wp_posts table, but I do not see a built in way way to limit my post_type to only post, not page or others that are in the wp_posts table. Is there one?

functions – Replace menu links with # and add name to its li

I have a wordpress menu:

<?php
    wp_nav_menu( array(
    'theme_location' => 'menu-categorias',
    'container' => 'ul',
    'menu_class' => 'navbar-nav dragscroll' ) );
?>

Which outputs this:

<ul id="menu-menu-categorias" class="navbar-nav dragscroll">
  <li id="menu-item-8" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-8 nav-item fadeIn">
    <a href="http://website.test/category/ux/" class="nav-link">Ux</a>
  </li>
  <li id="menu-item-9" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-9 nav-item fadeIn">
    <a href="http://website.test/category/editorial/" class="nav-link">Editorial</a>
  </li>
</ul>

I want the URLs of the nav-items to be replaced with # and to add the name of the category (in lowercase) to its li class . So the menu output should be like this:

<ul id="menu-menu-categorias" class="navbar-nav dragscroll">
  <li id="menu-item-8" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-8 nav-item fadeIn ux">
    <a href="#ux" class="nav-link">Ux</a>
  </li>
  <li id="menu-item-9" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-9 nav-item fadeIn editorial">
    <a href="#ux" class="nav-link">Editorial</a>
  </li>
</ul>

I tried adding this but I don’t get anything changed:

function lb_menu_anchors($items, $args) {
  foreach ($items as $key => $item) {
      if ($item->object == 'custom' && substr($item->url, 0, 1) == '#') {
          $item->url = site_url() . $item->url;
      }
  }
  return $items;
}
add_filter('wp_nav_menu_objects', 'lb_menu_anchors', 10, 2);

Any help to achieve these two things?

Replace Image in sharepoint Template (.xml) in Powershell

I have a problem about “Replace Image in sharepoint Template (.xml)”.
I have saved a SPO Team-Website Template (.xml) in my computer through powershell (in below code The name of this Template is:Site1-Template.xml and it includes: Image, Text, .. .).
Then I want to replace my selected newImage(Redicon) to OldImage(Blueicon) in this .xml Template file.
I found any Code and I changed it but it doesn’t work. can you please help me.

p.n: Sorry for my bad english and thank you in advance for your help.

#Get the Web and get it's Template content
$webs = connect-pnponline "https://admin.sharepoint.com/sites/Site1" | get-content -Path C:UsersTMPLSite1-Template.xml

#Iterate through webs
foreach ($web in $webs)
 {

 #Get All Images from site's Root into $AllPages Array
  $AllPages = @($web.Files | Where-Object {$_.Name -match ".aspx"})

  #Iterate through all pages
   foreach($Page in $AllPages)
     {
       #Web Part Manager to get all web parts from the page
        $webPartManager = $web.GetLimitedWebPartManager($Page.ServerRelativeUrl, (System.Web.UI.WebControls.WebParts.PersonalizationScope)::Shared)

       #Iterate through each web part
       foreach($webPart in $WebPartManager.WebParts)
          {
            $OldImage=$webPart.Image
            #Get the Content web part with specific Image
            if($webPart.Image -like "SiteAssets/SitePages/Site1-Template/Blueicon.jpg")
             {
                  #Replace the Old Image
                  $webPart.Image = $webPart.Image.Replace("SiteAssets/SitePages/Site1-Template/Blueicon.jpg", " C:UsersTMPLSite1-TemplateRedicon.jpg")
        
                   
                  #Save the changes
                  $webPartManager.SaveChanges($webPart)
                 
                  write-host "Updated '$($OldImage)' on $($web.URL)$($Page.ServerRelativeUrl)"
             }
           }
       }

 
 }


#ApplyTemplateToNewWebsite
Connect-PnPOnline -Url https://admin.sharepoint.com/sites/The Other Website
Apply-PnPProvisioningTemplate -Path C:UsersTMPLSite1-Template.xml

Replace by Fee- Unconfirmed Transaction

Ledger Wallet doesn’t support RBF but you can do Child Pays For Parent:

Make a transaction to your address 3M6EhQL3QUQHAFkSPH3vLc3VDCrJKP3iMv with amount 0.011, set a fee rate, preview the transaction and check and confirm the transaction only if one of the inputs is 0.01187067 BTC.

If this doesn’t work, download Electrum and CPFP from there.

But honestly, the fee rate of your transaction is not terribly low. I would wait another 24 hours.

macos – Replace symbolic links to libraries in executable with full path

Because I use homebrew to manage my packages but I compile ffmpeg by myself (I need to enable some components that is not included in the homebrew build), when homebrew upgrades one of its formulas that is a dependency of ffmpeg dyld can’t find the library. Because I set an environmental variable to disable homebrew cleaning old versions of formulas, the libraries are still there, just that the /usr/local/opt/<formula> path is linked to the new version in /usr/local/cellar/<formula>/<new_version>. How can I replace the symbolic links in the libraries ffmpeg links to with the full path? E.g. /usr/local/opt/x264/lib/libx264.155.dylib to /usr/local/Cellar/x264/r2917_1/lib/libx264.155.dylib I know I can use install_name_tool, but there are 151 libraries and 3 executables (ffmpeg, ffprobe, and ffplay) so it’s very time-consuming to do it by hand.

boot – Replace Windows 10 with Ubuntu 20.04

Replace Windows 10 with Ubuntu 20.04 on a Huawei machine

Hi guys!

I am trying to erase my Windows and replace it with Ubuntu. I watched this video about how to do it: https://youtu.be/lqSL_s4put8

But when I click the Restart button in order to boot from the USB, I got a notification stating that the Boot: FAILED

And then my BIOS menu opened..why this happened? what should I do now?

I was advised to disable the Secure Boot and try that way, which is what I did but unfortunately no progress…BIOS opens again..please help

View post on imgur.com

python – How to add padding in a dataset to fill up to 50 items in a list and replace NaN with 0?

I have the following encoded text column in my dataset:

[182, 4]
[14, 2, 31, 42, 72]
[362, 685, 2, 399, 21, 16, 684, 682, 35, 7, 12]

Somehow I want this column to be filled up to 50 items on each row, assuming no row is larger than 50 items. And where there is no numeric value I want a 0 to be placed.

In the example the wanted outcome would be:

[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,182, 4]
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14, 2, 31, 42, 72]
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,362, 685, 2, 399, 21, 16, 684, 682, 35, 7, 12]

mysql – Running a Find and Replace in phpMyAdmin with Regular Expression Using REGEXP_REPLACE

When I run an exact match find and replace, it works:

UPDATE wp_posts SET post_content = REGEXP_REPLACE (post_content, '" width="1920" height="1080" class="alignright size-medium wp-image-6378" /', '" class="aligncenter" /') WHERE post_author = 30;

When I attempt to run a find and replace with regex, it fails:

UPDATE wp_posts SET post_content = REGEXP_REPLACE (post_content, '" width="(d+)" height="(d+)" class="alignright size-medium wp-image-(d+)" /', '" class="aligncenter" /') WHERE post_author = 30;

I just need a wildcard match for any number for these 3 places, where there are thousands of images with various widths, heights, and IDs.

I’ve tried (d+), (d+), and d+ and get 0 matches.