Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4237368
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:45:50+00:00 2026-05-21T02:45:50+00:00

Hi everyone i am looking for a way to get code that i have

  • 0

Hi everyone i am looking for a way to get code that i have imputed into the database and maintain the formatting the problem i am having is if i insert code into the database like show below.

    <?php
add_action( 'init', 'create_post_type' );
function create_post_type() {
  register_post_type( 'blackwood_services',
    array(
      'labels' => array(
        'name' => __( 'BW Services' ),
        'singular_name' => __( 'BW Services' )
      ),
      'public' => true,
      'show_ui' => true,
      'capability_type' => 'post',
      'hierarchical' => false,
      'rewrite' => false,
      'query_var' => false,
      'supports' => array( 'title', 'editor', 'thumbnail', 'excerpts', 'revisions') //the editing regions that will support

    )
  );

When pulling it back out from the database to view it will view as shown below no spaces just one massive block off text/code no formatting.
i want it to show as formmatted code so i can copy and paste the code.

<?php add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'blackwood_services', array( 'labels' => array( 'name' => __( 'BW Services' ), 'singular_name' => __( 'BW Services' ) ), 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array( 'title',   'editor', 'thumbnail', 'excerpts', 'revisions') //the editing regions that will support ) ); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:45:51+00:00Added an answer on May 21, 2026 at 2:45 am

    Not sure what you saying, but it sounds like you are storing PHP in a database, which is an interesting idea…

    Anyway, you’ll want to make sure you escape newlines before storing (i.e. replace them with a \n).

    When you render it, stick it in a pre tag to ensure that they show up on a webpage, or use nl2br.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Everyone managing open-source-software runs into the problem, that with the time the process of
I am looking for everyone's opinion on what is the best way to stream
I am looking to select ids that are backwards from some standards we have
Background: I have an application written in Delphi that uses the Borland Database Engine
Hi everyone i am looking to get a sum out off array elements. out
When I'm online it seems that everyone has agreed that using the exclusive locking
Everyone in my office uses Macs and therefore most use Safari. We have a
Usually when code needs some resource that needs to be released I see it
HTTP Referer is the way I'm doing it at the moment. As everyone who's
Got an application (C# WPF) that needs to call home and get updated stuff

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.