Skip to content

Instantly share code, notes, and snippets.

@pwenzel
Created December 8, 2014 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwenzel/deecd99ad1c485b33ec6 to your computer and use it in GitHub Desktop.
Save pwenzel/deecd99ad1c485b33ec6 to your computer and use it in GitHub Desktop.
Fix Unescaped Title Attributes in plugin Custom Post Types Relationships (CPTR)
diff --git a/wp-content/plugins/custom-post-types-relationships-cptr/cptr.php b/wp-content/plugins/custom-post-types-relationships-cptr/cptr.php
index 2d82e17..853a51d 100644
--- a/wp-content/plugins/custom-post-types-relationships-cptr/cptr.php
+++ b/wp-content/plugins/custom-post-types-relationships-cptr/cptr.php
@@ -136,7 +136,7 @@ function cptr_category_selector() {
if (!empty($relations)) :
foreach($relations as $relation) :
$post = get_post($relation);
- echo "<div title='" . $post->post_title . "' class='thepost' id='post-".$post->ID ."'>
+ echo "<div title='" . esc_attr($post->post_title) . "' class='thepost' id='post-".$post->ID ."'>
<a href='#' class='removeme'>Remove</a>
<p><strong>" . $post->post_title . "</strong></p>
<input type='hidden' name='reladded[]' value='" . $post->ID . "' />
@@ -174,7 +174,7 @@ function cptr_cats() {
if (!empty($posts)) {
foreach ( $posts as $post ) {
setup_postdata($post);
- echo "<div title='" . $post->post_title . "' class='thepost' id='post-".$post->ID ."'>
+ echo "<div title='" . esc_attr($post->post_title) . "' class='thepost' id='post-".$post->ID ."'>
<a href='#' class='addme'>Add</a>
<p><strong>" . $post->post_title . "</strong></p>
<input type='hidden' name='related[]' value='" . $post->ID . "' />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment