The tag has no usage guidance.

learn more… | top users | synonyms

12
votes
8answers
66k views

What SQL Query to do a simple find and replace

Whenever I create a new website I first create a staging site on a subdomain like "stage.domain-name.com". After everything works correctly I export the database, open it in notepad++ and do a ...
9
votes
1answer
3k views

Moving WP install from local to live, what about wp_posts GUID?

Done this before and i am still wondering what to do with the wp_posts => guid content, which has reference to http://localhost But at wordpress.org http://codex.wordpress.org/Changing_The_Site_URL ...
4
votes
1answer
1k views

How to change “Draft” string for status of custom post type to “Unavailable”?

ANSWER MOD: just an important mod to the chosen answer: // check if you actually have drafts; also avoids extra '|' separator if (isset($views['draft'])) { // 'Drafts' should be added (and come ...
4
votes
1answer
671 views

Search/Replace for editor in HTML-mode

Is there a way to do a Search and Replace from the editor in HTML-mode? Plugins I found work in the visual editor, we are working only in HTML-mode, therefore -not- appropriate for what we do. I would ...
3
votes
1answer
2k views

Change html structure of all img tags in Wordpress

I have a Wordpress blog and am trying to implement the foresight.js image script. In short, I need to target all post images, swap out the src, width, & height attributes with data-src, ...
2
votes
2answers
3k views

Replace image attributes for lazyload plugin (data-src)

I want to apply jquery lazyload plugin. For this to work I have to create a new attribute which is data-src place there the src value and then replace the src value with a specific value ...
2
votes
1answer
272 views

Global, network-wide shortcodes or text replace functions

What I'm trying to achieve is a simple text-replace functions, that would be available to any site in my Wordpress Network. Basically I want to: Change [--] into — (—), Be able to ...
2
votes
2answers
5k views

Getting rid of the #038; when string replacing content

I'm trying to add some string replacements to the_title() - function format_title($content) { $content = str_replace('&','&<br>', $content); $content = ...
1
vote
1answer
334 views

open all .docs in word online

Hey I'm trying to make all .doc/docx .xls/xlsx files open in office online. This would mean that every link to a .doc http://mywebsite.com/wp-content/uploads.link.doc would have to instead point ...
1
vote
2answers
915 views

$wpdb->replace / Replace or update primary key

I write code to save data in to the database table. I want Replace a row in a table if it exists or insert a new row in a table if the row did not already exist. ...
1
vote
2answers
383 views

Renaming the Twenty Fourteen Wordpress theme

I know the benefits of creating child themes, but it in my case I really would like to create a theme based upon another one without any dependencies to a parent theme. I tried to use a sed command to ...
1
vote
2answers
44 views

Replace / Remove Shortcode after 1st run / post

I want to use a shortcode to replace it with an image form a url. My idea: [shortcode url="http://google.de/aImage.jpg"] I post this shortcode usinbg IFTTT. After publishing the article the ...
1
vote
1answer
104 views

Search and replace in post content

I am about to change themes on my site and also a plugin that creates tabs with a post. I need to replace multi-line text with other multi-line text and can't work out how to do it. I have tried ...
1
vote
1answer
526 views

bbpress change the word forum, topic, reply in the forum to another word I choose

bbpress I would want to customize my Forum in bbpress. by changing/replacing the words that appear on the forum layout. I would like to change the words (everywhere they appear): Forum, topic, reply. ...
1
vote
1answer
745 views

printf and _n in this example?

what is the last $count in this example? printf( _n( 'You have published %s post.', 'You have published %s posts.', $count, 'myplugin' ), $count ); i guess the first one is to fill each ...
1
vote
1answer
103 views

Remove all nav menu classes ( but keep useful ones… )

I'm trying to remove all menu-item classes (except for .current-menu-{item/parent/ancestor} and .menu-item-has-children) function custom_nav_menu_css_class($classes) { $classes = ...
1
vote
1answer
110 views

Custom save button shows 'Are you sure you want to…' dialog

