New answers tagged

0

Do you have any plugins that cache, such as WP SuperCache? If so, disable them. I once worked on a similar plugin and everything worked except for users with Firefox and Internet Explorer. I was using Chrome, which ignored the cache, but apparently WP SuperCache was the culprit.


0

You're almost there, but your understanding of how rules work is slightly off. Also I would recommend using the page_rewrite_rules filter: function wpse_224942_page_rewrite_rules( $rules ) { global $wp_rewrite; /* Don't forget to change "my_query_var" in the rewrite rule too */ $new_rules = array( 'bz/([^/]+)/?$' => ...


0

This is going to sound crazy, but the following worked... I put the content in the following directory: /var/www/myexamplesite.com/public_html (and created log/ as well) Along with the following entry in httpd.conf <VirtualHost *:80> ServerAlias www.myexamplesite.com myexamplesite.com DocumentRoot /var/www/myexamplesite.com/public_html ServerName ...


1

I fixed my problem as follows: // Adds rewrite rules for shop post type function gtp_add_shop_rewrite_rules() { add_rewrite_rule( '^shop/([^/]*)/([^/]*)/([^/]*)$', 'index.php?shop-category=$matches[1]&width=$matches[2]&height=$matches[3]', 'top' ); add_rewrite_rule( '^shop/([^/]*)/([^/]*)$', ...


1

Got it to work, changing the regex from (.+) to (.*) Maybe helpful for others searching same rewrite on search and pagination. add_rewrite_rule('discover/interiors/interior-results/(.*)/page/([0-9]{1,})/?', 'index.php?pagename=discover/interiors/interior-results&tag1=$matches[1]&paged=$matches[2]', 'top' ); ...


0

why not like this? add_action( 'pre_get_posts', 'my_post_queries' ); function my_post_queries( $query ) { if ($query->is_main_query() && !is_admin()) { // maybe check for specific page here // if (is_tax('your-taxonomy') { $query = false; remove_all_actions ( '__after_loop'); // } } } Or did I ...


1

The problem must be how you define your post variable. You assume it's the global $post but that's not always the case especially in non-singular pages like archives. The filter itself provides the correct post instance that's it's been called on as 2nd parameter. function product_type_permalink( $post_link, $post ) { // current post is already ...


0

You cannot have a rewrite slug of '/'. Note that using a slug of '', which you will find floating around, will not work for the latest WordPress versions either. If you want a url like http://domain.com/custom-post, there are no bullet-proof solutions, but the answer to this question will give you some leads: Remove slug from custom post type post URLs


0

Why not create an if statement to check if the email arg was passed, if so, redirect to the URL without the email. Something like: if ($_GET['email']) { //do unsubscribe stuff wp_redirect('http://www.domain.nl/email-acties/'); exit; } Unsubscribed!


0

Short: You don't need .html ending. .html ending can be easily archive by setting in Options > Permalink or using plugin like Custom Permalink. But that's just personal style. Having html or not is now just different in length of URL. For me, the shorter one is better. It's has no effect on SEO score. In the past, .html ending is some kind to distinguish ...


0

Not sure of the context for this, is it a custom post type or just a page? This might be something which you're looking for - function add_lead_management_endpoints() { add_rewrite_rule( 'manage-lead/lead_id/([0-9]{1,})/product_id/([0-9]{1,})', 'index.php?pagename=manage-lead&lead_id=$matches[1]&product_id=$matches[2]', ...


0

The link you provided deals with restricted access based on user permissions. But I gather from your question that you want to block hotlinking as a whole. If you don't already have one, you should create a .htaccess file in your root Wordpress directory (same location as wp-config.php). Add the following to it: # WP writes the following block # BEGIN ...


0

As said in the comments by Milo (many thanks!) the answer was already posted: Permalinks: custom post type -> custom taxonomy -> post


0

It should work but note that the date structure contains the structure for year, month and day archives as well, so you'll need something like: add_action( 'init', function() { global $wp_rewrite; $wp_rewrite->date_structure = 'archives/%year%/%monthnum%/%day%'; }); Don't forget to visit your permalinks settings page in wp-admin so that rewrite ...



Top 50 recent answers are included