I use WordPress’ built in “Press This” feature quite a lot.

I recently installed a new professional paid theme for my site, and for whatever reason this broke the normal behavior of “Press This” in the following way:

– It used to be that after clicking the “Publish” button in the “Press This” editor, the post would be published, and you would then be redirected to its permalink inside the same window.

– Now what happens is that instead of being redirected to the post’s Permalink, I get redirected to a Querystring URL in the following format: http://www.my-website-url.com/?post_type=post&p=12345

I tried looking into it myself, but I have very limited knowledge in php/javascript/ajax programming, and there is very little detailed documentation on how “Press This” works.

I also contacted the theme developer, but he said he didn’t know what about his theme could have caused this issue with “Press This”, and that he “doesn’t offer support for plugin conflicts”.

Can anyone who knows how “Press This” works help me figure this out? 🙁 What could a Theme possibly do that could cause this behavior?

I might be able to figure it out myself eventually if I spend the next WEEK on it, but I figured for someone “in the know” this would probably be quite easy.

Thank you!!

  • The URL format you're showing does work (and immediately gets converted on load into "pretty" permalink format). Have you re-saved your permalinks? I only ask because you don't mention having done it. Also, considering that Press This is included with WP Core, I'd think a "professional" WP theme developer ought to have it covered, one way or another. If there really is a conflict between his theme and Press This, he should warn potential buyers, and at a minimum offer money back,
    – CK MacLeod
    Feb 4, 2017 at 7:45
  • Hey CK MacLeod, thank you for taking the time to respond! As I don't really know what "re-saving" permalinks is, I'd say the answer is probably no :D Could you please elaborate on what that means? As for the second part I agree with you there and have re-engaged the developer asking him to resolve it as Press This is an integral part of WordPress now, as you said. Don't get me wrong, the theme is otherwise extremely good, which is why I prefer to resolve this issue rather than ask for a refund.
    – J.Smith
    Feb 4, 2017 at 14:04
  • Just to add, if I do use "Press This" to publish a post, and then I open that post via the standard editor right after, the permalink is there. So it is being generated. I just don't know why it's not being returned back to "Press This" when it's redirected to the published post.
    – J.Smith
    Feb 4, 2017 at 14:30
  • Re-Saving Permalinks: Go to Settings/Permalinks, click Save Changes - or, to be sure you've adopted new re-write rules, carefully note the current setting if it's custom and unusual-looking, then save back to the WordPress "Plain" default, then save again, but this time with the desired rules. If that doesn't work... then things might get complicated.
    – CK MacLeod
    Feb 4, 2017 at 16:14
  • Hey CK! Yeah, I tried that but it didn't work. I still get redirected to the post querystring rather than the permalink. I looked at the source code for wp-admin/includes/class-wp-press-this.php and on Line 181 the code is $redirect = get_post_permalink( $post_id );. So there is a call to the get_post_permalink() function, but it returns a querystring rather than a permalink. I then looked at the source code for it, but wasn't quite sure which condition gets invoked to return a querystring, and why...
    – J.Smith
    Feb 4, 2017 at 16:46

1 Answer 1


Okay, so after narrowing the problem down to the function get_post_permalink() which gets called by wp-admin/includes/class-wp-press-this.php on Line 181, and for some reason returns the Querystring rather than the Permalink when I am using my 3rd party theme, I implemented a workaround which is not ideal, but it works!

I added the following code, starting after Line 181:

if ( 'publish' === get_post_status( $post_id ) ) {
    $redirect = get_post_permalink( $post_id ); // at this point the function returned a querystring
/*START - Attempted fix for not redirecting to Permalinks with 3rd Party Theme*/
$post = get_post($post_id);
$slug = $post->post_name;
$post_link = $redirect;
$post_link = str_replace("%$post->post_type%", $slug, $post_link);
$post_link = home_url( user_trailingslashit($post_link) );
$redirect = $post_link;
/*END - Attempted fix for not redirecting to Permalinks with 3rd Party Theme*/
} elseif {...}

So I basically extracted part of the code from get_post_permalink(), and manually added it here to "force" the creation of a permalink from the returned Querystring, after the initial call of $redirect = get_post_permalink( $post_id );.

Again, this is far from ideal! It does work, but it's a fix for the symptom and not the root cause.

For now this will do, and I'll just wait for the theme developer to provide a more permanent solution via a theme update!

Once that happens I will update this post with what the theme developer will have to say as to the root cause of this problem to begin with.

  • You seem to be aware that this manner of correcting the problem is sub-optimal. If something like this hack is necessary, there is very likely a "WordPress way" to do it (i.e., able to survive upgrades to WP Core and also not likely to cause problems if you switch themes or permalinking), but maybe further discussion should wait until your Theme developer has responded. BTW, did you ever try re-setting (deleting and replacing) the bookmarklet?
    – CK MacLeod
    Feb 4, 2017 at 19:05
  • Yes, I am aware of the problems with this, and am keeping backups of all my changes so I can re-apply them easily in case of a WordPress core update. Definitely not optimal, but it's all I have at the moment. As for resetting the Bookmarklet, I haven't actually tried that, but how would could that have any possible connection to get_post_permalink( $post_id ); returning a Querystring instead of a Permalink on the php end of things? As I understand the bookmarklet is just simple javascript to call press-this.php and applies some pre-filtering.
    – J.Smith
    Feb 4, 2017 at 19:21
  • Just to make sure, I tried resetting the bookmarklet and tested it with my above fix removed, and the problem came back. So definitely not anything in the Bookmarklet.
    – J.Smith
    Feb 4, 2017 at 19:30
  • Without actually having my hands on your installation - esp the theme - I'm pretty much restricted to suggesting possible external fixes that also happen to be easy one and potentially of investigative value. In my own history with Press This, I have occasionally need to re-install the bookmarklet after switching themes, but never looked more deeply into why (life being short, WordPress long).
    – CK MacLeod
    Feb 4, 2017 at 20:21
  • Oh I wasn't criticizing you in any way, and thank you for taking the time to help me with my problem! I just wasn't sure the Bookmarklet thing could be related, but I did try it nonetheless as per your suggestion, but alas.. it did not help! Appreciate your time! :)
    – J.Smith
    Feb 5, 2017 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.