I'm looking for a way to replace the submitdiv meta box (publish box) with just one simple save button. By looking at Core I see there's a simple function returning a submit button: ...
1
vote
1answer
178 views

wp_editor not modify html tags of initial content

How can i set the tinyMCE editor in wp_editor to not modify/replace the html tags of the initial content ? I'm loading html content with tags (i know that they are deprecated but i need them) and ...
0
votes
2answers
122 views

About to migrate site to new domain

I've been developing a WordPress site for a client on my own hosting and domain and within the next week I'll be moving it to theirs. I have a number of questions regarding this as this is my first ...
0
votes
1answer
40 views

Replace text inside a huge multidimensional array

I've a huge multidimensional array with no-way to foreach it :), Anyway, i want to replace all http to a keyword so if the client convert his website into https he won't change all old images for the ...
0
votes
1answer
420 views

Replace text in the Title

In a string displayed by <?php the_title(); ?> I have to replace all & characters with and. Here is the code I've tried without success: <?php $wptitle = the_title(); $wptitle = ...
0
votes
3answers
2k views

replace html entities in posts between pre tags

I run a wordpress blog with a syntax highlighter plugin (Crayon). The plugin highlights code between pre tags, example: <pre class="lang:languageid" title="example"> some code </pre> ...
0
votes
2answers
163 views

Replace the slug of parent pages with # [closed]

I'm creating a Wordpress site with a Superfish CSS3 / Jquery dropdown menu, complete with hoverIntent as displayed here: http://users.tpg.com.au/j_birch/plugins/superfish/#examples As far as I can ...
0
votes
3answers
3k views

echo post-permalink without http and www

I have this line … <div class="permalink"><?php the_permalink(); ?></div> and the result on my page looks like this … http://mysite.com/whatever/post-or-so I guess it could ...
0
votes
1answer
798 views

is wpdb->replace() already sanitized?

i am working on a plugin that includes table in database that holds information from the different posts. right now i use $wpdb->replace(), so whenever a post is being created or updated it is also ...
0
votes
1answer
255 views

Can I change the “Home” text in the menu?

I’m pretty sure this can be done with a filter or some kind of find and replace, but I’m not sure how. I have a page called “Home” like so: When the link is displayed in my template it says ...
0
votes
2answers
33 views

Problem with images URL after filter applying

I have this code in my functions.php file: function user_content_replace($content) { // it's not a URL, let's apply the replacement if (!filter_var($string, FILTER_VALIDATE_URL)) { ...
0
votes
1answer
28 views

how to replace old DW site with new WP site? [closed]

I'm new to Wordpress.org. I have an old Dreamweaver website that I want to replace with my new Wordpress.org site, using my same original URL. How do I do this? I need simple, easy-to-understand ...
0
votes
1answer
97 views

Can't add classes using jQuery from a JSON string with get_body_class()

In order to refresh the classes on the <body>element after an AJAX call, I am writing at the top of my AJAX response the following in JSON: $o[ 'classes' ] = get_body_class('project'); I can ...
0
votes
1answer
111 views

Function to replace comment's accented characters before posting

I have some weird problems with encoding my Wordpress website and I can't add comments with accent words. when i try to do it, i received error by WP. What i need is just a function that read the ...
0
votes
2answers
122 views

WP function duplicating body content

I'm trying to insert content after the <body> tag using my plugin but the code I have is duplicating the <body> content. My code is at http://pastebin.com/rhDX8gsm (it's quite long) and ...
0
votes
1answer
177 views

Insert a field with PREG_REPLACE – strange behaviour

I'm trying to insert a custom field (from the Advanced Custom Fields plugin), and I need to place it within a div which I'm wrapping around an img, right before the img-tag. So basically this is the ...
0
votes
1answer
87 views

GUID URL Question

I had a website that needed to be re-done, so I hosted a new dev site (not locally) with a temporary domain. The dev/new site was completed and I then moved the domain from the old site to the dev/new ...
0
votes
2answers
810 views

