Skip to main content
How to programmatically uncheck or check "Generate automatic URL alias" on Pathauto Drupal 8

When generating new aliases using the Pathauto module in Drupal 8, you can often encounter the problem that these aliases are not generated through Bulk Update in /admin/config/search/path/update_bulk. The reason for this is that your previously created Entity (node or taxonomy term) does not have the automatic url generation checkboxes checked

pathauto

If your site has a lot of nodes and terms, then it is impossible to put it all by hand, and the way out is an SQL query in your database. Therefore, to make the checkboxes active for the selected node type, make such a query:

UPDATE `key_value` SET VALUE = 'i:1;' WHERE collection = 'pathauto_state.node' AND NAME IN (
SELECT `name` FROM (
SELECT kv.name 
FROM `key_value` kv 
LEFT JOIN `node` n 
ON n.nid = kv.name
WHERE kv.collection = 'pathauto_state.node' AND n.type = 'product' 
) kv1);

Where product replace with your system name of the node type

For taxonomy terms, the query will be as follows:

UPDATE `key_value` SET VALUE = 'i:1;' WHERE collection = 'pathauto_state.taxonomy_term' 

To uncheck the box, the queries will be the same, just change SET VALUE = 'i:1;' to SET VALUE = 'i:0;'

 
 

 

 

Subscribe

About The Author

Author of this blog. In SEO for over 10 years. In addition to SEO, I am interested in everything related to technology and earnings on the Internet, which I try to share with readers.