Colliding custom permalink rules

I’m developing a reviews site in WordPress, but am having some difficulties setting up the permalink structure I have in mind.

I created two extra custom post types “reviews” and “products”.
They both have the taxonomy “categories” attached to it. All reviews have the same name as the deepest category attached to it.

Reason for this I want 3 different pages:

  • category page: list view of products within that category + a link to the detailed review for that category
  • review page: a detailed review of all products listed beneath each other.
  • product page: a detailed review of one particular product.

The permalink structure should be like this:

  • category page: /%category%/ (so just the category hierarchy)
  • review page: /%category%/review (I don’t use %postname% because a review will only be in one category hierarchy and I want to show the full category hierarchy in the url)
  • product page: /%category%/%postname%/review

Is this actually technically possible?
I’ve been fiddling a lot yet (with adding permastructs) but only get 1 or 2 to work, but they seem to collide with eachother. Is there a way to bypass this?

Thanks

Go to Source
Author: Laurent

Remove add_action from plugin

I use this plugin. Is for auto expire user on specific date.

I want to add this action add_action(‘edit_user_profile’, array($this, ‘extra_user_profile_fields’)) when is_admin only because i have a conflict with an other plugin. I have try this to source code:

if (is_admin) {
add_action('edit_user_profile', array($this, 'extra_user_profile_fields'))
}

and all work well! But i want to add a function to child theme.

class Expire_User_Admin
{

    var $settings = null;

    public function __construct()
    {
        $this->settings = new Expire_User_Settings();

        // Admin Actions
        add_action('admin_init', array($this, 'expire_user_now'));

        // Profile Fields

        add_action('show_user_profile', array($this, 'extra_user_profile_fields'));
        add_action('edit_user_profile', array($this, 'extra_user_profile_fields'));
        add_action('user_new_form', array($this, 'user_new_form')); 

...
}

So i have try this with no luck. Any thoughts?

add_action('init', 'remove_plugin_action', 9999);
function remove_plugin_action()
{
    $plugin_class = new Expire_User_Admin();    
    remove_action('edit_user_profile', array($plugin_class, 'extra_user_profile_fields'));
    if (is_admin()) {
     add_action('edit_user_profile', array($plugin_class, 'extra_user_profile_fields'));
    }
}

Go to Source
Author: xiamtoula

Where to find documentation for CPT block template? (PHP)

I have been searching for a day and still carn’t seem to find the right documentation for what arguments I can pass to core components when attempting to configure a CPT block template in php. This is what I have but I want to take this further by nesting buttons and custom html etc. but carnt find the docs I need.

'template' => array(
    array( 'core/columns', array(), array(
        array( 'core/column', array("width" => "60"), array(
            array( 'core/image', array() ),
        ) ),
        array( 'core/column', array("width" => "40"), array(
            array( 'core/image', array() ),
            array( 'core/heading', array(
                'placeholder' => 'Add a inner paragraph'
            ) ),
        ) ),
    )
)       

Found everything needed to create bespoke blocks in JSX but blegh, Not got the time to learn the wizardry ways of JSX just yet and I dont really want new blocks just want the existing one bound as a template to a custom post type.

A good way to example my question, how did this person find the answer on how set the width of this template columns.

How to set column widths in a CPT block template?

How did the person find this answer ? did they have to dive in to the JS scripts of the component and work it out or is there some documentation on this or am I missing something all together.

Any help would be greatly appreciated.

Go to Source
Author: Johnny

How to delete spamy / hidden pages in WordPress and backlinks

I am working on a website www.laserprocessing.ro and last month we had some viruses that made 1k spammy pages or hidden pages.

My question is how can we delete those pages.

I want to tell you that Moz/Ahrefs/SEMRush found those pages but when I click the link it goes 404.

Go to Source
Author: Flavius Noja

Need help with .htaccess redirection for WordPress websites

I am changing the domain of my website.

But, I am struggling with the domain redirection. I need to implement this wildcard redirection.

So that I visit.

https://www.oldomain.com/page1

It should go to

https://newdomain.com/page1

Note: The new domain is without www.

Can anyone help me how to implement this?

Go to Source
Author: Nirmal Kumar

ANSWER

A 301 Redirect, or permanent redirect, is recommended when dealing with something similar to this one.

If you just want to hard redirect anything hitting oldomain.com to newdomain.com then a simple Redirect should do like so:

<VirtualHost *:443>
	ServerName oldomain.com
        ServerAlias www.oldomain.com
	Redirect 301 / https://newdomain.com
</VirtualHost>

The above example is also something that you will want to write in a server config like httpd.conf but not in a .htaccess file somewhere on your site directory. It is also clumsy since your old site’s pages – e.g https://www.domain.com/some/page/123 – will redirect only to https://newdomain.com which is the index page of the site.

So the other option would be Rewrite. It is also in case you don’t have root access to the server, and/or other sites that are not yours are sharing it as well. It would look like the following:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^oldomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.oldomain.com [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301,NC]

The above considers whether the request is written with or without the www subdomain in it. The old links or pages will also get carried over to the new one.