How can I post formatted source code?

  • Author
  • #797673

    I need to post code like it is done for example in .
    My blog is made using the installation and not using a my server.

    I saw some similar questions in but I suppose they are related to personal installation of wordpress and specific entries in configuration files.

    I have tried to follows the tutorial


    [sourcecode language="csharp"]
    your code here

    but these lines are shown as they are in the final post!!!

    Alternatively, is there some code snippet that produce the appropriate html text from a input string?

    The blog I need help with is



    My blog is made using the installation and not using a my server.

    May we have the address, please?


    Sure … but I don’t konow how it can be useful to answer my question :-) !!!

    My blog is in and the way I would like to post my code examples is the one used for example in this wordpress blog page .

    In my blog, for the time being, I used the tag but the indentation and the visibility of the code is not very usser friendly!!!!

    Hoping in an answer ....



    We need the link to the site to make sure you are actually hosted here at wordpress.COM. There are too many times that people swear they are hosted here, but they are not and we go round and round trying to get something to work only to find out they are not hosted here. Many things here at wordpress.COM are different than on self-hosted wordpress sites so the answers here are in general not correct on a self-hosted site. For example, the following solution for posting source code will not work on a self-hosted site.


    Thank you for your answer.
    I tried as I said in my first post, the method suggested in the link you provided putting in my Visual text the suggested pattern

    [sourcecode language="csharp"]
    your code here

    but in tha past, at least when I ask for a preview of the page before a real post, the text display exactly that characters instead of formating the code.

    NOW, after your post, I tried again and it succeded!!!???!!! Perhaps I made some typing error in the past … I didn’t changed any options in my blog: did you?

    Thank you very much for your quick support anyway ;-)

    I like wordpress and I find it very easy to handle!!!

    Kind regards


    You are welcome.

    I always put the sourcecode tags and the source code in while in the HTML tab in the editor. Shortcodes always work that way for me, but not always when I put them in in the visual tab in the editor. It shouldn’t matter, but it does sometimes.

The topic ‘How can I post formatted source code?’ is closed to new replies.