Search and replace special characters (å,ä,ö) for image attachments only in database

I need to replace the special characters å,ä,ö (with a or o) in my WP database for all image attachments. How can I apply this search and replace only to affect these links? Edit: Solved
0
votes
1answer
119 views

Replace text in excerpt

I have a separate theme for my custom WP install that will be use for mobile users, in my case I need to change an html tag in all the excerpt instances but without altering the DB, I found this ...
0
votes
1answer
50 views

How can I replace content on site generated from plugin without changing plugin

I downloaded a login form but I'd like to change its content without actually changing the plugin files so that it won't cause problems when updating later on. How can this be done?
0
votes
1answer
221 views

Extract Information from post content (using regex?)

I'm trying to replace some custom strings in my content before saving the post. I have got the $data["post_content"] which includes strings like %replaceContent:{type}% . Now I need to extract that ...
0
votes
1answer
227 views

Rename Smart YouTube's httpv back to http for all posts

I've used the Smart YouTube plugin to embed YouTube videos into my blogs. The way I did it is to replace the http:// of the YouTube url with httpv:// as the plugin describes. But now I noticed that ...
0
votes
2answers
2k views

MySQL: Possible to replace all of wp_posts.post_content(id#) via UPDATE + REPLACE + SELECT?

EDIT: I want to update one field (post_content) within a known record (id of 4) of a known table (wp_posts) in a new database (new_db). The update has to come from one field (post_content) within a ...
0
votes
1answer
52 views

Replace custom gallery shortcode with default gallery shortcode

I want to replace my custom gallery shortcode in my post content with the default Wordpress shortcode (in pre get posts). I will be doing this in only a certain instance where it will need to be ...
0
votes
0answers
25 views

Post title replacement

How do I change many post title only which are in drafts. I need to replace a list of words with another. I'm using latest WordPress version 3.9.2
0
votes
0answers
21 views

Bulk find replace to convert hundreds of old URL calls

We have a new wordpress site generated from an old html site with thousands of pages. An import process was used, but unfortunately as a result the site has hundreds of references within content to ...
0
votes
0answers
27 views

How to replace attached media through programmatically?

I am not sure, whether the similar question exist before. I tried to get but , couldn't get the similar question. Actually I want to replace an attached media with new image. Which Means, I am ...
0
votes
0answers
13 views

Correct way to update wp_script() url/src? [duplicate]

I tried to update the url/src of the queued $wp_scripts correctly... my aim is to use just relative paths. Therefore I: loaded the $wp_scripts replace the domain and saved the output. But it seems ...
0
votes
0answers
21 views

Is there a function like “attachment_fields_to_edit” but for “replacing” the image?

With the "attachment_fields_to_edit" function i can put custom fields to the images when i insert them in a post. The problem is, when someone clicks on "replace" he gets the "replace image" window ...
0
votes
1answer
110 views

str_replace function in theme

I am trying to change the color to red on certain words on my site. However the below code changes each word to "array". Can someone tell me what is wrong with my code? function ...
0
votes
1answer
21 views

Hide some shortcodes on posts from back-end

I searched everywhere on the web and I didn't find something that could really help me. Here is my problem; I use a plugin that provides shortcodes to show a file in a page or a post. For each file I ...
0
votes
1answer
90 views

'str_replace' and 'strtr' not working inside plugin

My goal is simple: Take a string like this --> 'https://www.secondarysite.com/subpage' And turn it into this --> 'https://www.primarysite.com/secondarysite/subpage' Sounds simple enough right? In ...
0
votes
0answers
67 views

Override theme template for index page

For one of the websites I manage we baked in a lot of custom functionality into the theme we are using. The problem with this is that it's difficult to switch themes. I wanted to decouple this code ...
0
votes
1answer
17 views

How to replace part of shortlink with nothing

I am attempting to shorten the wp_get_shortlink. I want to remove the "http://" which is unnecessary. I have attempted the regular php way of (Replace("http://"," " )); but it seems WordPress has a ...