Tag Info

Hot answers tagged

4

If you are looking for the post edit url for admin end and you have the post id (suppose $post_id) with you, then you can use the following code for getting the url. $post_url = admin_url( 'post.php?post=' . $post_id ) . '&action=edit';


3

Currently I can't offer a full answer to your question, but here as a starting point a (PHP 5.3+/closure) plugin that dumps the global WP_Rewrite object into the shutdown hook. <?php /* Plugin Name: Show WP_Rewrite Dump at the last hook (shutdown) */ add_action( 'shutdown', function() { var_dump( $GLOBALS['wp_rewrite'] ); } ); This doesn't take ...


2

A bit like a team/contributors page. You could look at the contributors page template included in the Twenty Fourteen default theme for WordPress as an excellent example. May be a challenge to use it with another theme depending on your skill level. Another option which i have coded myself for Genesis, is a widgetized page template. This way you can use ...


2

You need to update the new URL in the WordPress Address (URL) and Site Address (URL) in General settings. Some of your media may be pointing your old site or may not be available in that case you need to install a plugin named Search and Replace and you need to replace the every occurrence of the old URL with the new one.


2

Use the preview_post_link filter to modify the preview URL: function wpa_preview_link( $preview_link ){ return $preview_link . '&v=' . uniqid(); } add_filter( 'preview_post_link', 'wpa_preview_link' );


2

Why? I think the reason why a) domain.com/123 is not redirected back to b) domain.com/123/post-slug with the /%post_id%/%postname%/ permalinks settings, is that the matched rule is: [matched_rule] => ([0-9]+)(/[0-9]+)?/?$ You can get that information from the global $wp object. There are other useful informations in $wpavailable after the wp ...


2

What about something like that? function wpse139657_orderby(){ if( isset($_GET['orderby']) ){ $order = $_GET['order'] or 'DESC'; set_query_var('orderby', 'meta_value_num'); set_query_var('meta_key', $_GET['orderby']); set_query_var('order', $order); } } add_filter('pre_get_posts','wpse139657_orderby'); In this way ...


2

By far the easiest fix is to edit wp-config.php to define two constants. (s)FTP into your site, or use a host supplied file manager, and add: define( 'WP_SITEURL', 'http://www.abc.com/folder' ); define( 'WP_HOME', 'http://www.abc.com/folder' ); Those will be used instead of the information in the database. That will get your site up and running again. ...


2

Have you repub'd your permalinks? This will update the .htaccess file to ensure that routing works appropriately.


2

try this 'href'=> admin_url("post-new.php?post_type=albertis-kunstwerke")


2

The answer by Milo above seems to potentially be a bit off the mark, because it doesn't result in http://skipology.com/category/ being an actual page, but instead it just redirects to another page. I don't know for sure so I'm just adding mine here as an alternative. If you are ok with a little bit of manual setup for this, this would be the simplest way to ...


2

I was experiencing a similar problem and traced it back to Yoast's WordPress SEO plugin. This is a very popular plugin, so I wanted to post my fix. If you are running this plugin, do the following: Navigate to SEO > Permalinks Is "Redirect ugly URL's to clean permalinks" checked? If so, scroll down to the input field labelled "Other variables not to ...


2

From the WordPress Codex, this is how to enable permalinks in your blog. From your admin dashboard on the left side go to Settings -> Permalinks In the Settings → Permalinks panel (Options → Permalinks before WordPress 2.5), you can choose one of the "common" structures or enter your own in the "Custom structure" field using the structure tags. ...


2

Take look at official Query vars. You will see two columns and by then you will get why category__in doesn't work with the URL query string. (basically, the private keywords works only if you specify them in wp_query or so...) About subpost, I am not a hundred percent sure, what it is. In the whole WP_Query it is mentioned only with attachments, take a ...


2

For a page, change p=97 to page_id=97 or pagename=albums. p is for the post post type. I also suggest changing your query var to something more unique.


2

