Tag Info

Hot answers tagged

10

You can get the value of front in the global $wp_rewrite: global $wp_rewrite; echo $wp_rewrite->front; // or echo home_url( $wp_rewrite->front ); Though that is probably of limited use, as the front base isn't necessarily an existing page, and may 404 in many cases. If you're using that value to prepend to other URLs, you're likely doing it wrong. ...


5

First of all I have to say that wp_get_referer() is not 100% reliable because it relies on $_SERVER['HTTP_REFERER'] that is not 100% reliable, from php.net docs: The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify ...


4

I was about to suggest something like the function bellow, but lets face it @Milo's answer is just a bit smarter, so just for completeness reason and because I already wrote it down. function wpse163163_site_url_with_fix_permalink_base() { return get_site_url() . '/' . preg_replace( '/\%([a-z0-9]+?)\%/i', ...


3

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 ...


3

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.


3

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 ...


3

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 ...


3

You could make a list of paths to check... $page_paths = array( 'analysis/firstNamelastName', 'exercise/firstNamelastName' ); Then check if there's a page object for each of the page paths. foreach($page_paths as $page_path){ $page = get_page_by_path($page_path); if(!$page){ echo '<code>'.$page_path.'</code> Does not ...


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 ...


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

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

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


2

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 ...


2

The shortlink of a WordPress post is on default domain.com/?p=30, not the Id after the domain. If you like a permalink to the ID as shortlink for each post, then is this possible via a plugin. The follow source is a example. add_filter('get_shortlink', 'fb_custom_shortlink_filter'); function fb_custom_shortlink_filter() { global $post; return ...


2

You would need a custom rewrite rule for that: http://codex.wordpress.org/Rewrite_API/add_rewrite_rule I think you might have a hard time though, with it being within an area of the site (single post type) already using a custom rewrite rule!


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

In WordPress, URLs don't map to routes. They map to database queries. When using WordPress in the "default" permalinks mode, you have a set of variables in the main URL query, like ?p=1 or ?page=234 and so forth. There's also ?s=search and many others. If you use the "pretty" permalinks, then a big set of rules called the "rewrite rules" is created which ...


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

In order to work permalinks properly, you have to enable 'mod_rewrite' module in your apache server. Other wise it could not run .htaccess file and that is why it shows 'Not found'. It will be working if the permalink is disabled or set to default, right?


2

There are four valid sizes built in to the WordPress core. the_post_thumbnail('thumbnail'); // Thumbnail (default 150px x 150px max) the_post_thumbnail('medium'); // Medium resolution (default 300px x 300px max) the_post_thumbnail('large'); // Large resolution (default 640px x 640px max) the_post_thumbnail('full'); // ...


2

The "cheapest" way to achieve this probably would be to simply add two pages: // Standard template http(s)://example.com/portfolio-xyz Then add another page with your second URl and use a custom page template where you query your single post using get_post() and display it however it pleases you: <?php /* Template Name: Alternate Portfolio PT template ...


2

You will need to use site_url($path_to_style_sheet, 'https') instead of bloginfo(). The home_url() method also supports https.


1

I don't know what your definition of "simple" is, so not sure this qualifies. It's not really a simple task to do this dynamically. First, we register a new query var to pass the alternate identifier: function wpd_portfolios_query_var($query_vars){ $query_vars[] = 'portfolio_key'; return $query_vars; } add_filter('query_vars', ...


1

You can filter page_link to modify the output of any page's permalink value. The simplest way to identify the page is by ID, then you can append the query string via add_query_arg: function wpd_append_query_string( $url, $id ) { if( 42 == $id ) { $url = add_query_arg( 'ngg_force_update', 1, $url ); } return $url; } add_filter( ...


1

Data in the WP database is serialized. If you just do a search and replace you'll break your site. You need to reserialize your data as you change it. There are scripts and services that allow you to do a proper Search and Replace. My tool of choice is this one, and it works perfectly. There are also a couple plugins that work (like velvet blues), and I ...


1

It looks like every "old" URL is a bit different from each other so you should manually create permanent redirects (HTTP 301) for each URL. I recommend using either Redirects (very simple and intuitive) or Safe Redirect Manager (more advanced features) plugins.


1

This is very simple and can be accomplished all through the admin interface. First, create pages named Home and Blog under Pages. Then go to Settings > Reading, and under Front page displays, set Front page to your Home page, and Posts page to your Blog page. Next, under Settings > Permalinks, Select Custom Structure and enter /blog/%postname%/. If you ...


1

I think you could get it working with category__and I remember trying a similar approach to yours and found out that I would get content that was either in platform and/or in review. But to get actually posts that where only on both, excluding posts that were just in one of them, this was my approach. Maybe the way you have your posts works with that ...


1

If you plan to share/sell your plugin I strongly suggest don't load your plugin directly. That because to load WordPress you need to load the bootstrap file, that is /wp-load.php so, you should put in your embed-video.php something like: require '/wordpress/path/wp-load.php'; Do you notice the problem here? The /wordpress/path/ part is different for user ...



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