Tag Info

New answers tagged

0

The ugly URL trailing with %e2%80%8e is result of copy-paste content from Word, Excel or web page content. In this case copied content may include the special character which sometimes hidden ASCII space character. Just follow the below steps, Go to cPanel > phpMyAdmin Select the WP database Click on Search tab Enter value %e2%80%8e. Select the exact ...


0

You don't do that with your permalinks. You can do what you want in Wordpress Settings. Go to your Wordpress dashboard, 2. Click "Settings", 3. Click General. 4. In the "Site Address (URL)" Box remove the "blog" part like this --> "http://site.myurl.com/ NOTE: DON'T CHANGE THE WORDPRESS ADDRESS URL!!! Only change the Site Address Here is a screenshot ...


0

I just completed something like this (with great help from folks on this site). First, you need to add the rewrite endpoint to your functions: function wpa_read_endpoint(){ add_rewrite_endpoint( 'sub-url', EP_PERMALINK); } add_action( 'init', 'wpa_read_endpoint' ); Make sure to then go to the permalinks section of admin and save to refresh permalink ...


0

I'd say what you need to look deeper into is the Rewrite API and Endpoints, for starters see: Make WordPress: Rewrite endpoints API Codex: Rewrite API Codex: Rewrite API/add rewrite endpoint Additionally use the the search on here, because there are already similar Q&A's, which will definitely help you. Last note, doing such things manually ...


0

So, it turns out that if you pass a Post or Page object to the_permalink() or get_page_link() it will override the post object set by the loop whereas passing an ID won't. In the previous example you would use <?php echo get_page_link($mypage); ?> instead. Source of get_page_link() had the answers: ...


0

When you save permalink settings, is there the following notification at the bottom of page? If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all. I'm asking because the behaviour you ...


0

Not an answer (I'm not allowed to comment), but I'm wondering if you've ever figured this out? I'm also looking to allow visitors to see pending posts even though they don't necessarily have the proper credentials. Thanks.


3

Thank you for the response everyone. I played around with macemmek's solution and I think it led me to an even better solution: add_filter( 'wp_unique_post_slug_is_bad_attachment_slug', '__return_true' ); That is all that is needed. This will automatically 'skip' the default assigned slug on any attachment. So an attachment that might normally get the ...


3

You may hook wp_unique_post_slug() and append some string to the original slug if the post is an attachment type. The original slug based on post title will remain free. UPDATED after Rachel Baker's comment: original slug suffix is some random string. It does not guarantee uniqueness but may be enough for simple use cases. add_filter( ...


1

Tom's comment is correct, in that this is normal behaviour and there is not much you can do to stop it. But you can change slugs after things are uploaded/created. While you shouldn't do this if the links are known/publicised/listed on search engines, if you're just trying to fix this problem occasionally after an upload then you can edit the slug of the ...


0

I don't understand what you want to do. Every taxonomy is independent and the terms can't be shared between them. The only way I know to do a search with 2 parameters: taxonomy A term and taxonomy B term, and pass it to a WP Query along with the custom post type.


0

This is what I would do. I think the problem is with the data organization. I think you need at least 2 taxonomies and not only one (Categories). One for Country/Zone, and another for Topic (fashion and food). So you'll get: An archive for every topic, like http://www.example.com/food An archive for every zone, like http://www.example.com/europe or even ...


0

I think you only have to change '0', that is a string, by simply 0, that is a integer corresponding to the first place of the array of posts. I thik this is a good idea, maybe WordPress should do it by default ^^


1

Why waste storing (potentially) huge amounts of redundant, duplicate data, when you can store 1 pattern and only the unique "slug" for each post? The processing power involved in generating permalinks "on the fly" is so insignificant in comparison to merely loading WordPress, it'd be like trying to make your car go faster by driving naked to save weight...


-1

Try inserting /index.php/ after your home url


0

On the staging server, in your wp-config.php define( 'WP_SITEURL', 'http://SERVER_IP/projectname' ); define( 'WP_HOME', WP_SITEURL ); Then: Place an empty .htaccess in /projectname Load http://SERVER_IP/projectname/wp-admin/options-permalink.php Check .htaccess - have rewrite rules been added?


0

The only way I can see this working is by setting a couple of redirect rules in your .htaccess file. You'd have to manually redirect all your posts (that you want with that permalink structure) and prepend the /awesome URL part in front. Other than the aforementioned solution, which is a hack more than anything, I'm afraid that what you're looking for is ...


0

This is the simplest way to add .html, which involves overriding the default permastructure: function wpse_178112_permastruct_html( $post_type, $args ) { if ( $post_type === 'product' ) add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%.html", $args->rewrite ); } add_action( 'registered_post_type', ...


2

The permastruct /%category%/%postname%/ will include the categories and subcategories in the URL from top to first assigned child. So, if you want the URL be site.com/source/books/moby-dick/*postname*, you have to assign the post only to "Moby Dick". Assigning the post only to "Moby Dick" category will still show the post under "source" and "books" category ...


1

Open to admin dashboard > Settings > Permalinks, select "Custom Structure", enter: /%category%-%postname%/ and click "Save Changes". Or, you might consider separating the two with a forward slash: /%category%/%postname%/ Using the /%category%-%postname%/ custom permalink structure, the News category will show as /news-%postname%. For the Game category, ...


0

template_include Your first option here is to change the template that is used your pages so that you can do anything you wish, once that template has been called. The example below checks that the page is called 'portfolio', but obviously you can insert your own checks, and then locates a template called 'my-template-page.php'. If that template doesn't ...


0

I don't know if you can use pages for your purpose, but as in the comments in wp-includes/post.php line 3701 (in the wp_unique_post_slug function), you can use identical slugs for pages in different trees: /* * Page slugs must be unique within their own trees. Pages are in a separate * namespace than posts so page slugs are allowed to overlap post slugs. ...


0

To see how we can make this work, have a read through the Query Overview Codex page, particularly the What Plugins can Modify section: Modify the query specification, after variable values are saved (request filter or parse_request action; if you want to use conditional tag tests, use the parse_query or pre_get_posts action, as these run after the is_ ...


0

You would place this code inside your theme's functions.php file. It shouldn't really matter where in the file that you place it.



Top 50 recent answers are included