Is it possible to change image urls by hooks?

As you want to change (use different) URL for featured image only, you can use pre_option_upload_url_path hook. // Setting the uploads directory URL function wpse_change_featured_img_url() { return ‘http://www.example.com/media/uploads’; } add_filter( ‘pre_option_upload_url_path’, ‘wpse_change_featured_img_url’ ); This hook will not change URLs permanently but it will set uploads directory to some different URL temporally. This will also not … Read more

Dynamically change page title from URL param

You could do something like this in your header.php file (or where ever you are setting your page titles in your templates) <?php if (isset($_GET[‘user’])) : ?> <title>Entries from <?php echo(htmlspecialchars($_GET[‘user’], ENT_QUOTES)) ?></title> <?php else: ?> <title>Normal page title here</title> <?php endif; ?> Without more info on what plugin you are using, or how your … Read more

Best way to give site sub-page it’s own domain?

You are on the right track. Point your add-on domains to WordPress root Create WordPress landing pages Point to landing page using add-on domain Rel=canonical will prevent duplicate indexing penalty All landing page links will automatically point to canonical domain Naturally you will do all your editing from the canonical domain If you run into … Read more

How to stop WordPress from removing & from URL?

Here’s the why part: This part of the redirect_canonical() is removing the leading & in the redirect query part: // tack on any additional query vars $redirect[‘query’] = preg_replace( ‘#^\??&*?#’, ”, $redirect[‘query’] ); Example: example.tld/?&a=1&b=2&c=3 is redirected to example.tld/?a=1&b=2&c=3 If you must have the leading & you might try to adjust it through the redirect_canonical … Read more

pass user id in slug and get user information

The code seems incomplete. Maybe the problem is simply that you define $id but then try to use $user_id? Also, I think id is a protected variable, so maybe use my_id instead. Try this: www.mysite.com/test?my_id=123 $user_id = $_REQUEST[‘my_id’]; $camp_link = get_site_url().”/campaign-detail/?id=”.$user_id; echo “<p class=”campaign_store_name”><a href=””.$camp_link.””>”.$camp_title.”</a></p>”; $arform_id = Get_ARFORM_ID_using_slug($camp_link);

How to rewrite url wordpress?

You should hook add_rewrite_rule() into init Assuming http://local/rieltplus/ is your homepage, and category/catalog/ is a category archives, this should work: add_action(‘init’, function() { add_rewrite_rule( ‘category/catalog/([^/]+)?$’, ‘index.php?category_name=catalog&type=$matches[1]&price_min=1000&price_max=2000&area_min=5&area_max=50&room_num=5&etage=2&plan=old’, ‘top’ ); }); If you want to make that available to any category then mention it in the comments. By the way, local/rieltplus/category/catalog/TYPE&price_min is not a valid URL, unlike … Read more

How to redirect a page into file?

Recommend and currently use Quick Page/Post Redirect Plugin https://wordpress.org/plugins/quick-pagepost-redirect-plugin/ Request URL Destination URL /page/ http://example.com/uploades/file.pdf

Custom Post type and permalink settings

You can use the rewrite parameter to disable the front portion of the URLs (/academy/ in your case) for custom post types. function create_posttypes() { $labels1 = array( ‘name’ => __( ‘Definitions’ ), ‘singular_name’ => __( ‘Definition’ ), ‘all_items’ => __( ‘All Definitions’ ), ‘view_item’ => __( ‘View Definition’ ), ‘add_new_item’ => __( ‘Add New … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)