Hey there,
is it possible to add the %hashed_id slug to pages? Right now I only get posts with random slugs.
Thanks,
Marc
Hi Guys
We want move our website to another host, but we seem to have a problem on the new site if the WP hashed IDs is activated, How can we move the site without breaking things , or can we deactivate the plugin move the site and reactivate ?
Tony
]]>Just a suggestion – don’t use AUTH_KEY or any of the core keys and salts for the default Hashids salt.
A site owner may need to change these salts at any given time (for example to invalidate all cookies) and when they do all or their post URLs will change without any explanation of what happened.
]]>PHP Warning: gmp_add(): Unable to convert variable to GMP and it’s telling me to look at line 314
$number = $this->_math_functions[‘str’]($this->_math_functions[‘add’]($number, $pos * pow($alphabet_length, ($input_length – $i – 1))));
i see that on the github you fixed and change the method and the way the function is done, but this plugin didn’t get update since a while…
i have php 7.
]]>After I installed the plugin I get the following error:
Fatal error: Call to undefined function wp_get_current_user() in /site.com/blog/wp-includes/capabilities.php on line 522
I’m on WordPress MU (or Network whatever is newest).
]]>Getting this error
Use of undefined constant alpha_length - assumed 'alpha_length'
Type: PHP Notice Line: 53
File: /home/cleara15/public_html/wp-content/plugins/wp-hashed-ids/wp-hashed-ids.php
Amy ideas ?
]]>Hi, this is simple Notice, but but I tried the solution.
I would like to have an opinion on the method and if maybe there is an ideal solution.
function _hashed_id_parse_request($qv) {
if ( isset( $qv->query_vars['hashed_id'] ) )
$hashed_id = $qv->query_vars['hashed_id'];
else
$hashed_id = '';
// $hashed_id = $qv->query_vars['hashed_id'];
Great,
Regards.
Mario
Whenever active plugin works well, but in the super administrator multisite leave it in blank page
To this should be?
]]>Hi,
I’m testing your plugin, It’s possible to complete hide the permalink from users ?
I.E only browser can to un-crypt the original permalink of the post. Second when user copy and paste the permalink to drive to 404 error page.
Thank you
]]>Great plugin! I love Hash IDs, and appreciate your taking the time to add them to permalinks.
I also wanted to use this plugin with a Custom Post Type, so I added the necessary code. I couldn’t find a Github repo, so the modification is shown below.
I’ve found this especially helpful when combined with Custom Post Type Permalinks.
Original: wp-hashed-ids.php
lines 18-26
at version 1.0
function hashed_id() {
global $wp_rewrite;
add_rewrite_tag('%hashed_id%','([^/]+)');
$permalink = $wp_rewrite->permalink_structure;
if (!empty($permalink) && false !== strpos( $permalink, '%hashed_id%' )) {
add_filter('pre_post_link', '_hashed_id_post_link', 10, 2);
add_filter('parse_request', '_hashed_id_parse_request');
}
}
Modification:
// Add after line 23, 'pre_post_link'
add_filter('post_type_link', '_hashed_id_post_link', 10, 2); // CPTs
Result:
function hashed_id() {
global $wp_rewrite;
add_rewrite_tag('%hashed_id%','([^/]+)');
$permalink = $wp_rewrite->permalink_structure;
if (!empty($permalink) && false !== strpos( $permalink, '%hashed_id%' )) {
add_filter('pre_post_link', '_hashed_id_post_link', 10, 2); // Posts
add_filter('post_type_link', '_hashed_id_post_link', 10, 2); // CPTs
add_filter('parse_request', '_hashed_id_parse_request');
}
}
]]>
Hi, Do you have plans on updating this plugin to include custom post types? I really need this to work on custom post types.
]]>Was there a solution discovered for the custom post-type provision?
We’d like to obfuscate (hash) the slug for a certain post-type only.
Thanks!
]]>Hi,
It would be great if you could add support for custom post types for this one.
The closest I got with it is by adding this code:
function hashed_id() {
global $wp_rewrite;
add_rewrite_tag('%hashed_id%','([^/]+)');
$permalink = $wp_rewrite->permalink_structure;
if (!empty($permalink) && false !== strpos( $permalink, '%hashed_id%' )) {
add_filter('pre_post_link', '_hashed_id_post_link', 10, 2);
add_filter('post_type_link', '_hashed_id_custom_link', 1, 2);
add_filter('parse_request', '_hashed_id_parse_request');
}
}
function _hashed_id_post_link($permalink, $post) {
$hashids = new hashids(AUTH_KEY, HASHED_IDS_MIN_LENGTH);
$permalink = str_replace('%hashed_id%', $hashids->encrypt((int)$post->ID), $permalink);
return $permalink;
}
function _hashed_id_custom_link($permalink, $post) {
$hashids = new hashids(AUTH_KEY, HASHED_IDS_MIN_LENGTH);
$permalink = str_replace('%hashed_id%', $hashids->encrypt((int)$post->ID), $permalink);
return $permalink;
}
]]>