Tag Info

New answers tagged

0

Thanks to the suggestions of @feelinferrety I was able to put the URLs from my website as www.mywebsite.com/index.php/about-me OR www.mywebsite.com/index.php/references. Just did the following: Go to your site Settings > Permalinks > Common settings: Select the option Postname.


0

First, check if you have an .htaccess file with the following: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress If this file already exists with the appropriate ...


1

you CANT have a PAGE and a CUSTOM POST TYPE with the same name Maybe tree years ago it was impossible, but now you CAN. First, add this lines to $args into your post type: 'has_archive' => false, 'rewrite' => array( 'slug' => 'your slug', // if you need slug 'with_front' => false, ...


0

Your pretty URL is not working because you have not introduced the line 'rewrite' => false, in the argsarray while declaring the Custom Post Type. Use this code to solve your problem....Hope this works for you //This function is to register the archive page of post type function add_rewrite_rules($aRules) { $aNewRules = array('nos-soins-et-services/?$' ...


1

My problem was solved with this link. It was very helpful and difficult to find. function add_custom_query_var( $vars ){ $vars[] = "brand_name"; return $vars; } add_filter( 'query_vars', 'add_custom_query_var' ); function add_rewrite_rules($aRules) { $aNewRules = array('brand/([^/]+)/?$' => 'index.php?pagename=hotel&brand_name=$matches[1]'); ...


1

try this $post_id = 11; $post = get_post($post_id); $slug = $post->post_name; <a href="<?php get_site_url(); ?>/abstract/<?php echo $slug; ?>" title="<?php the_title_attribute(); ?>">Abstract</a>


0

According to your example 'example.com/wordpress-how-to/how-to-create-a-child-theme-in-wordpress/' search  = wordpress-how-to subject = how-to-create-a-child-theme-in-wordpress/ this code removes all the words from the subject found in search term. for more details check "Avoiding infinite loops" from save_post function modified_slug( $post_id ) ...


0

So this issue had to do with File permissions. I believed that I had already checked into this to make sure that permissions were set properly, but I must have erred. I went to the subdomain folder 'staging' which contains my WP install and turned on User 'read' and 'write' permissions, which were inactive. So now Web User and Owner permissions have been ...


0

I had the same issue and found a solution. From what I learned so far, there might be two causes to this problem: WP doesn't recognize your rewrite rules because they are not cached yet. You can check this by dumping get_option( 'rewrite_rules' ); and if your rules did get cached, then they'll be in that option. To ensure your rewrite rules are cached, ...


0

I have found a SOLUTION!!! (After endless research.. I can have CUSTOM POST TYPE permalinks like: example.com/category/sub_category/my-post-name here the code (in functions.php or plugin): //===STEP 1 (affect only these CUSTOM POST TYPES) $GLOBALS['my_post_typesss__MLSS'] = array('my_product1','....'); //===STEP 2 (create desired PERMALINKS) ...


0

The truth is that with a platform like WordPress it is very hard to pin point the problem as there can be hundreds of causes and with the ever growing template and plugins...anyways I had a case where it took me a long time to figure out so I want to share quickly here. Check to see how your template files display the content of posts/pages. If the code ...


2

If we check out the source of the wp_unique_post_slug() function, then we see that this is expected for hierarchical post types, other than nav_menu_item. If we try for example the slugs 360 or page360, then the -n slug suffix will show up. We can play with e.g.: echo wp_unique_post_slug( $slug = '360', $post_id = '', ...


4

The problem comes with using only numbers as URLs. Here is a forum thread in WP that discuss this issue. I'll cite Otto: WordPress 2.3 and up does not allow the post or page slugs to be all numeric. This is because that URL scheme will conflict with multi-page posts. There is no fix. Change them to something else. Alternatively, a plugin ...


1

When adding an external link you need to include HTTP:// or HTTPS:// at the start of the URL to link to an external domain. Otherwise the link will be added onto the current domain.


0

I found the answer myself - so here is the update to above problem: Custom post type registration: function create_post_type_mycustomname() { $args = array( 'capability_type' => 'post', 'has_archive' => 'mycustomname', 'rewrite' => array( 'slug' => '/mycustomname', 'feeds' => false ...


1

If it can help anyone, here is the full answer with the issues that might happen when you want to add Wordpress pagination with anchors to a template page. STEP 1 Follow the example on the Codex so that the paginate_links() function applies to your custom query and not to the main query. STEP 2 Your function should look like the code below : global ...


1

I notice that to link to each post, I am calling get_permalink() and this is creating an extra DB query for each post. Not true. If you check the link to the very old trac ticket #18822 in the post that you have linked to, this issue was raised by @kaiser in 2011. The question was answered by @scribu For example: $posts = get_posts(); foreach ( ...


0

You have to modify either before # BEGIN WordPress or after # END WordPress. This part is modified by WP, once you change your permanlink


0

You need to create a new permalink and after to set some rewrite rules. The function add_permastruct is a good start. You can find a good example here: http://shibashake.com/wordpress-theme/wordpress-permalink-add That's a media library example, but you can use the same functionality for your language module.


1

According to the official WordPress docs, when you save your Permalinks it updates your .htaccess file ... This isn't correct. When you switch from default-- ?= permalinks which are nothing but pure PHP URL parameter passing-- to anything else then WordPress will create a .htaccess file if it can, or tell you to create one. Once that file is created ...


0

Look at this section (excerpt): Day and name - An example of the day and name based structure is http://www.sample.com/2008/03/31/sample-post/ Month and name - An example of the month and name based structure is http://www.sample.com/2008/03/sample-post/ Numeric - An example of the numeric structure is http://www.sample.com/archives/123 ...


0

if the .htaccess file is writeable by the server it will automatically update the file. WordPress will try and do it, if it can't it will tell you to manually update the file.


1

As per what I understood from your question, you want two things - Listing of all publisher Listing of all books of a particular publisher. Here is code for both. Listing of all publisher $terms = get_terms( 'pa_publisher' ); echo '<ul>'; foreach ($terms as $each_term) { echo '<li>'.$each_term->name.'</li>'; } echo ...


1

Beside making certain categories to some domain. Why don't you create some post type like post-type-domainb and then redirect domain.com/post-type-domainb to domanb.com Please let me know if it doesn't work.


1

Permalink settings are available under Permalinks under the settings menu. I have faced a similar issue resetting the options here to non rewritten URLs and then back to the rewritten URLs should reset any issues with .htaccess file


0

Fixed. Maybe an Apache update or something did this to me. I changed AllowOverride None to AllowOverride All in /etc/apache2/apache2.conf for the /var/www folder.


0

i have also faced such kinds of problem when i upload the project to server and for fixed this i have followed below steps : change permalink and save it again. if code display below then replace with that code enable rewrite_mode and for doing this is have followed the steps from this article : ...


1

Update You can make use of the add_rewrite_endpoint: add_rewrite_endpoint( 'schools', EP_PERMALINK | EP_PAGES ); You can then check in the sidebar for the schools variable: global $wp_query; if ( isset( $wp_query->query_vars['schools'] ) ) { // ... } What is worth mentioning is that your URL will look like ...


0

Based on this question about retrieving Wordpress post slug, you could put together a link like the following: <a href="http://www.example.com/md/<?php global $post; echo $post->post_name; ?>">link text</a> Whether that goes to a functioning page or not, I don't know. It seems like you may want to change rewrite rules in the functions ...


0

Instead of going to the page and changing the slug, if you simply go to the page and save again, it will be fine. That's after you try resetting the permalinks and all that.


3

For custom post types, use the post_type_link filter just a you would use the post_link filter for post post type posts


0

Move the wordpress site to his new domain. Make sure everything is working, hint: update all url's using Velvet Blues Plugin Point the old domain to a directory containing only two files: A file named "index.php" containing: <?php $goto = $_SERVER["REQUEST_URI"]; header("HTTP/1.1 301 Moved Permanently"); header( "Location: http://new-domain-name.ch" ...


1

Before we start may I just quickly mention that for the future it is easier to reference the post by its ID instead of the URL as this is going to stay the same when slugs change. Anyway as you already have this shortcode now we need another solution. Your problem is that you need to find a post from its URL when the permalink changed. Fortunately the old ...



Top 50 recent answers are included