You are doing everything right, double check the below code and make sure to go to Permalinks in your dashboard to flush the rewrite rules. From Wordpress Codex: Note: Visiting the Permalinks screen triggers a flush of rewrite rules. There is no need to save just to flush the rewrite rules. It will work, I tested it using the below code: Put the ...


2

Don't use relative paths in WordPress, put the images in your theme directory and use the API to output correct paths. <img src="<?php echo get_template_directory_uri(); ?>/images/image.jpg">


2

Found the solution. By default wordpress doesn't show hierarchical URL for custom taxonomies. Therefore while registering custom taxonomy, we must include the rewrite variable. $args = array( 'rewrite' => array( 'hierarchical' => true ), );


2

Those are reserved keywords When you visit a WordPress blog you have: blogindexpage/?queryvariables=queryvalues So for a search request: example.com/?s=searchterm For a post/page of ID 12: example.com/?p=12 etc etc Pretty permalinks hides all this by using regular expressions to map nice looking URLs on to their equivalents. This doesn't prevent ...


2

Not completely sure I understand what you mean with that the parameters fall under a page job, but if you mean that different contents are loaded on the same page using javascript / ajax, you could use https://github.com/browserstate/history.js/ to generate the corresponding url for each state. Difficult to say more about how you could implement this without ...


2

This is a typical issue when moving WordPress sites. WordPress stores URLs - both main configuration URLs and resource URLs - in the database. These must be changed in the database when moving to a new domain or mail URL in localhost. Don't use simple SQL change queries in the database via adminer or phpmyadmin. WordPress and some themes store ...


1

So in general there are two opinions on absolute versus relative URLs: use relative URLs because easier to move around use absolute URLs because easier to move around Confusing, yes. The argument boils down to that migrating things with relative URLs you don't need to change domain. The counter argument is that you might need to change levels or URLs and ...


1

I re-ran the following update and now my links work! update wp_posts set post_content = REPLACE(post_content, 'http://domain.com/wp', 'http://domain.com/blog');


1

To concatenate strings, PHP uses the concatenation operator .. Thus, to append a string to the current user link, you can use bp_core_get_userlink( get_the_author_meta( 'ID' ), false, true ) . '/posts/' Note that I've removed the first part of the assignment from the $no_anchor and $just_link parameters, as the values should be passed, and not the ...


1

Use <?php echo home_url( '/' ); ?> as the action. 'search' by the way is not a valid bloginfo parameter.


1

Maybe you are not using the correct hooks nor the correct rewrite rule. You are rewriting to pagename, which is for pages. You should use name to get posts by slug. add_filter('query_vars', 'cyb_add_query_vars'); function cyb_add_query_vars( $vars) { $vars[] = "item"; return $vars; } add_action('init','cyb_add_rewrite_rules'); function ...


1

Okay, after searching a bit more I finally found an answer to my own question hidden in a comment of this feature request ticket: https://core.trac.wordpress.org/ticket/16557 The user nacin suggested to use this code: function remove_redirect_guess_404_permalink( $redirect_url ) { if ( is_404() ) return false; return $redirect_url; } ...


1

So I'm taking some liberties with this, I'm assuming a couple things: You know the taxonomy the term belongs to You have the term archive link So if I have the term archive link: $url = 'http://www.example.com/taxonomy/term/'; I know that the last part of that url is going to be the terms slug. I can use the slug with the taxonomy and get the ID but ...


1

Internal rewrite rules have to point to index.php and set the proper query vars for WordPress to be able to load the requested object: add_rewrite_rule( 'magazine/(\d{4})/(\d{2})/(\d{2})/?', 'index.php?issue=$matches[1]-$matches[2]-$matches[3]', 'top' ); That should get incoming requests to resolve correctly, however, that's only half the ...


1

When you delete a post, it merely gets put into the "trash" and retains its slug. When you created the "new" contact page, the slug "contact" was already in use by the original contact post that is in the trash. Go into your posts on the dashboard and click on the "Trash" link near the top of the post listing. Once in the Trash area, permanently delete ...



Only top voted, non community-wiki answers of a minimum length are eligible